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

[Solved] Ability help. Distributing an amount of HP through all nearby units.

Status
Not open for further replies.
Level 8
Joined
Apr 13, 2006
Messages
174
Hi, I want to make a spell that does this:

When you cast spell "Sacrifice" on a unit that has Ability X, the unit will be sacrificed (killed) and it's remaining health will be equally distributed through all allied units within a 450 AoE.

And also, an effect should appear on the healed units.

Can someone create a trigger for me?

Thanks in advance!

Edit: SOLVED!
 
Last edited:
Here:

  • main
    • Events
      • Unit - Starts effect of ability
    • Conditions
      • (Level of ability X for (Target of ability being cast)) Greater than 0
      • (Ability being cast) Equal to Sacrifice
    • Actions
      • Set tempp = (Position of (Target of ability being cast))
      • Set heal = (Life of (Target of ability being cast))
      • Set tempgroup = (Units in 450 of tempp matching (((Matching unit) is an ally to (Triggering player)) Equal to True + < your other conditions >)
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempgroup) Greater than 0
        • Then - Actions
          • Set heal = (heal / (Number of units in tempgroup))
          • Unit Group - Pick every unit in tempgroup and do Actions
            • Loop - Actions
              • Unit - Set Life of (Picked unit) to (Life of (Picked unit) + heal)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempgroup)
      • Custom script: call RemoveLocation(udg_tempp)
Additionaly you can add prevention trigger that stops unit if target does not have ability X:
  • stop
    • Events
      • Unit - Begins casting the ability
    • Conditions
      • (Ability being cast) Equal to Sacrifice
    • Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of ability X for (Target of ability being cast)) Less or equal to 0
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
 
Status
Not open for further replies.
Top