Is there a way to determine when a player has actually saved the game?

I would like to add a very specific event that only occurs after the player of my game has actually saved their progress. 


Is there a way to capture the fact that the player just saved the game?


I need to set the value of a certain variable to 1 if the player just saved the game, so that I can use that variable to fire an event.


But all of that hinges on being able to detect when the player actually saved the game. 


I know there is a way to force the save screen to open, but there is no way to actually force the player to save the game if they accidentally click out of it. 


Because of that, I need to detect when they actually saved the game, and then use that successful save to trigger an event. 


If its possible to do that, and anyone knows how or could advise me on how I might approach it, that would be greatly appreciated.
You can't force them to save their game, but you are able to bring up the save menu before an event takes place. Or even simply warn them "You're going to want to save your game."


This is truly when games that have save points shine more than games that let you save whenever you want. Save points often mean danger is ahead.


Regardless, just warn them or force the save menu to come up and you should be fine. 🙂  


If you're worried about them clicking out of the save menu, ask them right after if they actually saved or not. Give a choice "Did you actually save?" and if not, they get another chance. Some people like going through games without saving at all, it adds challenge and tension. 
You're doing a tutorial or something?


The rpg_managers.js file has this beginning at line 364:


DataManager.saveGameWithoutRescue = function(savefileId) {
var json = JsonEx.stringify(this.makeSaveContents());
if (json.length >= 200000) {
console.warn('Save data too big!');
}
StorageManager.save(savefileId, json);
this._lastAccessedId = savefileId;
var globalInfo = this.loadGlobalInfo() || [];
globalInfo[savefileId] = this.makeSavefileInfo();
this.saveGlobalInfo(globalInfo);
return true;
};


If you wanted something to happen the first time the player saves, you could just make that script turn on a switch after the save is done.  The following added line (towards the bottom) will turn on switch 8 when the save is done.  So you just condition your event by switch 8, and that page will become active when the save happens:


DataManager.saveGameWithoutRescue = function(savefileId) {
var json = JsonEx.stringify(this.makeSaveContents());
if (json.length >= 200000) {
console.warn('Save data too big!');
}
StorageManager.save(savefileId, json);
this._lastAccessedId = savefileId;
var globalInfo = this.loadGlobalInfo() || [];
globalInfo[savefileId] = this.makeSavefileInfo();
this.saveGlobalInfo(globalInfo);
$gameSwitches.setValue(8, true); // turn on switch 8 to indicate the player has done a save
return true;
};




If you go this way, make sure you do the change in the .js file in your project, not where MV is installed.
Shaz, thanks a bunch! That's exactly what I was looking for! I want to force a post-save event to happen each time they actually save their game. Your info will now allow me to do that. W00t!
Each time, or only the first time?  If you want an event to happen every time, you'll have to turn that switch off again after the event runs.


Also, putting it at that spot means the switch is not turned on at the time the save file is written, so if they load that game, the switch will be off and the event won't run.  If that's a problem, we'll need to do something a bit different.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-determine-when-a-player-has-actually-saved-the-game.61200/