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.

i dont understand...

Your code is Ok.

Try to put more information, because you put a silly and stupid screenshot with anything more that the error.

I think, you are trying with a Travel script, but with wich?.
 
my own script im working on, here i will add code: (please note it is a work in progress.)
Code:
#===================================================
# â–  Traveling System
#===================================================
#Created by Plague180
#I dont care if you credit me, but i would like it.
#(Credit to Plague180 Productions)
#
#if you find any errors with this code let me know at: plague180@yahoo.com
#Also please email me for features you think i should add.
#
#
# Special Thanks:
# Brewmeister: For helping me find the smallest most ovious mistakes that
# i so commonly make.
#
#Version 0.1
#Includes: Basic Functions.
#
#Version 0.2
#Added: vortex(map travel randomizer), bug fix related to EXIT_TO.
#
#Version 0.3
#Added: vortex(fixed some errors, still not perfect), Allows for more options(10)
#
#
#Known Bugs: 
#1.Trasitions Currently dont work.
#2.Vortex can land you on a unpassable tile.
#
# Last Update: December 17, 2008
#==============================================================================
# ** Scene_Travel
#------------------------------------------------------------------------------
#  This class performs Travel screen processing.
#==============================================================================
#
#
#
#

#-----------------------Start Edits Here---------------------------------------
Number_Of_Options = 7 #number of options you would like to use(
#(dont include exit as a option)
EXIT = "Next Page"                      #what you want it to say for exit
EXIT_TO = $scene = Scene_Page.new   #where you want it to exit to
#if you want to exit to map use: $scene = Scene_Map.new
#if you want to exit to menu use: $scene = Scene_Menu.new
#-------------------------------Option 1---------------------------------------
if $game_switches[1] == true
Travel_1_name = "Grasslands"    #name of the first option
Travel_1_Map = 1           #number of the map you want to travel too
Travel_1_Map_X = 9       #X coordinate you want the player to move too
Travel_1_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_1_Map_Face = 2 
Travel_1_Transition = "001-Blind01" #use name of the trasition you want to use 
elsif
  Travel_1_name = "Locked"
end  
#----------------------------Option 2---------------------------------------
Travel_2_name = "Woods"    #name of the first option
Travel_2_Map = 2          #number of the map you want to travel too
Travel_2_Map_X = 9        #X coordinate you want the player to move too
Travel_2_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_2_Map_Face = 2 
Travel_2_Transition = "001-Blind01" #use name of the trasition you want to use 
#-------------------------------Option 3---------------------------------------
Travel_3_name = "Forest"    #name of the first option
Travel_3_Map = 3           #number of the map you want to travel too
Travel_3_Map_X = 9       #X coordinate you want the player to move too
Travel_3_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_3_Map_Face = 2 
Travel_3_Transition = "001-Blind01" #use name of the trasition you want to use 
#-------------------------------Option 4---------------------------------------
Travel_4_name = "Mountain"    #name of the first option
Travel_4_Map = 4           #number of the map you want to travel too
Travel_4_Map_X = 9       #X coordinate you want the player to move too
Travel_4_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_4_Map_Face = 2 
Travel_4_Transition = "001-Blind01" #use name of the trasition you want to use 
#-------------------------------Option 5---------------------------------------
Travel_5_name = "Beach"    #name of the first option
Travel_5_Map = 5           #number of the map you want to travel too
Travel_5_Map_X = 9        #X coordinate you want the player to move too
Travel_5_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_5_Map_Face = 2 
Travel_5_Transition = "001-Blind01" #use name of the trasition you want to use
#-------------------------------Option 6---------------------------------------
Travel_6_name = "user adds more"    #name of the first option
Travel_6_Map = 5           #number of the map you want to travel too
Travel_6_Map_X = 9        #X coordinate you want the player to move too
Travel_6_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_6_Map_Face = 2 
Travel_6_Transition = "001-Blind01" #use name of the trasition you want to use
#-------------------------------Option 7---------------------------------------
Travel_7_name = "user adds more"    #name of the first option
Travel_7_Map = 5           #number of the map you want to travel too
Travel_7_Map_X = 9        #X coordinate you want the player to move too
Travel_7_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_7_Map_Face = 2 
Travel_7_Transition = "001-Blind01" #use name of the trasition you want to use
#-------------------------------Option 8---------------------------------------
Travel_8_name = "user adds more"    #name of the first option
Travel_8_Map = 5           #number of the map you want to travel too
Travel_8_Map_X = 9        #X coordinate you want the player to move too
Travel_8_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_8_Map_Face = 2 
Travel_8_Transition = "001-Blind01" #use name of the trasition you want to use
#-------------------------------Option 9---------------------------------------
Travel_9_name = "user adds more"    #name of the first option
Travel_9_Map = 5           #number of the map you want to travel too
Travel_9_Map_X = 9        #X coordinate you want the player to move too
Travel_9_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_9_Map_Face = 2 
Travel_9_Transition = "001-Blind01" #use name of the trasition you want to use
#-------------------------------Option 10---------------------------------------
Travel_10_name = "user adds more"    #name of the first option
Travel_10_Map = 5           #number of the map you want to travel too
Travel_10_Map_X = 9        #X coordinate you want the player to move too
Travel_10_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_10_Map_Face = 2 
Travel_10_Transition = "001-Blind01" #use name of the trasition you want to use
#-----------------------End Of Edits-------------------------------------------


class Scene_Travel
Number_Of_Options = Number_Of_Options + 1

  def main
    # Make command window
    s1 = Travel_1_name
    s2 = Travel_2_name
    s3 = Travel_3_name
    s4 = Travel_4_name
    s5 = Travel_5_name
    s6 = Travel_6_name
    s7 = Travel_7_name
    s8 = Travel_8_name
    s9 = Travel_9_name
    s10 = Travel_10_name
    s11 = EXIT
   if Number_Of_Options == 2
    @command_window = Window_Command.new(192, [s1, s11])
   end 
   if Number_Of_Options == 3
    @command_window = Window_Command.new(192, [s1, s2, s11])
  end 
  if Number_Of_Options == 4
    @command_window = Window_Command.new(192, [s1, s2, s3, s11])
  end
  if Number_Of_Options == 5
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s11])
  end
  if Number_Of_Options == 6
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5, s11])
  end
  if Number_Of_Options == 7
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5, s6, s11])
  end
  if Number_Of_Options == 8
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5 ,s6 ,s7, s11])
  end
  if Number_Of_Options == 9
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5, s6, s7, s8, s11])
  end
  if Number_Of_Options == 10
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5, s6 ,s7, s8, s9, s11])
  end
  if Number_Of_Options == 11
    @command_window = Window_Command.new(192, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11])
   end
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 240 - @command_window.height / 2
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame Update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
 def update
    # Update command window
    @command_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(0)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  
        command_one
      when 1  
        command_two
      when 2  
        command_three
      when 3  
        command_four
      when 4  
        command_five        
      when 5  
        command_six
      when 6
        command_seven
      when 7
        command_eight
      when 8
        command_nine
      when 9
        command_ten
      when 10
        command_cancel 
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Option 1] Command
  #--------------------------------------------------------------------------
  def command_one
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_1_Map
    $game_temp.player_new_x = Travel_1_Map_X
    $game_temp.player_new_y = Travel_1_Map_Y
    $game_temp.player_new_direction = Travel_1_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_1_Transition
    $scene = Scene_Map.new
    end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Option 2] Command
  #--------------------------------------------------------------------------
  def command_two
   # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_2_Map
    $game_temp.player_new_x = Travel_2_Map_X
    $game_temp.player_new_y = Travel_2_Map_Y
    $game_temp.player_new_direction = Travel_2_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_2_Transition
    $scene = Scene_Map.new
  end
    #--------------------------------------------------------------------------
  # * Process When Choosing [Option 3] Command
  #--------------------------------------------------------------------------
  def command_three
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_3_Map
    $game_temp.player_new_x = Travel_3_Map_X
    $game_temp.player_new_y = Travel_3_Map_Y
    $game_temp.player_new_direction = Travel_3_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_3_Transition
    $scene = Scene_Map.new
  end
    #--------------------------------------------------------------------------
  # * Process When Choosing [Option 4] Command
  #--------------------------------------------------------------------------
  def command_four
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_4_Map
    $game_temp.player_new_x = Travel_4_Map_X
    $game_temp.player_new_y = Travel_4_Map_Y
    $game_temp.player_new_direction = Travel_4_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_4_Transition
    $scene = Scene_Map.new
  end
    #--------------------------------------------------------------------------
  # * Process When Choosing [Option 5] Command
  #--------------------------------------------------------------------------
  def command_five
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_5_Map
    $game_temp.player_new_x = Travel_5_Map_X
    $game_temp.player_new_y = Travel_5_Map_Y
    $game_temp.player_new_direction = Travel_5_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_5_Transition
    $scene = Scene_Map.new
  end
     #--------------------------------------------------------------------------
  # * Process When Choosing [Option 6] Command
  #--------------------------------------------------------------------------
  def command_six
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_6_Map
    $game_temp.player_new_x = Travel_6_Map_X
    $game_temp.player_new_y = Travel_6_Map_Y
    $game_temp.player_new_direction = Travel_6_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_6_Transition
    $scene = Scene_Map.new
  end
     #--------------------------------------------------------------------------
  # * Process When Choosing [Option 7] Command
  #--------------------------------------------------------------------------
  def command_seven
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_7_Map
    $game_temp.player_new_x = Travel_7_Map_X
    $game_temp.player_new_y = Travel_7_Map_Y
    $game_temp.player_new_direction = Travel_7_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_7_Transition
    $scene = Scene_Map.new
  end
    #--------------------------------------------------------------------------
  # * Process When Choosing [Option 8] Command
  #--------------------------------------------------------------------------
  def command_eight
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_8_Map
    $game_temp.player_new_x = Travel_8_Map_X
    $game_temp.player_new_y = Travel_8_Map_Y
    $game_temp.player_new_direction = Travel_8_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_8_Transition
    $scene = Scene_Map.new
  end 
     #--------------------------------------------------------------------------
  # * Process When Choosing [Option 9] Command
  #--------------------------------------------------------------------------
  def command_nine
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_9_Map
    $game_temp.player_new_x = Travel_9_Map_X
    $game_temp.player_new_y = Travel_9_Map_Y
    $game_temp.player_new_direction = Travel_9_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_9_Transition
    $scene = Scene_Map.new
  end
     #--------------------------------------------------------------------------
  # * Process When Choosing [Option 10] Command
  #--------------------------------------------------------------------------
  def command_ten
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
        # Set transferring player flag
    $game_temp.player_transferring = true
    # appointment method is [direct appointment]
    # Set player move destination
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $game_temp.player_new_map_id = Travel_10_Map
    $game_temp.player_new_x = Travel_10_Map_X
    $game_temp.player_new_y = Travel_10_Map_Y
    $game_temp.player_new_direction = Travel_10_Map_Face
    $game_map.autoplay
    # Prepare for transition
    Graphics.freeze
    # Set transition processing flag
    $game_temp.transition_processing = true
    $game_temp.transition_name = Travel_10_Transition
    $scene = Scene_Map.new
    end
  #--------------------------------------------------------------------------
  # *  Process When Choosing [Option 11] Command
  #--------------------------------------------------------------------------
  def command_cancel
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Switch to menu screen

    EXIT_TO
    
  end

end
this is the important part:
Code:
if $game_switches[1] == true
Travel_1_name = "Grasslands"    #name of the first option
Travel_1_Map = 1           #number of the map you want to travel too
Travel_1_Map_X = 9       #X coordinate you want the player to move too
Travel_1_Map_Y = 7        #Y coordinate you want the player to move too
#direction you want the player to face(2=down,4=left,6=right,8=up)
Travel_1_Map_Face = 2 
Travel_1_Transition = "001-Blind01" #use name of the trasition you want to use 
elsif
  Travel_1_name = "Locked"
end
 

Atoa

Member

Simply.
the erro is in the fact that the global variable "$game_switches" is initialized only after the title screen
So it will be == nil before the command new game or continue.
try it
Code:
unless  $game_switches == nil
if $game_switches[1] == true
#code
elsif
  #code
end
end
this will fix the erro you posted.

But i think that it will not work.

Add this code in a class so you can initialize it when you want with the scene or maybe with a module (you can add de switch conditions in the scene)
 

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