Creating a new Window?

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?
You should create the window in the scene itself, right at the start and hide it until you need to show it.

Or you could also create the window only when you need it and dispose it right after you are done with whatever you want to do with it.

The latter would be more performance friendly, but requires some extra coding.

Your 'create_victory_window' method should be:

@victory_window = Window_BattleVictory.new@victory_window.hideThis would create the window and hide it immediately, so the player will not see it until you show it later.And when you want to show it, you can simply call this line (still in Scene_Battle):

Code:
@victory_window.show
If you want to call a method from the current scene outside of the scene class, you can always use:
Code:
SceneManager.scene.method_name(args)
Simply replace the 'method_name' with the name of your method from the scene class, and set the arguments for your method (if it has any), and that method will be executed.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-new-window.54470/