Triggers/Variables And Records

From SC2Mapster Wiki
Jump to: navigation, search

Trigger Elements

Ui-editoricon-general triggers.png Trigger
Ui-editoricon-triggereditor newevent.png Events
Ui-editoricon-triggereditor newcondition.png Conditions
Ui-editoricon-triggereditor newvariable.png Data Types
Ui-editoricon-triggereditor newpresettype.png Presets/Constants
Ui-editoricon-triggereditor newaction.png Actions Functions Database

Actions & Functions Database

If you want to create an action or function page, use this Template. If you want to create a new trigger category page, use this Template.

Ui-editoricon-triggercategories general2.png General Ui-editoricon-triggercategories actor.png Actors Ui-editoricon-triggercategories ai.png AI Ui-editoricon-triggercategories aiadvanced.png Advanced AI Ui-editoricon-triggercategories animation.png Animation
Ui-editoricon-triggercategories bank.png Banks Ui-editoricon-triggercategories cameras.png Cameras Ui-editoricon-triggercategoriescampaign.png Campaign Ui-editoricon-triggercategories catalog.png Catalog Ui-editoricon-triggercategorieschallenge.png Challenge
Ui-editoricon-triggercategorieschatbubble.png Chat Bubble Ui-editoricon-triggercategories cinematics.png Cinematics Ui-editoricon-triggercategories comment.png Comments Ui-editoricon-triggercategories conversations.png Conversation Ui-editoricon-triggercategories conversion.png Conversion
Ui-editoricon-triggercategories datatable.png Data Table Ui-editoricon-triggercategories debug.png Debug Ui-editoricon-triggercategories dialog.png Dialog Ui-editoricon-triggercategories environment.png Environment Ui-editoricon-triggercategories game.png Game
Ui-editoricon-triggercategories general.png General Ui-editoricon-triggercategories leaderboards.png Leaderboard Ui-editoricon-triggercategories logic.png Logic Ui-editoricon-triggercategories math.png Math Ui-editoricon-triggercategories melee.png Melee
Ui-editoricon-triggercategories objective.png Objective Ui-editoricon-triggercategories orders.png Order Ui-editoricon-triggercategories ping.png Ping Ui-editoricon-triggercategories player.png Player Ui-editoricon-triggercategories playergroup.png Player Group
Ui-editoricon-triggercategories point.png Point Ui-editoricon-triggercategories portrait.png Portrait Ui-editoricon-triggercategories region.png Region Ui-editoricon-triggercategories unitselection.png Selection Ui-editoricon-triggercategories sound.png Sound
Ui-editoricon-triggercategories story.png Story Ui-editoricon-triggercategories strings.png String Ui-editoricon-triggercategories techtree.png Tech Tree Ui-editoricon-triggercategories texttag.png Text Tag Ui-editoricon-triggercategories timer.png Timer
Ui-editoricon-triggercategories transmission.png Transmission Ui-editoricon-triggercategories triggers.png Trigger Ui-editoricon-triggercategories ui.png UI Ui-editoricon-triggercategories unit.png Unit Ui-editoricon-triggercategories unitgroup.png Unit Group
Ui-editoricon-triggercategories variable.png Variable Ui-editoricon-triggercategories visibility.png Visibility

Data Types

About Types

Every variable must be assigned a type. A variable may only store information appropriate for it's type. In other words, int variables can only store integers, and unit variables can only store units. Parameters also require specific types, and functions always return specific types.

Complex Types and Automatic Deletion

A number of types represent "complex" objects (i.e. objects larger than 4 bytes). Starcraft 2 automatically keeps track of these objects and deletes them from memory when they are no longer referenced by the script. Other types require that they be explicitly destroyed with the appropriate native function when no longer needed.

Types Affected by Automatic Deletion:

  • Ability Command
  • Bank
  • Camera Info
  • Color
  • Marker
  • Order
  • Player Group
  • Point
  • Region
  • Sound Link
  • String
  • Text
  • Timer
  • Transmission Source
  • Unit Filter
  • Unit Group
  • Unit References
  • Wave Info
  • Wave Target

Complex Types and Equality

Comparing two "complex" objects with the == or != operators will only compare the object reference, not the contained object data in most cases. However, a few types will compare the contained data instead including:

  • Ability Command
  • Color
  • Point
  • String
  • Unit Filter
  • Unit References


  • True:
    • Point (1, 2) == Point (1, 2)
    • "String" == "String"
  • False:
    • Order(abilCmd) == Order(abilCmd)
    • RegionEmpty() == RegionEmpty()

Complex Types and + or - Operators

Other than numerical types (byte, int, fixed) the operators that support + and/or - operators are:

  • String (+ Concatenates the two Strings)
  • Text (+ Concatenates the two Texts)
  • Point (+ or - Adds or Subtracts the X and Y values of the Points)

Primitive Types

Game Types