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.

Adding 'New Game' and 'Quit' to the Load screen...

Posting this because I didn't know if it went here or script requests and everybody on IRC told me to put it here.

My plan is to put both the New Game and the Quit options in the Load menu.  Then, remove the [New Game/Load/Quit] from the title screen.  The title screen would show only the title graphic with no windows or selections, and then when the user presses enter it would automatically boot into the load screen with these options.  I'm using Raziel's Chrono Trigger Save Menu, altered by me, to get the desired effect.  Now, I've altered the script a bunch to get the desired look/effects, but I can't get this one.  Which is why I'm here!  :D

http://xs322.xs.to/xs322/07502/script.PNG[/img]
A picture of what I currently have now.  The two empty boxes up top should be where New Game and quit go.  Please note that the graphics are very obviously placeholder and do not represent how any projects I may have in development right now actually look.  :P

Code:
#==============================================================================
# ** Chrono Trigger Save Menu
#------------------------------------------------------------------------------
# Raziel
# 2006-09-09
# Version 1.00
#==============================================================================
# ~Instructions
#  Icons of the characters are used in the save menu.
#  Make sure you put them in the icon folder and name them
#  like you name your character file, for example the icon for
#  Arshes would be 001-Fighter01
#  
#  For the chapter function, just use $game_system.chapter = "desired filename"
#  in a call script command and then the savefile will have the name
#  you choose.
#==============================================================================
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================
class Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     help_text : text string shown in the help window
  #--------------------------------------------------------------------------
  def initialize(help_text)
    @help_text = help_text
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make save file window
    @startgame_window = Window_Base.new(29,22, 290, 50)
    @quitgame_window = Window_Base.new(319,22, 290, 50)
    @save_window = []
    @save_window[0] = Window_Base.new(29,72, 70, 50)
    @save_window[1] = Window_Base.new(29,122, 70, 50)
    @save_window[2] = Window_Base.new(29,172, 70, 50)
    @save_window[3] = Window_Base.new(29,222, 70, 50)
    @chapter_window = []
    @chapter_window[0] = Window_Base.new(99,72, 510, 50)
    @chapter_window[1] = Window_Base.new(99,122, 510, 50)
    @chapter_window[2] = Window_Base.new(99,172, 510, 50)
    @chapter_window[3] = Window_Base.new(99,222, 510, 50)
    @save_left = Window_Base.new(378,293,231,172)
    @save_right = Window_Base.new(29,293,320,172)
    @savefile_windows = []
    @save_status = Window_SaveStatus.new
    for i in 0..3
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    # Select last file to be operated
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    # 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 windows
    @save_status.dispose
    @save_left.dispose
    @save_right.dispose
    @startgame_window.dispose
    @quitgame_window.dispose

    for i in 0..3
      @save_window[i].dispose
      @chapter_window[i].dispose
    end
    for i in @savefile_windows
      i.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @save_status.update
    $game_temp.save_index = @file_index
    if Input.trigger?(Input::C)
      # Call method: on_decision (defined by the subclasses)
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Call method: on_cancel (defined by the subclasses)
      on_cancel
      return
    end
    # If the down directional button was pressed
    if Input.repeat?(Input::DOWN)
      # If the down directional button pressed down is not a repeat,
      # or cursor position is more in front than 3
      unless @file_index == 3
        if Input.trigger?(Input::DOWN)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # Move cursor down
          @savefile_windows[@file_index].selected = false
          @file_index = (@file_index + 1)
          @savefile_windows[@file_index].selected = true
          return
        end
      end
      # If the up directional button was pressed
      elsif Input.repeat?(Input::UP)
        # If the up directional button pressed down is not a repeatã€
 

khmp

Sponsor

So just to clarify in the first picture you have in your post you want the top left window to contain the text and the ability to start a "New Game"? And the top right window to contain the text and the ability to "Quit"?
 
khmp":1tm0uca8 said:
So just to clarify in the first picture you have in your post you want the top left window to contain the text and the ability to start a "New Game"? And the top right window to contain the text and the ability to "Quit"?

Right!

And the New Game/Load/Quit window removed from the title screen, so all you have to do is press enter to go into the load screen.
 

khmp

Sponsor

Code:
#==============================================================================
# ** Chrono Trigger Save Menu
#------------------------------------------------------------------------------
# Raziel
# 2006-09-09
# Version 1.00
#==============================================================================
# ~Instructions
#  Icons of the characters are used in the save menu.
#  Make sure you put them in the icon folder and name them
#  like you name your character file, for example the icon for
#  Arshes would be 001-Fighter01
#  
#  For the chapter function, just use $game_system.chapter = "desired filename"
#  in a call script command and then the savefile will have the name
#  you choose.
#==============================================================================
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================
class Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     help_text : text string shown in the help window
  #--------------------------------------------------------------------------
  def initialize(help_text)
    @help_text = help_text
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make save file window
    @startgame_window = Window_Command.new(290, ['Start New Game'])
    @startgame_window.x = 29
    @startgame_window.y = 9
    @startgame_window.index = -1
    
    @quitgame_window = Window_Command.new(290, ['Quit Game'])
    @quitgame_window.x = 319
    @quitgame_window.y = 9
    @quitgame_window.index = -1
    
    @save_window = []
    @save_window[0] = Window_Base.new(29,72, 70, 50)
    @save_window[1] = Window_Base.new(29,122, 70, 50)
    @save_window[2] = Window_Base.new(29,172, 70, 50)
    @save_window[3] = Window_Base.new(29,222, 70, 50)
    @chapter_window = []
    @chapter_window[0] = Window_Base.new(99,72, 510, 50)
    @chapter_window[1] = Window_Base.new(99,122, 510, 50)
    @chapter_window[2] = Window_Base.new(99,172, 510, 50)
    @chapter_window[3] = Window_Base.new(99,222, 510, 50)
    @save_left = Window_Base.new(378,293,231,172)
    @save_right = Window_Base.new(29,293,320,172)
    @savefile_windows = []
    @save_status = Window_SaveStatus.new
    for i in 0..3
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    # Select last file to be operated
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    # 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 windows
    @save_status.dispose
    @save_left.dispose
    @save_right.dispose
    @startgame_window.dispose
    @quitgame_window.dispose

    for i in 0..3
      @save_window[i].dispose
      @chapter_window[i].dispose
    end
    for i in @savefile_windows
      i.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @save_status.update
    $game_temp.save_index = @file_index
    if Input.repeat?(Input::C)
      # If the user currently does not have a save file selected.
      if @file_index < 0
        # If the user has selected to start a new game.
        if @startgame_window.index == 0
          command_new_game
        # Else the user has selected to shutdown.
        else
          command_shutdown
        end
        return
      end
      # Call method: on_decision (defined by the subclasses)
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # If B button was pressed
    if Input.repeat?(Input::B)
      # Call method: on_cancel (defined by the subclasses)
      on_cancel
      return
    end
    
    if Input.repeat?(Input::RIGHT) || Input.trigger?(Input::LEFT) && 
        @file_index == -1
      # Toggle which window is currently selected.
      @startgame_window.index  = (@startgame_window.index == -1 ? 0 : -1)
      @quitgame_window.index  = (@quitgame_window.index == -1 ? 0 : -1)
    end
    
    # If the down directional button was pressed
    if Input.repeat?(Input::DOWN)
      # If the user hit down while the very last file was selected send them to
      # new game.
      if @file_index == 3
        @file_index = -1
        @startgame_window.index = 0
        deselect_allwindows
        return
      end
      # Set both windows to unselected behaviour as a safeguard.
      @startgame_window.index = -1
      @quitgame_window.index = -1
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # Move cursor down
      @savefile_windows[@file_index].selected = false
      @file_index += 1
      @savefile_windows[@file_index].selected = true
      return
      # If the up directional button was pressed
    elsif Input.repeat?(Input::UP)
      # If the user hit up while the very first file was selected send them to
      # new game.
      if @file_index == 0
        @file_index = -1
        @startgame_window.index = 0
        deselect_allwindows
        return
      # If the index went negative set it to the very last file.
      elsif @file_index == -1
        @file_index = 4
      end
      # Set both windows to unselected behaviour as a safeguard.
      @startgame_window.index = -1
      @quitgame_window.index = -1
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # Move cursor up
      if !@savefile_windows[@file_index].nil?
        @savefile_windows[@file_index].selected = false
      end
      @file_index -= 1
      @savefile_windows[@file_index].selected = true
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Deselect all save file windows
  #--------------------------------------------------------------------------
  def deselect_allwindows
    @savefile_windows.each {|window| window.selected = false}
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # 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: 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
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of
#  this class.
#==============================================================================
class Game_System
  attr_accessor :chapter
  alias raz_cms_system_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @chapter = ""
    raz_cms_system_initialize
  end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
  attr_accessor :save_index
  alias raz_cms_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @save_index = 0
    raz_cms_initialize
  end
end
#==============================================================================
# ** Window_SaveStatus
#------------------------------------------------------------------------------
#  This window displays stats on the save files.
#==============================================================================
class Window_SaveStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0,0,640,480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @index = $game_temp.save_index
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    filename = "Save#{$game_temp.save_index + 1}.rxdata"
    return unless FileTest.exist?(filename)
    file = File.open(filename, "r")
    @characters = Marshal.load(file)
    @frame_count = Marshal.load(file)
    @game_system = Marshal.load(file)
    @game_switches = Marshal.load(file)
    @game_variables = Marshal.load(file)
    Marshal.load(file)
    Marshal.load(file)
    Marshal.load(file)
    party = Marshal.load(file)
    Marshal.load(file)
    map = Marshal.load(file)
    self.contents.font.size = 15
    self.contents.font.bold = false
    for i in 0...party.actors.size
      actor = party.actors[i]
      x = 284
      y = i * 36 + 265
      draw_actor_name(actor, x - 210, y + 23)
      draw_actor_level(actor, x - 60, y + 23)
      self.contents.blt(x - 255, y + 34, RPG::Cache.icon(actor.character_name), Rect.new(0,0,24,24))
      self.contents.draw_text(x - 210, y + 37, 150, 32, "#{$data_system.words.hp} #{actor.hp} / #{actor.maxhp}")
      self.contents.draw_text(x - 60, y + 37, 150, 32, "#{$data_system.words.sp} #{actor.sp} / #{actor.maxsp}")
    end
    total_sec = @frame_count / Graphics.frame_rate
    hour = total_sec / 60 / 60
    min = total_sec / 60 % 60
    sec = total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
    self.contents.font.size = 15
    self.contents.draw_text(375, 292, 144, 32, map_name)
    self.contents.draw_text(375, 324, 144, 32, "Time Played:")
    self.contents.draw_text(430, 324, 144, 32, text,2)
    self.contents.draw_text(375, 356, 144, 32, "calendar goes here")
    self.contents.draw_text(375, 388, 144, 32, "Save #:")
    self.contents.draw_text(430, 388, 144, 32, @game_system.save_count.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super
    if @index != $game_temp.save_index
      refresh
    @index = $game_temp.save_index
    end
  end
end
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
#  This window displays save files on the save and load screens.
#==============================================================================
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     file_index : save file index (0-2)
  #     filename   : file name
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(40, 65 + file_index % 4 * 50, 640, 90)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @characters = Marshal.load(file)
      @frame_count = Marshal.load(file)
      @game_system = Marshal.load(file)
      @game_switches = Marshal.load(file)
      @game_variables = Marshal.load(file)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
    end
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 15
    self.contents.font.bold = false
    # Draw file number
    self.contents.font.color = normal_color
    name = "#{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    # If save file exists
    if @file_exist
      self.contents.draw_text(0, 0, 600, 32, @game_system.chapter.to_s,1)
    end
  end
end

Good luck with it Dissonance! :thumb:
 

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