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!
If you don't understand
if you want to create a percent on armor, then you would need a decimal number under 1...
Reason being to obtain a decimal number you would divide the number by 100(1/100 = 0.01) that will mean the percent that is reduced damage is 1%
if you would like to calculate how much damage is reduced then...
X will represent the damage being calculated
Z will represent the answer
X * 0.01 = Z
Here is an example
100 * 0.01 = 1
our of 100 DPS only 1 damage will be reduced.....
An easier way to understand
500 damage
56% damage reduction
(1/100 = decimal number)
(56/100 = 0.56)
500 * 0.56 = 280
The answer is how much damage will be reduced...
I think the question wasn't how to check the damage reduction, but how to check the amount of armor a unit has as a real/integer, so if a player has 7 armor, return the value of 7.
How to count unit armor?
Currently you cant find out the armor of a unit with a funciton. Thats a big Problem.
You have to save the armor in an integer. or find a own fucntion
Example:
JASS:
function GetArmorHero takes unit u returns armor
local integer id=GetUnitID(u)
local integer armor = LoadInteger(Yourhashtable,StringHash("Armor"),id)
set armor= armor+(GetHeroAgi(u)*0.0x) // x depends on how much armor your hero gets per agi)
return armor
endfuncion
Depending on your map you may want to chek buffs and items for the exact value =)
STOP double posting, it's against the rules...
You're constantly double posting for no real reason, you even made 2 seperate posts for "make a test map" + "please".
Couldn't you just say that in one post? It cannot be that hard.
ArcanaForce0 is probably right...
Edit: Didn't see SlayerII's post... I can say that his method is by far easier, but doesn't include items and base armor.
His Damage Reduction formula is correct though, but we don't need that afaik.
(Ohh, and you probably don't know JASS xD).
Since you're a "noob", I think this will be hard.
The easiest method I can think of is to create a table that stores all data (such as: Footman has 2 armor, Hero standard -2, ...).
In the same table, you can store things like: "Devotion aura: +1.5 armor".
And "Ring of Protection: +4 armor".
Then, in the trigger where you want to check the damage, you can loop an integer and then do something like this:
If Unit = Footman, then set armor = armor + 2
If Unit has buff Devotion Aura, then set armor = armor + 1.5
If unit has item ring of protection, then set armor = armor + 4.
Umm... yeah, if you've lost me by now, don't even bother to read the rest... I will pour it in trigger-form now.
Melee Initialization
Events
Map initialization
Conditions
Actions
-------- Armor Bonus per Agi --------
Set ArmorAgiBonus = 0.50
-------- Unit Types - Base Armor --------
Set ArmorCount = (ArmorCount + 1)
Set ArmorUnitType[ArmorCount] = Paladin
Set ArmorBonus[ArmorCount] = -2.00
Set ArmorCount = (ArmorCount + 1)
Set ArmorUnitType[ArmorCount] = Footman
Set ArmorBonus[ArmorCount] = 2.00
Set ArmorCount = (ArmorCount + 1)
Set ArmorUnitType[ArmorCount] = Knight
Set ArmorBonus[ArmorCount] = 5.00
-------- Items - Armor Bonus --------
Set ArmorItemCount = (ArmorItemCount + 1)
Set ArmorCount = (ArmorCount + 1)
Set ArmorItemType[ArmorItemCount] = Ring of Protection +1
Set ArmorBonus[ArmorCount] = 1.00
Set ArmorItemCount = (ArmorItemCount + 1)
Set ArmorCount = (ArmorCount + 1)
Set ArmorItemType[ArmorItemCount] = Ring of Protection +4
Set ArmorBonus[ArmorCount] = 4.00
Variables:
Armor: Real - The armor that the unit has (only used in the second trigger).
ArmorAgiBonus: Real - The armor bonus per agility point.
ArmorBonus: Real array - The armor bonus for everything (base armor, item).
ArmorCount: Integer - to count how many values affect the armor.
ArmorItemCount: Integer - To count how many items can affect the armor.
ArmorItemType: Item-type array - The items that can increase the armor.
ArmorUnitType: Unit-type array - The unit that you need to calculate the armor from.
That's not a small list, I know... but there are a lot of factors you need to keep in mind.
A prime example is the buffs: Devotion aura level 1 adds 1.5 armor, while it adds 3.0 armor at level 2, so that's a factor of (0 + (1.5 * Lvl)) - both factors need to be calculated.
The problem here is that I cannot find how to calculate the buff level at the moment, so I did not add buffs in the system.
Actions
For each (Integer LoopInt) from 1 to (ArmorCount - ArmorItemCount)), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to ArmorUnitType[LoopInt]
Then - Actions
Set Armor = ArmorBonus[LoopInt]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A Hero) Equal to True
Then - Actions
Set Armor = (Armor + (ArmorAgiBonus x (Real((Agility of (Triggering unit) (Include bonuses))))))
Else - Actions
For each (Integer LoopInt) from (ArmorCount - (ArmorItemCount + 1))) to ArmorCount, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type ArmorItemType[LoopInt]) Equal to True
Then - Actions
Set Armor = (Armor + ArmorBonus[(LoopInt + (ArmorCount - ArmorItemCount)))])
Else - Actions
Else - Actions
That should calculate the armor of a unit, includes base armor, items and agi.
Once I see where I can find the buff level, I can add that as well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.