Personal tools

ADVERTISEMENT

Variables

From The StarCraft 2 Wiki

Jump to: navigation, search

Variables are a quantity or function that may assume any given value or set of values - in other words a type of placeholder with no fixed value. In mathematics, they are usually represented by letters or symbols (for example: a, b, c, x, y, z, alpha, beta, gamma, theta) that take on the value of any number in an equation. In the equation x + 2 = 5, the equation can be solved to prove that the variable x has a value of 3.

In map-making, we often utilize variables a placeholders for more than just numbers. For example, they may function as a placeholder to represent a unit or a special effect (or any number of other things) that initially have no fixed value. Because we are defining the variables we use, they must have (at least) two properties: a name and a type. This isn't completely different from how variables are used in math, though, because mathematicians usually associate a certain letter or symbol with a specific type of number - for example theta doesn't usually just stand for any number, it usually represents an angle.


[edit] Why use variables?

Among other things, the use of variables in map-making greatly expands our ability to write concise code. Variables also allow the map to 'remember' the value of something used in one trigger in another trigger (i.e. the value of a variable can be passed around between triggers or referenced long after the trigger was initially run). Variables are a fundamental tool for developing and designing quality map code.


[edit] List of common variable types used in Warcraft III

WarCraft III Trigger Variables
Ability -
Ability Type -
Boolean A boolean is a conditional expression with two states (true or false). Boolean variables are useful for tracking and storing the status of variable conditions that change in-game.
Buff -
Camera Object -
Combat Sound -
Damage Type -
Destructible -
Destructible Type -
Defeat Condition -
Dialog Though the name doesn't say it, this is used for creating a Dialog Menu, or several menu's for use with dialog-selection maps such as "The Changeling".
Dialog Button With "Array" checked on, you can create multiple buttons for your dialog menus so that everything will work properly when a player selects your created button which could be: "Yes" "No" "Cancel" "Buy" "Sell" etc.
Effect Type -
Floating Text -
Game Cache Used for saving misc. data in Warcraft III Maps & Campaigns, such as a unit, or a hero and the hero's level, items and gold.
Game Speed -
Image -
Image Type -
Integer Integers include the set of positive and negative whole numbers and zero (examples: 10, 0, -5033); non-fraction numbers. Integer variables can be useful for creating counters, storing values of unit levels, numbers of units, food used, or any other whole-number element of the game.
Item -
Item-Class -
Item-Type -
Leaderboard -
Lightning -
Lightning Type -
Multiboard -
Order An order is a command given to a unit. Order variables are useful to storing order information given in-game.
Player A player is a user or computer that utilizes one of the 12 available player slots (plus the 4 non-player slots). A player variable is useful for temporarily storing information that identifies a specific player (examples: the owner of a unit, the player that caused an event to happen, a random player from a player group).
Player Color -
Player Group A player group is a variable that is used to flag a specific subset of players. Player group variables are useful for easily referencing a consistent subset of players defined in-game, for example, a team or all non-computer players.
Point A point is an object that is defined by an x, y (and sometimes z) coordinate in Cartesian space. Point variables are useful for marking specific reference places in the map (examples: the position of a unit, the center of a region, the target point of an ability).
Pathing Type -
Quest -
Quest Requirement -
Race -
Real A (non-imaginary) fraction (examples: 1.0023, 1.0, -1.02). Real number variables can be used to store time, damage done, angles, health or any other numerical game element that is not an integer.
Region A region is a pre-placed rectangle created in the editor by using the region palette in the terrain module. Region variables can be useful in triggers that require a reference to a general area in the map's terrain.
Sound -
Sound Type -
Special Effect -
String A string is a non-numeric character or symbol, such as a letter or word or a non-numeric numeral (examples: a, dog, ahd8923z, +!@#$%*). String variables are useful for storing phrases that can be displayed in-game or entered chat messages.
Tech-Type -
Terrain Deformation -
Terrain Shape -
Terrain Type -
Timer A timer is a integrated tool that automatically counts downward from a specific time. Timers exist only as variables and may be set to be repeating or not.
Timer Window A timer window is the graphical expression of a timer variable that appears on the user interface to indicate the time remaining on a timer. Timer window variables are useful if more than one timer variable is being used, to indicate which timer is being shown to players.
Trigger -
Ubersplat An ubersplat is the image around the base of units or doodads that integrates its appearance with the terrain.
Ubersplat Type -
Unit A unit is a type of game element that has unit-type properties (health, the potential for movement, access to artificial intelligence, user interface controls, that capacity to have abilities, etc.) Unit variables are useful for referencing a specific unit in-game.
Unit Group A unit group is a variable that is used to flag a specific subset of units. Unit group variables are useful for easily referencing a consistent subset of units defined in-game, for example, a group of heroes, all units owned by a specific player, all units in a region, etc.
Unit-Type A unit-type is a category of unit with the same characteristics. The relationship between unit-type and unit should not be confused, a unit is an individual (a particular footman, for example), a unit-type is that type (the characteristics of all footmen) that you edit in the unit editor. Unit-type variables are useful for referencing a type of unit in-game (for example, a unit is created by its unit-type).
Visibility Modifier -
Weather Effect Used for when creating multiple Weather Effects in a map, Array must be checked in order to allow multiple uses of this variable.