I need help instantly loading a save file index by script call for custom save menu

Zaen

Find Me on YouTube
Veteran
Joined
Nov 15, 2016
Messages
115
Reaction score
30
First Language
English
Primarily Uses
So, I figured out how to make my save points automatically save without opening up the save menu scene.


$gameSystem.onBeforeSave();
DataManager.saveGame(1);
StorageManager.cleanBackup(1);


However.... I did not figure this out on my own. I have a friend on chatroom who told it to me, but he seems busy and I can't have my script call needs for him every morning in his inbox two days in a row.


I was wondering if someone could help me with a script call to load that save file, index 1.


The script as well as any explanation how it works would be lovely. I enjoy learning as I go what is doing what.


For example, I don't know why the above takes place on three lines and not one. There are three things that need to be executed for the save to carry out. Any takers?


Thanks in advance.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
They are separated so that they can focus on a specific thing, that way it is also easy to modify them if needed (especially for aliasing instead of overwriting).  


Anyway you can probably try this


$gameSystem.onBeforeLoad(1);
DataManager.loadGame(1);
StorageManager.cleanBackup(1);




or just plain


DataManager.loadGame(1);
 

Sunless

A Sunless Sky
Member
Joined
Sep 15, 2016
Messages
3
Reaction score
1
First Language
English
Primarily Uses
@Engr
I tried both methods. The single line either freezes my game or, like the multiple line script call, this pops up.
 

 

Zaen

Find Me on YouTube
Veteran
Joined
Nov 15, 2016
Messages
115
Reaction score
30
First Language
English
Primarily Uses
Yeah, I had a feeling that wouldn't work or our friend would have told us that it was that simple.... Any other ideas?


Edit: The answer is somewhere in here, if posting this can assist someone in helping.

 


//-----------------------------------------------------------------------------
// Scene_Load
//
// The scene class of the load screen.

function Scene_Load() {
this.initialize.apply(this, arguments);
}

Scene_Load.prototype = Object.create(Scene_File.prototype);
Scene_Load.prototype.constructor = Scene_Load;

Scene_Load.prototype.initialize = function() {
Scene_File.prototype.initialize.call(this);
this._loadSuccess = false;
};

Scene_Load.prototype.terminate = function() {
Scene_File.prototype.terminate.call(this);
if (this._loadSuccess) {
$gameSystem.onAfterLoad();
}
};

Scene_Load.prototype.mode = function() {
return 'load';
};

Scene_Load.prototype.helpWindowText = function() {
return TextManager.loadMessage;
};

Scene_Load.prototype.firstSavefileIndex = function() {
return DataManager.latestSavefileId() - 1;
};

Scene_Load.prototype.onSavefileOk = function() {
Scene_File.prototype.onSavefileOk.call(this);
if (DataManager.loadGame(this.savefileId())) {
this.onLoadSuccess();
} else {
this.onLoadFailure();
}
};

Scene_Load.prototype.onLoadSuccess = function() {
SoundManager.playLoad();
this.fadeOutAll();
this.reloadMapIfUpdated();
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
};

Scene_Load.prototype.onLoadFailure = function() {
SoundManager.playBuzzer();
this.activateListWindow();
};

Scene_Load.prototype.reloadMapIfUpdated = function() {
if ($gameSystem.versionId() !== $dataSystem.versionId) {
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
}
};




Edit2: Here's a video of what I've found:










Edit3:


I solved it myself :p
 

Code:
$gameSystem.onAfterLoad();
DataManager.loadGame(1);
StorageManager.cleanBackup(1);
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
The actual loading is surely on DataManager called by Scene_File (the parent of Scene_Save and Scene_Load)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

On my journey of character rework: I had this character, she was meant to be just a princess that joins your party. And at long term she was just uninteresting... So I tweaked her to be a rebel agaisn't the royalty before meeting up with the party.

Quick tip for any other ametuer pixel artists! When trying to create a colour palette, enabling Antialiasing can speed up the process of creating different shades! Just place your lightest colour and your darkest colour next to each other, select both pixels, and stretch it out!
Revolutionizing the JRPG Industry: Knocking on Doors.

Take that, murderhobos.
Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.

Forum statistics

Threads
106,054
Messages
1,018,578
Members
137,843
Latest member
Betwixt000
Top