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

[Trigger] Damage Detection Crash

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
Anyone know why this crashes my game?

  • Giantslayer Thing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Giantslayer for (Attacking unit)) Greater than 0
      • ((Triggering unit) is An Ancient) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in GSGroup) Equal to True
        • Then - Actions
        • Else - Actions
          • Unit Group - Add (Triggering unit) to GSGroup
          • Trigger - Add to Giantslayer <gen> the event (Unit - (Triggering unit) Takes damage)
          • Trigger - Turn on Giantslayer <gen>
  • Giantslayer
    • Events
    • Conditions
    • Actions
      • Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Life of (Triggering unit)) x 0.05) damage of attack type Pierce and damage type Normal
      • Trigger - Turn off (This trigger)
 
The action "Unit - Cause damage source to damage..." fires the event for that trigger "Unit takes damage"... So it causes an infinite loop and eventually crashes. The fix is to add "Trigger - Turn off (This trigger)" and enable around the action:
  • Trigger - Turn off (This trigger)
  • Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Life of (Triggering unit)) x 0.05) damage of attack type Pierce and damage type Normal
  • Trigger - Turn on (This trigger)
Or in your case, you can just move the turn off to the top and that will be it since you disable it at the end anyway.
 
Status
Not open for further replies.
Top