• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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