• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Spell] Healing Nearby units Upon Death

Status
Not open for further replies.
Level 3
Joined
Jun 17, 2012
Messages
46
Hey I have a spell for my hero that basically goes like this:
When a friendly unit near to the hero dies, all units around the hero get healed.

I cannot figure out how to get it to work, any help would be appreciated.
 
  • Death Heal
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 600.00 of TempLoc matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Triggering player)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 300.00)
      • Custom script: call RemoveLocation(udg_TempLoc)
This trigger will heal any allied units within 600 AOE around the dying Hero unit by 300.
TempLoc is Point variable
 
  • Death Heal
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 600.00 of TempLoc matching (((Matching unit) belongs to an ally of (Triggering player)) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 300.00)
            • Else - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 150.00)
      • Custom script: call RemoveLocation(udg_TempLoc)
Normal unit will get healed by 150 and Heroes unit will get healed by 300.
 
It works ALMOST perfect. The problem is that the camera gets moved to the center of the map. Also the units near the hero get healed to full health, but units that aren't even near the hero get healed for the target amount. I can just post the map here if you think it'd help.
 
Wow yea that's almost exactly what I want. However I only want units who die next to the hero with the spell to heal people.
 
I thought it was pretty well explaned... "When a friendly unit near to the hero dies, all units around the hero get healed." But adding that still doesn't change the fact that ANYONE can be healed, they don't have to be near the hero.
 
uhhh no i haven't actually... I'm not sure what's so hard to understand. Let me type the order of events.
1. Hero gets a spell
2. A friendly unit near the hero dies
3. All friendly units near the hero get healed
It's really not that complicated.
 
Yea yea that's it defskull, sorry for taking forever to reply I was asleep. Here's a +rep in advance haha
WhiteDeath I'm not sure why I didn't think of that myself haha hurdur I'll try it out.


EDIT: WhiteDeath what you said worked except that the camera moved to the center of the map when the unit died, which doesn't make any sense, none of my triggers have anything to do with cameras.
 
Last edited:
  • ((Dying unit) has buff BUFF) Equal to True
Dead unit can't have buffs, therefore it won't be detected.

EDIT: WhiteDeath what you said worked except that the camera moved to the center of the map when the unit died, which doesn't make any sense, none of my triggers have anything to do with cameras.
Makes no sense at all.
Do you got other triggers in your map except mine ?
I can assure you that the camera problem is not from my test map.
 
The problem lies within the condition you just made.
You should filter dead units, because when a dead unit is added his HP back, it will returns a null value thus, making the game becomes misinterpret...

I have fixed your map, take a look.

Also, added a nested if-else for more accurate handling of data per each level of buff.
 

Attachments

Status
Not open for further replies.
Back
Top