How do I return to the most recent save state through a script? (custom game over screen)

EndlessGame

Veteran
Veteran
Joined
Jun 17, 2020
Messages
160
Reaction score
38
First Language
English
Primarily Uses
RMMV
I made my own custom game over screen with two options, one being "continue" and the other "exit". I want the "continue" option to take the player back to the last time that the game was saved. I see that you can open the save screen through an event command but I don't want this. I want it to be so that as soon as you hit continue it loads into the most recent save. Is there a way to do this through events or scripts or do I need a plugin?

This is what my event looks like right now.

EDIT: Just to be clear, this is for a custom game over screen.

EDIT #2: Title change to clarify

Screenshot (488).png
 
Last edited:

Aphotic

Veteran
Veteran
Joined
Feb 19, 2019
Messages
54
Reaction score
32
First Language
English
Primarily Uses
RMMV
I found this thread which may be exactly what you're looking for.
 

EndlessGame

Veteran
Veteran
Joined
Jun 17, 2020
Messages
160
Reaction score
38
First Language
English
Primarily Uses
RMMV
I found this thread which may be exactly what you're looking for.
This plugin is great but unfortunately, it only works for the title screen and doesn't give me the option to do it through event commands/a script.
 

Aphotic

Veteran
Veteran
Joined
Feb 19, 2019
Messages
54
Reaction score
32
First Language
English
Primarily Uses
RMMV
This plugin is great but unfortunately, it only works for the title screen and doesn't give me the option to do it through event commands/a script.
I've never messed with loads and saves, but wouldn't the script alone accomplish what you need through a script call?


Code:
var id =DataManager.lastAccessedSavefileId();
DataManager.loadGame(id)? this.onLoadSuccess() : this.onLoadFailure();
 

EndlessGame

Veteran
Veteran
Joined
Jun 17, 2020
Messages
160
Reaction score
38
First Language
English
Primarily Uses
RMMV
I've never messed with loads and saves, but wouldn't the script alone accomplish what you need through a script call?


Code:
var id =DataManager.lastAccessedSavefileId();
DataManager.loadGame(id)? this.onLoadSuccess() : this.onLoadFailure();
I tried it as a script call but it didn't work unfortunately.
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
433
Reaction score
358
First Language
German
Primarily Uses
RMMV
I tried it as a script call but it didn't work unfortunately.
Well it should work. I said it a lot already and I'll keep saying it: Just telling us something "didn't work" is not at all helpful in providing further help. Can you please be more specific? What exactly did you try (preferably with screenshots)? What exactly did you expect to happen? And what exactly happened instead? Can you try again while the console is open (F8) and post the output (if any) as a screenshot?
 

rpgLord69

Veteran
Veteran
Joined
Oct 23, 2021
Messages
310
Reaction score
267
First Language
Finnish
Primarily Uses
RMMZ
I checked the script call list out of curiosity and it gives this kind of code to load (I put the latest save file ID script to the save file ID spot). This at least seemed to load my save when I tested it...

if (DataManager.loadGame(DataManager.latestSavefileId())) { $gameSystem.onAfterLoad(); SceneManager._scene.fadeOutAll(); if ($gameSystem.versionId() !== $dataSystem.versionId) { var p = $gamePlayer; p.reserveTransfer($gameMap.mapId(), p.x, p.y, p.direction(), 0); p.requestMapReload(); } SceneManager.goto(Scene_Map); }
 

EndlessGame

Veteran
Veteran
Joined
Jun 17, 2020
Messages
160
Reaction score
38
First Language
English
Primarily Uses
RMMV
I checked the script call list out of curiosity and it gives this kind of code to load (I put the latest save file ID script to the save file ID spot). This at least seemed to load my save when I tested it...

if (DataManager.loadGame(DataManager.latestSavefileId())) { $gameSystem.onAfterLoad(); SceneManager._scene.fadeOutAll(); if ($gameSystem.versionId() !== $dataSystem.versionId) { var p = $gamePlayer; p.reserveTransfer($gameMap.mapId(), p.x, p.y, p.direction(), 0); p.requestMapReload(); } SceneManager.goto(Scene_Map); }
Thank you. This worked.
 

Latest Posts

Latest Profile Posts

DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.
A secret desire of mine: I want to make a horror game based on Celtic mythology. I've seen plenty of Greek, Japanese and Norse mythology-based horror games, but I don't think I've ever seen a Celtic-based horror game anywhere...
FF Opera Omnia is in quite a bizarre state right now. As soon as the tutorial is completed, the game levels all characters to level 70 and makes all new characters start at level 70.

Forum statistics

Threads
125,537
Messages
1,171,784
Members
164,603
Latest member
nhacaionline
Top