[Trigger] Need help with on die spell

Status
Not open for further replies.
Level 5
Joined
Mar 16, 2013
Messages
108
Hello, i need help with this GUI trigger! cant make it work.
My zombies lose mana when they're not in combat. When they get any damage, they win some mana. The idea was that when a zombie dyes, if he have more than certain amount of mana, he explodes causing some dmg to nearby units, but i dont manage to make it explode.


  • Zombie Explosion
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Zombie
      • (Unit-type of (Dying unit)) Equal to Zombie (Menor)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Dying unit)) Greater than or equal to 85.00
        • Then - Actions
          • Special Effect - Create a special effect at (Position of (Dying unit)) using war3mapImported\BloodSlam.mdx
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Dying unit)) matching (((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Dying unit) to damage (Picked unit), dealing (30.00 + ((Max life of (Picked unit)) x 0.16)) damage of attack type Spells and damage type Normal
        • Else - Actions


ill be waiting for answers, thank you very much!
 
Level 5
Joined
Mar 16, 2013
Messages
108
my bad yall, i had two conditions. Put them on Or - Any to make it work
  • Or - Any (Conditions) are true
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Zombie
      • (Unit-type of (Triggering unit)) Equal to Zombie (Menor)

should ill delete this post?
 

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,166
I would store the Dying unit in a unit variable:
  • Set Variable Zombie = (Dying unit)
Also, you don't need an If Then Else, you can just put the Mana condition with the rest of the other conditions (outside of the OR block).

Lastly, you're leaking two Points when you use (Position of (Dying unit)). A simple fix:
  • Actions
    • Set Variable Zombie = (Dying unit)
    • Set Variable ZombiePoint = (Position of Zombie)
    • Special Effect - Create a special effect at ZombiePoint using war3mapImported\BloodSlam.mdx
    • Special Effect - Destroy (Last created special effect)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 300.00 of ZombiePoint) matching (((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Cause Zombie to damage (Picked unit), dealing (30.00 + ((Max life of (Picked unit)) x 0.16)) damage of attack type Spells and damage type Normal
    • Custom script: call RemoveLocation(udg_ZombiePoint)
 
Level 5
Joined
Mar 16, 2013
Messages
108
Thanks!!! it means a lot. Didnt notice it
I would store the Dying unit in a unit variable:
  • Set Variable Zombie = (Dying unit)
Also, you don't need an If Then Else, you can just put the Mana condition with the rest of the other conditions (outside of the OR block).

Lastly, you're leaking two Points when you use (Position of (Dying unit)). A simple fix:
  • Actions
    • Set Variable Zombie = (Dying unit)
    • Set Variable ZombiePoint = (Position of Zombie)
    • Special Effect - Create a special effect at ZombiePoint using war3mapImported\BloodSlam.mdx
    • Special Effect - Destroy (Last created special effect)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 300.00 of ZombiePoint) matching (((Matching unit) belongs to an enemy of Player 4 (Purple)) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Cause Zombie to damage (Picked unit), dealing (30.00 + ((Max life of (Picked unit)) x 0.16)) damage of attack type Spells and damage type Normal
    • Custom script: call RemoveLocation(udg_ZombiePoint)
 
Status
Not open for further replies.
Top