• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Turn off trigger, do something, turn on trigger. Is this a safe method to avoid infinite loops?

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
So, my trigger is working fine. I'm just curious if turning off a trigger, then doing something that would run the trigger's Events, then turning the trigger back on is a safe method to avoid a crash/infinite loop.

  • Destructible Death
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Occlusion height of (Picked destructible)) Greater than 0.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Destructible - Remove (Picked destructible)
          • Trigger - Turn on (This trigger)
        • Else - Actions
      • Else - Actions
In my trigger's case, removing the picked destructible causes the trigger to run again, thus it tries to remove itself over and over again and crashes the game. However, turning the trigger on and off like I did prevents that problem. Is this a safe practice?
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
If you're removing multiple destructibles it is better to disable the trigger, remove all that need to be removed, and then re-enable the trigger. Instead of disable-remove-enable, disable-remove-enable, disable-remove-enable....
 
Status
Not open for further replies.
Top