• 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.

[General] DestroyTrigger(Trigger)

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
When using the function
JASS:
DestroyTrigger()
How do I destroy a trigger that isn't DestroyTrigger(GetTriggeringTrigger())? I want a separate trigger to run, which after 30 seconds, will remove itself so it doesn't run anymore. But until that 30 seconds comes along, it needs to still be running.

So I figured I'd make a separate trigger that goes off after elapsed game time is 30 seconds, then remove the first trigger (Along with this one), but I don't know how to find the name of the trigger and thus the Custom Script gives me an error saying "Expected a Name"
 
Level 12
Joined
May 20, 2009
Messages
822
I do have one more question.

Does "Clicked Dialog Button" return a Triggering Player?

What I mean is, would this work?

  • PickedRace
    • Events
      • Dialog - A dialog button is clicked for PickRaceDialog
    • Conditions
    • Actions
      • For each (Integer PlayerIndex) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (Player(PlayerIndex))
              • (Clicked dialog button) Equal to CustomRace
            • Then - Actions
              • Set PlayerPickedCustomRace[PlayerIndex] = True
            • Else - Actions
If not, how can I return the triggering player?

(Looking at the code, does not appear to do so)
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Yes, if you do a general TriggerRegisterDialogEvent, GetTriggerPlayer() will return the player variable who clicked a button or otherwise interacted with that dialog in some way (though button clicking is the only way I know).

If you do a simple button click event, however, GetTriggerPlayer() will always return null. Never use button click events but dialog click events.

JASS:
local trigger t
set t = CreateTrigger()
call TriggerRegisterDialogEvent(t, myDialog)
//add your actions/conditions now
 
Status
Not open for further replies.
Top