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

Wc3 closes by using this?

Status
Not open for further replies.
Level 15
Joined
Sep 27, 2009
Messages
669
My wc3 closes when i use item that is triggered by this trigger:
  • Counter
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Counter Bones ) Equal to True
    • Actions
      • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (1.50 x GDD_Damage) damage of attack type Spells and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GDD_Damage Greater than 50.00
        • Then - Actions
          • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + 5.00)
        • Else - Actions
It should return damage to attacker, but when i do an item and someone hits me, wc3 closes... :vw_wtf:
 
You are causing an infinite loop. GDD_Event becomes 0.00 when a unit is damaged. In that trigger, you use this line:
  • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (1.50 x GDD_Damage) damage of attack type Spells and damage type Normal
That causes the trigger to fire again and again because a unit is constantly damaged. It causes an infinite loop and it crashes. :)

To fix it, just do this:
  • Counter
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Counter Bones ) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (1.50 x GDD_Damage) damage of attack type Spells and damage type Normal
      • Trigger - Turn on (This trigger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GDD_Damage Greater than 50.00
        • Then - Actions
          • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + 5.00)
        • Else - Actions
It will prevent the event from being fired from that damage. ;D
 
Status
Not open for further replies.
Top