Saving custom variables

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
Hello all, a random question; 


how does one go about saving custom or better yet global variables?
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
put your custom variable value into a global variable and it should safe alongside with the rest of the game data.


global variables ($game_variables) keep there values automaticly.


OR iam just getting you wrong.


Edit: Just saw that this is MV, and no post delete button in sight.... maybe its still accurate?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
what custom/global variables are you talking about?  Give a better explanation of what you're trying to do, as there are several ways, and if people just guess as what you want, you'll end up with the wrong thing.


What is the variable for, how do you have it designed, how do you want to be able to access it?  Should it be accessed only from the current saved game, or from all of them?
 
Last edited by a moderator:

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
@Shaz 


well the thing is, i made a plugin that heavily relies on global variables just for simplicity but then it got really complicated, anyway after completing it i realized that the data just doesn't get saved when i save the game in test mode.


@Bex


 well the plugin uses global variables but they still don't get saved.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
But what do you mean by global variables?  Are they global just to the current game?  Or to ALL games?


If you've just made them global so they can be accessed from anywhere, but still belong to the current game only (not a really good design method), change them to make them a part of $gameSystem or $gamePlayer or $gameParty - whatever seems the most logical based on their purpose.  That way, they'll automatically be saved.


Otherwise you can create a class and put them all into that, so they're not global anymore, and modify the save/load functions to include your new class.
 

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
@Shaz


ok i'll try the latter. thnx 


;_;  how tho? 


I just realized that it may not be as simple as I had thought to edit the save load function, is there a simple way to do this? Or if possible could it get an example? 
 
Last edited by a moderator:

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top