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
4,069
Reaction score
2,478
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
323
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

The power of tutorials. This was fun to make,parallax lightning makes more sense to me now. Now comes the annoying step of doing stuff without a step by step show though !_!
With the new phone, I can now play a lot of old RPGs that my old phone just didn't have room for. Some RPGs definitely show their age even with updated graphics and quick saving.
I don't think I have ever stuck to a project this long....And I'm still just in the planning stages basically xD
It's not about the engine, it's about the resources.

Forum statistics

Threads
121,964
Messages
1,145,507
Members
160,243
Latest member
KrisSis265
Top