I need help with this leaking trigger. Would Variables prevent it from crashing?

Level 4
Joined
Aug 11, 2017
Messages
16
I isolated the trigger that made my map crash after some times. Would Variables prevent it from crashing?

  • Unit Killing Bonus
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) is A Hero) Equal to False
      • ((Killing unit) is A structure) Equal to False
      • ((Killing unit) is Summoned) Equal to False
    • Actions
      • Unit - Set Armor of (Killing unit) to ((Armor of (Killing unit)) + 1.00)
      • Unit - Set Dice Number of (Killing unit) to ((Dice Number of (Killing unit) for weapon index 0) + 1) for weapon index: 0
      • Unit - Set Dice Number of (Killing unit) to ((Dice Number of (Killing unit) for weapon index 1) + 1) for weapon index: 1
      • Animation - Change (Killing unit)'s size to (((Armor of (Killing unit)) + 100.00)%, ((Armor of (Killing unit)) + 100.00)%, ((Armor of (Killing unit)) + 100.00)%) of its original size
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Add this and see what happens:
  • Conditions
    • (Killing unit) Not equal to No unit
Remember that units can die without there being a "killer".

Also, this Event in particular is problematic. It doesn't adhere to the normal trigger queue rules and will run it's actions immediately.

Here's an attempt at fixing the trigger:
  • Unit Killing Bonus
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Killing unit) Not equal to No unit
      • ((Killing unit) is A Hero) Equal to False
      • ((Killing unit) is A structure) Equal to False
      • ((Killing unit) is Summoned) Equal to False
    • Actions
      • Set Variable KB_Killer = (Killing unit)
      • Unit - Set Armor of KB_Killer to ((Armor of KB_Killer) + 1.00)
      • Set Variable KB_Size = (Max((Armor of KB_Killer + 100.00)), 100.00)
      • Unit - Set Dice Number of KB_Killer to ((Dice Number of KB_Killer for weapon index 0) + 1) for weapon index: 0
      • Unit - Set Dice Number of KB_Killer to ((Dice Number of KB_Killer for weapon index 1) + 1) for weapon index: 1
      • Animation - Change KB_Killer's size to (KB_Size%, KB_Size%, KB_Size%) of its original size
I prevent KB_Size from ever going below 100%, maybe unnecessary but worth trying since units can have negative armor. Another issue may lie in trying to interact with an unused weapon index, you could try adding an If Then Else to confirm that the unit's weapons are enabled.
 
Last edited:
Level 4
Joined
Aug 11, 2017
Messages
16
Add this and see what happens:
  • Conditions
    • (Killing unit) Not equal to No unit
Remember that units can die without there being a "killer".

Also, this Event in particular is problematic. It doesn't adhere to the normal trigger queue rules and will run it's actions immediately.

Here's an attempt at fixing the trigger:
  • Unit Killing Bonus
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Killing unit) Not equal to No unit
      • ((Killing unit) is A Hero) Equal to False
      • ((Killing unit) is A structure) Equal to False
      • ((Killing unit) is Summoned) Equal to False
    • Actions
      • Set Variable KB_Killer = (Killing unit)
      • Unit - Set Armor of KB_Killer to ((Armor of KB_Killer) + 1.00)
      • Set Variable KB_Size = (Max((Armor of KB_Killer + 100.00)), 100.00)
      • Unit - Set Dice Number of KB_Killer to ((Dice Number of KB_Killer for weapon index 0) + 1) for weapon index: 0
      • Unit - Set Dice Number of KB_Killer to ((Dice Number of KB_Killer for weapon index 1) + 1) for weapon index: 1
      • Animation - Change KB_Killer's size to (KB_Size%, KB_Size%, KB_Size%) of its original size
I prevent KB_Size from ever going below 100%, maybe unnecessary but worth trying since units can have negative armor. Another issue may lie in trying to interact with an unused weapon index, you could try adding an If Then Else to confirm that the unit's weapons are enabled.
Thank you! :D
 
Top