VXAce I need Help to do a Game Over screen...

Sorry if the title seems a little confusing, let me explain.

I'm making a scripted game over scene, and all I have left to do is make it so that when the player decides to try again, it loads the last save point from the save slot they chose.

In other words, if the player loads save file 2, they get a game over, and when they try again, the last save file in their slot is loaded, which is save file 2. (This is to prevent other save files, such as save file 1, from being loaded.)

I think this can be done with a Script call, but idk which script call is...
Ah F me, wrong Maker, Ignore! 😀
Okay, I've been trying, but nothing has worked.

I tried things like:
DataManager.load_game(DataManager.latest_savefile_index)

But nothing :/
Idk if this needs a script or something...
(I'm doing a Common Event for the game over scene using this script.)
Hello, you can use this script call:
Ruby:
if DataManager.load_game(DataManager.last_savefile_index)
  Scene_Load.new.on_load_success
end

The last save file index can be retrieved with DataManager.last_savefile_index.
The second call with Scene_Load ensures that the right setup is done, note that I did not setup the Scene_Load normally, so this might create issues if you use some custom scripts that affect the Scene_Load.

Also, if you've never saved your game (meaning you've started from a new game), then this might load a totally different savefile. To avoid this, you can refer to another value: $game_system.save_count that stores the number of times the game was saved.
So this script call might be more suited in this case:
Ruby:
if $game_system.save_count > 0 && DataManager.load_game(DataManager.last_savefile_index)
  Scene_Load.new.on_load_success
end
Hello, you can use this script call:
Ruby:
if DataManager.load_game(DataManager.last_savefile_index)
  Scene_Load.new.on_load_success
end

The last save file index can be retrieved with DataManager.last_savefile_index.
The second call with Scene_Load ensures that the right setup is done, note that I did not setup the Scene_Load normally, so this might create issues if you use some custom scripts that affect the Scene_Load.

Also, if you've never saved your game (meaning you've started from a new game), then this might load a totally different savefile. To avoid this, you can refer to another value: $game_system.save_count that stores the number of times the game was saved.
So this script call might be more suited in this case:
Ruby:
if $game_system.save_count > 0 && DataManager.load_game(DataManager.last_savefile_index)
  Scene_Load.new.on_load_success
end
At first it seemed like it wasn't working, but after investigating further, it turned out that a script was responsible for it not working.

Since I have a custom game save script, it changes load_game to “load_game2.”

I just had to change load_game to add the 2 and that's it, it works great!

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-to-do-a-game-over-screen.181496/