Ok, so i am watching this tutorial here:
and this guy is showing how to make a custom menu. now, he is pretty good at explaining things, but if you jump to 24:42 in the video and pause it you will see this guys Window_TestHeader script, which looks like this: (I modified the class name slightly for ease of use)
#==============================================================================# ** Window_Header#------------------------------------------------------------------------------# This class creates the header for scenes.#==============================================================================class Window_Header < Window_Base #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) self.windowskin = Cache.system(Menu_API::Windowskin) if Menu_API::Windowskin self.opacity = Menu_API:😮pacity end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text(text) contents.clear set_font(Menu_API::Header_Font) draw_text(0, 0, contents.width, contents.height, text, 1) endendNow i use this class in there following scripts as well:
and here is the custom module (with a few extra additions from me) that gives the needed font
and there error when i launch the new option in the menu is this:
Script 'Window_Header' line 20: NoMethodError occurred.
undefined method 'set_font' for #<WIndow_Header:0x553ca64>
now what puzzles me isn't the error, but why i am getting it. you see, he uses all the scripts i just posted (plus one that doesn't use the set_font method) and he gets absolutely no errors. I even checked in the Window_Base class for a set_font method and i couldn't find one....
what in the hell is going on? I have spent the past 3 hours trying to tear apart the RGSS3 engine looking for that god forsaken method but to no avail.
anyone have any answer?
and this guy is showing how to make a custom menu. now, he is pretty good at explaining things, but if you jump to 24:42 in the video and pause it you will see this guys Window_TestHeader script, which looks like this: (I modified the class name slightly for ease of use)
#==============================================================================# ** Window_Header#------------------------------------------------------------------------------# This class creates the header for scenes.#==============================================================================class Window_Header < Window_Base #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) self.windowskin = Cache.system(Menu_API::Windowskin) if Menu_API::Windowskin self.opacity = Menu_API:😮pacity end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text(text) contents.clear set_font(Menu_API::Header_Font) draw_text(0, 0, contents.width, contents.height, text, 1) endendNow i use this class in there following scripts as well:
#==============================================================================# ** Options Scene#------------------------------------------------------------------------------# This class inherits the super class Scene_MenuBase#==============================================================================class Scene_Options < Scene_MenuBase #-------------------------------------------------------------------------- # * Start #-------------------------------------------------------------------------- def start super create_header_window() create_help_window() create_command_window() create_status_window() end #-------------------------------------------------------------------------- # * Create Header Window #-------------------------------------------------------------------------- def create_header_window @header_window = Window_Header.new(0, 0, Graphics.width, Graphics.height * 0.20) @header_window.viewport = @viewport if (Menu_API::Banner) @header_window_banner = Sprite.new() @header_window_banner.bitmap = Menu_API::Banner_Name @header_window_banner.x = Grapics.width * 0.2 @header_window_banner.y = 100 @header_window_banner.z = 255 else @header_window.set_text("Options") end end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_Main.new() @command_window.viewport = @viewport @command_window.height = Graphics.height - @header_window.height - @help_window.height @command_window.help_window = @help_window @command_window.set_handler🙂option1, method🙂command_save_game)) @command_window.set_handler🙂option2, method🙂command_load_game)) @command_window.set_handler🙂option3, method🙂command_quit_game)) @command_window.set_handler🙂cancel, method🙂return_scene)) end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_status_window @status_window = WidnowMenuStatus.new(0, 0) @status_window.x = Graphics.width * 0.295 @status_window.y = 0 + @header_window.height @status_window.z = 255 end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new() @help_window.x = 0 @help_window.y = Grapics.height * 0.825 @help_window.z = 255 end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update super return_scene() if Input.trigger?🙂 end #-------------------------------------------------------------------------- # * Terminate #-------------------------------------------------------------------------- def terminate super @header_window_banner.dispose() @header_window_banner.bitmap.dispose() end #-------------------------------------------------------------------------- # * Save Game Command #-------------------------------------------------------------------------- def command_save_game SceneManager.call(Scene_Save) end #-------------------------------------------------------------------------- # * Load Game Command #-------------------------------------------------------------------------- def command_load_game SceneManager.call(Scene_Load) end #-------------------------------------------------------------------------- # * Quit Game Command #-------------------------------------------------------------------------- def command_quit_game SceneManager.call(Scene_End) endend
Code:
#==============================================================================# ** Command_Window#------------------------------------------------------------------------------# This class creates the command window for scenes.#==============================================================================class Window_Main < Window_Command #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize super(0, Graphics.height * 0.2) end #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def visible_line_number item_max end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command("Save", :option1) add_command("Load", :option2) add_command("Quit", :option3) end #-------------------------------------------------------------------------- # * Process Ok #-------------------------------------------------------------------------- def process_ok @@last_command_symbol = current_symbol super end #-------------------------------------------------------------------------- # * Select Last #-------------------------------------------------------------------------- def select_last select_symbol(@@last_command_symbol) end #-------------------------------------------------------------------------- # * Update Help Window #-------------------------------------------------------------------------- def update_help super return unless @help_window @help_window.set_text("Save Current Game Progress") if @index == 0 @help_window.set_text("Load Previous Game Progress") if @index == 1 @help_window.set_text("Quit Game") if @index == 2 endend
module Menu_API extend self #-------------------------------------------------------------------------- # ** Sound Options ** #-------------------------------------------------------------------------- # Sound = ["filename", volume, pitch] Open_Menu = ["Decision2", 80, 100] Close_Close = ["Cancel2", 80, 100] Move_Cursor = ["Cursor2", 80, 100] Confirm = ["Decision2", 80, 100] Cancel = ["Cancel2", 80, 100] Buzzer = ["Cancel1", 80, 100] #-------------------------------------------------------------------------- # ** Font Settings ** #-------------------------------------------------------------------------- # font = [["FontName"], Fontsize, [r,g,b], bold, outline, shadow] Header_Font = [["Times New Roman"], 35, [255, 255, 255], false, true, false] Font = [["Times New Roman"], 25, [255, 255, 255], false, true, false] #-------------------------------------------------------------------------- # ** Windowskin Settings ** #-------------------------------------------------------------------------- Windowskin = "Window" Opacity = 255 #-------------------------------------------------------------------------- # ** Window Banner Settings ** #-------------------------------------------------------------------------- Banner = false # set to true for banner, false uses default text# Banner_Name = Cache.system(nil)end
Script 'Window_Header' line 20: NoMethodError occurred.
undefined method 'set_font' for #<WIndow_Header:0x553ca64>
now what puzzles me isn't the error, but why i am getting it. you see, he uses all the scripts i just posted (plus one that doesn't use the set_font method) and he gets absolutely no errors. I even checked in the Window_Base class for a set_font method and i couldn't find one....
what in the hell is going on? I have spent the past 3 hours trying to tear apart the RGSS3 engine looking for that god forsaken method but to no avail.
anyone have any answer?