• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[vJASS] Best Way to Get Armour?

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
first, theres no snippet in that post as far as i can tell.

anyway, idk, this might work
JASS:
function GetUnitArmor takes unit u returns real
local real hp = GetUnitState(u, UNIT_STATE_LIFE)
local real damage
call UnitDamageTarget( u, u, 10.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
set damage = hp - GetUnitState(u, UNIT_STATE_LIFE)
call SetUnitState(u, UNIT_STATE_LIFE, hp)
if damage > 10.0 then
set damage = 20.0 - damage
return (damage-10.0)/(damage*0.06)
endif
return (10.0-damage)/(damage*0.06)
endfunction

just remmeber the constants are correct
 
Status
Not open for further replies.
Back
Top