YEP.180 – Autosave – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

You can grab the plugin here:

English Mirror

Support Team Yanfly on Patreon

Autosave is a common feature found in standard RPG’s nowadays. Games would save at certain triggers or upon changing maps so that the player won’t lose any progress in case they forget to manually save. This plugin adds in an Autosave function to your game(s) and lets you control when to Autosave or set it to do it automatically under certain conditions.


Introduction


This plugin requires YEP_SaveCore. Make sure this plugin is located under YEP_SaveCore in the plugin list.

Autosave is a common feature found in standard RPG’s nowadays. Games would save at certain triggers or upon changing maps so that the player won’t lose any progress in case they forget to manually save. This plugin adds in an Autosave function to your game(s) and lets you control when to Autosave or set it to do it automatically under certain conditions.


Instructions


There are three ways to go about Autosave with this plugin. Please read them carefully and decide which one(s) is best suited for your game.

Manual:
– By default, Autosave does not happen automatically with this plugin. You, as the game dev, need to insert the Plugin Command: Autosave at the various points you want the Autosave to occur. This one gives you the most control over your game.

Autosave on Map Load:
– This is a Plugin Parameter. When it is set to true, the game will Autosave each time the map scene is loaded. This means entering a new map, coming out of a menu, or finishing a battle. All three of those conditions causes the Autosave function to activate.

Autosave on Main Menu:
– This is a Plugin Parameter. When it is set to true, the game will Autosave each time the player enters the Main Menu from the map scene. Autosave will NOT occur any other way regarding the Main Menu, meaning that coming out of the Item scene to the Main Menu will not activate Autosave.

Autosaving will not occur if the player disables Autosave. If you don’t want to give the player the ability to disable Autosave, you can set the Plugin Parameter “Show Option” to false.

You can use all three methods of Autosaving together. You can have it done manually, Autosave on loading a map, and Autosave on calling the Main Menu to get the most coverage.

*NOTE: Although you can use all three methods together, be mindful of your players. Sometimes, saving a game could induce a bit of lag depending on how big the save files are. Autosaving is no different. This is something that cannot be fixed by plugins.

*NOTE: Autosaving will not occur until the player saved manually at least once in-game. After that, Autosave will take the slot that was used to save and continue saving to it or whichever save slot the player moved to later.


Plugin Commands


Autosave is manually done by the game developer using plugin commands. There are also other plugin commands that can control autosaving, too.

Plugin Commands:

Autosave
– This will make the game automatically save in the last saved file slot used by the player. If the player has started a new game and did not save into a slot yet, nothing will happen. If autosave is disabled by the player through the Options menu or disabled by the system with a plugin command, nothing will happen either.

EnableAutosave
DisableAutosave
– This will forcibly enable or disable autosaving done by the game. This will not bypass the player’s option to disable Autosave if trying to enable it. The player’s decision to disable Autosaving will take priority over the game dev’s. If you wish to take this option away from the player, please change it in the plugin parameters.


Options Core Settings – Adding the New Option


If you are using YEP_OptionsCore.js, you can add a new Option using this plugin. Here’s the following code/parameter settings you can use with it.

———
Settings:
———

Name:
\i[231]Autosave
Help Description:
Enables \c[4]Autosaving\c[0] for your game if ON. 
You can still manually save your game.
Symbol:
autosave
Show/Hide:
show = Imported.AutosaveShowOpt;
Enable:
enabled = true;
Ext:
ext = 0;

———-
Functions:
———-

Make Option Code:
this.addCommand(name, symbol, enabled, ext);
Draw Option Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
this.drawOptionsOnOff(index);
Process OK Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);
Cursor Right Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, true);
Cursor Left Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, false);
Default Config Code:
// Empty. Provided by this plugin.
Save Config Code:
// Empty. Provided by this plugin.
Load Config Code:
// Empty. Provided by this plugin.

Happy RPG Making!