chinyingwoei
Member
Sorry to post this long script, but I hav a problem using it.
The problem is I cant save or load file.... (EOFError)
Any1 can help,pls?
The problem is I cant save or load file.... (EOFError)
Any1 can help,pls?
Code:
#=============================================================
# <> Fishing Script Advanced v1.8dca
# ==> You can delete all the comments except the copyright and creator info. Thanks.
# ==> Do not rip, repost or any other way of reproducing without proper credit. Thanks.
# ShadowClan Technologies ? 2003-2005 - All rights reserved. X-RPG/Asylum rules :-)
#--------------------------------------------------------------------------------------------------------------------------
# * Help? Info?
# There's been a change of plan. Help is located to original place of posting of this script.
#
# * History
# 8/6/2005 22:22 - Made Fish Class [inits, defs]
# 24/7/2005 13:40 - Made scene and windows for script
# 24/7/2005 15:52 - Fixed errors
# 24/7/2005 23:51 - Completion of beta version 0.21? + Info
# 26/7/2005 14:21 - Added new definitions and created equip scene
# 26/7/2005 14:40 - Fixed some more problems when equipping. Status window complete.
# 26/7/2005 15:19 - Added Attraction? definition. You can use this. I didn't.
# 27/7/2005 13:47 - Fixed some bugs
# 28/7/2005 14:44 - Added harpoons
# 28/7/2005 16:00 - Added nets
# 29/7/2005 14:10 - Modified result window to net catching
# 29/7/2005 23:33 - Result scene for net fishcatching. Few bugs though... [bugs fixed]
#
# That would end the little explaining for now. I -really- hope you like this script.
#--------------------------------------------------------------------------------------------------------------------------
# * Suggestions? ==> PM or post in the section where this is posted.
# * Created by: GoldenShadow (invincible_p0wer_@hotmail.com)
# * Credits: Lots to Nick and makeamidget for helping me get started on equip scene. Thanks!
#=============================================================
module SC # keep this
RXSC_FISH = "Fishing Script ENHANCED: Ver. 1.8dca"
KEEP_FISH = true # if set to false, doesn't add to inventory (throws fish back)
LOSE_BAIT = false
MULTI_POOL = true # if multiple fish can be caught and engine picks one randomly
USE_POINTS = true
FISH_SPEED = Graphics.frame_rate #Standard Graphics.frame_rate
#change to a number is your game lags
end
class FishCatch # this is it, be gentle :P
# Attributes used by the class
attr_accessor :meter_player # The meter to built up while you press buttons
attr_accessor :meter_fish # This the fish meter that also builts up.
attr_accessor :active_fish_id # The active fish, random calculated
attr_accessor :net_fish_ids # Contains more fishes for in nets
attr_accessor :fish_party # Contains party info
attr_accessor :fish_caught # array for fish caught (true/false)
attr_accessor :fish_size # array for fish size
attr_accessor :fish_weight # array for fish weight
attr_accessor :fish_name
attr_accessor :fish_life
attr_accessor :fish_resist
attr_accessor :max_fish
attr_accessor :rod_power
attr_accessor :phase
attr_accessor :rods
attr_accessor :bait
attr_accessor :equipped_rod
attr_accessor :equipped_bait
attr_accessor :fish_point
attr_accessor :total_points
# Initialize all the stuff..
def initialize
$data_items = load_data("Data/Items.rxdata") # in case
@meter_player = 0
@meter_fish = 0
@active_fish_id = 1
@net_fish_ids = []
@fish_party = []
@fish_caught = {} # the hash with data (true if caught)
@fish_size = [] # fish id with fish size (in whichever method [cm, inch etc])
@fish_weight = [] # fish id with fish weight (in whichever method [kg, lbs etc])
@fish_name = {} # fish id with fish name
@fish_life = []
@fish_resist = []
@max_fish = $data_items.size # max fish to be caught (look at item database)
@rod_power = 1
@phase = 0
@rods = []
@bait = []
@equipped_rod = 1 # ID of equipped rod
@equipped_bait = 15 # ID of equipped bait
@fish_point = []
@total_points = 0
get_data
get_rod_power
get_harpoon_range
get_net_time
get_net_range
get_net_max
get_net_power
end
# get initial data of the fish, in case u make a fishbook
def get_data
for id in 1...@max_fish
@fish_caught[id] = false
@fish_size[id] = 0
@fish_weight[id] = 0
@fish_name[id] = "????"
@fish_life[id] = 100
@fish_resist[id] = ($data_items[id].hit.to_f) / 2.0
@fish_point[id] = ($data_items[id].price.to_i / 2)
end
end
def points # get total points outside of class
return @total_points
end
def add_points(n) # adding points
if n.is_a?(Numeric)
@total_points += n
else
return
end
end
# Get your rod power, thats calculated from item ID
def get_rod_power
if @equipped_rod == 1 # Rod ID for fishing
return @rod_power = 1
elsif @equipped_rod == 2 # Rod ID for fishing
return @rod_power = 2
elsif @equipped_rod == 3 # Rod ID for fishing
return @rod_power = 3
elsif @equipped_rod == 4 # Rod ID for fishing
return @rod_power = 4
elsif @equipped_rod == 5 # Rod ID for fishing
return @rod_power = 5
elsif @equipped_rod == 6 # Rod ID for fishing
return @rod_power = 6
elsif @equipped_rod == 7 # Rod ID for fishing
return @rod_power = 7
elsif @equipped_rod == 8 # Rod ID for fishing
return @rod_power = 8
else
return @rod_power = 1 #Default
end
end
# Gets the harpoon range, calculated from item ID, use range = [min, max]
def get_harpoon_range
if @equipped_rod == 11 # Harpoon ID in item database
range = [40, 60] # Range to catch fish in %.
elsif @equipped_rod == 12
range = [10, 30]
else # If harpoon ID is not defined, uses default range
range = [45, 55] # <== default range
end
return range
end
# this will get the data for nets to catch fish
def get_net_data(type = 0)
if @equipped_rod == 13 # ID of net
@net_time = 2 # seconds to hold
@net_range = [1, 99]#[44, 50] # what range to keep
@net_power = 5 #net power
@net_max = 10 #max fish
elsif @equipped_rod == 14
@net_time = 10
@net_range = [55, 60]
@net_power = 3
@net_max = 4
else # if ID not defined
@net_time = 10 # seconds to hold (default)
@net_range = [20, 25] #range (default)
@net_power = 3 #max power (default)
@net_max = 3 #max fish (default)
end
#return the correct thing
case type
when 0
return
when 1
return @net_time
when 2
return @net_range
when 3
return @net_power
when 4
return @net_max
end
end
# etc, add more if you wanna, the bait calc is happened elsewhere btw.
#returns the net time
def get_net_time
return get_net_data(1)
end
#returns the net range
def get_net_range
return get_net_data(2)
end
#returns the net power
def get_net_power
return get_net_data(3)
end
#returns the net max fish
def get_net_max
return get_net_data(4)
end
# If its caught, record data
def caught(id)
if id == nil
print "Unable to add fish: Missing Parameters (ERR01)"
return
elsif id > @max_fish or id == 0
print "Unable to add fish: Range beyond MAX or NIL (ERR02)"
return
else
@fish_caught[id] = true
@fish_size[id] = $data_items[id].pdef_f
@fish_weight[id] = $data_items[id].mdef_f
@fish_name[id] = $data_items[id].name
end
end
def attraction?(bait)
if @active_fish_id.include(1,2) # IDs for fish to be attracted to some bait
if @equipped_bait == 70 # ID for equipped bait
return true # they are attracted and will bite
else
return false
end
end
# etc etc. add more.
end
def pick_fish # randomly choice
if SC::MULTI_POOL == true
if @fish_party.size == 0
@active_fish_id = @fish_party[0]
else
r = rand(@fish_party.size)
@active_fish_id = @fish_party[r]
end
else
@active_fish_id = @fish_party[0]
end
end
def pick_net_fish
if SC::MULTI_POOL == true
if @fish_party.size == 0
@net_fish_ids[0] = @fish_party[0]
else
@net_fish_ids.clear
maxr = rand($fish.get_net_max)
for i in 0..maxr
r = rand(@fish_party.size)
@net_fish_ids[i] = @fish_party[r]
end
end
end
end
end
# The window that shows the fight...
class Window_Versus < Window_Base
def initialize
super(16,16,260, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
self.z = 9999
if $fish == nil
$fish = FishCatch.new
end
refresh
end
def refresh
self.contents.clear
inc = $data_items[$fish.equipped_rod].name
if inc.include?("Harpoon") == false and inc.include?("Net") == false
rect = Rect.new(63, 9, 102, 6)
self.contents.fill_rect(rect, Color.new(0, 0, 0)) # Modify the color as pleased
rect = Rect.new(63, 25, 102, 6)
self.contents.fill_rect(rect, Color.new(0, 0, 0)) # Modify the color as pleased
self.contents.font.size = $fontsize.is_a?(Numeric) ? $fontsize - 4 : $defaultfontsize - 4
self.contents.draw_text(0,-6,self.width-40,32,"Player")
rect = Rect.new(64, 10, $fish.meter_player, 4)
self.contents.fill_rect(rect, Color.new(0, 0, 255)) # Modify the color as pleased
self.contents.draw_text(0,10,self.width-40,32,"Fish")
rect = Rect.new(64, 26, $fish.meter_fish, 4)
self.contents.fill_rect(rect, Color.new(255, 0, 0)) # Modify the color as pleased
self.contents.draw_text(170,-6,self.width-40,32,$fish.meter_player.round.to_s + " %")
self.contents.draw_text(170,10,self.width-40,32,$fish.meter_fish.round.to_s + " %")
elsif inc.include?("Harpoon")
rect = Rect.new(63, 9, 102, 6)
self.contents.fill_rect(rect, Color.new(0, 0, 0)) # Modify the color as pleased
self.contents.font.size = $fontsize.is_a?(Numeric) ? $fontsize - 4 : $defaultfontsize - 4
self.contents.draw_text(0,-6,self.width-40,32,"Player")
rect = Rect.new(64, 10, $fish.meter_fish, 4)
self.contents.fill_rect(rect, Color.new(0, 0, 255)) # Modify the color as pleased
self.contents.draw_text(0,10,self.width-40,32,"HARPOON vs FISH", 1)
self.contents.draw_text(170,-6,self.width-40,32,$fish.meter_fish.round.to_s + " %")
elsif inc.include?("Net")
rect = Rect.new(63, 9, 102, 6)
self.contents.fill_rect(rect, Color.new(0, 0, 0)) # Modify the color as pleased
self.contents.font.size = $fontsize.is_a?(Numeric) ? $fontsize - 4 : $defaultfontsize - 4
self.contents.draw_text(0,-6,self.width-40,32,"Net")
rect = Rect.new(64, 10, $fish.meter_fish, 4)
self.contents.fill_rect(rect, Color.new(0, 0, 255)) # Modify the color as pleased
self.contents.draw_text(0,10,self.width-40,32,"NET vs FISHES!", 1)
self.contents.draw_text(170,-6,self.width-40,32,$fish.meter_fish.round.to_s + " %")
end
end
end
# Window when fish is caught
class Window_Fish < Window_Base
def initialize(fish, start = 0)
super(320, 240, 320, 240)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
@fish = fish
@points = $fish.fish_point[@fish]
refresh
end
def get_points
@points = 0
unless $fish.equipped_rod == nil or $fish.equipped_rod == 0
if $data_items[$fish.equipped_rod].name.include?("Net")
for id in $fish.fish_party
@points += $fish.fish_point[id]
end
else
@points = $fish.fish_point[$fish.active_fish_id]
end
end
end
def get_avarage_str
@avarage1 = 0
@amount1 = 0
for id in 0...@size
@amount1 += $fish.fish_resist[id].to_i
end
@avarage1 = @amount1 / @size
end
def get_avarage_pnt
@avarage2 = 0
@amount2 = 0
for id in 0...@size
@amount2 += $fish.fish_point[id].to_i
end
@avarage2 = @amount2 / @size
end
def refresh
self.contents.clear
get_points
if $fish.phase == 0
$fish.caught(@fish)
self.contents.clear
if $data_items[$fish.equipped_rod].name.include?("Net")
@size = $fish.net_fish_ids.size
get_avarage_str
get_avarage_pnt
self.contents.draw_text(0, 0, self.width - 40, 32, "#{@size} Kinds of fish caught! #{@points} Points!", 1)
self.contents.draw_text(0, 64, self.width - 40, 32, "Avarage points: #{@avarage2}")
self.contents.draw_text(0, 96, self.width - 40, 32, "Avarage strentgh: #{@avarage1}")
self.contents.draw_text(0, 128, self.width - 40, 32, "More info, press A button", 1)
self.contents.draw_text(0, 160, self.width - 40, 32, "Congrats! Total points: #{$fish.points}", 1)
else
self.contents.draw_text(0, 0, self.width - 40, 32, "Fish caught! #{@points} Points!", 1)
bitmap = RPG::Cache.icon($data_items[@fish].icon_name)
self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(28, 32, 212, 32, $data_items[@fish].name)
self.contents.draw_text(0, 64, self.width - 40, 32, "Size: " + $fish.fish_size[@fish].to_s + " cm.")
self.contents.draw_text(0, 96, self.width - 40, 32, "Weight: " + $fish.fish_weight[@fish].to_s + " kg.")
self.contents.draw_text(0, 128, self.width - 40, 32, "Power: " + $fish.fish_resist[@fish].to_s + " fpwr.")
self.contents.draw_text(0, 160, self.width - 40, 32, "Congratulations. Total points: #{$fish.points}", 1)
end
$fish.total_points += @points
elsif $fish.phase == 1
self.contents.draw_text(0, 90, self.width - 40, 32, "The fish got away!", 1)
if SC::LOSE_BAIT == true
self.contents.draw_text(0, 64, self.width - 40, 32, "You lost your bait...")
$game_party.lose_item($fish.equipped_bait, 1)
end
elsif $fish.phase == -1 and @fish == 0
self.contents.draw_text(0, 90, self.width - 40, 32, "No equipment!", 1)
end
end
end
# This is the scene where the fight is done through.
class Scene_FishFight
def main
if $fish.equipped_rod == nil or $fish.equipped_rod == 0
$fish.phase = -1
@catch = Window_Fish.new(0)
@catch.x = 320 - @catch.width / 2
@catch.y = 240 - @catch.height / 2
@catch.z = 9999
@block = true
end
@spriteset_map = Spriteset_Map.new
unless @block == true
if $data_items[$fish.equipped_rod].name.include?("Net")
starting = $fish.get_net_range[0] + $fish.get_net_range[1]
$fish.meter_fish = starting / 2
@timer = 0
@resist = 0
$fish.pick_net_fish
for i in 0...$fish.net_fish_ids.size
@resist += $fish.fish_resist[$fish.net_fish_ids[i]] / SC::FISH_SPEED
end
@startingsec = Graphics.frame_count / Graphics.frame_rate
else
$fish.pick_fish
end
@bar = Window_Versus.new
@bar.z = 9999
@catch = Window_Fish.new($fish.active_fish_id)
@catch.x = 320 - @catch.width / 2
@catch.y = 240 - @catch.height / 2
@catch.z = 9999
@catch.active = false
@catch.visible = false
@str = 0
@stop = false
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset_map.dispose
unless @block == true
@bar.dispose
end
@catch.dispose
end
def update
@spriteset_map.update
unless @block == true
@bar.update
@bar.refresh
end
@catch.update
if @catch.active
update_catch
return
end
if Input.trigger?(Input::B) # cancel, loses bait
$game_system.se_play($data_system.cancel_se)
$fish.meter_player = 0
$fish.meter_fish = 0
$game_party.lose_item($fish.equipped_bait, 1)
$scene = Scene_Map.new
end
inc = $data_items[$fish.equipped_rod].name
if Input.trigger?(Input::C) and @stop != true # tab this!
if inc.include?("Harpoon") == false and inc.include?("Net") == false
$fish.meter_player += $fish.get_rod_power
elsif inc.include?("Harpoon")
rangemin = $fish.get_harpoon_range[0]
rangemax = $fish.get_harpoon_range[1]
if $fish.meter_fish > rangemin and $fish.meter_fish < rangemax
@stop = true
if SC::KEEP_FISH == true
$game_party.gain_item($fish.active_fish_id, 1)
end
$fish.phase = 0
@catch.refresh
@catch.active = true
@catch.visible = true
else
@stop = true
$fish.phase = 1
@catch.refresh
@catch.active = true
@catch.visible = true
end
elsif inc.include?("Net")
#
end
end
#Net info starts here
if inc.include?("Net")
@currentsec = Graphics.frame_count / Graphics.frame_rate
@secdiff = @currentsec - @startingsec
if @secdiff >= $fish.get_net_time
@stop = true
if SC::KEEP_FISH == true
for i in 0...$fish.net_fish_ids.size
$game_party.gain_item($fish.net_fish_ids[i], 1)
end
end
$fish.phase = 0
@catch.refresh
@catch.active = true
@catch.visible = true
end
if $fish.get_net_range[0] > $fish.meter_fish or $fish.get_net_range[1] < $fish.meter_fish
@stop = true
$fish.phase = 1
@catch.refresh
@catch.active = true
@catch.visible = true
end
end
if Input.trigger?(Input::X) and inc.include?("Net")
$fish.meter_fish -= $fish.get_net_power
elsif Input.trigger?(Input::Y) and inc.include?("Net")
$fish.meter_fish += $fish.get_net_power
end
#End net info
unless @block == true
update_fish
if $fish.meter_player >= 100
$fish.meter_player = 100
@stop = true
if SC::KEEP_FISH == true
$game_party.gain_item($fish.active_fish_id, 1)
end
$fish.phase = 0
@catch.refresh
@catch.active = true
@catch.visible = true
end
end
end
def update_fish
inc = $data_items[$fish.equipped_rod].name
if inc.include?("Net") == false and inc.include?("Harpoon") == false
if @str >= $fish.fish_life[$fish.active_fish_id] and $fish.meter_player < 100
$fish.meter_fish = 100
@stop = true
$fish.phase = 1
@catch.refresh
@catch.active = true
@catch.visible = true
elsif @stop == true
#
elsif @str <= $fish.fish_life[$fish.active_fish_id]
@add = $fish.fish_resist[$fish.active_fish_id] / SC::FISH_SPEED
@str += @add
$fish.meter_fish += @add
end
elsif inc.include?("Harpoon")
if @str >= 100
@str = 0
$fish.meter_fish = 0
end
@add = $fish.fish_resist[$fish.active_fish_id] * 5 / SC::FISH_SPEED
@str += @add
$fish.meter_fish += @add
elsif inc.include?("Net")
@timer += 1
if @timer > 3
@timer = 0
end
if @stop == true
#
elsif @timer == 3
phase = rand(7)
case phase
when 0
unless $fish.meter_fish > 100
$fish.meter_fish += @resist + 1
else
$fish.meter_fish -= @resist + 1
end
when 1
unless $fish.meter_fish > 100
$fish.meter_fish += @resist - 1
else
$fish.meter_fish -= @resist - 1
end
when 2
unless $fish.meter_fish > 100
$fish.meter_fish += @resist
else
$fish.meter_fish -= @resist
end
when 3
unless $fish.meter_fish > 100
$fish.meter_fish += @resist / 2
else
$fish.meter_fish -= @resist / 2
end
when 4
unless $fish.meter_fish < 0
$fish.meter_fish -= @resist + 1
else
$fish.meter_fish += @resist + 1
end
when 5
unless $fish.meter_fish < 0
$fish.meter_fish -= @resist - 1
else
$fish.meter_fish += @resist - 1
end
when 6
unless $fish.meter_fish < 0
$fish.meter_fish -= @resist
else
$fish.meter_fish += @resist
end
when 7
unless $fish.meter_fish < 0
$fish.meter_fish -= @resist / 2
else
$fish.meter_fish += @resist / 2
end
end
if $fish.meter_fish < 0
$fish.meter_fish = 1
elsif $fish.meter_fish > 100
$fish.meter_fish = 99
end
end
end
end
def update_catch
inc = $data_items[$fish.equipped_rod].name
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$fish.phase = 1
$fish.meter_player = 0
$fish.meter_fish = 0
@str = 0
$scene = Scene_Map.new
elsif Input.trigger?(Input::X) and inc.include?("Net")
$game_system.se_play($data_system.decision_se)
$scene = Scene_FishResult.new
end
end
end
# Okay now, this is the stuff where you equip your fishing rod and bait to use.
# Rods must have a element called "Rod" and baits must have element called "Bait".
# You can make them in the item database. Anywhere you want as this script
# will only search for elements that are "Rod" and/or "Bait".
class Window_FishGear < Window_Selectable
def initialize(type = 0)
super(0, 64, 320, 416)
@column_max = 1
@type = nil
@type = type
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @type == 1
for i in 1...$data_items.size
if $data_items[i].element_set.include?($data_system.elements.index("Rod"))
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
elsif @type == 2
for i in 1...$data_items.size
if $data_items[i].element_set.include?($data_system.elements.index("Bait"))
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
elsif @type == 0
return
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
end
self.contents.font.color = normal_color
x = 4
y = index * 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(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 234, y, 16, 32, "x", 1)
self.contents.draw_text(x + 248, y, 24, 32, number.to_s, 2)
end
def update_help
if @type == 1
@help_window.set_text(self.item == nil ? "Rod: No Info" : "Rod: #{self.item.description}")
elsif @type == 2
@help_window.set_text(self.item == nil ? "Bait: No Info" : "Bait: #{self.item.description}")
elsif @type == 0
@help_window.set_text("Welcome to the equip scene for your fishing gear.")
end
end
end
class Window_FishStatus < Window_Base
def initialize
super(320, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, self.width - 40, 32, "Equipment", 1)
if $fish.equipped_rod == nil or $fish.equipped_rod == 0
self.contents.draw_text(4, 64, self.width - 40, 32, "No fishing pool is equipped!")
else
self.contents.draw_text(4, 64, self.width - 40, 32, "Rod: " + $data_items[$fish.equipped_rod].name.to_s)
end
if $fish.equipped_bait == nil or $fish.equipped_bait == 0
self.contents.draw_text(4, 128, self.width - 40, 32, "No fish bait is equipped!")
else
self.contents.draw_text(4, 128, self.width - 40, 32, "Bait: " + $data_items[$fish.equipped_bait].name.to_s)
end
self.contents.draw_text(4, 196, self.width - 40, 32, "Press A to equip rods")
self.contents.draw_text(4, 228, self.width - 40, 32, "Press S to equip bait")
self.contents.draw_text(4, 260, self.width - 40, 32, "Press D to de-equip active")
end
end
class Scene_FishEquip
def main
@help_window = Window_Help.new
@gear = Window_FishGear.new(0)
@gear.index = -1
@gear.help_window = @help_window
@status = Window_FishStatus.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@gear.dispose
@status.dispose
end
def update
@help_window.update
@gear.update
@status.update
if @gear.active
update_gear
return
end
end
def update_gear
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
elsif Input.trigger?(Input::X)
if @phase == 2 or @phase == nil
@phase = 1
@gear.dispose
@gear = Window_FishGear.new(1)
@gear.help_window = @help_window
@gear.active = true
@help_window.update
end
return
elsif Input.trigger?(Input::Y)
if @phase == 1 or @phase == nil
@phase = 2
@gear.dispose
@gear = Window_FishGear.new(2)
@gear.help_window = @help_window
@gear.active = true
@help_window.update
end
return
elsif Input.trigger?(Input::C) and @gear.index != nil
if @phase == 1
@gear.refresh
$game_system.se_play($data_system.equip_se)
$fish.equipped_rod = @gear.item.id
unless $fish.equipped_rod == nil or $fish.equipped_rod == 0
inc = $data_items[$fish.equipped_rod].name
if inc.include?("Harpoon") or inc.include?("Net")
$fish.equipped_bait = 0
end
end
@status.refresh
elsif @phase == 2
@gear.refresh
unless $fish.equipped_rod == nil or $fish.equipped_rod == 0
inc = $data_items[$fish.equipped_rod].name
unless inc.include?("Harpoon") or inc.include?("Net")
$game_system.se_play($data_system.equip_se)
$fish.equipped_bait = @gear.item.id
end
end
@status.refresh
end
elsif Input.trigger?(Input::Z)
$game_system.se_play($data_system.equip_se)
if @phase == 1
$fish.equipped_rod = 0
@status.refresh
elsif @phase == 2
$fish.equipped_bait = 0
@status.refresh
else
return
end
end
end
end
# Saving. Loading. New Game... you don't need to make this, I already did it for you.
class Scene_Title # new game stuff
alias fish_new_game command_new_game
def command_new_game
fish_new_game
$fish = FishCatch.new
end
end
class Scene_Save < Scene_File # save stuff
alias fish_save write_save_data
def write_save_data(filename)
fish_save
Marshal.dump($fish, filename)
end
end
class Scene_Load < Scene_File # load stuff
alias fish_load read_save_data
def read_save_data(filename)
fish_load
$fish = Marshal.load(filename)
end
end
# The scene for result screen when caught fish with a net.
# This is the window containing the fish you caught
class Window_FishList < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...$fish.net_fish_ids.size
@data.push($data_items[$fish.net_fish_ids[i]])
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
self.contents.font.color = normal_color
end
x = 4
y = index * 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(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
# window for fish details.
class Window_FishDetail < Window_Base
def initialize
super(320, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
def show_detail(fish)
if @fish != $data_items[fish]
self.contents.clear
@fish = $data_items[fish]
self.contents.draw_text(0, 16, self.width - 40, 32, "Information", 1)
self.contents.draw_text(0, 96, self.width - 40, 32, "Size: " + $fish.fish_size[@fish.id].to_s)
self.contents.draw_text(0, 128, self.width - 40, 32, "Weight: " + $fish.fish_weight[@fish.id].to_s)
self.contents.draw_text(0, 160, self.width - 40, 32, "Strength: " + $fish.fish_resist[@fish.id].to_s)
self.contents.draw_text(0, 232, self.width - 40, 32, "Cancel to go to map.", 1)
end
end
end
# scene...
class Scene_FishResult
#--------------------------------------------------------------------------
def main
@help_window = Window_Help.new
@command_window = Window_FishList.new
@command_window.help_window = @help_window
@info_window = Window_FishDetail.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
def update
@help_window.update
@command_window.update
@info_window.update
if @command_window.active
update_command
end
end
#--------------------------------------------------------------------------
def update_command
@info_window.show_detail(@command_window.item.id)
if Input.trigger?(Input::B) or Input.trigger?(Input::C)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
end
# Final Update: August 6th 2005 @ 17:46 GMT (SID07)