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

Armor bonus per percentage of life lost

Status
Not open for further replies.
Level 2
Joined
Nov 4, 2018
Messages
11
Hey guys, i been failing to accomplish this. Im trying to create a passive skill that grants the hero 1 point of armor for every 20% of missing health.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Make an item ability based on the armor bonus from ring of protection or whatever. Give it 6 levels with each level being 0, 1, 2, 3, 4, 5 armor. Give this ability to the unit in its Object Editor list of abilities; item abilities don't usually show up on the unit's command card but if you can see it there set its button position in the OE to (0,-11) and you can hide it (shift + double-click to enter a negative value). Then you periodically check this unit with a trigger and update the level of the ability as necessary to match its current missing HP.
  • Events
    • Time - Every 1.00 seconds of game-time //pick an update period, not too fast is recommended
  • Conditions
  • Actions
    • Set LifeMissing = 100.00 - (Percentage life of (UNIT_VARIABLE))
    • Set Level = Integer(LifeMissing / 20.00) + 1
    • Unit - Set level of ARMOR_ABILITY for UNIT_VARIABLE to Level
 
Level 2
Joined
Nov 4, 2018
Messages
11
Make an item ability based on the armor bonus from ring of protection or whatever. Give it 6 levels with each level being 0, 1, 2, 3, 4, 5 armor. Give this ability to the unit in its Object Editor list of abilities; item abilities don't usually show up on the unit's command card but if you can see it there set its button position in the OE to (0,-11) and you can hide it (shift + double-click to enter a negative value). Then you periodically check this unit with a trigger and update the level of the ability as necessary to match its current missing HP.
  • Events
    • Time - Every 1.00 seconds of game-time //pick an update period, not too fast is recommended
  • Conditions
  • Actions
    • Set LifeMissing = 100.00 - (Percentage life of (UNIT_VARIABLE))
    • Set Level = Integer(LifeMissing / 20.00) + 1
    • Unit - Set level of ARMOR_ABILITY for UNIT_VARIABLE to Level
Great dude, works perfect. I can even do more things with that. Thank you.
 
Status
Not open for further replies.
Top