Jump to content

Recommended Posts

Single Save File v1.0

by AABattery

 

INTRODUCTION

Some games are better off with only one save... well, that's what this script does! When opening the save screen, the player will not see the regular save slots, but instead, their game will be saved to a single file, which you can easily rename! When they press continue from the title screen, they'll be automatically taken to their saved game.

 

I needed this script for my own game. I've searched this up but found no scripts, and the work around wasn't what I wanted, so I tried to make it myself. I only rewrote a few things which were directly related to saving/loading and I've tested this many times, so I hope that this script doesn't conflict with any other scripts. I'm not an avid scripter, but any suggestions on how I can make this better would really help (considering that I'll be using this myself!) I want to learn!

 

FEATURES

- Saves and loads only a single file

- Plays sound on save (not on load, though)

- Easily be able to change the name of the save file

 

FUTURE PLANS

- Confirmation for save (Would you like to save? yes/no)

 

HOW TO USE

Place anywhere below "Materials" and above "Main"

 

SCRIPT

 

 

#==============================================================================
# .: Single Save :.
# .: Version 1.0 :.
# .: By AABattery :.
# http://www.rpgmakervxace.net/topic/8772-single-save-file/
#==============================================================================
# Some games are better off with only one save file. That's what this does!
#==============================================================================
#  INSTRUCTIONS
#------------------------------------------------------------------------------
# This script is just a plug-n-play, and doesn't need any configuration,
# however, if you want to change the name of the save file, just change the
# word "Save" inside the quotes in the DataManager module.
#
# Be sure that both instances of "Save" are written the same and that the
# extension (.rvdata2) is intact. Otherwise you will receive some problems.
#==============================================================================
#   If you encounter any problems, please post in the thread shown above!
#==============================================================================
#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
#  This module manages the database and game objects. Almost all of the
# global variables used by the game are initialized by this module.
#==============================================================================
module DataManager
 #--------------------------------------------------------------------------
 # * Determine Existence of Save File
 #--------------------------------------------------------------------------
 def self.save_file_exists?
!Dir.glob('Save.rvdata2').empty? # Change 'Save' to whatever you want
 end
 #--------------------------------------------------------------------------
 # * Create Filename
 #     index : File Index
 #--------------------------------------------------------------------------
 def self.make_filename(index)
sprintf("Save.rvdata2")		  # Change "Save" to whatever you want
 end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs common processing for the save screen and load screen.
#==============================================================================
class Scene_File < Scene_MenuBase
 #--------------------------------------------------------------------------
 # * Start Processing
 #--------------------------------------------------------------------------
 def start
super
save_load_file
 end
 def terminate
 end
 #--------------------------------------------------------------------------
 # * Saves/Loads
 #--------------------------------------------------------------------------
 def save_load_file
 end
end
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
 #--------------------------------------------------------------------------
 # * Loads
 #--------------------------------------------------------------------------
 def save_load_file
DataManager.load_game(0)
Graphics.transition(30)
fadeout_all
$game_system.on_after_load
SceneManager.goto(Scene_Map)
 end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
 #--------------------------------------------------------------------------
 # * Saves
 #--------------------------------------------------------------------------
 def save_load_file
DataManager.save_game(0)
Sound.play_save
return_scene
 end
end

 

 

CREDIT AND THANKS

- AABattery

- All those who helped me improve this script ^_^/>

Edited by AABattery

Share this post


Link to post
Share on other sites

It seems like your intention is to not have Scene_File at all, so why not just put the code that saves the game in the only places the player can save (menu, event command in game_interpreter), and the code that loads the game in the only place that the player can load (title screen)? Not that it would make a big difference :)

Edited by casper667

Share this post


Link to post
Share on other sites

Well, I didn't want to mess around too much since I'm just a beginner XD, but wouldn't putting it in with the menu and title screens be troublesome for someone who's using custom menu systems?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×