View Single Post
Old 12-08-2006, 06:19 PM   #2 (permalink)
x42bn6
Aya Matsuura is awesome
 
x42bn6's Avatar
 
Join Date: Nov 2002
Location: Trieste, Friuli-Venezia Giulia
Age: 20
Posts: 15,282
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.*
__________________
* IM IN UR WIKI RVRTING UR EDITS

x42bn6 is offline   Reply With Quote