• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

1 Use Triggers

Status
Not open for further replies.
Level 24
Joined
Oct 12, 2008
Messages
1,783
How important is it clean up "quest triggers"
eg. I would like to display a message the first time a player builds something. Do I just turn off the trigger after running it once, or is there some other thing I need to do?
 
I sometimes do something along the lines of:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
Instead of GetTriggeringTrigger(), you can use a trigger-variable or reference the GUI-generated trigger-names (gg_trg_Untitled_Trigger_001) to destroy other triggers.

Note that there are some down-sides of destroying triggers, but if it's only a fairly normal trigger (I.E. isn't triggered by complicated systems such as a Damage Engine) it's fine.
 
Level 24
Joined
Feb 27, 2019
Messages
833
Does this get the trigger which runs this script? And is it needed to put anything in-between ( )?
That function returns the trigger which runs the script. You dont need to put anything in-between the ().
GetTriggeringTrigger() does not require any arguments because it only returns an argument.
JASS:
function GetTriggeringTrigger takes [B]nothing[/B] returns [B]trigger[/B]
...
endfunction
The parenthesises are used if you want to add arguments to the function.
JASS:
function DestroyTrigger takes [B]trigger whichTrigger[/B] returns [B]nothing[/B]
...
endfunction
 
Status
Not open for further replies.
Top