Load Game/Continue Game event switch

That'd be because I missed the return value, woops. One of the many problems with javascripts lack of enforcement. Just a few adjustments should (hopefully) fix that for you. Change the inner lines of your new loadGame function to something like this:


var success = this._oldLoadGame(savegameId); //load the game normally
if (success) {
$gameSwitches.setValue(1, true); //assuming switch 1 is "LOAD GAME", this will turn it on right after you load a game
}
return success;


It needs the return value to confirm whether or not the save file actually loaded, if it fails nothing happens! I think it's using "failed to load" to identify empty save slots, too.
DataManager._oldLoadGame = DataManager.loadGame; //preserve the old function
DataManager.loadGame = function(savegameId) { //override the functionality to create a wrapper
var success = this._oldLoadGame(savegameId); //load the game normally
if (success) {
$gameSwitches.setValue(1, true); //assuming switch 1 is "LOAD GAME", this will turn it on right after you load a game
}
return success;



No worries! So, when I put it in like this, the game now loads, but the switch isn't actually turning ON.
There should me a "};" on the line after "return success;", it was working because the plugin broke and didn't even load, letting the default behavior happen.
There should me a "};" on the line after "return success;", it was working because the plugin broke and didn't even load, letting the default behavior happen.


Sweet, got it! Thank you for your help!


You should submit this to the master plugin list (assuming there is one), I think a lot of people would get a good use out of this plugin.
AdamSakuru


Could you show a screen shot of your final event window ?
This is what the event window looks like with the plugin installed.

untitled.PNG
I know this is two years old in terms of discussion (and technically a necropost) but I was looking all over for something like this and it more than did the trick for me. As a convenience I have committed it to a plugin file and will post accordingly.

The only question I have is that once I do, I'd like someone to cross-check it and advise on moving the switch definition from the plugin file and into the management interface as I'm not 100% sure how to do it yet.

BreakerZero, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/load-game-continue-game-event-switch.72742/