Den_C

Veteran
Veteran
Joined
Jun 22, 2017
Messages
42
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
I’d like to load the last saved game using a script call. I tried to use this:

DataManager.loadGame(DataManager.latestSavefileId());
SceneManager.goto(Scene_Map);

It loads the game, but before this, for a short moment, I get a screen with some wrong tiles. It doesn't happen when I load normally. What's wrong with this script call?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,210
Reaction score
1,898
First Language
English
Primarily Uses
RMMV
I'm not sure why you have the SceneManager call in there. Part of loading the game is taking you to the appropriate map afterward. If that function call is queued up and doing something, it could be causing your glitch.
 
Joined
Oct 6, 2019
Messages
45
Reaction score
12
First Language
Spanish
Primarily Uses
RMMV
I think SceneManager isn't necessary, you can try this script that I use.
JavaScript:
/*script can be found below. credit @ldd if you want, and tell me if you'd want an actual plugin for this
*/

Scene_Load.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
};

Scene_Load.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
var id = DataManager.lastAccessedSavefileId();
DataManager.loadGame(id)? this.onLoadSuccess() : this.onLoadFailure();
};
This script skips the continue window slot and loads the last file. Hope it works!
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
608
Reaction score
320
First Language
German
Primarily Uses
A bit late to the party, but for sake of completion:

If you save/load your game directly through a script command, the game will save/load the game state in the middle of processing a frame, which is not supposed to happen by default and can cause issues in some cases.
(When saving, some of the process for that frame might be skipped/repeated after reloading; when loading, the game will finish processing the frame using and modifying a mix of old and new game data).

So using a plugin to ensure the loading is done outside the games update loop is recommended.
 

Den_C

Veteran
Veteran
Joined
Jun 22, 2017
Messages
42
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
Thank you all very much! I found the plugin I needed.
 

Den_C

Veteran
Veteran
Joined
Jun 22, 2017
Messages
42
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
Actually, I didn’t exactly mean that I found the plugin that loads the last saved file. I wanted to say that, thanks to the help of the great people on this thread, I found the solution for my specific situation.

If you’d like to use a script call (in an event), you can use the script posted by SuzuMito7u7 above. If you’d like to load the last save after Game Over, you can use this:

Hope it helps.
 

Latest Threads

Latest Profile Posts

Anyone want dynamically soft shadow? :kaohi:
1643106068630.png
Happy Birthday, me!
Woops.
giphy.gif
Ack, I've got to make a script support thread... I hate doing it now; I feel like an annoyance to people. Especially because my questions are usually stupid. Or, at least I assume they are when I don't get any replies lol. Oh well, I'll just make it in the morning. No point doing it now if I'll be asleep.
Slowly working on directions and walking sprites. :kaoback:
mA1ETTy.jpg

Forum statistics

Threads
118,685
Messages
1,117,871
Members
155,807
Latest member
exrtcyvigubhinjomk44
Top