Is there a script to manually load Switches?

firststef

Veteran
Veteran
Joined
Jan 3, 2017
Messages
79
Reaction score
9
First Language
Romanian
I want to manually load the switches data from a savefile with a script

Im noob so i tried

StorageManager.loadFromLocalFile(1)

After of course i tried manually to save a file

StorageManager.saveToLocalFile(1,json) but json is not defined

But i failed at saving the file.

Please share any thoughts. Thanks.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,370
Reaction score
7,678
First Language
German
Primarily Uses
RMMV
It would help a lot if you add an explanation of what you want to achieve instead of how you want to do that.

There are a lot of possible side effects if switches are loaded without the rest of any savefiles data, and it is quite possible that you will fail to get what you want even if some one gives you the correct answer to the question, simply because you never said what the game effect should be.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Code:
var file = StorageManager.loadFromLocalFile(1);
var fileParse = JsonEx.parse (file);
var switches = file.switches;
Should work. Especially if you give enough time between the first two lines (separating by wait command)

Also, if you intend to use it through editor, then maybe you'd need to delete the var words.
 
Last edited:

firststef

Veteran
Veteran
Joined
Jan 3, 2017
Messages
79
Reaction score
9
First Language
Romanian
@Andar It is in relation with this thread i made

https://forums.rpgmakerweb.com/inde...ck-from-options-scene-to-pre-title-map.89103/

I triggered a switch in-game. What I am trying to do with this script is have the game check if a switch is on at the very beginning of the game.

@Poryg Here is what it shows me

error.PNG
I first need to say that the switch isn,t saved by normal saving trough the Save Scene. I also need to save the switch manually first, if you would know how i can do that.

If there is a need I will show you my event, or better yet, provide a link to my game for you to understand better. If you want.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Saving switches manually first is a pain in the butt. It would be much better to save it to a totally external file.
Or you could use this plugin.
http://himeworks.com/2015/12/sync-save-data/

It has a plugin command that synchronizes these "global" switches and variables whenever you need to.
 

firststef

Veteran
Veteran
Joined
Jan 3, 2017
Messages
79
Reaction score
9
First Language
Romanian
I tried it worked, but i had to do this also.
wtf.PNG
But IDK WHY now my bgm that was right under does not play!!!

Srsly something is wrong the audio is cut off entirely with this plugin.
 

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

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,230
Members
137,607
Latest member
Maddo
Top