Explaining what Variables are in RPG Maker
(Thanks to @draxicor for helping me understand what Variables are and providing the pictures + second example! )
Variables is a way to make Events in RPG Maker, and it is similar to Switches.
A Switch is a way to Event, which only has the terms “ON” or “OFF”. You can turn ON a Switch or turn it OFF. (And only that!)
It’s like a light switch! When the Switch is ON, the light is on (the event happens!).
When the Switch is OFF, the light doesn’t turn on (the event DOESN’T happen).
Variables are similar to Switches except instead of “ON” and “OFF”, they use numbers! And that number, whichever value you choose, can mean “ON” or “OFF”.
(”Think about it this way: if a switch is like a light switch, then a variable is like a dimmer dial: it works the same way, but instead of only two positions (on or off), there is no limit on the amount of positions a variable can have.” - (-FinalbossBlues.com-))
Variables also use these symbols: = (EQUAL), < (Less Than), > (Greater Than), ≤ (Less-than-or-Equal-to) , ≥ (Greater-than-or-Equal-To), and ≠ (Not Equal To).
To try to make sense of what Variables are + can do, here are some examples:
Example 1: You have multiple endings. The endings is dependent on how many Special Items you have. (There is a total of 2 Special Items here!)
0 Special Items = Bad Ending
1 Special Item = Normal Ending
2 Special Items = Good Ending
Bad Ending: If the MC picks up 0 Special Items, the Variable can be =0 or <1 (unless you have negative integers. If you do, you want =0). [Note: If you want a SPECIFIC Number, it’s best to make it =#.]
Normal Ending: =1 (NOT <2). The reason why <2 does NOT work is because the value of 0 (having no special items) might trigger the Normal Ending. (This is an example of wanting a specific number.)
Good Ending: If the MC picks up 2, the Variable can be =2 or ≥2 (if there’s no other number that’s greater than 2, it’s okay to use the ≥ symbol).
NOTE: This example of variables is based on a set value of numbers (0, 1, 2).
Example 2: An event triggered by your test score.
(NOTE: This example differs from the first example slightly because it has a wide range of variables as opposed to the first example which had a set variable.)
MC is taking a test. Depending on how many you get correct (variables), an event is triggered.
Variable >50
Event: “You passed! Congratulations!”
Variable ≤50
Event: “You failed! Go study harder!”
(Note: Because you will always meet these conditions after finishing the test–you will either have above 50 or below 50 grades–one of these events will trigger.)
Event: “It’s a present for acing the test!” “I wouldn’t get this if I haven’t had a 100 score!”
Event: Receive a present.
(Note: ONLY when your test/variable score equals 100 will you trigger this event.)
Here is an example of the Test:
So in examples like this one, where variables can be affected (increased in score or decreased in score) you need to use Control Variables.
Control Variables: Control Variables are basically what “controls your variables” (it affects your variable score!). Basically, it’s what will be subtracted or added to your variable score.
In this example, getting an incorrect answer has no effect on the number of your variable (variable score stays the same).
If, however, you get a correct answer, you have a Control Variable of +10. (This means that your variable score gets an increase of 10 per correct answer!) So getting 10 correct answers means a variable score of 100! Which leads to the variable =100 event of getting the present!
If, however, you choose an insulting answer, the Control Variable is -20. So each time you choose an insulting answer, your variable score is subtracted by 20.
Third Example: Trust System (similar to example 2!)
Imagine a video game where you can make friends or enemies! If you are kind to someone, your trust points will increase! If you’re mean, you will lose a trust point!
So in this example, the Control Variables will be:
And the Variable will be:
Best Friends Forever: =20
When the trust points equal 20, you’ll become best friends with the character!
If the trust points equals 0 or less than (as the Control Variable is a subtraction, it can lead to negative points!), it triggers the Enemies event!
Note: Just having the Variable doesn’t mean the event will trigger. You still have to event it!
(Like in the second example!)
Hope this is clear! Thanks to @draxicor for helping me!