@crabas_sakti I apologize crabas, I gave you the wrong damage reduction formula.
I thought damage reduction was (1-armorreduction)^armor
If we follow
@Dr Super Good 's damage reduction formula, we would have
For positive Armor,
damage reduction =((armor)*0.06)/(1+0.06*(armor))
So, if we deal 100 chaos damage to our unit, and it takes y damage, we have
y = 100 * (1 - (z * k)/(1+ (z * k)))
where z is your armor and k is 0.06, the reduction constant
y/100 = 1 - ((zk)/1+zk)
y/100 - 1 = - 1/((1/zk) + 1)
((y/100) - 1) ((1/zk) + 1) = - 1
(1/zk) ((y/100) - 1) = - y/100
1/z = k((- y/100)/(y/100 - 1))
z = 1 / (k((- y/100)/(y/100 - 1)))
Which would be your armor. If you were doing the triggers as I told you beforehand, erase them, here's the fresh (and hopefully more correct) way:
Event - whatever event you want to check the armor for
Actions
Set unitCheckUnit = the unit you want to check armor for
Set realCurrLife = current life of CheckUnit
save the current life of the checked unit
Set life of CheckUnit to (Life of CheckUnit + 100)
add some hp to the checked unit so it doesn't die
Set realy = current life of CheckUnit
Cause (some dummy unit) to damage CheckUnit for 100 chaos damage
Set realy = realy - current life of CheckUnit
check the damage really taken by the unit after we have dealt it 100 chaos damage
(y will be some value between 0 and 100)
ONLY WORKS WITH POSITIVE ARMOR VALUES
Set realArmor = 1 / ( ( 0.06 * ( - realy / 100 ) ) / ( ( realy / 100 ) - 1 ) )
We calculate the armor using the formula
Set life of CheckUnit to realCurrLife
Give our unit it's original life value back
Again, many apologies for my first false statement. Confused the armor system with another game I play.
This should be correct.
Convert realArmor to an integer if needed, retrieve your armor value.
Cheers!
PS; this should also only work for positive armor values.