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

[General] Difference between Destroy Trigger and Turn Off trigger

Status
Not open for further replies.
Level 12
Joined
Jan 4, 2014
Messages
548
Hello, I was wondering if anyone could give me some insight between destroy trigger and turn off trigger. Which is better if know that i will never be using a specific trigger again? I'm seeking to reduce any possible lag, so what I normally do is turn of the triggers. My reasoning is the trigger is off, so the game will never check the Event, therefore less crap is running in the back ground.

I have noticed that periodic event triggers that are turned off such as (Every 10 seconds >>> Action), seem to continue rolling the periodic timer in the background despite not running any actions. I say this because I have a periodic trigger (every 60 seconds >>> Action) that is off until somewhere around one hour into my map and it causes the first activation of the actions to be done anywhere between 1 to 60 seconds after the trigger is turned off.

Also wondering if there is any down-side to destroying triggers that I know I will never use again.

Also how exactly does the destroy trigger command work.
let's say my trigger name is "killunits" is the code
Custom script: call DestroyTrigger( killunits() )

Thank you
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Turning a trigger off should deregister the event listeners and hence make the trigger have little to no overhead. Periodic triggers might align their expiration times to allow for staggering/higher performance, this does not mean they still produce overhead when turned off unless otherwise proved.

Destroying a trigger frees resources associated with the trigger object. Once this is done, the trigger object is gone for good and will need to be recreated and reassigned to any variables that you need to reference it. Destroying triggers has been known to cause crashes under some circumstances but these were never explained clearly and might have been patched.

let's say my trigger name is "killunits" is the code
Custom script: call DestroyTrigger( killunits() )
It is not a function but a variable. You need to reference the GUI created trigger variable that is assigned the trigger object. You can get the name by temporarily converting the GUI to JASS (custom script) and then looking at the initialization function where the trigger is created.
 
Status
Not open for further replies.
Top