Get Unit's Armor Value?

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,243
Did you use this? It is not limited to any sane value. I don't know whose system it is.
JASS:
library GUA
function GetUnitArmor takes unit u returns real
    local real hp1 = GetUnitState(u, UNIT_STATE_LIFE)
    local real hp2
    local real damage
    call UnitAddAbility(u, 'A000')
    call SetUnitAbilityLevel(u, 'A000', 2)
    call UnitRemoveAbility(u, 'A000')
    set hp2 = GetUnitState(u, UNIT_STATE_LIFE)
    call UnitDamageTarget( u, u, 1000.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
    set damage = hp2 - GetUnitState(u, UNIT_STATE_LIFE)
    call UnitAddAbility(u, 'A000')
    call SetUnitAbilityLevel(u, 'A000', 3)
    call UnitRemoveAbility(u, 'A000')
    call SetUnitState(u, UNIT_STATE_LIFE, hp1)
    if damage > 10.0 then
        set damage = 10.0 - damage
        return (damage-10.0)/(damage*0.06)
    endif
    return (10.0-damage)/(damage*0.06)
endfunction
endlibrary
 
Level 5
Joined
Jun 28, 2010
Messages
110
@pred1980: There is such no proper demonstration in there as well as demo map so i can't use it.

@Maker: I used Daelin's ones, which was written more than 6 years ago i think

Also i found this, which does find no HP limit and no Armor value limit, even its not accurate 100%. For example, i modified a unit to 5000 armor -> display 4991 armor => not a big thing

http://www.hiveworkshop.com/forums/...type-v8-225031/?prev=search=armor&d=list&r=20
 
Status
Not open for further replies.
Top