Persistent data is a data that still exist when the player visits the game again. The example of this is stuff like a “New Game +” feature on some game, system setting, unlockables, and gallery.
However, RMXP only loads stored data when a player loads a specific save file, which is rather inconvenient when we’re trying to make a system similar to those I’ve mentioned before.
This script enables the game to load certain in-game switches and variables automatically when the game starts.
Here’s how to set this script up. First, put the script on your game. Chose switches and variables that you want to treat as persistent data. Put [p] somewhere in their name (note that the p is in lower case).
When you made some changes to the persistent data, save it using these script call:
$scene = Save_System.new
The variables will be stored in a file named System.rxdata. And you’re done! This script will load the data stored in that file when player run the game, and load it again when player start a new game, or after the player load a game from a certain save file.
The persistent data can be accessed like normal switches or variables from almost anywhere within the game.
Intriguing, isn’t it?
Here’s the script: Persistent Data Script
1. This script can be used for commercial or non-commercial games, only if you credit me (Black Mage) properly.
2. Put a link back to my site (burningwizard.worpress.com).
3. Tell me about the game you made. I’ll be happy to play and review your game, assumed I have some times to spare
Just in case you’re still wondering, the script is licensed under Attribution 3.0 Unported.
Version 1.1 (20 April 2017) – Bugfix for “nil”-named switches & variables caused by initialization of “foreign” scripts.
Version 1.0 (19 November 2015) – Initial design.