• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
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