Global Variables(?)

I want to be able to access global variables - variables that are across the whole game - in order to skip certain intros. What I mean is that the player sat through an intro to a boss fight. If they die, why should they be forced to watch it all again?

Or maybe I just want to count deaths like Sans does. I dunno. Here's what I mean by that comment.
"I mean, look at you, Ruki! You didn't die once! That's rather impressive!"
"I mean, look at you, Ruki! You're still in one piece! Well, despite that death."
"I mean, look at you, Ruki! Two deaths! I'd give that... Hmm... A B? B+?"
"I mean, counting your deaths, a B- is still a passing grade."

And so on.

So can someone help me like this?
I don't understand how you are trying to achieve what you're looking for with global variables. Skipping scenes and global variables are like different subjects.

But anyways, there are many accessible global variables:
Code:
// For everything related to game switches and variables.
$gameVariables;
$gameSwitches;
$gameVariables.setValue(id, value); // Sets the value of variable #id. Same method for switches
$gameVariables.value(id);           // Gets the value of variable #id. Same method for switches

// Global variable for party stuff
$gameParty;

// Global variable for actors stuff
$gameActors;

There are more global variables, but I don't think I have to list them all.
I don't understand how you are trying to achieve what you're looking for with global variables. Skipping scenes and global variables are like different subjects.

But anyways, there are many accessible global variables:
Code:
// For everything related to game switches and variables.
$gameVariables;
$gameSwitches;
$gameVariables.setValue(id, value); // Sets the value of variable #id. Same method for switches
$gameVariables.value(id);           // Gets the value of variable #id. Same method for switches

// Global variable for party stuff
$gameParty;

// Global variable for actors stuff
$gameActors;

There are more global variables, but I don't think I have to list them all.
Sorry IDK what it's called lol
You know those variables that get saved outside of the save but have to do with a single save? A good example would be Jevil. First time you (attempt to) fight him, you go through the full cutscene, then the rest, you go straight into the battle.
Edit: Not saving between attempts. Let's have these outside variables autosave upon edit.
There's nothing in the default engine that gets saved automatically and that is save file dependent (meaning unique within different save file). The only thing that is saved automatically is the option settings (variable is called ConfigManager ), but it is common across all save files.

EDIT: Meaning that to achieve what you're trying to achieve you'll need custom coding.
Also, even if you use the default ConfigManager to save stuff in it (which I do not recommend), there's still some coding to be done to make it work as ConfigManager wasn't design for that.
There's nothing in the default engine that gets saved automatically and that is save file dependent (meaning unique within different save file). The only thing that is saved automatically is the option settings (variable is called ConfigManager ), but it is common across all save files.

Is it possible to save in the save folder as a new file, then? Let's call this file "Newvar.sav".

Here are the steps I want to be able to do with the commands I want to make:
Open the file: openvar
Close the file: closevar
Write to the file: writevar (group, variable, value)
Read the file: readvar (group, variable)
Save the file: savevar
How are you handling game overs? You could set the battles to Cannot Lose when making the battle processing event. If they do you do a one frame count to tint the screen black, add +1 to a variable and transfer the player to another location. Or you could use Hime's Sync Save Data plugin to sync your saves and variables.
How are you handling game overs? You could set the battles to Cannot Lose when making the battle processing event. If they do you do a one frame count to tint the screen black, add +1 to a variable and transfer the player to another location. Or you could use Hime's Sync Save Data plugin to sync your saves and variables.

I am using the real game over screen.

So here's what I want to do.


Don't mind the commentary in this vid.
When you go to 4:40 of the vid, you can see that it is the full cutscene. However, at 14:42, you can see that the cutscene is shortened to actions, despite no progress being made, no saves, nothing.

Here is an example of the death counting:


As the attempts of this fight differ, so does the dialogue, counting up.

I want to be able to replicate these using those kinds of variables. All that the dialogue depends on is the number of times you've seen the scene without saving, or maybe a death count starting at a certain point. Think of it as an outside variable working on a specific file.
Is it possible to save in the save folder as a new file, then? Let's call this file "Newvar.sav".

Here are the steps I want to be able to do with the commands I want to make:
Open the file: openvar
Close the file: closevar
Write to the file: writevar (group, variable, value)
Read the file: readvar (group, variable)
Save the file: savevar
Yes you can do that, but since it's a new system that you're adding to your game you'll have to create the new objects to handle that. Plus, you'll need to create your auto-save system.

To create/write/read a save file, just refer to the DataManager and the StorageManager in the code. Both objects are pretty straightforward. Here's a list of methods that you can take inspiration from:
Code:
DataManager.loadGameWithoutRescu(savefileId);
DataManager.makeSavefileInfo();
DataManager.makeSaveContents();
DataManager.extractSaveContents(contents);

// More important stuff in the StorageManager object
StorageManager.save(savefileId, json);
StorageManager.load(savefileId);
StorageManager.saveToLocalFile(savefileId, json);
StorageManager.loadFromLocalFile(savefileId);
Yes you can do that, but since it's a new system that you're adding to your game you'll have to create the new objects to handle that. Plus, you'll need to create your auto-save system.

To create/write/read a save file, just refer to the DataManager and the StorageManager in the code. Both objects are pretty straightforward. Here's a list of methods that you can take inspiration from:
Code:
DataManager.loadGameWithoutRescu(savefileId);
DataManager.makeSavefileInfo();
DataManager.makeSaveContents();
DataManager.extractSaveContents(contents);

// More important stuff in the StorageManager object
StorageManager.save(savefileId, json);
StorageManager.load(savefileId);
StorageManager.saveToLocalFile(savefileId, json);
StorageManager.loadFromLocalFile(savefileId);

I'm not sure how exactly I can do that. I'm not sure if I exactly want the other save file. At the end of the day, I just want to be able to do what those 2 vids did. Newvar.sav was an idea of doing this.
Okay let's make this a bit simpler so you can handle it better. I couldn't find anything to do what you wanted on MV. Let's change up how game overs work with Hime's Gameover Events plugin. now when the player loses a losable battle, then they will be transported to a separate map that you can make a autorun event in which you can activate switches and variables from and then send the player back to a previous save point or even right before the boss fight. When the boss fight starts, activate a switch and when the player is transferred to your game over map you can have a conditional branch check if that boss switch is on and if it is then you +1 to a variable. Once the player gets back to that fight again, you can either have a separate page or use conditional branches from there.
Okay let's make this a bit simpler so you can handle it better. I couldn't find anything to do what you wanted on MV. Let's change up how game overs work with Hime's Gameover Events plugin. now when the player loses a losable battle, then they will be transported to a separate map that you can make a autorun event in which you can activate switches and variables from and then send the player back to a previous save point or even right before the boss fight. When the boss fight starts, activate a switch and when the player is transferred to your game over map you can have a conditional branch check if that boss switch is on and if it is then you +1 to a variable. Once the player gets back to that fight again, you can either have a separate page or use conditional branches from there.

So what I'm gathering is that it increases a certain variable per death? At that, why don't I make it increase the variable, send them to their last save spot, and force save? (Then again, how can I find their last save spot?)
You will create all that in a autorun event that you have in the game over map. As for getting save spots, use switches. I advise you just set aside a bunch of empty switch slots specifically for those save spots. Then when the player interacts with a save spot, turn off all the switches and turn on the switch for that spot.
You will create all that in a autorun event that you have in the game over map. As for getting save spots, use switches. I advise you just set aside a bunch of empty switch slots specifically for those save spots. Then when the player interacts with a save spot, turn off all the switches and turn on the switch for that spot.

Is it possible to use a variable instead? And how do I force the save onto the file?
Very possible. just be sure to remember what number you have for each save spot and have the proper conditional branches. As for the force saving I couldn't find anything about forcing a save on a certain file, so the only way I know how to do that is with an Autosave plugin.
Very possible. just be sure to remember what number you have for each save spot and have the proper conditional branches. As for the force saving I couldn't find anything about forcing a save on a certain file, so the only way I know how to do that is with an Autosave plugin.

Alright. However, I want the player to have only the level and EXP they had at their last save when the game over screen does what it does. Plus, I can't find an autosave plugin that doesn't just save on its own. I just want one that will allow me to force a save. Do you know any like that?
What you could do is at save spots have the game put the player's level and exp into variables and then when the game over event have the game set the players level and exp to those variables. What autosave plugins have you tried? Most of the ones that I know of allow you to customize when they save so you could completely turn off everything and just use plugin and script commands at your leisure.
What you could do is at save spots have the game put the player's level and exp into variables and then when the game over event have the game set the players level and exp to those variables. What autosave plugins have you tried? Most of the ones that I know of allow you to customize when they save so you could completely turn off everything and just use plugin and script commands at your leisure.

How exactly do you "set" a level and EXP? I know you can remove all levels and EXP, add the saved levels and EXP, subtract 1 from level, but I don't want to do all that. Such a hassle.

And could you recommend one or two?
Sadly game developing sometimes requires you doing hassling tasks and workarounds to do simple stuff. Especially if you don't know how to code. For Autosave plugins I usually use Yanfly's and then I found this one on itch.
Sadly game developing sometimes requires you doing hassling tasks and workarounds to do simple stuff. Especially if you don't know how to code. For Autosave plugins I usually use Yanfly's and then I found this one on itch.

So how exactly can I save the switches using variables? (I am using one switch for each story point and variables per background info)
And the problem with the autosave plugin on Itch is that it creates new autosave files (I want it to save directly into the file). I also have a problem with there being no command to autosave. As for Yanfly's, I don't have access to my money.

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.

Original thread: https://forums.rpgmakerweb.com/threads/global-variables.117268/