Load last game after Game Over


[IMG]http://i1135.photobucket.com/albums/m639/Torqus7/ayy.png[/IMG]​


Load last save after Gameover
​


 
​


This plugin is simple enough for anyone to understand, it just modifies the way the GameOver scene works.


Originally when you lose you are sent to the title screen, I don't think that's something you really want for your game, I want my players to keep playing, so I'll save them the rage of reloading their save files.


That's what this plugin does, it loads the last saved file by the player, not the file 99 or the most advanced, just the last save made, so they keep playing the game they were playing before the game over. And, if there's no saved game, it will send the player to the title screen just as before.


Also, if you press enter, the save is loaded, but if the Cancel button is pressed, you're sent to the title screen.


Don't need to credit, this is a very short plugin that anyone could have made.

/*:
 * @plugindesc v1.01 Load last saved game after gameover.
 * @author Torqus
 * @help
 * CHANGELOG
 *    1.01 - Now the player can decide if he wants to continue or go to the title with Ok or Cancel keys
 *
 * Load last save after Gameover
 *
 * This plugin is simple enough for anyone to understand, it just modifies
 * the way the GameOver scene works.
 *
 * Originally when you lose you are sent to the title screen, I don't think
 * that's something you really want for your game, I want my players
 * to keep playing, so I'll save them the rage of reloading their save files.
 *
 * That's what this plugin does, it loads the last saved file by the player,
 * not the file 99 or the most advanced, just the last save made,
 * so they keep playing the game they were playing before the game over.
 * And, if there's no saved game, it will send the player to the title screen
 * just as before.
 *
 * Also, if you press enter, the save is loaded, but if the Cancel button
 * is pressed, you're sent to the title screen.
 *
 * Don't need to credit, this is a very short plugin that anyone could have made.
 */


Scene_Gameover.prototype.update = function() {
    if (this.isActive() && !this.isBusy() && this.isTriggered()) {
        this.loadgame();
    }
    if (this.isActive() && !this.isBusy() && this.isBackTriggered()) {
        this.gotoTitle();
    }
    Scene_Base.prototype.update.call(this);
};


Scene_Gameover.prototype.isTriggered = function() {
    return Input.isTriggered('ok') || TouchInput.isTriggered();
};
Scene_Gameover.prototype.isBackTriggered = function() {
    return Input.isRepeated('cancel') || TouchInput.isCancelled();
};


Scene_Gameover.prototype.loadgame = function() {
    this.fadeOutAll();
    if(DataManager.isAnySavefileExists()){
        DataManager.loadGame(DataManager.latestSavefileId());
        this.reloadMapIfUpdated();
        $gameSystem.onAfterLoad();
        SceneManager.goto(Scene_Map);
    }
    else{
        SceneManager.goto(Scene_Title);
    }
};


Scene_Gameover.prototype.gotoTitle = function() {
    this.fadeOutAll();
    SceneManager.goto(Scene_Title);
};


Scene_Gameover.prototype.reloadMapIfUpdated = function() {
    $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
    $gamePlayer.requestMapReload();
};

MEGA download:


https://mega.nz/#!4MZDiZTD!JpMi1FUl8mb4q5Th4yUUMmy9HN48qpSOJ7F_DUdfFwU


CHANGELOG


NEW 1.01 - Now players can decide if they want to continue with Ok or go to title with Cancel. I tested it and doesn't work with touch, working on it, but it takes time considering you have to build the apk and install it in the phone just to test it.


Enjoy!
It doesn't seems to work. I am wondering if the Plugin needs the filename declaration to work as I think they do need it. 
Do I have to set it on a specific position on the Plugin List?
It worked for me in my project which is full of plugins, and in a fresh one without any. It might be a compatibility issue with another plugin that modifies the Game Over or the place where the save file is, can you tell me if you have any?

Also, remember that this plugin is made to send the player to the title screen if there's no saved games, and to load the last save only if there's any.
This one's great, thanks!

I'll credit you anyways. 
Ah man! If it could also give the option to start at the beginning of the fight, it would be awesome. Something like : Retry, load last save and quit. 🙂 but GOOD JOB!
Ah man! If it could also give the option to start at the beginning of the fight, it would be awesome. Something like : Retry, load last save and quit. 🙂 but GOOD JOB!
Well, Now that you mention it, I didn't think about adding something like "make autosaves in some places and load that instead" because I figured someone with more experience would make an Autosave plugin that would work with mine. But adding that thing you said about loading the game IN battle is a huge improvement for this. I don't know if I'll be able to do it but I'll give it a look. And thanks!

 EDIT:

Well, I gave it a look. I can't do that. I'm not a very experienced programmer as you can see. But you can do something similar to this for evented battles like bosses. In the event, the first page that activates will turn a switch and save the game with "DataManager.saveGame(X)" where X is the file to save (use 99 for now). Then the other page has as condition that switch that you turned, and is setted as parallel process (so it runs immediately after the first page without the necessity to click again). Then, when the player loses and loads the game, the battle or event will start immediately. Be careful how you use it though, you don't want your players stuck forever in a loop that will only be closed with ALT+F4.
I haven't installed this, but I'm too familiar with Final Fantasy VI bugs that I'm suspicious of how simple this is. What if there are existing save files, the player starts a new game, and then they get a game over? Wouldn't they be sent to the last place that was saved in what is now a completely different game?
I haven't installed this, but I'm too familiar with Final Fantasy VI bugs that I'm suspicious of how simple this is. What if there are existing save files, the player starts a new game, and then they get a game over? Wouldn't they be sent to the last place that was saved in what is now a completely different game?
Well that's no bug. That's how it works, if you have a game saved lvl60, start a new game, don't save and get a gameover, the lvl60 save will be loaded. I didn't do anything about that because it'll make the plugin very complex with knowledge I don't have only to solve an issue that probably 0.01% of the players will encounter. I mean, who has a saved game, starts a new one and dies before saving the game?

Well, actually, if you want to solve this, you can do it by using "DataManager.saveGame(21)" in an event close to the start of the game. Looks like the game allows 20 saves, but try using slot 21 , if it works you will be sure that it wont delete an existing save.

I would like to know if it worked, I don't have enough time to test it now.
Good job^^
CHANGELOG

NEW 1.01 - Now players can decide if they want to continue with Ok or go to title with Cancel. I tested it and doesn't work with touch, working on it, but it takes time considering you have to build the apk and install it in the phone just to test it.
Niiiiice 😀
The only game over plugin that works for me, thank you. All other game over plugins do some mystical things, but not what they should do.

Original thread: https://forums.rpgmakerweb.com/threads/load-last-game-after-game-over.52077/