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

call DestroyTrigger( GetTriggeringTrigger() )

Status
Not open for further replies.
Level 8
Joined
Oct 2, 2013
Messages
288
So this function here: call DestroyTrigger( GetTriggeringTrigger() )

I understand it's a function that removes the trigger it has been placed with.

I thought it would be logical to use it for my Map Initializations.
And in addition, I used a Wait function. So my trigger looks like this:

- All the Map Initials functions
- Wait 1 second
- call DestroyTrigger( GetTriggeringTrigger() )

Is that dangerous to use wait?
The reason I use wait is because I experienced some trouble without it -if I remember correctly.

Anything wrong with this?
 

EdgeOfChaos

E

EdgeOfChaos

Shouldn't be a problem... but why would you wait before destroying? There aren't any benefits.
 
Level 8
Joined
Oct 2, 2013
Messages
288
I thought so. Not sure why I put it there. My first thought was that I might previously have experienced some bugs. But I guess I got it wrong.

Anyway, thx :)
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
DestroyTrigger is reported to cause bugs under certain conditions, especially if the trigger is sleeping. I do not really see how it's worthwhile to delete a couple of static triggers that won't ever occur again, for you do not even erase the functions, only a bit of linkage.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
It free's up memory therefore is worth doing if you know how to do so.

Yeah, wow, that totally makes up for the thousands of triggers I have to setup anyway for dynamic invocation.

Make sure to never call a destroyed trigger. In your code when you try to run a trigger put that in an ITE and check I the trigger is null before trying to run it to prevent any possible chance of bugs.

Destroying an object does not set the remaining variables pointing to it to null. null-check != destroyed-check
 
Status
Not open for further replies.
Top