• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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,337
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