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

[Trigger] How do you set a reigon to heal a hero?

Status
Not open for further replies.
Level 3
Joined
May 8, 2008
Messages
38
  • Hero Healing
    • Events
      • Unit - A unit enters Red Unit Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
I'm not sure if there is an action that heals your unit at a reasonable rate... how can I do this?

(Oh, and btw, red unit spawn is just a reigon I use to spawn units... I figured I could use the same reigon for this)
 
Level 4
Joined
May 4, 2008
Messages
113
Code:
Events
 Time - Every 1.00 seconds of Game Time

Actions
 Unit Group - Pick every unit in (Units in Red Unit Spawn <gen> matching ((Matching unit is A Hero Equal to True) and (Owner of (Matching unit) Equal to (Player 1 (Red)))) and do (Actions):
 Loop - (Actions):
  Set Life of (Picked unit) to ((Life of (Picked Unit)) + (Life of (Picked unit) / 25))

Heals every hero owned by player 1 red in that region for 4% of their health every second.
 
Level 7
Joined
Oct 24, 2006
Messages
110
Well Ziggy yours works, but you can 'heal' or increase/add the Hero's HP using this method:

  • Hero Healing
    • Events
      • Unit - A unit enters Red Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 100.00[Or any amount of life increase])
Unit - Set Life action sets the unit's current health to the value you've chosen, so that's why I used the formula Life of Unit + Hit Points Healed so that you can actually add/subtract HP to a unit instead of setting it to a fixed value.:grin:

Hope it helped...XD
 
Level 3
Joined
May 8, 2008
Messages
38
just putting that code into GUI format...

  • Events
    • Time - Every 1.00 seconds of Game Time
  • Actions
    • Unit Group - Pick every unit in (Units in Red Unit Spawn <gen> matching ((Matching unit is A Hero Equal to True) and (Owner of (Matching unit) Equal to (Player 1 (Red)))) and do (Actions):
    • Loop - (Actions):
      • Set Life of (Picked unit) to ((Life of (Picked Unit)) + (Life of (Picked unit) / 25))
 
Level 4
Joined
May 4, 2008
Messages
113
Just remember that that trigger has a memory leak. To fix it, you'll need to set the unit group to a variable (ie, Temp_Group) and then destroy it with:

Custom Script: call DestroyGroup(udg_Temp_Group)

Otherwise it may build up to cause lag.
 
Status
Not open for further replies.
Top