How do I implement a "suspend save" feature?
Some games have a feature that's often called "suspend" or "quicksave." Basically, as a compromise between "save anywhere" and "save only in certain places," the game only lets you make "real" saves in certain places but also lets you make a temporary save file at any time, which will then get deleted as soon as you load it. This lets you take a break from playing without having to find a save point. This article will discuss how to implement such a feature in OHRRPGCE.
NOTE: This article will assume you know your way around CUSTOM.EXE and are comfortable with menu editing and plotscripting. If you aren't comfortable with menu editing or plotscripting, you should probably get some more practice first before trying this.
The basic principle[edit]
At a bare minimum, a suspend save system needs two things:
1. The game needs the player access to a "suspend" option that saves the game and then immediately exits. 2. When a save file created through the suspend option is loaded, the game needs to know this was a suspend save and delete the save file.
A good suspend save system will have a third thing:
3. The player, when loading a saved game, should be able to tell whether they're loading a suspend save or a normal save.
[edit]
OHRRPGCE's load menu displays a lot of information about save files, but none of it is particularly useful as a way of indicating a suspend save. There is, however, one very effective method of making it easy to tell which slots are and aren't suspend saves: hide the suspend save entirely and provide some different method of loading it, so that the player knows that that method will always load a suspend save and the regular load menu will always load a regular save file. We will proceed on the principle that suspend saves are always in a specific slot that the player is unable to see. By default, OHRRPGCE games provide the player with four save slots, so we'll use save slot 5 for our suspend saves. If your game provides more slots you'll have to change that.
This trick has one unfortunate side effect: the last-used save slot will now be the suspend slot instead of the last slot the player actually selected. The save menu handles this by putting the cursor on the bottom slot, which makes sense but is a bit unsightly (and might lead to the player being unsure what slot they were actually using). To work around this we'll use a global to remember the player's last save slot and restore that when the suspend save is loaded. In this example this will be global variable 200.
[edit]
As mentioned, we'll be providing a different method of loading the suspend save compared to the regular saves. Technically this could be done in-game from the main menu or something, but it's probably better to make a title screen menu. You'll want to set aside a tag (tag 100 in this example) to enable or disable the suspend save option, so you don't offer the player a suspend save that doesn't exist.
Turn on "Skip title screen" and "Skip load screen" in the general preferences. Make a menu called "Title Menu" with the following bitsets enabled: Allow gameplay & scripts, Suspend player even if gameplay allowed, Disable player closing menu, Prevent main menu activation. You may also want No box. Give it the following menu items:
- Caption: New Game
Type: 4 Run script
Subtype: [whatever script actually begins a new game]
Enable if tag 100=ON (suspend save exists) and also tag 0=ON (Always)
Edit bitsets: Close menu when activated - Caption: Load Game
Type: 1 Special screen
Subtype: 9 Load - Caption: Resume Suspended Game
Type: 4 Run script
Subtype: loadsuspendsave
Edit bitsets: Close menu when activated - Caption: New Game
Type: 1 Special screen
Subtype: 10 Quit
You can implement these differently if you want, or add additional options, but you need at least these available.
Scripts[edit]
To get this all to work, you'll need plotscripts like these:
define constant (5, suspend save slot) # a slot not visible to the player define constant (100, suspend save exists) # any tag that isn't already in use global variable (200, last manual slot) # any number global that isn't already in use # ----------------------------------------------------------------------------- # "Suspend save" function. Saves in hidden slot 5 and then immediately exits # the game. This allows the player to take a break without having to find a # save point. # ----------------------------------------------------------------------------- plotscript, suspend save, begin # Creating the suspend save will cause last save slot to return the # suspend save slot instead of whichever slot the player actually used # last, creating an annoying quirk where, after loading a suspend save, # the save menu will always open with the bottom save slot selected. # To prevent this, we'll store the current value of last save slot in # a global variable so that it gets saved in the file. last manual slot := last save slot # There are four save slots visible to the player. The suspend save slot # is number 5, so it's hidden. save in slot (suspend save slot) # Immediately quit and return to title screen. reset game end # ----------------------------------------------------------------------------- # Display title screen and title menu. # This is currently being used as the "new game" script, but having a pre-title # intro sequence added in front is a future possibility. # ----------------------------------------------------------------------------- plotscript, display title menu, begin # We won't actually manipulate this menu but it's good practice to # put its handle somewhere anyway. variable (title menu) # Display the actual title screen and play music. Use whatever values here are # appropriate for your game. show backdrop (title screen bg) play song (song:title screen) # Use a tag to tell the menu whether the player has a suspend save. set tag (suspend save exists, save slot used (suspend save slot)) # Actually open the menu. title menu := open menu (menu:Title Menu) end # ----------------------------------------------------------------------------- # Script that gets called when the player chooses to load the suspend save # from the title menu. # ----------------------------------------------------------------------------- plotscript, load suspend save, begin # Lead from the suspend save slot. There's more that needs to happen after # this for the suspend save function to work as intended, but this script will # inherently die when the save file is loaded, so the on-load script will have # to know it's been loaded from a suspend save. This uses a simple solution of # "passing the baton," sending an argument to the on-load script via load from # slot. Another simple option would be to have the on-load script check the # value of last save slot. load from slot (suspend save slot, true) end # ----------------------------------------------------------------------------- # On-load script that plays when a saved game is loaded. The argument loaded # from suspend is a way of letting this script know that the save that was just # loaded is a suspend save, so that it can "receive the baton" from load # suspend save(). # ----------------------------------------------------------------------------- plotscript, load game, loaded from suspend = false, begin if (loaded from suspend) then, begin # The save that was just loaded is the suspend save. # Delete the suspend save so it can only be used once. delete save (suspend save slot) # And now set the last save slot to the *player's* last save slot # so that the save menu's default slot will be correct. set last save slot (last manual slot) end # If you have anything else you need your on-load script to do, put it here. end
You'll need to set all of these scripts to be called from specific places:
- display title menu should be your new game script, set under Global Script Triggers.
- load game should be your load game script, also under Global Script Triggers.
- load suspend save should be called by a menu item on your Title Menu.
- suspend save should have some means of being triggered by the player. I'd suggest adding a menu item for it to your Main Menu.
With all that done, you should now have a working suspend feature, and can torment your players with unreasonably long distances between save points without the weight of "what if they don't actually have enough free time to get there?" on your conscience.