Sign in to follow this  
Followers 0
Fegarur

Script de Pesca II

9 posts in this topic

Descripción:
Una versión mejorada del anterior script de Pesca de Tiberius.

Screens:[spoiler]
user posted image
user posted image
user posted image[/spoiler]

Demo:
Descarga Directa (Inglés)
Descarga de MediaFire (Español)
Descarga de SaveFile (Español)
Descarga de Uploading (Español)
Descarga de Rapidshare (Español)
Descarga de Megaupload (Español)

Scripts:
Colocar todos encima de Main:
1.- Fish:
CODE
class Fish
 attr_reader :strength
 attr_reader :weight
 attr_reader :base_id
 
 def initialize(base_id)
   @base_id = base_id
   base = $data_items[base_id]
   @weight = base.recover_hp + rand(base.recover_sp - base.recover_hp + 1)
   @strength = (5.5 * Math.sqrt(@weight) - @weight / 36 - 5) * (85 + rand(31)) / 360.0
 end
 
 def price
   return $data_items[@base_id].price * @weight
 end
 
 def icon_name
   return $data_items[@base_id].icon_name
 end
 
 def name
   return $data_items[@base_id].name
 end
end

2.- Game actor and Game Party:
CODE
class Game_Actor
 attr_accessor :best_fish
end

class Game_Party
 attr_reader :fish
 
 def gain_fish(fish)
   if @fish == nil
     @fish = [fish]
   else
     @fish.push(fish)
   end
 end
 
 def sell_fish(fish)
   @fish.delete(fish)
   $game_party.gain_gold(fish.price)
 end
end

3.- Scene Map:
CODE
class Scene_Map
 alias non_fishing_update update
 
 def update
   non_fishing_update
   if Input.trigger?(Input::A)
     call_fishing
   end
 end
 
 def call_fishing
   case $game_player.direction
   when 2
     lookingx = $game_player.x
     lookingy = $game_player.y + 1
  when 4
     lookingx = $game_player.x - 1
     lookingy = $game_player.y
   when 6
     lookingx = $game_player.x + 1
     lookingy = $game_player.y
   when 8
     lookingx = $game_player.x
     lookingy = $game_player.y - 1
   end
   fisher = nil
   for actor in $game_party.actors
     if actor.weapon_id != 0 and $data_weapons[actor.weapon_id].element_set.include?(17) and
         actor.armor1_id != 0 and $data_armors[actor.armor1_id].guard_element_set.include?(18) and
         actor.armor2_id != 0 and $data_armors[actor.armor2_id].guard_element_set.include?(19) and
         actor.armor3_id != 0 and $data_armors[actor.armor3_id].guard_element_set.include?(20)
       fisher = actor
       break
     end
   end
   return if fisher == nil
   case $game_map.terrain_tag(lookingx,lookingy)
     when 0
       return
     when 1
       $scene = Scene_Fishing.new(fisher, [34, 35, 36, 37])
     when 2
       $scene = Scene_Fishing.new(fisher, [34, 35, 36, 37, 38, 39, 40])
     when 3
       $scene = Scene_Fishing.new(fisher, [34, 35, 36, 37, 38, 39, 40, 41, 42, 43])
     when 4
       $scene = Scene_Fishing.new(fisher, [36, 37, 38, 39, 40])
     when 5
       $scene = Scene_Fishing.new(fisher, [36, 37, 38, 39, 40, 41, 42, 43])
     when 6
       $scene = Scene_Fishing.new(fisher, [38, 39, 40, 41, 42, 43])
     when 7
       $scene = Scene_Fishing.new(fisher, [41, 42, 43])
   end
 end
end

4.- Scene_Fishing:
CODE
class Scene_Fishing
 def initialize(fisher, fishlist = [34, 35, 36, 37, 38, 39, 40, 41, 42, 43])
   @fishlist = fishlist
   @fish = nil
   @location = 0
   @fisher = fisher
 end
 
 def main
   @help_window = Window_Help.new
   @info_window = Window_FisherInfo.new(@fisher)
   @fish_window = Window_FishingInfo.new(@fisher)
   @main_window = Window_FishMain.new
   @help_window.set_text(@fisher.name + " is going fishing!!", 1)
   @wait_count = 200
   @reel_step = 0
   @fish_pull = 0
   @bit = 2
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @help_window.dispose
   @info_window.dispose
   @fish_window.dispose
   @main_window.dispose
   GC.start
 end
 
 def update
   @help_window.update
   @info_window.update
   @fish_window.update
   @main_window.update
   if @wait_count == 0
     @help_window.set_text("Fishing...", 1)
   else
     @wait_count -= 1
   end
   if @fish != nil
     @location += @fish.strength * @fish_pull / 10.0 / divisor * (85 + rand(31)) / 100.0
     @fish_pull -= 0.15
     if @fish_pull < 0
       @fish_pull = 15 + rand(110) / 10.0
       Audio.se_play("Audio/SE/022-Dive02", 50 + rand(51))
     end
   end
   if Input.trigger?(Input::B)
     if @fish == nil
       $game_system.se_play($data_system.cancel_se)
       $scene = Scene_Map.new
     else
       $game_system.se_play($data_system.buzzer_se)
       @help_window.set_text("Can't leave, something's hooked!!", 1)
       @wait_count = 100
     end
   end
   if Input.trigger?(Input::C)
     if @location == 0
       min = $data_armors[@fisher.armor2_id].pdef * 10
       max = $data_armors[@fisher.armor2_id].mdef * 10
       @location = min + rand(max - min + 1)
       @bit = 2
       Audio.se_play("Audio/SE/021-Dive01")
       @help_window.set_text("You cast your line.", 1)
       @wait_count = 100
     else
       @help_window.set_text("Your line is already cast.", 1)
       @wait_count = 100
     end
   end
   if @location > 0
     if Input.trigger?(Input::Y)
       reel_in((3 - @reel_step) % 4)
       @reel_step = 1
     end
     if Input.trigger?(Input::R)
       reel_in((4 - @reel_step) % 4)
       @reel_step = 2
     end
     if Input.trigger?(Input::L)
       reel_in((5 - @reel_step) % 4)
       @reel_step = 3
     end
     if Input.trigger?(Input::X)
       reel_in((6 - @reel_step) % 4)
       @reel_step = 0
     end
   else
     if Input.trigger?(Input::X) or Input.trigger?(Input::Y) or Input.trigger?(Input::L) or Input.trigger?(Input::R)
       @help_window.set_text("Can't reel in, line not cast.", 1)
       @wait_count = 100
     end
   end
   if @location < 0
     @location = 0
     if @fish != nil
       catch
     end
   end
   if @location > $data_armors[@fisher.armor2_id].mdef * 10
     @location = $data_armors[@fisher.armor2_id].mdef * 10
     @fish = nil
     @help_window.set_text("The fish got away.", 1)
     @wait_count = 100
   end
   @main_window.refresh(@location, @fish)
 end
 
 def reel_in(dstep)
   steps = (@fish == nil ? [0.5, 0.5, 0.5, 1] : [0, -0, 2, 1])
   change = (@fisher.atk * @fisher.str + $data_armors[@fisher.armor3_id].pdef * @fisher.dex) *
       steps[dstep] / 500.0 / divisor
   if change < 0
     change = [email protected] * @fish_pull / 10.0 / divisor
   end
   @location -= change
   if @fish == nil and rand(100) < $data_armors[@fisher.armor1_id].pdef and rand(2) < @bit and
         rand(2) < @bit and @location > 50
     if $game_party.item_number(33) > 0 or rand(1000) < $data_armors[@fisher.armor1_id].pdef #BAIT
       choose_fish
       $game_party.lose_item(33, @bit == 2 ? 1 : 0) #BAIT
       @fish_window.refresh
       @bit -= 1
       @fish_pull = 15 + rand(110) / 10.0
       @help_window.set_text("Something took the bait! Start reeling it in!!", 1)
       for i in 0..60
         @main_window.refresh(@location, @fish)
         Graphics.update
       end
       @wait_count = 100
     else
       @help_window.set_text("Nothing's biting, we need more bait...", 1)
       @wait_count = 200
     end
   end
 end
 
 def divisor
   pchange = (@fisher.atk * @fisher.str + $data_armors[@fisher.armor3_id].pdef * @fisher.dex) / 5000
   return [pchange, 1].max if @fish == nil
   return [pchange, 1, @fish.strength / 3].max
 end
 
 def catch
   @help_window.set_text("You caught a " + @fish.weight.to_s + "lb " + @fish.name + "!", 1)
   $game_system.me_play($game_system.battle_end_me)
   $game_party.gain_fish(@fish)
   @main_window.refresh(@location, @fish)
   if @fisher.best_fish == nil or @fisher.best_fish.weight < @fish.weight
     @fisher.best_fish = @fish.clone
     @help_window.set_text("You caught a " + @fish.weight.to_s + "lb " + @fish.name + "! A new record for " +
         @fisher.name + "!", 1)
     @fish_window.refresh
   end
   for i in 0..100
     Graphics.update
   end
   @wait_count = 50
   @fish = nil
 end
 
 def choose_fish
   list = []
   for i in @fishlist
     if $data_items[i].hit < $data_armors[@fisher.armor1_id].mdef
       for j in 0..($data_armors[@fisher.armor1_id].mdef - $data_items[i].hit)
         list.push(i)
       end
     end
   end
   @fish = Fish.new(list[rand(list.size)])
 end
end

5.- Window_FisherInfo:
CODE
class Window_FisherInfo < Window_Base
 def initialize(fisher)
   super(0, 64, 400, 128)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   self.contents.font.color = normal_color
   @fisher = fisher
   refresh
 end
 
 def refresh
   self.contents.clear
   bitmap = RPG::Cache.character(@fisher.character_name, @fisher.character_hue)
   cw = bitmap.width / 4
   ch = bitmap.height / 4
   w = contents.text_size(@fisher.name).width + cw + 4
   self.contents.blt(96 - w / 2, 32 - ch / 2, bitmap, Rect.new(0, 0, cw, ch))
   self.contents.draw_text(100 - w / 2 + cw, 20, 120, 32, @fisher.name)
   draw_item_name($data_weapons[@fisher.weapon_id], 0, 64)
   draw_item_name($data_armors[@fisher.armor1_id], 192, 0)
   draw_item_name($data_armors[@fisher.armor2_id], 192, 32)
   draw_item_name($data_armors[@fisher.armor3_id], 192, 64)
 end
end

6.- Window_FishingInfo:
CODE
class Window_FishingInfo < Window_Base
 def initialize(fisher)
   super(400, 64, 240, 128)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   self.contents.font.color = normal_color
   @fisher = fisher
   refresh
 end
 
 def refresh
   self.contents.clear
   draw_item_name($data_items[33], 0, 0) #BAIT
   self.contents.draw_text(width - 80, 0, 48, 32, ": " + $game_party.item_number(33).to_s, 2) #BAIT
   self.contents.draw_text(0, 32, 208, 32, "Record Fish", 1)
   if @fisher.best_fish != nil
     x = 90 - contents.text_size(@fisher.best_fish.weight.to_s + "lb " + @fisher.best_fish.name).width / 2
     self.contents.blt(x, 68, RPG::Cache.icon(@fisher.best_fish.icon_name), Rect.new(0, 0, 24, 24))
     self.contents.draw_text(x + 28, 64, 212, 32, @fisher.best_fish.weight.to_s + "lb " + @fisher.best_fish.name)
   else
     self.contents.draw_text(0, 64, 208, 32, "N/A", 1)
   end
 end
end

7.- Window_FishMain:
CODE
class Window_FishMain < Window_Base
 def initialize
   super(0, 192, 640, 288)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh(0, nil)
 end
 
 def refresh(location, fish)
   self.contents.clear
   bitmap = RPG::Cache.picture("FishBG01")
   self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 608, 256))
   bitmap = RPG::Cache.icon("081-Ripple")
   self.contents.blt(location, 160, bitmap, Rect.new(0, 0, 24, 24))
   if fish != nil
     bitmap = RPG::Cache.icon(fish.icon_name)
     self.contents.blt(location, 184, bitmap, Rect.new(0, 0, 24, 24), location > 0 ? (608 - location) / 10 : 160)
   end
 end
end

8.- Scene_FishShop:
CODE
class Scene_FishShop
 def main
   @help_window = Window_Help.new
   @help_window.set_text("Selling Fish", 1)
   @gold_window = Window_Gold.new
   @gold_window.x = 480
   @gold_window.y = 64
   @fishlist_window = Window_FishList.new
   @data_window = Window_FishInfo.new
   @fishlist_window.help_window = @data_window
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @help_window.dispose
   @gold_window.dispose
   @fishlist_window.dispose
   @data_window.dispose
 end
 
 def update
   @help_window.update
   @gold_window.update
   @fishlist_window.update
   @data_window.update
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
   end
   if Input.trigger?(Input::C)
     if @fishlist_window.fish != nil
       $game_system.se_play($data_system.shop_se)
       $game_party.sell_fish(@fishlist_window.fish)
       @gold_window.refresh
       @fishlist_window.refresh
     else
       $game_system.se_play($data_system.buzzer_se)
     end
   end
 end
end

9.- Window_FishList:
CODE
class Window_FishList < Window_Selectable
 def initialize
   super(0, 128, 640, 352)
   @column_max = 2
   self.index = 0
   refresh
 end
 
 def fish
   return @data[self.index]
 end
 
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = $game_party.fish == nil ? [] : $game_party.fish.clone
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     self.contents.font.name = $defaultfonttype
     self.contents.font.size = $defaultfontsize
     for i in 0...@item_max
       draw_fish(i)
     end
   end
 end
 
 def draw_fish(index)
   fish = @data[index]
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(fish.icon_name)
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 212, 32, fish.name, 0)
   self.contents.draw_text(x + 192, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 212, y, 64, 32, fish.weight.to_s + "lbs", 2)
 end
 
 def update_help
   @help_window.refresh(@data[self.index])
 end
end

10.- Window_FishInfo:
CODE
class Window_FishInfo < Window_Base
 def initialize
   super(0, 64, 480, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   self.contents.font.color = normal_color
   refresh(nil)
 end
 
 def refresh(fish)
   self.contents.clear
   if fish == nil
     return
   end
   self.contents.blt(0, 4, RPG::Cache.icon(fish.icon_name), Rect.new(0, 0, 24, 24))
   self.contents.draw_text(28, 0, 448, 32, fish.name + " (" + fish.weight.to_s + "lbs) : " + fish.price.to_s + " " +
       $data_system.words.gold + " (" + $data_items[fish.base_id].price.to_s + " " + $data_system.words.gold +
       " per pound)")
 end
end


Recursos Necesarios:
Incluídos en el Demo. Por separado:
Descarga Directa

Instrucciones:
1.- Crea 4 atributos nuevos en la Base de Datos: Caña, Anzuelo, Sedal, Carrete. Si ya has agregado nuevos elementos, tendrás que editar su ID en el Scene_Map de este script (no el que viene por defecto).

2.- Crea nuevas armas y dales el atributo Caña. Dales valor de ataque como a cualquier otra arma.

3.- Crea escudos con el atributo Anzuelo. Dales valor de Defensa Física y Mágica. La Defensa Física es la probabilidad de atraer peces (2-15 es razonable), y la Mágica la de que los peces sean mejores (de 10 a 100 más o menos).

4.- Crea cascos y dales el atributo sedal. La defensa Física será la longitud mínima que alcance y la Defensa Mágica la longitud máxima. El mínimo debería ser 5 ó más, y el máximo 60 ó menos.

5.- Crea armaduras y dales el atributo Carete. Pon valores como en cualquier armadura.

6.- Crea un nuevo objeto, el Cebo. Si tiene ID 33 está bien. Si no, cámbia la ID en los scripts Scene_Fishing y Window_FishingInfo (está marcado).

7.- Crea nuevos objetos, que serán los peces. Edita sus iconos y sus nombres.

8.- El precio que pongas será lo que te paguen por él. Pon precios bajos, porque te pagarán por cada libra que pese, y si es pesado... $_$

9.- El PV que pongas será su peso mínimo, y el PM su peso máximo (en Recuperar).

10.- El % de Daño será el nivel del pez. Se corresponderá con el anzuelo. Si el nivel del pez es 50, sólo se podrá coger si el anzuelo tiene una Defensa Mágica de más de 50.

11.- En el Scene_Map del script hay varias filas con números de ID. Edítalas según las ID de los peces que tengas. Ten en cuenta que cada fila se refiere a un nivel de terreno distinto de 1-7 (que tendrás que editar en la base de datos)

12.- Asegúrate de que tus clases pueden usar las cañas, anzuelos, sedales y carretes para equiparlos.

13.- Tienes que usar un fondo de pantalla de 608x256 que tenga de nombre "FishBG01" (sin las comillas).

14.- Para pescar, acércate al agua y pulsa Shift. En la pantalla de pesca pulsa el botón de acción para lanzar el anzuelo y S, W, Q, A para enrrollarlo. Si sólo pulsas un botón también se moverá, pero no es tan efectivo.

15.- Para vender los peces utiliza:
QUOTE
$scene = Scene_FishShop.new


Crédito:
Script creado por Tiberius. Edited by Fegarur
0

Share this post


Link to post
Share on other sites
El script esta muy bueno, me encanta, que bien se te da lo de los script.

Suerte.
0

Share this post


Link to post
Share on other sites
Ya, al fin he probado el demo xD.png, es exelente!!!, muy, pero muy divertido, exelente aporte Fegarur! icon13.gif

Saludos laugh.gif
0

Share this post


Link to post
Share on other sites
Muy buen aporte, se agradece icon13.gif
0

Share this post


Link to post
Share on other sites
Me alegro de que os guste el script. Es cansino para instalarlo, pero no está mal.

@666: Los scripts no los hago yo, sólo los posteo. icon13.gif
0

Share this post


Link to post
Share on other sites
QUOTE
@666: Los scripts no los hago yo, sólo los posteo.


Da igual, lo importante es que lo has puesto.

-Suerte-
0

Share this post


Link to post
Share on other sites
Demonios!!!! lo intenté y no me sale bien.......por mas que me acerco al agua y apreto SHIFT no puedo pescar!!!! blink.gif
0

Share this post


Link to post
Share on other sites
pues mira a ver qué estás haciendo mal, porque lo probé personalmente y funciona...
Sigue las instrucciones hasta llegar al error. puede quee sté en el paso 11, según dices, fíjate bien.

Tu otra opción es descargar el demo y comparar todo con tu proyecto. icon13.gif
0

Share this post


Link to post
Share on other sites
Leñe Fegarur!!!!
Tio es el mejor Script que he visto en los ultimos 4 meses!!!!
Con esto ya puedo hacer un zelda como el de Twilight princess... o un juego de pesca solo...
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