Help in creating and accessing global variables.

Hi all!

Im sure this has been asked but I dont find that specific thread. So, how can I create my own global variables that can be accessed and save their value after a save/load game. I created some variables on some events, just to realize that those variables are undefined the next time I load the game.

Thanks!
You need that to put in a save content, so it will be saved and loaded. As for how to do that, I'm not sure how to do it in MV. This probably better to be moved in Learning JS.
Moved to: Learning Javascript
If you want to create your own variable that gets saved/loaded to the save file, you can reference the snippet I posted here:
https://forums.rpgmakerweb.com/index.php?threads/js-snippets-thread.92501/#post-881460

Alternatively, you can add your data as properties to an object that is already saved/loaded (example: $gameSystem, $gamePlayer, etc.)

Original thread: https://forums.rpgmakerweb.com/threads/help-in-creating-and-accessing-global-variables.100432/