Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Need help with an error.

Dko

Member

Hiya im getting this error and im not sure how to correct it. Normally im decent at trouble shooting but this message has me stumped.

Script 'Scene_Title and Actor mods' line 12: NameError occurred
uninitialized constant Scene_Title::Game_temp

This is the code that gives the error.
Code:
class Scene_Title
  #--------------------------------------------------------------------------
  # * Main Database
  #--------------------------------------------------------------------------
  alias dkos_main_database main_database
  def main_database
    dkos_main_database
    if FileTest.exist?("Data/Actors2.rxdata") && $DEBUG 
      
      # If it is not already constructed you need to create the $game_temp-object, as the interpreter needs this when running
      $game_Temp = Game_temp.new
      
      myInterpreter = Interpreter.new
      
      # Setup a commen event (Here with the id 1 you can change this number 
      # to whatever the id of the event, you want to be executed, is)
      myInterpreter.setup($data_common_events[1], 0)
      # Run the interpreter
      myInterpreter.update
    end
    $data_actors.each {|actor| actor.setup_stats if actor != nil}
  end
end
 

Dko

Member

Ahh gota love it when code your given has typo's :P Thanks but I get a new error.
Script 'Interpreter 1'line 47: NoMethodError occurred.
undefined method 'map_id' for nil:NilClass

Which I guess means I can only use the Interpreter class once i have loaded a map. :/
 
So, you are trying to call a common event when the database is loaded, and then access the party data?

Well, firstly, you can call the common event, but this isn't practical. The reason is that the $game data hasn't been created yet. If all you are doing is functions in the common event, I suggest just using code for this.

Secondly, $game_party has not been initialized yet. It does not get created until the command_new_game method is processed.

So I suggest your code to be something like this:

Code:
class Scene_Title
  alias dkos_main_database main_database
  alias dkos_main_cng command_new_game
  def main_database
    dkos_main_database
    # Place in scripts your common event here
  end
  def command_new_game
    dkos_main_cng
    $data_actors.each {|actor| actor.setup_stats unless actor.nil?}
  end
end
 

Dko

Member

Acttualy im not even sure what im doing. Im wanted to try to do a 'Show choices' event in code so I didn't have to re write a whole window class that basically is already there to make things easy. I asked on the forum and this is basically what I got. But it seams to be not that easy. So im probably going to just scrap this idea and try to figure out how to make a window like 'Show choices'. ( sigh I sometimes just wish I could windows gui function in C++ sometimes with RPG maker xp)
 
That's extremely simple. In your main method, create a new command window.

Code:
@another_command_window = Window_Command.new(width, ['Command 1', 'Command 2', ...])
@another_command_window.x = a
@another_command_window.y = b
...

If you want this window to be displayed before your other command window, below where it creates your other window, add

Code:
@command_window.visible = false
@command_window.active = false

Now, below this line
Code:
  def update
Add something like
Code:
if @another_command_window.active
  update_another_command
  return
end

Now create a new method
Code:
def update_another_command
  # Put your code here
end


I suggestion reading some tutorials covering command windows. I suggestion Dube's Chapter 3 tutorial. You can find a link in my signature.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top