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

[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