Difference between revisions of "Variables"

From HIVE
Jump to navigation Jump to search
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Variables are used to store information into something that you will be able to call later on. This information can be pretty much anything (not just numbers!), from units to players, passing by regions, orders, sounds, and much '''much''' more. For a complete list of the Variable Types, please [[Variable_Types_(List)|click here]].
+
Variables are used to store information that you will be able to call later on. This information can be pretty much anything from units to players, passing by regions, orders, sounds, and much '''much''' more.
  
When making a variable there are also many ways to create one, locally and globally.  Both function the same way, but local variables can only be accessed by the trigger in which it was defined.
+
To create a variable, right click the left area in the Trigger Window, go to New, then New Variable ('''Ctrl + B''').  Now you need a type, a name, and sometimes a value or configure it to be an array.
 
 
To create a variable, right click the left area in the Trigger Window, go to New, then New Variable ('''CTRL + B''').  Now you need a type, a name, and sometimes a value or configure it to be an array.  Types go from Units, to Player Groups (Forces), integers (number with no decimal) and reals (number with decimal), and most objects dealing with leaderboards and [[Dialog|dialogs]].  An integer is a great way to store information needed in triggers later on, and SC1 veterans who know Death Counters will understand them rather easily.
 
  
 +
==Variables Basics==
 
Writing to a variable is as simple as making a new action, and choosing the option that first comes up, which is 'Set Variable'.  When setting a variable, the editor will automatically populate the list with reasonable things to put into it.
 
Writing to a variable is as simple as making a new action, and choosing the option that first comes up, which is 'Set Variable'.  When setting a variable, the editor will automatically populate the list with reasonable things to put into it.
  
 
When reading a variable, conditions vary.  Bringing a unit to a location can also be done by bringing a variable to a location, if the unit is inside the Unit variable.  Even math can be done, in the math section of the conditions list, to variables containing numbers and can allow you to do more things in only one trigger.
 
When reading a variable, conditions vary.  Bringing a unit to a location can also be done by bringing a variable to a location, if the unit is inside the Unit variable.  Even math can be done, in the math section of the conditions list, to variables containing numbers and can allow you to do more things in only one trigger.
  
 +
===Local Variables===
 +
A '''Local Variable''' is a variable that you will only be able to use within the one trigger that contains it.
  
==Local==
+
===Global Variable===
A '''Local variable''' is a variable that you will only be able to use within the trigger that contains it.
+
A '''Global Variable''' is used to transcend the boundaries of the triggers, thus allowing you to use it anywhere. They are created on the left-tree, where triggers and folders are listed.
  
==Global==
+
===Arrays===
A '''Global variable''' is used to transcend the boundaries of the triggers, thus allowing you to use it anywhere. They are created on the left-tree, where triggers and folders are listed.
+
'''Arrays''' are extremely useful and time-saving when you learn to use them properly. They are used to store different information into the same variable. Let's say you have a Variable that you want to change based on what different players do, but you don't want the changes one player makes to affect the variable for another player. By checking the box next to "Array" and setting the size to the amount of players in your game, you can then link to whateverVariable[1] and have that specifically be for Player 1's triggers, then set up whateverVariable[2] for Player 2, and so on. Of course this also isn't limited to something as simple as that. Arrays are most helpful when you just want to keep your variables organized and minimal rather than having to create a ton of variables that serve a similar purpose.
  
==Arrays==
+
===Constants===
'''Arrays''' are extremely useful and time-saving when you learn to use them properly. They are used to store different informations into the same variable.
+
A '''Constant''' "type" variable is one that you will not be able to change. You set its initial value, and it'll always stay as it is.
  
What is the difference between having 10 different variables and 1 variable with 10 arrays? Well, with the arrays, you can use an Integer to call data, which will save you a lot of time.
+
==Variable Types==
 
+
*[[Variables/Ability Command|Ability Command]]
==Constants==
+
*[[Variables/Actor|Actor]]
A  '''Constant''' "type" variable is one that you will not be able to change. You set its initial value, and it'll always stay as it is.
+
*[[Variables/Actor Message|Actor Message]]
 
+
*[[Variables/Actor Scope|Actor Scope]]
==See Also==
+
*[[Variables/AI Filter|AI Filter]]
*[[FAQs]]
+
*[[Variables/Animation Name|Animation Name]]
*[[Triggers]]
+
*[[Variables/Attribute ID (Game)|Attribute ID (Game)]]
 +
*[[Variables/Attribute ID (Player)|Attribute ID (Player)]]
 +
*[[Variables/Attribute Value|Attribute Value]]
 +
*[[Variables/Bank|Bank]]
 +
*[[Variables/Boolean|Boolean]]
 +
*[[Variables/Byte|Byte]]
 +
*[[Variables/Camera Object|Camera Object]]
 +
*[[Variables/Chat Bubble|Chat Bubble]]
 +
*[[Variables/Cinematic|Cinematic]]
 +
*[[Variables/Color|Color]]
 +
*[[Variables/Conversation|Conversation]]
 +
*[[Variables/Conversation Reply|Conversation Reply]]
 +
*[[Variables/Conversation State Index|Conversation State Index]]
 +
*[[Variables/Dialog|Dialog]]
 +
*[[Variables/Dialog Item|Dialog Item]]
 +
*[[Variables/Difficulty Level|Difficulty Level]]
 +
*[[Variables/Doodad|Doodad]]
 +
*[[Variables/Integer|Integer]]
 +
*[[Variables/Leaderboard|Leaderboard]]
 +
*[[Variables/Marker|Marker]]
 +
*[[Variables/Mercenary|Mercenary]]
 +
*[[Variables/Mission Archive|Mission Archive]]
 +
*[[Variables/Model Camera|Model Camera]]
 +
*[[Variables/Objective|Objective]]
 +
*[[Variables/Order|Order]]
 +
*[[Variables/Ping|Ping]]
 +
*[[Variables/Planet|Planet]]
 +
*[[Variables/Player Color|Player Color]]
 +
*[[Variables/Player Group|Player Group]]
 +
*[[Variables/Point|Point]]
 +
*[[Variables/Portrait|Portrait]]
 +
*[[Variables/Purchase Category|Purchase Category]]
 +
*[[Variables/Purchase Group|Purchase Group]]
 +
*[[Variables/Purchase Item|Purchase Item]]
 +
*[[Variables/Real|Real]]
 +
*[[Variables/Region|Region]]
 +
*[[Variables/Research Category|Research Category]]
 +
*[[Variables/Research Item|Research Item]]
 +
*[[Variables/Research Tier|Research Tier]]
 +
*[[Variables/Revealer|Revealer]]
 +
*[[Variables/Sound|Sound]]
 +
*[[Variables/Sound Link|Sound Link]]
 +
*[[Variables/String|String]]
 +
*[[Variables/Target Filter|Target Filter]]
 +
*[[Variables/Text|Text]]
 +
*[[Variables/Text Tag|Text Tag]]
 +
*[[Variables/Time Of Day|Time of Day]]
 +
*[[Variables/Timer|Timer]]
 +
*[[Variables/Timer Windows|Timer Windows]]
 +
*[[Variables/Transmission|Transmission]]
 +
*[[Variables/Transmission Source|Transmission Source]]
 +
*[[Variables/Trigger|Trigger]]
 +
*[[Variables/Unit|Unit]]
 +
*[[Variables/Unit Filter|Unit Filter]]
 +
*[[Variables/Unit Group|Unit Group]]
 +
*[[Variables/Unit Type|Unit Type]]
 +
*[[Variables/Water|Water]]
 +
*[[Variables/Wave|Wave]]
 +
*[[Variables/Wave Info|Wave Info]]
 +
*[[Variables/Wave Target|Wave Target]]
  
 
[[Category:StarCraft II]]
 
[[Category:StarCraft II]]
 +
[[Category:Triggers]]
 
[[Category:Reference]]
 
[[Category:Reference]]
[[Category:Triggers]]
 

Latest revision as of 10:21, 27 March 2013

Variables are used to store information that you will be able to call later on. This information can be pretty much anything from units to players, passing by regions, orders, sounds, and much much more.

To create a variable, right click the left area in the Trigger Window, go to New, then New Variable (Ctrl + B). Now you need a type, a name, and sometimes a value or configure it to be an array.

Variables Basics

Writing to a variable is as simple as making a new action, and choosing the option that first comes up, which is 'Set Variable'. When setting a variable, the editor will automatically populate the list with reasonable things to put into it.

When reading a variable, conditions vary. Bringing a unit to a location can also be done by bringing a variable to a location, if the unit is inside the Unit variable. Even math can be done, in the math section of the conditions list, to variables containing numbers and can allow you to do more things in only one trigger.

Local Variables

A Local Variable is a variable that you will only be able to use within the one trigger that contains it.

Global Variable

A Global Variable is used to transcend the boundaries of the triggers, thus allowing you to use it anywhere. They are created on the left-tree, where triggers and folders are listed.

Arrays

Arrays are extremely useful and time-saving when you learn to use them properly. They are used to store different information into the same variable. Let's say you have a Variable that you want to change based on what different players do, but you don't want the changes one player makes to affect the variable for another player. By checking the box next to "Array" and setting the size to the amount of players in your game, you can then link to whateverVariable[1] and have that specifically be for Player 1's triggers, then set up whateverVariable[2] for Player 2, and so on. Of course this also isn't limited to something as simple as that. Arrays are most helpful when you just want to keep your variables organized and minimal rather than having to create a ton of variables that serve a similar purpose.

Constants

A Constant "type" variable is one that you will not be able to change. You set its initial value, and it'll always stay as it is.

Variable Types