well it was all good till i discovered this bugg, when u use an item and u use all the items of it (i mean like u got 10 potions and u use them all at that time) a bugg happen and the game crash... this is what it says line 654 No Method Error Ocurred Undefined Method 'refresh' for nil:NilClass
heres the scrip, i hope i can get some help thx
#-----------------------------------------------------------------
# Slipknot's Menu
# created by Slipknot
#-----------------------------------------------------------------
class Scene_Menu
#-----------------------------------------------------------------
def initalize (menu_index = 0)
@menu_index = menu_index
end
#-----------------------------------------------------------------
def main
opa = 182
@spriteset = Spriteset_Map.new
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"; s5 = "Save Game"
s8 = "Quit"; s7 = "Options"; s6 = "View Map";@tip = rand(4)
@command = WCommand.new (152,[s1,s2,s3,s4,s5,s6,s7,s8],1)
@command.index = @menu_index
@command.x = 320 - @command.width/2
@command.y = 480 - @command.height
@command.opacity = opa
if $game_party.actors.size == 0
@command.dis(1,1); @command.dis(2,1); @command.dis(3,1)
end
if $game_system.save_disabled
@command.dis(4,1)
end
if itemdis; @command.dis(0,1); end
@playtime = PlayTime.new
@playtime.opacity = opa
@help = MenuWin.new(22,"Agency FB",opa)
@help.y = 480 - @help.height; @help.x = 640 - @help.width
@tips = MenuWin.new(20,"Agency FB",opa)
@tips.y = 480 - @tips.height
@imagen = Sprite.new
@imagen.bitmap=RPG::Cache.picture("necro2")
ox = @imagen.bitmap.width/2
oy = @imagen.bitmap.height/2
@opt = Window_Command.new(235,["WindowSkins","Music Volume","Sound Effect Volume"])
@skin = Window_Command.new(195,["Blue","Violent Violet","Traditional Retro","Traditional","Spamy","Hell Breath","Grass","Fatal Venom"])
@bgm = Slipknot_Slider.new("BGM")
@bgm.index = $game_system.bgm_volume
@se = Slipknot_Slider.new("SE")
@se.index = $game_system.se_volume
yo = 240 - @opt.height/2
xo = 16
xox = xo + @opt.width
visact(@opt,false); @opt.x = xo; @opt.y = yo
visact(@skin,false); @skin.x = xox; @skin.y = yo
visact(@bgm,false); @bgm.x = xox; @bgm.y = yo
visact(@se,false); @se.x = xox; @se.y = yo
@optwins = [@opt,@skin,@bgm,@se]
for i in @optwins; i.z = @command.z + 100; i.opacity = opa; end
@imagen.x = 320 - ox
@imagen.y = 240 - oy
@imagen.opacity = 255
@gold = Gold.new; @gold.x = 440
@gold.y = 0; @gold.opacity = opa
@status = Window_MenuStatus.new
@status.x = 56; @status.y = 0
@status.z = 2000; @status.visible = false
@wins = [@command,@status,@gold,@playtime,@help,
@tips,@imagen,@opt,@skin,@bgm,@se]
Graphics.transition
loop do
Graphics.update; Input.update; update
if $scene != self; break; end
end
Graphics.freeze; @spriteset.dispose
for i in @wins; i.dispose; end
end
#-----------------------------------------------------------------
def update
for i in @wins; i.update; end
update_tips
if @command.active; update_command
update_help; return
end
if @status.active; update_status; return; end
if @opt.active; update_opt; return; end
if @sbs; update_sbs; return; end
end
#-----------------------------------------------------------------
def update_opt
if Input.trigger?(Input::B)
visact(@opt,false)
@command.active = true
end
if Input.trigger?(Input::C)
case @opt.index
when 0; optacc(@skin)
when 1; optacc(@bgm)
when 2; optacc(@se)
end; return
end
end
#-----------------------------------------------------------------
def optacc(w)
@opt.active = false; @sbs = true; visact(w,true)
end
#-----------------------------------------------------------------
def update_sbs
if Input.trigger?(Input::B)
case @opt.index
when 0; optcan(@skin)
when 1; optcan(@bgm)
when 2; optcan(@se)
end
end
case @opt.index
when 1; volacc(1,@bgm.index); return
when 2; volacc(2,@se.index); return
end
if Input.trigger?(Input::C) and @skin.active
case @skin.index
when 0; skinacc("Blue","Blue")
when 1; skinacc("Violent Violet","Violent Violet")
when 2; skinacc("Traditional Retro","Traditional Retro")
when 3; skinacc("Traditional","Traditional")
when 4; skinacc("Spamy","Spamy")
when 5; skinacc("Hell Breath","Hell Breath")
when 6; skinacc("Grass","Grass")
when 7; skinacc("Fatal Venom","Fatal Venom")
end
return
end
end
#-----------------------------------------------------------------
def volacc(pla,vol)
case pla; when 1
$game_system.bgm_volume = vol
when 2
$game_system.se_volume = vol
end
end
#-----------------------------------------------------------------
def skinacc(sk1,sk2)
$game_system.se_play($data_system.decision_se)
$game_system.windowskin_name = sk1
$game_system.namewindowskin_name = sk2
end
#-----------------------------------------------------------------
def optcan(w)
visact(w,false); @opt.active = true; @sbs = false
end
#-----------------------------------------------------------------
def update_help
case @command.index
when 0
if itemdis; a = "(You Dont Have Any Items...)"
else; a = ""; end
@help.ref("See your collected items.",a)
when 1; @help.ref("See hero Skills","")
when 2; @help.ref("See and change the hero's","equipment.")
when 3; @help.ref("See the complete status of","one hero.")
when 4; @help.ref("Saves the game.","")
when 5; @help.ref("View the current map.","")
when 6; @help.ref("Change settings:","Volume and Windowskin.")
when 7; @help.ref("Restart or Quit the game.","")
end
end
#-----------------------------------------------------------------
def update_tips
case @tip
when 0; @tips.ref("Use the potions only when","you really are in danger.")
when 1; @tips.ref("Put attention when someone","is near to reach a new level.")
when 2; @tips.ref("Constantly save the game.","")
when 3; @tips.ref("Always keep in your bag","items like potions & revives.")
when 4; @tips.ref("If you found a new town","talk with everybody.")
end
end
#-----------------------------------------------------------------
def itemdis
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0; @data.push($data_items[i]); end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0; @data.push($data_weapons[i]); end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0; @data.push($data_armors[i]); end
end
if @data.size == 0; return true; end
end
#-----------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play ($data_system.cancel_se)
$scene = Scene_Map.new; return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command.index == 1..3
$game_system.se_play ($data_system.buzzer_se)
return
end
case @command.index
when 0
if itemdis
$game_system.se_play($data_system.buzzer_se); return
end; comacc(Menu_Item)
when 1..3
$game_system.se_play ($data_system.decision_se)
@command.active = false; @status.index = 0
visact(@status,true)
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end; comacc(Scene_Save)
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_Minimap.new(1)
when 6
$game_system.se_play($data_system.decision_se)
@opt.index = 0; visact(@opt,true)
@command.active=false
when 7; comacc(Scene_End); end
return
end
end
#-----------------------------------------------------------------
def comacc(a)
$game_system.se_play($data_system.decision_se); $scene = a.new
end
#-----------------------------------------------------------------
def visact(w,tf)
w.visible = tf; w.active = tf
end
#-----------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play ($data_system.cancel_se)
@command.active = true
visact(@status,false)
@status.index = -1
return
end
if Input.trigger?(Input::C)
case @command.index
when 1
if $game_party.actors[@status.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
statacc(Scene_Skill)
when 2; statacc(Scene_Equip)
when 3; statacc(Scene_Status)
end
return
end
end
#-----------------------------------------------------------------
def statacc(a)
$game_system.se_play($data_system.decision_se); $scene = a.new(@status.index)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class PlayTime < Window_Base
#-----------------------------------------------------------------
def initialize
super (0,0,200,80)
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.font.size = $defaultfontsize
self.contents.font.name = $defaultfonttype
refresh
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text (4,0,150,32,"In Game Tome")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60; min = @total_sec /60 % 60
sec = @total_sec % 60
text = sprintf ("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text (10, 24, 120, 28, text, 2)
end
#-----------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Gold < Window_Base
#-----------------------------------------------------------------
def initialize
super (0,0,200,80)
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.font.size = $defaultfontsize
self.contents.font.name = $defaultfonttype
if $game_party.gold < 1
icon = RPG::Cache.icon("gold1")
elsif $game_party.gold < 100
icon = RPG::Cache.icon("gold1")
elsif $game_party.gold < 250
icon = RPG::Cache.icon("gold1")
elsif $game_party.gold < 500
icon = RPG::Cache.icon("gold1")
elsif $game_party.gold < 1000
icon = RPG::Cache.icon("gold1")
else
icon = RPG::Cache.icon("gold1")
end
gold = $game_party.gold.to_s
unless gold.size > 4; money = gold
else
case gold.size
when 5
ary = gold.slice!(0,2)
money = ary + ","+ gold
when 6
ary = gold.slice!(0,3)
money = ary + ","+ gold
when 7
ary1 = gold.slice!(0,4)
ary2 = ary1.slice!(1,4)
money = ary1 + ","+ ary2 +","+ gold
end
end
self.contents.draw_text (0,5,130,32, money.to_s, 2)
self.contents.blt(130,8,icon,Rect.new(0,0,24,24))
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Window_MenuStatus < Window_Selectable
#-----------------------------------------------------------------
def initialize
super (0, 0, 528, 480)
self.opacity = 210
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
self.active = false; self.index = -1
end
#-------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 94; y = i * 116
actor = $game_party.actors[i]
self.contents.draw_text(x,y,160,32,actor.name.upcase)
draw_actor_class (actor, x+230, y)
draw_actor_level (actor, x, y+32)
draw_actor_state (actor, x+90, y+32)
draw_actor_exp (actor, x, y+64)
draw_actor_hpg (actor, x+230, y+35, 120,16)
draw_actor_spg (actor, x+230, y+69,120,16)
end
end
#-------------------------------------------------------------
def update_cursor_rect
if @index < 0; self.cursor_rect.empty
else; self.cursor_rect.set(0,@index * 116,self.width-32,96); end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class MenuWin < Window_Base
#-----------------------------------------------------------------
def initialize(fosi,fona,opa)
super(0,0,247,88); self.opacity = opa
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.font.size = fosi; self.contents.font.name = fona
ref("","")
end
#-----------------------------------------------------------------
def ref(txt,txt2)
self.contents.clear
self.contents.draw_text(0,0,214,28,txt)
self.contents.draw_text(0,28,214,28,txt2)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Slipknot_Slider < Window_Base
#-----------------------------------------------------------------
def initialize(text = "")
super(0,0,160,290)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.active = false; @text = text
if @index == nil; @index = 0; end
@item_max = 100; self.visible = false
@scale = 2; refresh
end
#-----------------------------------------------------------------
def index=(index)
@index = index; refresh
end
#-----------------------------------------------------------------
def index
return @index
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0,0,128,24,@text+" volume",1)
self.contents.draw_text(30,32,80,24,"0%")
self.contents.draw_text(30,82,80,24,"25%")
self.contents.draw_text(30,132,80,24,"50%")
self.contents.draw_text(30,182,80,24,"75%")
self.contents.draw_text(30,232,80,24,"100%")
curhei = 18; mish = @item_max * @scale + curhei
self.contents.fill_rect(0,32,20,mish+8,Color.new(200,200,200,140))
self.contents.fill_rect(2,34,16,mish+4,Color.new(128,128,128,190))
self.contents.fill_rect(4,36,12,mish,Color.new(64,64,64,190))
y = (@index*(@item_max*@scale))/@item_max + 36
self.contents.fill_rect(3,y,14,curhei, Color.new(100,100,100,215))
self.contents.fill_rect(6,y+4,8,curhei - 8, Color.new(90,90,90,215))
end
#-----------------------------------------------------------------
def update
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
if self.active and @item_max > 0
if Input.repeat?(Input::UP)
if @index != 0
case @text
when "BGM"
@index -= 5
$game_system.bgm_play($game_system.bgm_memorize)
when "SE"
$game_system.se_play($data_system.decision_se)
@index -= 5
end; return
end
$game_system.se_play($data_system.buzzer_se)
end
if Input.repeat?(Input::DOWN)
if @index < @item_max
case @text
when "BGM"
@index += 5
$game_system.bgm_play($game_system.bgm_memorize)
when "SE"
$game_system.se_play($data_system.decision_se)
@index += 5
end; return
end
$game_system.se_play($data_system.buzzer_se)
end
refresh; return
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class WCommand < Window_Selectable
#-----------------------------------------------------------------
def initialize(width, commands,pos=0)
super(0,0,width,commands.size*32+32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width-32,@item_max*32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@pos = pos; refresh; self.index = 0
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max; draw_item(i, normal_color); end
end
#-----------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4,32*index, self.contents.width-8,32)
self.contents.fill_rect(rect, Color.new(0,0,0,0))
self.contents.draw_text(rect,@commands[index],@pos)
end
#-----------------------------------------------------------------
def dis(index,pos=0)
@pos = pos; draw_item(index,disabled_color)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Game_System
#-----------------------------------------------------------------
attr_accessor :bgm_volume
attr_accessor :se_volume
#-----------------------------------------------------------------
alias options_initiliaze initialize
def initialize
options_initiliaze
@bgm_volume = 100; @se_volume = 100
end
#-----------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/"+bgm.name,bgm.volume * bgm_volume/100,bgm.pitch)
else; Audio.bgm_stop
end; Graphics.frame_reset
end
#-----------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * se_volume / 100, bgs.pitch)
else; Audio.bgs_stop
end; Graphics.frame_reset
end
#-----------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/"+me.name, me.volume*se_volume / 100, me.pitch)
else; Audio.me_stop
end; Graphics.frame_reset
end
#-----------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/"+se.name,se.volume*se_volume/100,se.pitch)
end
end
#-----------------------------------------------------------------
def namewindowskin_name
if @namewindowskin_name == nil
return "RaulBlue"
else; return @namewindowskin_name; end
end
#-----------------------------------------------------------------
def namewindowskin_name=(namewindowskin_name)
@namewindowskin_name = namewindowskin_name
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Menu_Item
#-----------------------------------------------------------------
def main
@what = ItemCommand.new
@what.z = 100
@help_window = Window_Help.new
@help_window.visible = false
@none = NoneWin.new
@target_window = Window_Target.new
visact(@target_window,false)
@itemw = SoloItem.new
@itemw.help_window = @help_window
@weparm = WeaponArmor.new
visact(@weparm,false); visact(@itemw,false)
@wins = [@what,@help_window,@none,@target_window,@itemw,@weparm]
Graphics.transition
loop do
Graphics.update
Input.update; update
if $scene != self; break; end
end
Graphics.freeze
for i in @wins; i.dispose; end
end
#-----------------------------------------------------------------
def update
for i in @wins; i.update; end
if @itemw.active == false or @weparm.active == false
@none.visible = true; @help_window.visible = false
else; @none.visible = false; @help_window.visible = true; end
if @what.active; update_what; return
else; @help_window.visible = true; end
if @itemw.active; update_item; return; end
if @weparm.active; update_weparm; return; end
if @target_window.active; update_target; return; end
end
#-----------------------------------------------------------------
def update_what
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
case @what.index
when 0; visact(@what,false); visact(@itemw,true)
when 1; visact(@what,false); visact(@weparm,true)
when 2
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
end
return
end
end
#-----------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
visact(@what,true); visact(@itemw,false); return
end
if Input.trigger?(Input::C)
@item = @itemw.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@itemw.active = false
@target_window.x = (@itemw.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else; @target_window.index = 0; end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@itemw.draw_item(@itemw.index)
end
$scene = Scene_Map.new; return
end
end; return
end
end
#-----------------------------------------------------------------
def update_weparm
if Input.trigger?(Input::B)
visact(@what,true)
visact(@weparm,false)
return
end
@item = @weparm.item
if Input.trigger?(Input::C)
$game_system.se_play($data_system.buzzer_se)
return
end
end
#-----------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
unless $game_party.item_can_use?(@item.id)
@item_window.refresh
end
@itemw.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@itemw.draw_item(@itemw.index)
end
@target_window.refresh
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new; return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end; return
end
end
#-----------------------------------------------------------------
def visact(w,tf)
w.active = tf; w.visible = tf
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class SoloItem < Window_Selectable
#-----------------------------------------------------------------
def initialize
super(0,64,640,416)
@column_max = 2
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 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@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_item(i)
end
end
end
#-----------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
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(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 + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#-----------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class WeaponArmor < Window_Selectable
#-----------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
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 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
@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_item(i); end
end
end
#-----------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.weapon_number(item.id)
self.contents.font.color = disabled_color
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(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 + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#-----------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class NoneWin < Window_Base
#-----------------------------------------------------------------
def initialize; super(0,64,640,416); end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class ItemCommand < Window_Selectable
#-----------------------------------------------------------------
def initialize
super(0,0,640,64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 3; @column_max = 3
@commands = ["Items","Weapons and Armors","Leave"]
refresh; self.index = 0
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max; draw_item(i); end
end
#-----------------------------------------------------------------
def draw_item(index)
x = 4+index * 212
self.contents.draw_text(x,0,200,32,@commands[index])
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Scene_Minimap
#-----------------------------------------------------------------
def initialize(n=0)
@n = n
end
#-----------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@contents = Slipknot_Contents.new
@minimap = Sprite_MiniMap.new
@width = @minimap.bitmap.width/2.5
@height = @minimap.bitmap.height/2.5
@minimap.x = 320 - (@minimap.bitmap.width/2.5)/2
@minimap.y = 276 - (@minimap.bitmap.height/2.5)/2
Graphics.transition
loop do
Graphics.update; Input.update; update
if $scene != self; break; end
end
Graphics.freeze
@minimap.dispose; @spriteset.dispose; @contents.dispose
end
#-----------------------------------------------------------------
def update
if Input.trigger?(Input::B) or Input.trigger?(Input::A)
$game_system.se_play($data_system.cancel_se)
case @n
when 0; $scene = Scene_Map.new
when 1: $scene = Scene_Menu.new(5)
end
end
@minimap.update; @contents.update
if @width > 640
if Input.repeat?(Input::LEFT)
@minimap.x -= 2
elsif Input.repeat?(Input::RIGHT)
@minimap.x += 2
end
return
end
if @height > 448
if Input.repeat?(Input::UP)
@minimap.y -= 2
elsif Input.repeat?(Input::DOWN)
@minimap.y += 2
end
end
return
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Slipknot_Contents < Window_Base
#-----------------------------------------------------------------
def initialize
super(0,0,640,480)
self.opacity = 0; self.z = 110
self.contents = Bitmap.new (width-32,height-32)
self.contents.font.name = $defaultfonttype
self.contents.clear
back_color = Color.new(0,0,0,128)
self.contents.fill_rect(280,2,48,30,back_color)
self.contents.font.size = $defaultfontsize
self.contents.draw_text(0,0,608,32,"CURRENT MAP",1)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Sprite_MiniMap < Sprite
#-----------------------------------------------------------------
INDEX =
[
26, 27, 32, 33, 4 , 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
26, 27, 32, 11, 4 , 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
26, 27, 10, 33, 4 , 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
26, 27, 10, 11, 4 , 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
]
X = [0, 1, 0, 1]
Y = [0, 0, 1, 1]
#-----------------------------------------------------------------
def initialize
super
self.z = 100
@map_id = -1
update
end
#-----------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#-----------------------------------------------------------------
def update
super
if @map_id == $game_map.map_id
return
end
@tile = 32
@map_id = $game_map.map_id
@d = $game_map.height
@c = $game_map.width
width = @c*@tile; hight = @d*@tile
size = @d*@c
self.bitmap = Bitmap.new(width, hight)
self.bitmap.fill_rect(0,0,width, hight,Color.new(0,0,0) )
for i in 0...size
x = i % @c; y = i / @c
for j in [0,1,2]
pos = $game_map.data[x,y,j]
if pos >= 384
bmp = RPG::Cache.tile($game_map.tileset_name,pos,0)
src_rect = Rect.new(0,0,@tile,@tile)
self.bitmap.blt(x*@tile,y*@tile,bmp,src_rect)
end
if pos >= 48 and pos < 384
id = pos / 48 - 1
pos = pos % 48
bmp = RPG::Cache.autotile($game_map.autotile_names[id])
for g in 0..3
h = 4 * pos + g
y1 = INDEX[h] / 6
x1 = INDEX[h] % 6
src_rect = Rect.new(x1*16,y1*16,16,16)
self.bitmap.blt(x*@tile+X[g]*16,y*@tile+Y[g]*16,bmp,src_rect)
end
end
end
end
self.zoom_x = 40.0 / 100.0
self.zoom_y = 40.0 / 100.0
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Window_Base < Window
#-----------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
self.contents.fill_rect(x, y, width, width, start_color)
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
#----------------------------------------------------------------
def draw_actor_hpg(actor, x, y, width = 120, height = 12)
w = width * actor.hp / actor.maxhp
hp_color_1 = Color.new(255, 0, 0, 192)
hp_color_2 = Color.new(255, 96, 0, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x - 40, y - 25, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 8, y - 25, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 20, y - 25, 48, 32, actor.maxhp.to_s)
self.contents.font.color = system_color
self.contents.draw_text(hp_x - 70, y - 25, 32, 32, "Health Points")
end
#-----------------------------------------------------------------
def draw_actor_spg(actor, x, y, width = 120, height = 12)
w = width * actor.sp / actor.maxsp
hp_color_1 = Color.new( 0, 0, 225, 192)
hp_color_2 = Color.new( 0, 128, 225, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x - 40, y - 25, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 8, y - 25, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 20, y - 25, 48, 32, actor.maxsp.to_s)
self.contents.font.color = system_color
self.contents.draw_text(sp_x - 70, y - 25, 32, 32, "Magic power")
end
#-----------------------------------------------------------------
end