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.

HBGames

I have this awesome code I just scripted. It makes it so that when you click load or save, it automatically saves it into slot 1, the only slot, and it automatically loads from that slot also. So if you are planning on your game only having one save, then use this!!

[rgss]#==============================================================================
# ** 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
# Select last file to be operated
@file_index = $game_temp.last_file_index
# 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
end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
# If C button was pressed
  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
  #--------------------------------------------------------------------------
  # * Make File Name
  # file_index : save file index (0-3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
return "Save Data.rxdata"
  end
[/rgss]

Installation:

Just replace it with Scene_File. Oh yeah and one more thing, in Scene_Title go to line 49 and replace this:
Code:
  if FileTest.exist?("Save#{i+1}.rxdata")
With this:
Code:
  if FileTest.exist?("Save Data.rxdata")


Once again, only use this code if you are planning on having one and only one save file in your game.

If you are going to use this please credit me also. Please.

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