Status
Not open for further replies.

yawk

Yawk
Veteran
Joined
Mar 31, 2018
Messages
65
Reaction score
28
First Language
Spanish
Primarily Uses
RMVXA
Hello! I'm making a system in my game that uses save slots for one thing. I already have a way to forcefully save in a certain slot, but I haven't been able to find a way to forcefully load the slot that I want from a Script call or a plugin, could someone help me? Thanks for reading :D
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,698
Reaction score
2,248
First Language
Dutch
Primarily Uses
RMMV
what do you expect from a force load and when?

if you want to save on 1 slot during gameplay and not open the
save scene, TSR_Save can help you on that part, as it has an
autosave feature as well + customisation.

for loading the save is something you need to explain more.
 

IschmarVI

Villager
Member
Joined
Jun 4, 2022
Messages
15
Reaction score
5
First Language
German
Primarily Uses
RMMV
For auto saving, you should only need a force save function in order to make sure that the player cannot manually overwrite the autosave. But for loading, you shouldn't need that because there is no reason as to why you would restrict when a player can load a save.

So if you want to load the save that was forcefully saved, you can just ... load it, I guess?
 
Joined
Dec 16, 2017
Messages
328
Reaction score
1,389
First Language
English
Primarily Uses
RMMZ
try looking through this code from an old plugin of mine, jumpStart:

 

yawk

Yawk
Veteran
Joined
Mar 31, 2018
Messages
65
Reaction score
28
First Language
Spanish
Primarily Uses
RMVXA
For auto saving, you should only need a force save function in order to make sure that the player cannot manually overwrite the autosave. But for loading, you shouldn't need that because there is no reason as to why you would restrict when a player can load a save.

So if you want to load the save that was forcefully saved, you can just ... load it, I guess?
what do you expect from a force load and when?

if you want to save on 1 slot during gameplay and not open the
save scene, TSR_Save can help you on that part, as it has an
autosave feature as well + customisation.

for loading the save is something you need to explain more.
To resolve your doubts, my game does not use the loading and saving scenes of the base rpg maker because they seem boring to me, so I had to do them by events, the problem is that when loading a saved file, I have not found anything to manually load the file that I indicate from the event. The save is already implemented, I'm missing the load.

I don't mean auto save, I want a script call that loads a slot that I have specified in an event or a plugin to do this.

try looking through this code from an old plugin of mine, jumpStart:

And I have to say that I have absolutely no idea about javascript, so searching in a code for me is like finding a needle in a haystack
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,660
Reaction score
2,753
First Language
EN
Primarily Uses
RMMZ
Here's an example script call from the MV / MZ Script Call List (Continue/Load):

// Continue from save slot 4 if (DataManager.loadGame(4)) { $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); }
Link to the list:
 

yawk

Yawk
Veteran
Joined
Mar 31, 2018
Messages
65
Reaction score
28
First Language
Spanish
Primarily Uses
RMVXA
Here's an example script call from the MV / MZ Script Call List (Continue/Load):

// Continue from save slot 4 if (DataManager.loadGame(4)) { $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); }

Link to the list:
Thank you so much! This was what I was looking for! :D
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,698
Reaction score
2,248
First Language
Dutch
Primarily Uses
RMMV
if you had 1 save slot, and yo udo the evented way, you should have
said so in your topic, so we dont have to guess :)

so be clear next time as well.

TSR_Save can provide 1 slot save and ca load directly to the game
if you please so "true continue" or overwrite the continue that way.

if you dont provide the neccessary info, we need to ask questions,
instead for a straight answer what you look for.

it's hard for us to guess what you seek with low information.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
613
Reaction score
326
First Language
German
Primarily Uses
Edit: Had tried to retract the post before I saw caethyril had already responded to it. But this is what it originally said:

Concerning caethyrils post:
I would advise caution with this particular script though. In the vast majority of cases this should work fine, but in theory loading a savestate through a script call in the middle of the games update process (when events commands would be run) could cause unintended effects that might be hard to track down.

[Example and alternative proposal retracted due to flaws, see next post]
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,660
Reaction score
2,753
First Language
EN
Primarily Uses
RMMZ
I would advise caution with this particular script though. In the vast majority of cases this should work fine, but in theory loading a savestate through a script call in the middle of the games update process (when events commands would be run) could cause unintended effects that might be hard to track down.
I don't see how your proposed code changes anything? (popScene on an empty stack will exit the game, but you could just change the push(loadingScene) to a goto in that case.)

Thoughts:
  1. $gameMap gets replaced with data loaded from the save file.

  2. SceneManager.goto(Scene_Map) tells the game to empty the stack and initialise a new map scene instance, which includes reloading $dataMap. This should happen the frame after the script call is evaluated.

  3. The rest of the current update cycle for event commands should effectively be skipped because Game_Interpreter#update includes a SceneManager.isSceneChanging check.
Have I missed something? :kaoswt:
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
613
Reaction score
326
First Language
German
Primarily Uses
I messed up a bit both with the example given and the code, although the general concern might still stand if you are using Plugins that work on the map.

The concern was that while $gameMap and other game objects get replaced, your are in the middle of the old $gameMaps update function when that happens, meaning the rest of that function call will still use "this" to access the old map. The old maps events will still get executed, but calls to game objects will work on the newly loaded objects (during passability checks for example).

I was indeed wrong with the example of the parallel event changing a variable though, thanks for pointing it out. =) That makes it indeed less likely to cause chaos. ^^
Sorry for that.

The "Switch On/Off..." move route commands might still interfere with a newly loaded savestate. Not sure who actually uses that command though...^^


And yeah, the code I posted... :(
The code was way too long to fit in a script command anyway it turned out.
I had to stealthily fix the "this.popScene()" to "if (!SceneManager.isSceneChanging()) this.popScene()" so you might have seen the even more wrong version...^^
The purpose was just to have a fallback should loading the game fail and the SceneManager.goto(Scene_Map) line never get executed.

The idea of the changes was to let Scene_Map complete all its updates for the frame just in case before changing to the handcrafted scene to load a new game. Unfortunately it was obvious I didn't try to test that thing first...^^

May do another proposal on that later if nobody else does. :)
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,660
Reaction score
2,753
First Language
EN
Primarily Uses
RMMZ
Since the thread starter has marked the thread "[SOLVED]"...

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Feel free to start your own thread or message me or whatever if you find a reproducible test case (without plugins) showing that the script call I posted can cause bugs, though!

PS @yawk: in future you can report your post, e.g. with a reason like "Solved". That highlights the thread for the moderators and clearly communicates that you'd like the thread to be closed. :kaohi:
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Thunderstorm approaching: *rumble rumble*

Me: "Hmph... so.. you've come..."

And ONLY me: (adapts fighting stance) "...now show me your TRUE POWER!!!"

*Thunderstorm fizzles out. Sunshine and rainbows.*

Seriously, ONLY ME: "No! Come back! I.. I didn't mean..."
The black rose maiden! :kaopride:
vmTLAk8.jpg

Character: Aki Izayoi from Yugioh 5Ds.
Took some trial and error, but I managed to create "visuals" for underground dig path regions.
Couldn't sleep at all so I started working on the topmost deck. I've had to make several deviations from the Imperator/Berengaria's deck-plans to accommodate MV's movement, but 100% accuracy was never my intention.
Still no name for the poor ship...:kaodes:
Screenshot-2022-06-25-053308.png

Forum statistics

Threads
123,034
Messages
1,153,593
Members
161,381
Latest member
hvrhrt
Top