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

[JASS] trigger event question

Status
Not open for further replies.
Level 21
Joined
Mar 27, 2012
Messages
3,232
Would it work if I make a global trigger then add the events. When I'm done w it destroy the trigger then when I need it for the new events create the trigger again and add the new events or will this cause a leak ?

In short, this will not leak if you use JASS and proper methods.

Trigger actions will leak, conditions will not.
If you are using GUI, then it's not a good idea to make dynamic triggers.

For JASS you'd need to combine multiple approaches to avoid leaks.
1. Actions inside conditions - this means that conditions are used as actions. They do something and then return false.
2. Destroying and creating triggers, because events are impossible to remove or leak if trigger isn't destroyed.

GUI-Friendly Damage Detection by Weep uses dynamic triggers.
He has a trigger array and every unit in the map is linked to a trigger.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Ooo thts odd how would using only conditions work ?

From what I found I can null events by setting them to a global variable and reusing when I want to. Is this a good way

Also do the same thing w triggeractions

Basically if you do everything in conditions, then it works. Afterall, the game doesn't prevent that.

Resetting events will quite definitely leak. Event and variable are separate and if you reset the variable, then the event is still there.

There is no good way to get rid of triggeractions, I suggest using conditions, as almost nothing is different.
 
Status
Not open for further replies.
Top