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

How do I add a "Unit Type" condition to a Jass function?

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2005
Messages
523
JASS:
function DeathAnnounce_DeathCondition takes nothing returns boolean
    return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true
endfunction

So in that bit I successfully added the condition that the dying unit CLASS is a Hero, but how would I add a condition for, let's say, if the unit is a Footman? Or if the unit is NOT a Rifleman?

Thanks.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The above term "UnitType" is often mistaken/ambiguous. The jass type "unittype", which is used in function "IsUnitType", is more like a flagging as you have seen, a unit can be assigned multiple.

That's why in own naming convention, I prefer to call one UnitType and the other UnitClass.
 
To get the UnitTypeIds (example 'hfoo' for footman) head to unit editor in Object Editor and do Ctrl + D. Rawdata gonna replace everything. Look on unit tree (place to the left, on unit editor window, where all units are listed), unit names will be replaced with thier typeids. Now you can put those into your function.

UnitType - is more a unit classification actually. This actually check for example is unit has classification mechanic, or if it's a building or a hero etc etc.
 
Status
Not open for further replies.
Top