How can I make global variables?

Question is really straightforward-
How can I make global variables in rpg maker mz that can change throughout game and multiple options the player chooses?
I'm talking about if a variable level is for instance 50 or 0.5 (etc etc) then only some dialogue options are shown
is this possible if so where can i add such and control what should the variable start with in the start of the game?
I'm not quite sure what you are trying to do.

A global variable is usually a variable that is valid in all savegames. For example, if you add an overall statistic to cover all your battles in all savegames. Or if you want to do a New Game+ and take some stats from a previous Savegame with you.

There are plugins for that. Quick search found this, maybe there are free ones aswell.

Your explanation sounds more like variables that are used during your game (e.g. if your Charisma gets higher, you can use more dialogue options). That is already the purpose of variables.
A variable that starts at a certain number and changes throughout the game is already how variables work. Use Control Variables with events (under Game Progression) to change your variables, and put an event on your starting map to set them to certain numbers.

As for a Choice only showing up based on a condition, you'd likely need a plugin for that to work. Without one, you can use Label (under Flow Control) so if someone picks a choice they "can't", you can tell them and boot them back to the choice.
Question is really straightforward-
How can I make global variables in rpg maker mz that can change throughout game and multiple options the player chooses?
I'm talking about if a variable level is for instance 50 or 0.5 (etc etc) then only some dialogue options are shown
is this possible if so where can i add such and control what should the variable start with in the start of the game?

Aren't those what variables are in the maker? Or do you want a separate variable aside from the ones rpg maker has by default?
Have you done tutorials? Such as the ones included with MZ? Variables are built into the event system and are one of the most basic parts.
I'm not quite sure what you are trying to do.

A global variable is usually a variable that is valid in all savegames. For example, if you add an overall statistic to cover all your battles in all savegames. Or if you want to do a New Game+ and take some stats from a previous Savegame with you.

There are plugins for that. Quick search found this, maybe there are free ones aswell.

Your explanation sounds more like variables that are used during your game (e.g. if your Charisma gets higher, you can use more dialogue options). That is already the purpose of variables.

im trying to make a function in the game that makes certain dialogue options highen or lower a variable such as happiness for the main character

the lower the happiness - different dialogue options will show
I guess global variable is wrong wording, I more of meant to just say that the variable is there for the entirety of the gameplay

As for a Choice only showing up based on a condition, you'd likely need a plugin for that to work.

so, there is no possibility for making something like

happiness - variable

if happiness = <50 then
blah blah dialogue options

if happiness >50 then
blah blah dialogue options

or

if example choice selected
then
happiness +5

sorry if this sounds really hazy, it's almost 3 am for me
if its not possible, what plugin would you recommend? or is it completely not possible

Have you done tutorials? Such as the ones included with MZ?
quite a long time since; i guess i should refresh them again
All variables are always available.

I think you are asking for Conditional Branches.
If Variable has value 1, do this. If Variable has value 2, do that.

But, as @kirbwarrior said, you can't link variables directly to dialogue choices without a plugin. You would have to copy those parts of dialogue into several Conditional Branches to cover your different setups of choices.
if example choice selected
then
happiness +5
This is easy, just use Control Variables to add 5 to the variable inside the Choice.

if happiness = <50 then
blah blah dialogue options

if happiness >50 then
blah blah dialogue options
If it's this simple, Conditional Branches can work well enough. Just put the Choices available to the player insider the correct Branch.
You would have to copy those parts of dialogue into several Conditional Branches to cover your different setups of choices.

so like

if variable has value 1 then
dialogues

if variable has value 2 then
dialogues

???

do you know any plugins that might ansewr my issues?
Are we even talking about Choices, or is this what you want?

1735005042956.png
Are we even talking about Choices, or is this what you want?

View attachment 326738
well, yes something like that would be good, although id also need it to work with choices


1735005464983.png

ive set variables like this, how did you make the if?
let me try painting the example lol

1735005672523.png
It's a Conditional Branch.

1735005985260.png


1735005878350.png
this ansswers so much!! i feel so stupid forgetting that youve mentioned cond branches...
will this post be closed after some time or am i free to come back here when ive got more 'stupid' questions? ill be sure to watch some tutorial videos tomorrow on conditional branches aswell as remind myself of variables
If your upcoming questions are about different topics, you better create new threads.
It sounds like you want an MZ plugin that allows you to set Switches and Variables to show/hide choices in a choice menu.

Here you go, Merry Christmas.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-make-global-variables.174116/