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.

how to Force save

Okay, here's the deal;

I want my game to have a save system which alllows the player to chose their save file at the beginning of the game. Each time they decide to save, the player would not be directed to the save screen but, they will be forced to save in the same save file on the map screen.  How do I do it?

I'm sorry if this is a complete noob question.
PS. I don't know much about rgss.

                    Thanks
 
I've Been using this one my self Wyattina. It's quite useful for several purposes. Right now it auto saves almost constantly when you do an action. Enjoy. (By Darklord, Blue Elf, and Me "Not me as in I")

#==============================================================================
# Autosave Script Offline 1.0
#------------------------------------------------------------------------------
# Authors  Darklord, Blue Elf and Meâ„¢
# Version  Offline 1.0
#------------------------------------------------------------------------------
# This script aliases(a)/rewrites(r) in the folowwing classes and methods:
#
#  Game_Party  -> gain_gold  (a) , gain_item (a), gain_armor (a), gain_weapon (a)
#  add_actor (a), remove_actor (a)
#  Game_System -> initialize (a)
#  Scene_Save  -> initialize (a,r) , on_decision (a,r)
#  Scene_Map  -> transfer player (r)
#  Scene_Battle 1 -> battle_end (a)
#==============================================================================


#==============================================================================
# *** AutoSave
#------------------------------------------------------------------------------
# This module handles the AutoSaving
#==============================================================================
module AutoSave
#--------------------------------------------------------------------------
# * Saves File
#--------------------------------------------------------------------------
def self.save
  begin
    #Saves the file to whatever $game_system.filename is
    file = File.open($game_system.filename, "wb")
    a = Scene_Save.new
    a.write_save_data(file)
  ensure
    file.close
  end
end
#--------------------------------------------------------------------------
# * Deletes File
#--------------------------------------------------------------------------
def self.deletesave
  begin
    if FileTest.exits?($game_system.filename)
      File.delete($game_system.filename)
    end 
  end
end
end
#==============================================================================

#==============================================================================
# ** Scene_AutoSave
#------------------------------------------------------------------------------
# This class performs save screen processing.
# This changes the autosave file
#==============================================================================

class Scene_AutoSave < Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super("Which file would you like to your acount to be saved to?")
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    $game_system.filename_c(filename)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  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
#--------------------------------------------------------------------------
# * Aliasing Objects
#--------------------------------------------------------------------------
alias autosaveinit initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
  autosaveinit
  @filename = "Save1.rxdata"
end
#--------------------------------------------------------------------------
# * Filename -> Returns Autosave Filename
#--------------------------------------------------------------------------
def filename
  if @filename != nil
    return @filename
  else
    return "Save1.rxdata"
  end 
end
#--------------------------------------------------------------------------
# * Filename_change -> Sets New Autosave Filename
#--------------------------------------------------------------------------
def filename_c(newname)
  return if newname == "" or newname == nil
  @filename = newname
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party

alias gainglod_autosave gain_gold
alias gainitem_autosave gain_item
alias gainweap_autosave gain_weapon
alias gainarmor_autosave gain_armor
alias add_actor_autosave add_actor
alias remove_actor_autosave remove_actor
#--------------------------------------------------------------------------
# * Gain Gold (or lose)
# n : amount of gold
#--------------------------------------------------------------------------
def gain_gold(n)
  gainglod_autosave(n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def gain_item(item_id, n)
  gainitem_autosave(item_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
  gainweap_autosave(weapon_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
  gainarmor_autosave(armor_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Add an Actor
#    actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
  add_actor_autosave(actor_id)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Remove Actor
#    actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
  remove_actor_autosave(actor_id)
  AutoSave.save
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
alias tp_autosave transfer_player
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
$game_map.map_id != $game_temp.player_new_map_id ? result = true : result = false
tp_autosave
AutoSave.save if result
end
end
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle
alias battle_end_autosave battle_end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #    result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  def battle_end(result)
  battle_end_autosave(result)
  AutoSave.save
end
end
 
Sure let me edit it for ya!  :lol:

#==============================================================================
# Autosave Script Offline 1.0
#------------------------------------------------------------------------------
# Authors   Darklord, Blue Elf and Meâ„¢
# Version   Offline 1.0
#------------------------------------------------------------------------------
# This script aliases(a)/rewrites(r) in the folowwing classes and methods:
#
#  Game_Party  -> gain_gold  (a) , gain_item (a), gain_armor (a), gain_weapon (a)
#  add_actor (a), remove_actor (a)
#  Game_System -> initialize (a)
#  Scene_Save  -> initialize (a,r) , on_decision (a,r)
#  Scene_Map   -> transfer player (r)
#  Scene_Battle 1 -> battle_end (a)
#==============================================================================


#==============================================================================
# *** AutoSave
#------------------------------------------------------------------------------
# This module handles the AutoSaving
#==============================================================================
module AutoSave
#--------------------------------------------------------------------------
# * Saves File
#--------------------------------------------------------------------------
def self.save
  begin
    #Saves the file to whatever $game_system.filename is
    file = File.open($game_system.filename, "wb")
    a = Scene_Save.new
    a.write_save_data(file)
  ensure
    file.close
  end
end
#--------------------------------------------------------------------------
# * Deletes File
#--------------------------------------------------------------------------
def self.deletesave
  begin
    if FileTest.exits?($game_system.filename)
      File.delete($game_system.filename)
    end
  end
end
end
#==============================================================================

#==============================================================================
# ** Scene_AutoSave
#------------------------------------------------------------------------------
# This class performs save screen processing.
# This changes the autosave file
#==============================================================================

class Scene_AutoSave < Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super("Which file would you like to your acount to be saved to?")
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    $game_system.filename_c(filename)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  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
#--------------------------------------------------------------------------
# * Aliasing Objects
#--------------------------------------------------------------------------
alias autosaveinit initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
  autosaveinit
  @filename = "Save1.rxdata"
end
#--------------------------------------------------------------------------
# * Filename -> Returns Autosave Filename
#--------------------------------------------------------------------------
def filename
  if @filename != nil
    return @filename
  else
    return "Save1.rxdata"
  end
end
#--------------------------------------------------------------------------
# * Filename_change -> Sets New Autosave Filename
#--------------------------------------------------------------------------
def filename_c(newname)
  return if newname == "" or newname == nil
  @filename = newname
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party

alias gainglod_autosave gain_gold
alias gainitem_autosave gain_item
alias gainweap_autosave gain_weapon
alias gainarmor_autosave gain_armor
alias add_actor_autosave add_actor
alias remove_actor_autosave remove_actor
#--------------------------------------------------------------------------
# * Gain Gold (or lose)
# n : amount of gold
#--------------------------------------------------------------------------
def gain_gold(n)
If $Game_Switches[1] =! true
  gainglod_autosave(n)
  AutoSave.save
end
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def gain_item(item_id, n)
If $Game_Switches[1] =! true
  gainitem_autosave(item_id, n)
  AutoSave.save
end
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
If $Game_Switches[1] =! true
  gainweap_autosave(weapon_id, n)
  AutoSave.save
end
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
If $Game_Switches[1] =! true
  gainarmor_autosave(armor_id, n)
  AutoSave.save
end
end
#--------------------------------------------------------------------------
# * Add an Actor
#     actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
If $Game_Switches[1] =! true
  add_actor_autosave(actor_id)
  AutoSave.save
end
end
#--------------------------------------------------------------------------
# * Remove Actor
#     actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
If $Game_Switches[1] =! true
  remove_actor_autosave(actor_id)
  AutoSave.save
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
alias tp_autosave transfer_player
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
If $Game_Switches[1] =! true
$game_map.map_id != $game_temp.player_new_map_id ? result = true : result = false
tp_autosave
AutoSave.save if result
end
end
end
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle
alias battle_end_autosave battle_end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  def battle_end(result)
If $Game_Switches[1] =! true
   battle_end_autosave(result)
   AutoSave.save
end
end
end

Okay here's how it should work now. I simply added If $Game_Switches[1] =! Ture then skip autosave.

This means whenever you turn on trigger one the game will no longer autosave. Turn it off and it will autosave again.

Hope it's easy for you to use!
 
This should do it. Sorry I spaced. I put random "end"'s around the script lol. this one should be fixed along with a bunch of other syntax errors like capital letters in statements that messed them up. tell me how this one works for you!

#==============================================================================
# Autosave Script Offline 1.0
#------------------------------------------------------------------------------
# Authors  Darklord, Blue Elf and Meâ„¢
# Version  Offline 1.0
#------------------------------------------------------------------------------
# This script aliases(a)/rewrites(r) in the folowwing classes and methods:
#
#  Game_Party  -> gain_gold  (a) , gain_item (a), gain_armor (a), gain_weapon (a)
#  add_actor (a), remove_actor (a)
#  Game_System -> initialize (a)
#  Scene_Save  -> initialize (a,r) , on_decision (a,r)
#  Scene_Map  -> transfer player (r)
#  Scene_Battle 1 -> battle_end (a)
#==============================================================================


#==============================================================================
# *** AutoSave
#------------------------------------------------------------------------------
# This module handles the AutoSaving
#==============================================================================
module AutoSave
#--------------------------------------------------------------------------
# * Saves File
#--------------------------------------------------------------------------
def self.save
  begin
    #Saves the file to whatever $game_system.filename is
    file = File.open($game_system.filename, "wb")
    a = Scene_Save.new
    a.write_save_data(file)
  ensure
    file.close
  end
end
#--------------------------------------------------------------------------
# * Deletes File
#--------------------------------------------------------------------------
def self.deletesave
  begin
    if FileTest.exits?($game_system.filename)
      File.delete($game_system.filename)
    end
  end
end
end
#==============================================================================

#==============================================================================
# ** Scene_AutoSave
#------------------------------------------------------------------------------
# This class performs save screen processing.
# This changes the autosave file
#==============================================================================

class Scene_AutoSave < Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super("Which file would you like to your acount to be saved to?")
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    $game_system.filename_c(filename)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Map.new
  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
#--------------------------------------------------------------------------
# * Aliasing Objects
#--------------------------------------------------------------------------
alias autosaveinit initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
  autosaveinit
  @filename = "Save1.rxdata"
end
#--------------------------------------------------------------------------
# * Filename -> Returns Autosave Filename
#--------------------------------------------------------------------------
def filename
  if @filename != nil
    return @filename
  else
    return "Save1.rxdata"
  end
end
#--------------------------------------------------------------------------
# * Filename_change -> Sets New Autosave Filename
#--------------------------------------------------------------------------
def filename_c(newname)
  return if newname == "" or newname == nil
  @filename = newname
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party

alias gainglod_autosave gain_gold
alias gainitem_autosave gain_item
alias gainweap_autosave gain_weapon
alias gainarmor_autosave gain_armor
alias add_actor_autosave add_actor
alias remove_actor_autosave remove_actor
#--------------------------------------------------------------------------
# * Gain Gold (or lose)
# n : amount of gold
#--------------------------------------------------------------------------
def gain_gold(n)
  if $Game_Switches[1] =! true
  gainglod_autosave(n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def gain_item(item_id, n)
  if $Game_Switches[1] =! true
  gainitem_autosave(item_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
  if $Game_Switches[1] =! true
  gainweap_autosave(weapon_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
  if $Game_Switches[1] =! true
  gainarmor_autosave(armor_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Add an Actor
#    actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
  if $Game_Switches[1] =! true
  add_actor_autosave(actor_id)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Remove Actor
#    actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
  if $Game_Switches[1] =! true
  remove_actor_autosave(actor_id)
  AutoSave.save
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
alias tp_autosave transfer_player
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
  if $Game_Switches[1] =! true
  $game_map.map_id != $game_temp.player_new_map_id ? result = true : result = false
  tp_autosave
  AutoSave.save if result
  end
end
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle
alias battle_end_autosave battle_end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #    result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  def battle_end(result)
if $Game_Switches[1] =! true
  battle_end_autosave(result)
  AutoSave.save
end
end
end
 
Thanks. But there is another problem.   :dead:

On line 217 there is a syntax error.

line 217 is 'class Scene_Map'

right over here:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
alias tp_autosave transfer_player


I'm really not experienced with RGSS

Hope you can get it fixed!


  Thanks
 

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