• 🏆 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!

[General] Difference between Destroy Trigger and Turn Off trigger

Status
Not open for further replies.
Level 12
Joined
Jan 4, 2014
Messages
543
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,205
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