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'm stumped.

I've been working on this for awhile, and one portion has me stumped.

In Hero Rental (a game I'm scripting for, link found in my signature - Userbar) I was making a bunch of Extras. One of them was a script that would allow for a unique experiance. (no not THAT experiance)

You can change the text background.

However, whenever I tried it, it didn't work.

First off, I created the portion in the title menu.
This isn't a problem, so i believe.
s1 = "Begin a Journey"
s2 = "Continue Your Quest"
s3 = "Extras"
s4 = "End Game"
@command_window = Window_Command.new(215, [s1, s2, s3, s4])
@command_window.back_opacity = 0
@command_window.x = 150 - @command_window.width / 2
@command_window.y = 200
I have a lot of coding in it, but that is the main portion, i have all the loading and stuff, it works.

However, the problem comes in this part of the extras section, it bumps me to a whole new game, without changing it. I know I am probably using the wrong coding, if i am, can you tell me what i should use?

#--------------------------------------------------------------------------
# * Command: Extras
#==========================================================================
def command_extras(nosound = false)
x5 = "Blue"
x6 = "Red"
@command_window = Window_Command.new(150, [x5, x6])
x5 = @windowskin_name = $Blue01
x6 = @windowskin_name = $Red01
return
end
# Update game screen
Graphics.update
# Update input information
Input.update
end

Any ideas?
 

khmp

Sponsor

All right I have good news and bad news. The good news is that it works on mine with that exact code. Bad news that doesn't help you at all. The only thing I can think of is a script installation error. So here it is the whole shebang.

Code:
#============================================================================
# ** Scene_Title
#----------------------------------------------------------------------------
# This class performs title screen processing.
#============================================================================


class Scene_Title
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # If battle test
    if $BTEST
      battle_test
      return
    end
    # Load database
    $data_actors = load_data("Data/Actors.rxdata")
    $data_classes = load_data("Data/Classes.rxdata")
    $data_skills = load_data("Data/Skills.rxdata")
    $data_items = load_data("Data/Items.rxdata")
    $data_weapons = load_data("Data/Weapons.rxdata")
    $data_armors = load_data("Data/Armors.rxdata")
    $data_enemies = load_data("Data/Enemies.rxdata")
    $data_troops = load_data("Data/Troops.rxdata")
    $data_states = load_data("Data/States.rxdata")
    $data_animations = load_data("Data/Animations.rxdata")
    $data_tilesets = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system = load_data("Data/System.rxdata")
    # Make system object
    $game_system = Game_System.new
    # Make title graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    # Make command window
    s1 = "Begin a Journey"
    s2 = "Continue Your Quest"
    s3 = "Extras"
    s4 = "End Game"
    @command_window = Window_Command.new(215, [s1, s2, s3, s4])
    @command_window.back_opacity = 0
    @command_window.x = 150 - @command_window.width / 2
    @command_window.y = 200
    
    @Red01 = 'h12_windowskin.png'
    @Blue01 = 'h12_windowskin.png'
    @Default = $game_system.windowskin_name

    # Continue enabled determinant
    # Check if at least one save file exists
    # If enabled, make @continue_enabled true; if disabled, make it false
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    # If continue is enabled, move cursor to "Continue"
    # If disabled, display "Continue" text in gray
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    # Play title BGM
    $game_system.bgm_play($data_system.title_bgm)
    # Stop playing ME and BGS
    Audio.me_stop
    Audio.bgs_stop
    # 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 command window
    @command_window.dispose
    # Dispose of title graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @command_window.update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
        when 0 # New game
          command_new_game
        when 1 # Continue
          command_continue
        when 2 # Extras
          command_extras
        when 3 # Shutdown
          command_shutdown
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game(nosound = false)
    # Play decision SE
    $game_system.se_play($data_system.decision_se) unless nosound
    # Stop BGM
    Audio.bgm_stop
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each type of game object
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    # Set up initial party
    $game_party.setup_starting_members
    # Set up initial map position
    $game_map.setup($data_system.start_map_id)
    # Move player to initial position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Refresh player
    $game_player.refresh
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Command: Continue
  #--------------------------------------------------------------------------
  def command_continue(nosound = false)
    # If continue is disabled
    unless @continue_enabled
    # Play buzzer SE
    $game_system.se_play($data_system.buzzer_se) unless nosound
    return
    end
    # Play decision SE
    $game_system.se_play($data_system.decision_se) unless nosound
    # Switch to load screen
    $scene = Scene_Load.new
  end
  #--------------------------------------------------------------------------
  # * Command: Shutdown
  #--------------------------------------------------------------------------
  def command_shutdown
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Fade out BGM, BGS, and ME
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # Shutdown
    $scene = nil
  end
  #--------------------------------------------------------------------------
  # * Command: Extras
  #--------------------------------------------------------------------------
  def command_extras
    print("Currently only 2 options are available. This is a beta test.")

    # Create a new command window
    new_command_window = Window_Command.new(150, ['Music', 'Window Skin'])

    # This boolean is enabled only if the user wants to look at the selection of
    # window skins.
    window_skins = false

    # Loop continually until the user is done.
    loop do
      new_command_window.update
      Graphics.update
      Input.update
      break if Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        case new_command_window.index
          when 0 #Music
            # Just get the player into the game.
            command_new_game
            $game_temp.player_transferring = true
            $game_temp.player_new_map_id = 4
            $game_temp.player_new_x = 9
            $game_temp.player_new_y = 13
            $game_temp.player_new_direction = 8
            break
          when 1 #Window Skin
            # Enable the boolean to show that the user wants a new windowskin.
            window_skins = true
            break
        end
      end
    end
    # Toss the window we are done with it.
    new_command_window.dispose
    
    # If the user selected the second choice start the window skin selection
    # method.
    if window_skins
      command_windowskins
    end
  end
  #--------------------------------------------------------------------------
  # * Command: WindowSkin Selection
  #--------------------------------------------------------------------------  
  def command_windowskins
    # Create the new window with the new selection.
    new_command_window = Window_Command.new(150, ['Blue', 'Red', 'Default', 'Go Back'])

    # Make a boolean to later be enabled if the user wants to go back.
    go_back = false

    # Loop continually until the user is done.
    loop do
      new_command_window.update
      Graphics.update
      Input.update
      break if Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        case new_command_window.index
          when 0 # 'Blue'
            $game_system.windowskin_name = @Blue01
          when 1 # 'Red'
            $game_system.windowskin_name = @Red01
          when 2 # 'Default'
            $game_system.windowskin_name = @Default
          when 3 # Go Back
            go_back = true
            break
        end
      end
    end
    # Toss the window.
    new_command_window.dispose
    
    # If the user wanted to go back to the previous window.
    if go_back
      command_extras
    end
  end

  #==========================================================================
  # * Battle Test
  #--------------------------------------------------------------------------
  def battle_test
    # Load database (for battle test)
    $data_actors = load_data("Data/BT_Actors.rxdata")
    $data_classes = load_data("Data/BT_Classes.rxdata")
    $data_skills = load_data("Data/BT_Skills.rxdata")
    $data_items = load_data("Data/BT_Items.rxdata")
    $data_weapons = load_data("Data/BT_Weapons.rxdata")
    $data_armors = load_data("Data/BT_Armors.rxdata")
    $data_enemies = load_data("Data/BT_Enemies.rxdata")
    $data_troops = load_data("Data/BT_Troops.rxdata")
    $data_states = load_data("Data/BT_States.rxdata")
    $data_animations = load_data("Data/BT_Animations.rxdata")
    $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
    $data_system = load_data("Data/BT_System.rxdata")
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each game object
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    # Set up party for battle test
    $game_party.setup_battle_test_members
    # Set troop ID, can escape flag, and battleback
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Play battle BGM
    $game_system.bgm_play($game_system.battle_bgm)
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  alias_method :old_command_new_game, :command_new_game
  def command_new_game(nosound = false)
    windowskin_name = $game_system.windowskin_name
    old_command_new_game(nosound)
    $game_system.windowskin_name = windowskin_name
  end
end

You'll need to change those class variables @Red01, @Blue01 to whatever those windowskins that you use it. Can anyone else try this as well to make sure it works all right?
 
Ok, I have another problem. My script isn't working, alias error, I added in a windowskin # 2, can you help again khmp?

#============================================================================
# ** Scene_Title
#----------------------------------------------------------------------------
# This class performs title screen processing.
#============================================================================


class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "Begin a Journey"
s2 = "Continue Your Quest"
s3 = "Extras"
s4 = "End Game"
@command_window = Window_Command.new(215, [s1, s2, s3, s4])
@command_window.back_opacity = 0
@command_window.x = 150 - @command_window.width / 2
@command_window.y = 200
@Metal = 'Special1.png'
@Red01 = 'Red_Windowskin.png'
@Blue01 = 'Blue_windowskin.png'
@Green01 = '004-Green01.png'
@Mystic = 'wskin_e.png'
@Default = $game_system.windowskin_name

# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# 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 command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2 # Extras
command_extras
when 3 # Shutdown
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game(nosound = false)
# Play decision SE
$game_system.se_play($data_system.decision_se) unless nosound
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue(nosound = false)
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se) unless nosound
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se) unless nosound
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Command: Extras
#--------------------------------------------------------------------------
def command_extras
# Create a new command window
new_command_window = Window_Command.new(150, ['Music', 'Window Skin'])

# This boolean is enabled only if the user wants to look at the selection of
# window skins.
window_skins = false

# Loop continually until the user is done.
loop do
new_command_window.update
Graphics.update
Input.update
break if Input.trigger?(Input::B)
if Input.trigger?(Input::C)
case new_command_window.index
when 0 #Music
# Just get the player into the game.
print("Go to the waypoint")
when 1 #Window Skin
# Enable the boolean to show that the user wants a new windowskin.
window_skins = true
break
end
end
end
# Toss the window we are done with it.
new_command_window.dispose

# If the user selected the second choice start the window skin selection
# method.
if window_skins
command_windowskins
end
end
#--------------------------------------------------------------------------
# * Command: WindowSkin Selection
#--------------------------------------------------------------------------
def command_windowskins
# Create the new window with the new selection.
new_command_window = Window_Command.new(250, ['Blue', 'Red', 'Metal', 'Next'])

# Make a boolean to later be enabled if the user wants to go back.
go_back = false

#Make an initialized thing that won't activate
windowskin_2 = false

# Loop continually until the user is done.
loop do
new_command_window.update
Graphics.update
Input.update
break if Input.trigger?(Input::B)
if Input.trigger?(Input::C)
case new_command_window.index
when 0 # 'Blue'
$game_system.windowskin_name = @Blue01
when 1 # 'Red'
$game_system.windowskin_name = @Red01
when 2 # 'Metal'
$game_system.windowskin_name = @Metal
when 3 # 'Next'
windowskin_2 = true
end
end
end
# Toss the window we are done with it.
new_command_window.dispose

# If the user selected the second choice start the window skin selection
# method.
if windowskin_2 = true
command_windowskins2
end
end

def command_windowskins2
#create
new_command_window = Window_Command.new(250, ['Green', 'Mystic'])
#Make a boolean to later be enabled if the user wants to go back.
go_back = false

# Loop continually until the user is done.
loop do
new_command_window.update
Graphics.update
Input.update
break if Input.trigger?(Input::B)
if Input.trigger?(Input::C)
case new_command_window.index
when 0 # 'Green'
$game_system.windowskin_name = @Green01
when 1 # Mystic
$game_system.windowskin_name = @Mystic

break
end
# Toss the window.
new_command_window.dispose

# If the user wanted to go back to the previous window.
if go_back
command_windowskin
end
end

#==========================================================================
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Command: New Game
#----------------=============================================================
alias_method :eek:ld_command_new_game, :command_new_game
def command_new_game(nosound = false)
windowskin_name = $game_system.windowskin_name
old_command_new_game(nosound)
$game_system.windowskin_name = windowskin_name
end
end
end
end
 

khmp

Sponsor

Of course let me have a look. First put the code in code tags.

Otherwise
Code:
  alias_method :old_main, :main
Becomes
alias_method :eek:ld_main, :main <- Notice the smiley face?

Plus it will retain the tabbing. Its all at the same indentation right now. I'll update and edit when its done.

[edit1]
Do you really want there to be a separate window to display a few more choices? Can we not for simplicity's sake keep them all in one window? 4 is only the max when using events :P

[edit2]
Alright I added the most important thing I believe this needed. Extensibility. And to make SephirothSpawn happy I'm using a hash to do this. I'm assuming order wasn't a super important detail to you but if it is just let me know and it'll become two arrays instead. So anyway back to the extensibility. To add another custom skin. Look in the top of the Scene_Title:
Code:
WINDOW_SKINS = 
  { 
    'Metal' => 'Special1.png',
    'Red01' => 'Red_Windowskin.png',
    'Blue01' => 'Blue_windowskin.png',
    'Green01' => '004-Green01.png',
    'Mystic' => 'wskin_e.png'
  }
To add to this put a comma at the end of the last element and follow the pattern of the above items and voila your new skin will appear in the window skin list. Now it probably won't be in the order it appears in the hash but you won't have to change any other code. So here for your coding pleasure:

Code:
#============================================================================
# ** Window_Command
#----------------------------------------------------------------------------
#  This window deals with general command choices.
#============================================================================

class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Get a Command  
  #     index : index of the command you want
  #--------------------------------------------------------------------------
  def command(index)
    return @commands[index]
  end
end

#============================================================================
# ** Scene_Title
#----------------------------------------------------------------------------
# This class performs title screen processing.
#============================================================================

class Scene_Title
  WINDOW_SKINS = 
  { 
    'Metal' => 'Special1.png',
    'Red01' => 'Red_Windowskin.png',
    'Blue01' => 'Blue_windowskin.png',
    'Green01' => '004-Green01.png',
    'Mystic' => 'wskin_e.png'
  }
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # If battle test
    if $BTEST
      battle_test
      return
    end
    # Load database
    $data_actors = load_data("Data/Actors.rxdata")
    $data_classes = load_data("Data/Classes.rxdata")
    $data_skills = load_data("Data/Skills.rxdata")
    $data_items = load_data("Data/Items.rxdata")
    $data_weapons = load_data("Data/Weapons.rxdata")
    $data_armors = load_data("Data/Armors.rxdata")
    $data_enemies = load_data("Data/Enemies.rxdata")
    $data_troops = load_data("Data/Troops.rxdata")
    $data_states = load_data("Data/States.rxdata")
    $data_animations = load_data("Data/Animations.rxdata")
    $data_tilesets = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system = load_data("Data/System.rxdata")
    # Make system object
    $game_system = Game_System.new
    # Make title graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    # Make command window
    s1 = "Begin a Journey"
    s2 = "Continue Your Quest"
    s3 = "Extras"
    s4 = "End Game"
    @command_window = Window_Command.new(215, [s1, s2, s3, s4])
    @command_window.back_opacity = 0
    @command_window.x = 150 - @command_window.width / 2
    @command_window.y = 200
    @default_windowskin_name = $game_system.windowskin_name
    
    # Continue enabled determinant
    # Check if at least one save file exists
    # If enabled, make @continue_enabled true; if disabled, make it false
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    # If continue is enabled, move cursor to "Continue"
    # If disabled, display "Continue" text in gray
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    # Play title BGM
    $game_system.bgm_play($data_system.title_bgm)
    # Stop playing ME and BGS
    Audio.me_stop
    Audio.bgs_stop
    # 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 command window
    @command_window.dispose
    # Dispose of title graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @command_window.update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
        when 0 # New game
          command_new_game
        when 1 # Continue
          command_continue
        when 2 # Extras
          command_extras
        when 3 # Shutdown
          command_shutdown
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game(nosound = false)
    # Play decision SE
    $game_system.se_play($data_system.decision_se) unless nosound
    # Stop BGM
    Audio.bgm_stop
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each type of game object
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    # Set up initial party
    $game_party.setup_starting_members
    # Set up initial map position
    $game_map.setup($data_system.start_map_id)
    # Move player to initial position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Refresh player
    $game_player.refresh
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Command: Continue
  #--------------------------------------------------------------------------
  def command_continue(nosound = false)
  # If continue is disabled
  unless @continue_enabled
    # Play buzzer SE
    $game_system.se_play($data_system.buzzer_se) unless nosound
    return
  end
  # Play decision SE
  $game_system.se_play($data_system.decision_se) unless nosound
  # Switch to load screen
  $scene = Scene_Load.new
  end
  #--------------------------------------------------------------------------
  # * Command: Shutdown
  #--------------------------------------------------------------------------
  def command_shutdown
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Fade out BGM, BGS, and ME
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # Shutdown
    $scene = nil
  end
  #--------------------------------------------------------------------------
  # * Command: Extras
  #--------------------------------------------------------------------------
  def command_extras
    # Create a new command window
    new_command_window = Window_Command.new(150, ['Music', 'Window Skin'])
    
    # This boolean is enabled only if the user wants to look at the selection of
    # window skins.
    window_skins = false
    
    # Loop continually until the user is done.
    loop do
      new_command_window.update
      Graphics.update
      Input.update
      break if Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        case new_command_window.index
        when 0 #Music
          # Just get the player into the game.
          print("Go to the waypoint")
          break
        when 1 #Window Skin
          # Enable the boolean to show that the user wants a new windowskin.
          window_skins = true
          break
        end
      end
    end
    # Toss the window we are done with it.
    new_command_window.dispose
    
    # If the user selected the second choice start the window skin selection
    # method.
    if window_skins
      command_windowskins
    end
  end
  #--------------------------------------------------------------------------
  # * Command: WindowSkin Selection
  #--------------------------------------------------------------------------
  def command_windowskins
    # Get the list of possible window skins and then append onto it
    skins = WINDOW_SKINS.keys
    skins << 'Default'
    skins << 'Go Back'
    
    # Create the new window with the new selection.
    skin_select = Window_Command.new(250, skins)
    skin_select.z = 999
    
    # Make a boolean to later be enabled if the user wants to go back.
    go_back = false
    
    # Loop continually until the user is done.
    loop do
      skin_select.update
      Graphics.update
      Input.update
      break if Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        if skin_select.command(skin_select.index) == 'Go Back'
          go_back = true
          break
        elsif skin_select.command(skin_select.index) == 'Default'
          $game_system.windowskin_name = @default_windowskin_name
        else
          # Set the window skin to the proper element
          $game_system.windowskin_name = 
            WINDOW_SKINS[skin_select.command(skin_select.index)]
        end
      end
    end
    # Toss the window we are done with it.
    skin_select.dispose

    if go_back
      command_extras
    end
  end

  #--------------------------------------------------------------------------
  # * Battle Test
  #--------------------------------------------------------------------------
  def battle_test
    # Load database (for battle test)
    $data_actors = load_data("Data/BT_Actors.rxdata")
    $data_classes = load_data("Data/BT_Classes.rxdata")
    $data_skills = load_data("Data/BT_Skills.rxdata")
    $data_items = load_data("Data/BT_Items.rxdata")
    $data_weapons = load_data("Data/BT_Weapons.rxdata")
    $data_armors = load_data("Data/BT_Armors.rxdata")
    $data_enemies = load_data("Data/BT_Enemies.rxdata")
    $data_troops = load_data("Data/BT_Troops.rxdata")
    $data_states = load_data("Data/BT_States.rxdata")
    $data_animations = load_data("Data/BT_Animations.rxdata")
    $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
    $data_system = load_data("Data/BT_System.rxdata")
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each game object
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    # Set up party for battle test
    $game_party.setup_battle_test_members
    # Set troop ID, can escape flag, and battleback
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Play battle BGM
    $game_system.bgm_play($game_system.battle_bgm)
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  alias_method :old_command_new_game, :command_new_game
  def command_new_game(nosound = false)
    windowskin_name = $game_system.windowskin_name
    old_command_new_game(nosound)
    $game_system.windowskin_name = windowskin_name
  end
end

Before you make any other changes or have ideas about changes let me know so I can help you through it.

Good luck with your game shiroun! :thumb:
 
Thanks khmp. It took me a minute to figure out how to work the system you gave me.


I only have 1 problem. It only updates certain parts of the game. It may be my fault, so i'll check it
 

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