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!