What are variables?

x42bn6

Retired Staff
Joined
Nov 11, 2002
Messages
15,150
Reaction score
2
Location
London, United Kingdom
It is used to store values that can be used for multiple triggers or just for convenience.

Say, for example, you want to make the first unit that enters a region to patrol a region using multiple regions to guide it (Region 1 to Region 2 to Region 3 to Region 4 and back to Region 1, for example). However, there is no constant (like "Triggering Unit") that corresponds to "First unit that enters this region".

So what is the solution? A variable. You store the unit in a Unit variable and then order the variable to do things.

There are many other uses. You can store arrays of units so you can make your own AI, arrays of heroes to gangbang a castle, and so on.

The other use of variables is for convenience. If you have, for example, a mathematical constant that takes 5 minutes to create using the panels, you may as well put this constant as a variable and reference that every time you need it.*
 

x42bn6

Retired Staff
Joined
Nov 11, 2002
Messages
15,150
Reaction score
2
Location
London, United Kingdom
Plenty - I have probably missed tons of them.

User inputs are always useful, too.

Basically, if you think you want to store any bit of data, you should be using variables. You could do it by creating units (i.e. A Paladin in the top-right means a unit is dead) but this is essentially a variable, and much more convenient.*
 

Dream_Walker

BattleForums Senior Member
Joined
Feb 20, 2005
Messages
1,924
Reaction score
0
Location
Arcanum
It's kind of like variables from Algebra. They "store" things.

In case you were wondering, arrays are just more variables. Variable[0] can be different than Variable[1].
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
It opens a space of memory to allow the map to store information for later use. Can be data types like integers, floats, etc. To objects like units and buildings. To even things like timers and regions. Any object can be made an array.

But be warned. Do not overuse them, they will take up extra space on your file. Almost like importing icons or skins.
 

NewPosts

New threads

Top