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

Re-using triggers

Status
Not open for further replies.
Level 3
Joined
Dec 16, 2010
Messages
31
How can you reuse a trigger on the same unit?

For example if i have trigger1 and I register it using TriggerRegisterUnitInRange(trigger1, unit1 ...), then it will execute when a unit2 walks within range of unit1. However this stops triggering for unit 2 after the first time. In order for it to trigger again for unit2, he has to get out-of-range of unit1, then come back into range. I would like it to continuously trigger for unit 2 as long as he is in range of unit1. I don't want to use enums, I was just wondering if this is possible with just the trigger.

Also what does ResetTrigger() do exactly?

And what is the difference between TriggerEvaluate() and TriggerExecute()?
 
Level 3
Joined
Dec 16, 2010
Messages
31
Yes I considered that, but I would have to do this for every unit that triggers the event, so it would be like iterating over these units twice, once in the event (behind the scenes) and again in a loop. This I wanted to avoid.

Edit: while we are on the topic, If I re-register a trigger without destroying/recreating it, do I cause a leak? Like If I called TriggerRegisterUnitInRange() twice on the same trigger.
 
Level 5
Joined
Nov 30, 2010
Messages
184
Is it like a spell that damages units near it like immolation? What you do is create a trigger that adds unit 2 to a unit group when it goes near unit 1.

Then you need another trigger that has a periodic time event that picks all the units in the group and damages them or something.

Finally you need a trigger that removes unit 2 from the group when he dies or moves out of unit 1 range.
 
Status
Not open for further replies.
Top