• 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] call DestroyTrigger(GetTriggeringTrigger())

Status
Not open for further replies.
Level 11
Joined
Dec 31, 2007
Messages
780
i read that the destroy trigger function may cause random crashes in maps, something about indexes stacks or something i dont remember right now...

My question is:

Is destroying a trigger a good or a bad choice?

Note: i have no idea about JASS... im using that function in GUI
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Don't destroy triggers. The only acceptable usage is once in a long time periodic as part of a damage detection system. Then you should be using a system, and even then it is debateable if the handle index leaks are better than risking it...

In certain complex jass systems where you create multiple triggers per unit, it's pretty obvious that you want to destroy those triggers if the unit dies, but it really doesn't matter in GUI.

No, you don't want to destroy them, because making them in the first place was stupid.

If you're sure that you won't use them again, and want to have some more memory space, then yes.

Not really worth the risk, DestroyTrigger is borked. Memory is cheap, handle index corruption makes maps go boom.
 
Level 11
Joined
Dec 31, 2007
Messages
780
well... i was destroying triggers at the end of each trigger... they could not be executed twice coz they were "elapsed game time events" and when a unit learns a skill i checked for it to be lvl 4 and destroy the trigger (as it is an aos map ... skills are learned only once) but ive already deleted all of the destroy trigger function calls
 
Level 5
Joined
Jan 6, 2006
Messages
106
No, it still is no safer than destroying them anywhere else. As if one object kills your map's performance anyways.

Yes it does. Imagine a targeted immolation spell, and I use a looping trigger or a timer to execute the functions. If the unit dies, but the trigger is still there... Damn, I cant even imagine that.

Even if I disable the trigger, the trigger and its local variables and handles are still there, present in the memory. Of course if won't show much effect with 1 unit. But what with 100 or even 1000 units?

For the sake of memory management I still recommend destroying triggers.
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Yes it does. Imagine a targeted immolation spell, and I use a looping trigger or a timer to execute the functions. If the unit dies, but the trigger is still there... Damn, I cant even imagine that.

Even if I disable the trigger, the trigger and its local variables and handles are still there, present in the memory. Of course if won't show much effect with 1 unit. But what with 100 or even 1000 units?

For the sake of memory management I still recommend destroying triggers.

If you're using dynamic triggers at all for that, you're doing it wrong.
 
Level 5
Joined
Jan 6, 2006
Messages
106
If you're using dynamic triggers at all for that, you're doing it wrong.

Hmm? In which sense?

As far as I know my triggers still work fine for me, regardless in single player testing or online/LAN multiplayer gaming, despite the fact they indeed involves much unnecessary work and looks too complex for direct importing.

------------------------------------------------------------------------------------------------------------------------

EDIT (To topic starter): Anyway, to destroy triggers or not, it's up to you. As long as it does not interfere with your intended functions it should be fine.
 
Last edited:
Status
Not open for further replies.
Top