SC2Mapster Wiki
Register
Advertisement

The Trigger Editor

  • The trigger editor is a powerful and easy-to-use tool with a GUI that allows map makers to create scripts for maps without writing galaxy script or even needing to know C programming language.
  • Trigger files are automatically converted into galaxy script when the map is run
  • Changes in the trigger editor are not needed to build simple melee map using standard SC2 rules, but pretty much anything else will require at least some trigger work.
  • Hybridization of triggers with data can be used to create features that are not possible with triggers or data alone (eg. the Archangel boss fight in zlab02 - Back In The Saddle)

GUI layout

  • Under the View menu make sure Show List Panel, Show Libraries and Show Triggers are enabled so that all triggers applied to the map are visible.
  • Upper Left Window: Contains trigger libraries (unless the Library On Bottom option is enabled) originating from dependencies and mods added to the map or imported .SC2Lib files. Triggers in libraries run whenever the triggering event occurs and the conditions are met while Definitions in the library become available for use in triggers.
    • Note that triggers in libraries cannot be disabled by right clicking and need to be disabled with a Turn Trigger On/Off action run by another trigger if they are undesirable
  • Lower Left Window: Contains the list of trigger elements in the opened map (unless the Library On Bottom option is enabled). New elements can be added and labels/flags/properties modified by right clicking. Left clicking an element opens it in the window on the upper right of the screen while left click drag and drop allows the order of elements to be moved around.
  • Upper Right Window: Shows details of the currently selected element (from the lower left window). New sub-elements can be added and labels/flags/properties modified by right clicking. Left clicking a sub-element opens it in the lower right window while left click drag and drop allows the order and hierarchy of elements to be moved around. Double left clicking opens a window to change the sub-element for an alterative option of the same type.
  • Lower Right Window: Is split into three sections.
    • The upper window lists the Parameters used by the selected sub-element with parameters introduced by Functions used to define other parameters being nested to the right of the defined parameter.
    • In the middle is the selected sub-element in string form with as yet undefined parameters in Red and defined parameters in Blue. Left clicking the coloured text opens a window to define the parameters.
    • The bottom window shows the Hint Text entry of the sub-element if it is a Definition

Trigger Element Types

  • Comments: Text added that will not interfere with the code used for organisation and note taking.
    • Use as reminders for projects if development is resumed after a hiatus
    • Useful for learning purposes when other people look at the map
  • Custom Scripts: Boxes for inputting galaxy script directly. See Language Overview section to learn more
  • Definitions: Creates custom Events, Conditions, Actions or Functions able to be used in Triggers. Often used to simplify repetitive yet complex actions and functions eg. creating Dialogs.
  • Folders: Used for organising groups of elements together (usually by function or development progress). Drag and drop elements to move them in/out of folders
  • Presets: Single dimensional variables with predefined values linked to a text tag. Often used for variables with static values that are frequently used eg. map specific options/settings and Switch Case actions
  • Records: Stores an array of multiple Variables that can have different Types. Commonly used for convenience when loading and saving with Banks or when the variable size index values represent the same object.
    • Require a variable using the -Record type to use variables stored on the record
  • Triggers: (For details see next section)
  • Variables (Global): Variables that are able to be shared between triggers and threads. Use these for stuff used for multiple triggers or threads.

Element Flags, Labels and Properties

  • Enabled: When disabled prevents the trigger from being executed even by other triggers.
  • Initially On: The trigger starts in the On state meaning any events the trigger has will run the trigger if the conditions are met. If disabled the Turn Trigger On/Off action from another trigger needs to turn the trigger on for the events to operate. Even in the off state triggers will still run if executed by the Run Trigger action of another trigger.
  • Template: (Unknown)
  • Internal: (Unknown)
  • Depreciated: (Unknown)
  • Not Yet Implemented: (Unsure) Flag indicating a placeholder for people viewing the map?
  • Label: Categories for the organisation of elements. Also changes the texture to the left of the element

Triggers

The Basic Concept of a Trigger

Every trigger has spaces for several types of sub-element. The minimal requirements to make an independent functional trigger are an Event (what conditions makes the trigger run) and an Action (what it does). Triggers once executed will work through all sub-elements sequentially until completion. This means that loops will prevent the execution of action sub-elements further down the list until the loop finishes.

Trigger Sub-Element Types

TM-Basic1

  • Events: The event that will "run" the trigger (Unit dies, Unit enters region, Effect Used, etc.). Whenever this event happens, the trigger will start, create a new thread and check the conditions. Triggers lacking events can still be run by other triggers using Run Trigger actions specifying the trigger under the Parameters however this means that at least one trigger somewhere must have at least one event.
  • Variables (Local): Variable used to store information for a single execution of a trigger. Local variables are deleted when the trigger thread finishes running and are created and linked in parallel for each thread created meaning multiple copies of the same variable with different values can exist at a time. This has advantages if executing the same trigger multiple times on multiple targets transiently (eg. displaying damage taken on a cluster of units hit several times by a multicastable area of effect ability with damage over time). Having the correct Type of local variable in the trigger is required for some Functions and Actions to appear as options.
  • Conditions: Conditions are restrictions before the actions are executed. They have all to be true in order for the trigger to continue (Unit has attribute "hero", Owner of unit is player 1, Race of player is Terran, etc.)
  • Actions: What the trigger does in response to the event. This can range from the creation of units to modification of their stats to adding minerals or ending the game in victory/defeat, etc.
  • Comments: Text added that will not interfere with the code used for organisation and note taking.
    • Use as reminders for projects if development is resumed after a hiatus
    • Useful for learning purposes when other people look at the map

Sub-Element Flags, Labels and Properties

  • Enabled: When disabled prevents the sub-element from being executed when the trigger runs.
  • Depreciated: (Unknown)
  • Not Yet Implemented: (Unsure) Flag indicating a placeholder for people viewing the map?
  • Label: Categories for the organisation of sub elements. Also changes the texture to the left of the sub-element


Actions & Functions Database

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

Other Built-Ins Reference (By element type)

Coding Concepts & Tutorials

Advertisement