• 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] Dynamically creating triggers or one trigger for all ?

Status
Not open for further replies.

Ardenian

A

Ardenian

I learned in the past one should not destroy triggers.

However, I wonder about this:
TriggerRegisterUnitEvent(gg_trg_trigger,u, unitevent1)
This only refers to a specific unit.
Not a problem for me when referring to heroes, however, what about missiles ?
Considering each game a lot of missiles are fired, wouldn't this stack up and leak/lag or something ?
I talk about thousands of these events.

I currently use a function to trigger my unit's movement.
However, this function takes more than just movement into concern which is not always need, not needed for missiles e.g.
My idea was to write functions per use ( a function for heroes, a function for missiles, a function for homing missiles,...) and to puzzle together a trigger.
Then, upon unit death, I would destroy that trigger.
This would also apply to specific timers expiring.

Is that a good solution or are there aspects to consider ?

I know there is something like missile recycling, but I am not very fond of that right now.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
Event objects persist until the associated trigger object is destroyed. In your case if the missile was removed after it had the event applied and the trigger was never removed then it would leak, over time handle index and memory usage would increase.

As far as I can tell destroying triggers is perfectly safe except under some confusing circumstance. Something like it is not safe to destroy multiple triggers simultaneously or in response to some events.
 

Ardenian

A

Ardenian

Oh, good to know, thanks, but I am not going to use waits anyways, using timers instead
 
Status
Not open for further replies.
Top