Set Initial Value of a Variable

Hi

I am searching for a way to set the initial Value of a Variable.

But is has to be independent from the Map where my character is.

I know that I can add an Event on the first Map and set these Variables there, but I really need this independenty from the Map where my Character is.

Greetings
Tx423w
Can't you have the player start on a map, set the values, and then transfer them to where you want them to go? You won't lose variable data when the player saves the game, so you don't need to worry about them having to go to the initial map when they load a saved game.
Yes, why do you need it to be independent of where the player is? Isn't the player always going to start in the same place when they begin a new game?
Yes that is true, but what happens if you add a variable in a game update, and wanna use your current savestate? In that situation it is not clear on which Map the player is, right?
I'm not really a fan of this approach. I think a game shouldn't be released to players until it's finished, and if there are bugs that require updates, players should accept that sometimes they may have to start over. This would likely only be in the very early days after release though, as that's when most of the serious bugs are found, that made it through testing.


Do you actually have a situation where you need to do this, or are you asking for "what-if's"?


Variables have a value of 0 by default. If you use a new variable that hasn't been used before, it will start at 0. What reason would you have for wanting it to start at some other value? If you just need to set it to 0, then you don't need to do anything at all.


Any kind of plugin/script mod that would allow to you change a variable when a save file is loaded would have to consider what happens when the player loads that save file, the variable is changed, they play a bit, activate some events that change the variable again, save and then load again - if you're not careful, the result will be that the variable is reset again, which could have undesirable consequences to their gameplay - either letting them do stuff over, getting events out of sync, losing some progress they've made, or even blocking them from continuing.
Shaz, first of all, thank you for your long answer.

It's more like a 'What-If' Question. I want to save specific Map Coordinates in variables to teleport there.

And it should never be possible that these variables are 0.

But I finally found a work-around for this. So thank you very much 🙂
What is your workaround?
I have the same issue. I need a variable to be "???" when the game starts, as all my maps use the variable in place of a name.
I have it so the save file shows this variable, and the map names show up as unknown until you actually learn rheir name in-game.
Currently, as soon as you start the game, the map name shows "0", and that is not good.
If you really want to do a check when the player loads a save (for example, if you’ve updated the game) you could use a plugin like linked to here: https://forums.rpgmakerweb.com/index.php?threads/firing-event-after-savegame-is-loaded.58145/

Just make sure to include a conditional or otherwise disable the common event once it’s run the first time. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/set-initial-value-of-a-variable.51664/