Variables
A variable is an object whose value can change during the course of your map. You can use a variable to perform tasks, store results or change properties during the match.
Using Variables in Properties
It's often useful to use a variable as a property on an object in your map. For this example, we will use an Integer variable named Skulls.
I want to show how many Skulls the player has collected. I'd like to use some floating World Text. In the World Text properties, hover over the Text property. Use the Options > Swap Variable/Constant buttons (LEFT CTRL + G on PC, LT + X/Square on console) to open the variable picker. Select the Skulls variable from the list.
The World Text will now display the value of Skulls. Whenever the value of Skulls changes, the World Text will also change to reflect the new value.
There are lots of properties that can be set to variables. Experiment with properties that are numbers, integers, colors, or text strings to see if they can be controlled using a variable.
Comparing Variables
When using variable Compare objects, you will probably need to set the LHS or RHS property to a variable. In my map, the goal is to earn at least 666 Skulls. I will set the LHS property on an Integer Compare to my Integer Variable (named Skulls) and the RHS property to a constant number 666.
During the course of the match, the player will earn Skulls. Whenever the value of Skulls changes, I want to see if the player has earned enough Skulls to win. This logic chain will test to see if the value of Skulls is at least 666. If it is, the match will end in a victory.
You can compare a variable to a constant or a variable to another variable.