Save-Point
Simple fishing script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Simple fishing script (/thread-6912.html)



Simple fishing script - Magna Man - 04-05-2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Ok when you go up to water and press d you will start fishing, depending on your settings you will find different stuff!

First put this above main and call it Fishing
Code:
#==============================================================================
# â–�  fishing
#------------------------------------------------------------------------------
#  デ�ッグ画��処� を行� クラス��。
#==============================================================================

class Fishing
#----------------------------------------------------------------------------
# Start
#----------------------------------------------------------------------------
def initialize
   @fw = Window_Fish.new
   $fm = "Fishing..."
   @fw.refresh
   delay(60)
   fish
end
#----------------------------------------------------------------------------
# Fishing!
#----------------------------------------------------------------------------
def fish
   delay(40)
   @fr = rand(4)#this number inside the brackets indicate how many things there are. and remeber it starts from 0 so if you have 5 things you have to have 4
   case @fr
   when 0
     $game_player.animation_id =  98
     $fm = "Hey! I got one! 10 pounds!"
     @fw.refresh
     $game_party.gain_item(33, 1)#the item number of the fish is here
     delay(60)
   when 1
     $fm = "Darn its just a rock!"
     @fw.refresh
     delay(60)
   when 2
     $fm = " Yuck! an old boot!"
     @fw.refresh
     delay(60)
   when 3
     $game_player.animation_id =  98
     $fm = "Hey! I got one! 20 pounds!"
     @fw.refresh
     $game_party.gain_item(34, 1)
     delay(60)
   when 4
     $fm = "Darn! no fish!"
     @fw.refresh
     delay(60)
   end
   @fw.dispose
end
#----------------------------------------------------------------------------
# Delay
#----------------------------------------------------------------------------
def delay(wait)
   count = Graphics.frame_count
   while wait + count >= Graphics.frame_count
     Graphics.update
   end
end
end

Ok now see the section fish in this section you control what you catch. it is pretty self explanitory.
next find this in Scene_Map
Code:
# B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::B)
     # イベント実行中ã?‹ãƒ¡ãƒ‹ãƒ¥ãƒ¼ç¦?止中ã?§ã?ªã?‘ã‚Œã?°
     unless $game_system.map_interpreter.running? or
            $game_system.menu_disabled
       # メニュー呼ã?³å‡ºã?—フラグã?¨ SE æ¼”å¥?フラグをセット
       $game_temp.menu_calling = true
       $game_temp.menu_beep = true
     end
   end

and under it insert this:
Code:
# FISHING
   # if z pushed call fishing
   if Input.trigger?(Input::Z)
     fishing
   end
   # FISHING

Now insert this anywhere inbetween def update and def transfer_player
Code:
#--------------------------------------------------------------------------
# â—? Fishing
#--------------------------------------------------------------------------
def fishing
   character = $game_player
   case character.direction
   when 2
     lx = character.x
     ly = character.y + 1
   when 4
     lx = character.x - 1
     ly = character.y
   when 6
     lx = character.x + 1
     ly = character.y
   when 8
     lx = character.x
     ly = character.y - 1
   end
   if $game_map.terrain_tag(lx,ly) == 1
     Fishing.new
   else
     Audio.se_play("Audio/SE/057-Wrong01")
   end
end

and now make a new script under window_base and insert this:
Code:
#==============================================================================
# â–�  Window_Fish
#------------------------------------------------------------------------------
#  Fishy!
#==============================================================================

class Window_Fish < Window_Base
#--------------------------------------------------------------------------
# â—? Start
#--------------------------------------------------------------------------
def initialize
   super(0, 406, 640, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   self.opacity = 0
   $fm = " "
   refresh
end
#--------------------------------------------------------------------------
# â—? Refresh
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 0, 640, 32, $fm)
end
end

and just set water tiles to terrain type 1!

and credit to dragonslayer for the delay script! thanks!

TADA!

TK