• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

GetArmor() - Does this exist and how to use it ?

Status
Not open for further replies.

Ardenian

A

Ardenian

I recall seeing somewhere that there is something like
JASS:
GetArmor()
to get a unit's armor, is this true and can it be used in GUIJASS/GUI with the common WE ?
It is not listed in the JASS API Manual, so I wondered whether there is a way to get a unit's armor value without keeping track of everything.
 
Keep in mind that such systems create heavy overhead as they use a test dummy that damages a unit, then do the maths to get the armor value by the amount of damage dealt.

The best idea is to keep track of all abilities/buffs (like devotion aura or inner fire) and stats that modify armor (like agility, which get be get via triggers) in your map manually, then calculate the armor of the unit based on these informations.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Also keep in mind that such GetArmor systems are bogus. They use some completely unreliable method which might return the correct value but can bug in a thousand cases.

The only ways are either saving all buffs/upgrades/etc or having everything emulated by a DDS.
 

Ardenian

A

Ardenian

Ahh, then it is the good old story Idon'tuseJNGPnordoIunderstandJASS/vJASS.

Thanks, Bribe, Zwiebelchen and Ezekiel12, I will see what solution I choose.
It is sad to not have a simple command and I wonder why there isn't such by default.

or use Bonus Mod to apply, read, change/reset (additional only) armor
it is 'half-solution' but easy to do
This is actually a quite good idea, since you don't get armor with hero stats, in my map.
Therefore, it should be easy to count them based on the BonusMod/CSS I use.
Thanks!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
The best idea is to use SC2 where such a function does exist. However on second thought that is also a rather silly idea...

Most accurate -> mod/buff tracking system to get armor by keeping track of base armor and all modifiers
Fastest -> Deal damage to unit and work out armor based on reduction. Might run into accuracy problems and conflicts with DDS systems.

The problem with keeping track of armor is that you need to feed in the initial armor values of all possible units into the trigger system and then also feed in the armor modifiers of all possible buffs. Since you cannot get all buffs on a unit (another feature SC2 has) you will need to test for all possible armor modifying buffs which is O(n) with the number of armor modifying buffs created and hence very slow. Armor from agility is easy to compute but one must remember it is fractional armor although it appears as an integer in the UI.

The problem with dealing damage to a unit is there are so many situations which could cause the result to be inaccurate. Eg if the unit has mana shield active, has extra damage reduction against that kind of attack or is subject to a DDS system. Negative armor requires computation with a Logarithm function which is slow and possibly inaccurate due to no native support but that still has a finite complexity which is as good as O(1).
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You are just lucky that tome of armor doesnt exist... I actually hoped it did.
Base armor and upgrades etc are also quite harsh on the calculation.

Either simulate damage and calculate the reduction, or use a stat system and load the variable.
 
Status
Not open for further replies.
Top