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

[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 66
Joined
Aug 10, 2018
Messages
6,739
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 40
Joined
Feb 27, 2007
Messages
5,129
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