• 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.

Get the main attribute of a target

Status
Not open for further replies.
There is no native function for that.

Instead, you can either:
A) Check whichever attribute is the highest. (but this only works for certain heroes, since the primary stat may not necessarily be the highest)
B) Create a database. (just store data for each hero, storing their primary attribute)

I recommend option B since option A doesn't work too often anyway.

Basically, for each hero on your map, you simply store whichever attribute is their primary attribute into a hashtable saved under their unit ID. For example, you could save under the paladin's unit-id "strength". Or something along those lines.

It is tedious, but once you have them all saved, then you can retrieve it just by loading the value stored under a unit's id and see whether it is strength, agility, or intelligence.
 
Level 7
Joined
Oct 11, 2008
Messages
304
Basically MAC just create 3 units and 3 dummies, each unit will be added X value (in this case, 100) to each attribute, so, 1 unit will get 100 strength, other 1 unit will get 100 agility and the last 1 unit will get 100 intelligence.

Then each unit will attach 1 dummy.

Then I check what is the lowest life (based on the dummies).

Then I register the value to a database :p, you can do it with GUI and a Hashtable.
 
Level 7
Joined
Oct 11, 2008
Messages
304
By default, Primary Attribute give bonus damage to the hero.

The dummy with lowest life is the dummy which takes more damage.

Obvious this method will fail if you remove that feature. But this is the only way to detect the Primary Attribute of some hero using all the features of Warcraft.
 
Level 11
Joined
Nov 15, 2007
Messages
800
You could also use point value, if you aren't using it for something else. I.E., set the point value of strength heroes to 1, agility heroes to 2, and intelligence heroes to 3, since you can reference point value in triggers and it doesn't really have much of a function by default.

Laiev's method is pretty ingenious though.
 
Status
Not open for further replies.
Top