So I've created a new window called Window_BattleVictory, and I'm having trouble creating it in battles.
The Script for the window is as follows. The values for x,y,width, etc. are just experimental, I was planning to adjust them after seeing the window, which I can't. There are also some variables that I've defined (namely, @true_exp)
#==============================================================================# ** Window_BattleVictory#------------------------------------------------------------------------------# This window displays how much EXP and JP you get after a battle#==============================================================================class Window_BattleVictory < Window_Base #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize super(0,0,window_width, window_height) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height fitting_height(visible_line_number) end #-------------------------------------------------------------------------- # * Display the true exp gauges #-------------------------------------------------------------------------- def true_exp_gauges y = 0 $game_party.battle_members.each do |actor| draw_gauge(0,y,100,exp_gauge_rate(actor) ,text_color(24), text_color(15)) y += 30 end end #-------------------------------------------------------------------------- # * Get the rate for gauges for each actors true EXP #-------------------------------------------------------------------------- def exp_gauge_rate(actor) the_actor = $game_party.battle_members[actor] ((the_actor.true_exp - the_actor.true_exp_for_level(actor.true_level - 1)) / the_actor.true_exp_for_level(the_actor.true_level)) endendI've defined methods inside Scene_Battle like this
#-------------------------------------------------------------------------- # * Create Battle Victory Window (set to nil until the victory) #-------------------------------------------------------------------------- def create_victory_window @victory_window = nil end #-------------------------------------------------------------------------- # * Set @victory_window to a new window #-------------------------------------------------------------------------- def set_victory_window @victory_window = Window_BattleVictory.new end create_victory_window is called in create_all_windows, and set_victory_window is called in BattleManager (on line 205, for the error messages) I didn't have this at first, but when I did (something) = Window_BattleVictory.new in the BattleManager I got:
Script 'BattleManager' line 205: NoMethodError occured
undefined method 'new' for nil:NilClass
Whenever I tried a battle test, so I though this might help. Now I get the error
Script 'BattleManager' line 205: NoMethodError occured
undefined local variable or method 'set_victory_window' for Module BattleManager
Can someone please tell me how to open up a new window?
The Script for the window is as follows. The values for x,y,width, etc. are just experimental, I was planning to adjust them after seeing the window, which I can't. There are also some variables that I've defined (namely, @true_exp)
#==============================================================================# ** Window_BattleVictory#------------------------------------------------------------------------------# This window displays how much EXP and JP you get after a battle#==============================================================================class Window_BattleVictory < Window_Base #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize super(0,0,window_width, window_height) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height fitting_height(visible_line_number) end #-------------------------------------------------------------------------- # * Display the true exp gauges #-------------------------------------------------------------------------- def true_exp_gauges y = 0 $game_party.battle_members.each do |actor| draw_gauge(0,y,100,exp_gauge_rate(actor) ,text_color(24), text_color(15)) y += 30 end end #-------------------------------------------------------------------------- # * Get the rate for gauges for each actors true EXP #-------------------------------------------------------------------------- def exp_gauge_rate(actor) the_actor = $game_party.battle_members[actor] ((the_actor.true_exp - the_actor.true_exp_for_level(actor.true_level - 1)) / the_actor.true_exp_for_level(the_actor.true_level)) endendI've defined methods inside Scene_Battle like this
#-------------------------------------------------------------------------- # * Create Battle Victory Window (set to nil until the victory) #-------------------------------------------------------------------------- def create_victory_window @victory_window = nil end #-------------------------------------------------------------------------- # * Set @victory_window to a new window #-------------------------------------------------------------------------- def set_victory_window @victory_window = Window_BattleVictory.new end create_victory_window is called in create_all_windows, and set_victory_window is called in BattleManager (on line 205, for the error messages) I didn't have this at first, but when I did (something) = Window_BattleVictory.new in the BattleManager I got:
Script 'BattleManager' line 205: NoMethodError occured
undefined method 'new' for nil:NilClass
Whenever I tried a battle test, so I though this might help. Now I get the error
Script 'BattleManager' line 205: NoMethodError occured
undefined local variable or method 'set_victory_window' for Module BattleManager
Can someone please tell me how to open up a new window?