Sign in to follow this  
Followers 0
Fegarur

Recolector de hierbas

14 posts in this topic

Descripción:
Este script te permite cavar la tierra para conseguir ciertas hierbas cultivadas.

Recursos Necesarios:
Necesitas todo esto en la carpeta Icons:
user posted imageCon nombre: avobe
user posted imageCon nombre: below
user posted imageCon nombre: DDirt
user posted imageCon nombre: Dirt
user posted imageCon nombre: left
user posted imageCon nombre: Right

Script:
Añade este script: (Scene_Herb)[spoiler]
CODE
#==============================================================================
#     Scene_Herb
#------------------------------------------------------------------------------
#     The scene with herbalism
#==============================================================================

class Scene_Herb
 #--------------------------------------------------------------------------
 #    Initialize
 #--------------------------------------------------------------------------
 def initialize(plant_id, time = 8, size = 7, amount = 1)
   @plant_id = plant_id
   @time = time
   @size = size
   @size = 13 if @size > 13
   @size = 1 if @size < 1
   @amount = amount
   @amount = 1 if @amount < 1
 end
 #--------------------------------------------------------------------------
 #    Main
 #--------------------------------------------------------------------------
 def main
   @plant_window = Window_Plant.new(@plant_id, @time, @size, @amount)
   while @plant_window.rm
     @plant_window.dispose
     @plant_window = Window_Plant.new(@plant_id, @time, @size, @amount)
   end
   @time_window = Window_Help.new
   @plant_window.time_window = @time_window
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @plant_window.dispose
   @time_window.dispose
 end
 #--------------------------------------------------------------------------
 #    Update
 #--------------------------------------------------------------------------
 def update
   if !@plant_window.done
     @plant_window.update
     @time_window.update
   else
     if Input.trigger?(Input::C)
       $scene = Scene_Map.new
     end
   end
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
   end
 end
end
[/spoiler]

Añade este script: (Window Plant) [spoiler]
CODE
#==============================================================================
#     Window_Plant
#------------------------------------------------------------------------------
#     The Window with the plant in it
#==============================================================================

class Window_Plant < Window_Base
 attr_reader :done
 attr_reader :rm
 attr_accessor :time_window
 #--------------------------------------------------------------------------
 #    Initialize
 #--------------------------------------------------------------------------
 def initialize(plant_id, time, size, amount)
   super(112, 64, 416, 416)
   self.contents = Bitmap.new(width - 32, height - 32)
   @amount = amount
   @rm = false
   @x = 0
   @y = -1
   @time = time * 40
   @id = plant_id
   @name = $data_items[plant_id].name
   @stuff = []
   for x in 0..15
     @stuff.push([])
     for y in 0..14
       @stuff[x][y] = 1
     end
   end
   cx = rand(2) + 7
   pbs = []
   lastm = 0
   for y in 0..size
     @stuff[cx][y] = 2
     case rand(lastm)
     when 4, 6, 8, 10, 12, 14, 16, 18
       if rand(3) > 0
         cx += 1
         @stuff[cx][y] = 2
         lastm = 0
       end
       if rand(3) > 0 and y < 12
         @stuff[cx + 1][y] = 2
         @stuff[cx + 2][y] = 2
         @stuff[cx + 2][y + 1] = 2
         @stuff[cx + 2][y + 2] = 2
         pbs.push([cx + 2, y + 1, 0])
         lastm = 0
       end
     when 5, 7, 9, 11, 13, 15, 17, 19
       if rand(3) > 0
         cx -= 1
         @stuff[cx][y] = 2
         lastm = 0
       end
       if rand(3) > 0 and y < 12
         @stuff[cx - 1][y] = 2
         @stuff[cx - 2][y] = 2
         @stuff[cx - 2][y + 1] = 2
         @stuff[cx - 2][y + 2] = 2
         pbs.push([cx - 2, y + 1, 1])
         lastm = 0
       end
       pbts = []
       for i in pbs
         if i[1] < 11 and rand(2) > 0
           pbts.push(i)
           y = i[1] + rand(2)
           case i[2]
           when 0
             @stuff[i[0] + 1][y] = 2
             @stuff[i[0] + 2][y] = 2
             @stuff[i[0] + 2][y + 1] = 2
             @stuff[i[0] + 2][y + 2] = 2
           when 1
             @stuff[i[0] - 1][y] = 2
             @stuff[i[0] - 2][y] = 2
             @stuff[i[0] - 2][y + 1] = 2
             @stuff[i[0] - 2][y + 2] = 2
           end
         end
       end
       for i in pbts
         pbs.delete(i)
       end
     end
     lastm += 2
   end
   dirt = dto
   for x in 0..15
     for y in 0..14
       if @stuff[x][y] == 1 and dirt.include?([x, y]) == false
         @rm = true
       end
     end
   end
   refresh
 end
 #--------------------------------------------------------------------------
 #    Done?
 #--------------------------------------------------------------------------
 def done?
   done = true
   for x in 0..15
     for y in 0..14
       if @stuff[x][y] == 2
         if x > 0
           done = false if @stuff[x - 1][y] == 1
         end
         if x < 15
           done = false if @stuff[x + 1][y] == 1
         end
         if y > 0
           done = false if @stuff[x][y - 1] == 1
         end
         if y < 14
           done = false if @stuff[x][y + 1] == 1
         end
       end
     end
   end
   return done
 end
 #--------------------------------------------------------------------------
 #    Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   types = ["DDirt", "Dirt", "DDirt"]
   for x in 0..15
     for y in 0..14
       bitmap = RPG::Cache.icon(types[@stuff[x][y]])
       self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
       if @stuff[x][y] == 2
         if y == 0
           bitmap = RPG::Cache.icon("above")
           self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
           bitmap = RPG::Cache.icon($data_items[@id].icon_name)
           self.contents.blt(x * 24, 0, bitmap, Rect.new(0, 0, 24, 24))
         end
         if @stuff[x][y + 1] == 2
           bitmap = RPG::Cache.icon("below")
           self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
         end
         if @stuff[x][y - 1] == 2
           bitmap = RPG::Cache.icon("above")
           self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
         end
         if @stuff[x - 1][y] == 2
           bitmap = RPG::Cache.icon("left")
           self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
         end
         if @stuff[x + 1][y] == 2
           bitmap = RPG::Cache.icon("right")
           self.contents.blt(x * 24, y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
         end          
       end
     end
   end
   bitmap = RPG::Cache.icon("004-Weapon04")
   self.contents.blt(@x * 24, @y * 24 + 24, bitmap, Rect.new(0, 0, 24, 24))
 end
 #--------------------------------------------------------------------------
 #    Update
 #--------------------------------------------------------------------------
 def update
   super
   @time_window.set_text("Cavando: " + @name + ". Tiempo restante: " + ((@time + 10) / 40).round.to_s, 1)
   moved = false
   if Input.repeat?(Input::DOWN)
     if @y < 14
       @y += 1
       moved = true
     end
   end
   if Input.repeat?(Input::UP)
     if @y > 0
       @y -= 1
       moved = true
     end
   end
   if Input.repeat?(Input::RIGHT)
     if @x < 15
       @x += 1
       moved = true
     end
   end
   if Input.repeat?(Input::LEFT)
     if @x > 0
       @x -= 1
       moved = true
     end
   end
   if @y > -1
     @time -= 1
     if @time < 0 or @stuff[@x][@y] == 2
       refresh
       Audio.se_play("Audio/SE/057-Wrong01")
       @time_window.set_text("¡Cortaste la rama! Pulsa la tecla de acción para continuar...", 1)
       @time_window.update
       @done = true
       return
     end
   end
   if moved
     if @y > -1
       @stuff[@x][@y] = 0
       Audio.se_play("Audio/SE/129-Earth01")
     else
       $game_system.se_play($data_system.cursor_se)
     end
     refresh
     if done?
       $game_system.me_play($game_system.battle_end_me)
       $game_party.gain_item(@id, 1)
       extra = ""
       if @amount > 1
         extra = "(" + @amount.to_s + ")"
       end
       @time_window.set_text("¡Ganaste " + @name + extra + "! Pulsa la tecla de acción para continuar...", 1)
       @time_window.update
       @done = true
     end
   end
 end
 #--------------------------------------------------------------------------
 #    Dirt touching origin
 #--------------------------------------------------------------------------
 def dto
   dt = [[0, 0]]
   checked = []
   for x in 0..15
     checked.push([])
     for y in 0..14
       checked[x].push(false)
     end
   end
   for i in 0..50
     for x in 0..15
       for y in 0..14
         if dt.include?([x, y]) and !checked[x][y]
           checked[x][y] = true
           if x > 0
             if 1 == @stuff[x - 1][y] and !dt.include?([x - 1, y])
               dt.push([x - 1, y])
             end
           end
           if x < 15
             if 1 == @stuff[x + 1][y] and !dt.include?([x + 1, y])
               dt.push([x + 1, y])
             end
           end
           if y > 0
            if 1 == @stuff[x][y - 1] and !dt.include?([x, y - 1])
              dt.push([x, y - 1])
             end
           end
           if y < 14
             if 1 == @stuff[x][y + 1] and !dt.include?([x, y + 1])
               dt.push([x, y + 1])
             end
           end
         end
       end
     end
   end
   return dt
 end
end
[/spoiler]

Instrucciones:
+ Inserta los dos scripts sobre Main.
+ Para empezar a cavar, necesitas llamar script:
CODE
$scene = Scene_Herb.new(33, 8, 7, 1)
Lo analizo:
El 33 es el número, en la base de datos, del objeto que vas a recoger.
El 8 son los segundos que vas a tener para intentarlo.
El 7 es el tamaño de la planta.
El 1 es cuántas veces vas a recoger el objeto.
+ Por defecto, las cifras citadas arriba son las que operarán en el script, menos la ID del objeto. Si quieres usar las mismas características, basta con que nombres el objeto, en este caso:
CODE
$scene = Scene_Herb.new(33)

+ Para recolectar la planta, tienes que rodear todo su borde cavando.

Crédito:
Script creado por Tiberius (obligatorio) Edited by Fegarur
0

Share this post


Link to post
Share on other sites
jaja quedaría re weno este script con el de cocina pa asi poer acer pitos xD.png
0

Share this post


Link to post
Share on other sites
Leyendo el título pe pensé otra cosa xD.png

->Parece muy bueno es scipt,aora lo uso a ver si me funciona... icon13.gif
0

Share this post


Link to post
Share on other sites
Tengo demo, si lo necesitais... aunque no creo. xD.png
0

Share this post


Link to post
Share on other sites
Claro,pon demo,así se entiendo uno muxho mejor y sale de dudas xD.png
0

Share this post


Link to post
Share on other sites
Parece bastante bueno,pero no se lo k hay k conseguir,si corto la raiz se acabó...la verdad no se lo k hace aun xD.png

P.D:A ok ya se lo k hace,consiste en los bordes...ok
Edited by Garlic
0

Share this post


Link to post
Share on other sites
Lo puse en las instrucciones. xD.png
0

Share this post


Link to post
Share on other sites
o_O Como dijo Garlic... leí título y pense dr... impresionado.gif xD.png Pero está bueno. icon13.gif
0

Share this post


Link to post
Share on other sites
Wo! justo lo que necesitaba para usarlo junto con la alquimia, pero no funciona cheesy.gif podrias volver a ponerlo porfavor? :-D
0

Share this post


Link to post
Share on other sites
Prueba ahora.
La demo parece inactiva, y yo no tengo otra, así que habrá que conformarse. xD.png
0

Share this post


Link to post
Share on other sites
llorar.gif sin las imagenes no sirve mucho jeej, y no se como eran para crearlas yo, pone autor asi que lo busco por internet y si lo encuentro lo pongo aqui por si alguien tb lo quiere happy.gif
- - - - - - - - -
anda que soy un poco tonto, xD las imagenes que faltan son dos raices, y como estan las otras dos, photoshop, rotar 180º y ya esta, si hubiera leido bien los nombres... xD.png

Ya tengo script! xD tongue.gif

Funciona perfectamente, si alguien lo quiere lo explico como se usa happy.gif Edited by Eanarion
0

Share this post


Link to post
Share on other sites
auxilio.gif Y como Se excaba? deberia haber algo como una pala no? auxilio.gif
pero buen aporte! voy a probarlo! happy.gif
user posted image
- - - - - - - - -
y el enlace del demo no sirve llorar.gif
0

Share this post


Link to post
Share on other sites
Ya, el autor eliminó su web, o al menos la trasladó.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0