Jump to content
Toggle menu
  • 17.3K articles
  • 8.2K files
  • 5 users
  • 280.7K edits
WoW Classic Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

API UnitCreatureType

From WoW Classic Wiki

Returns the creature type of the specified unit -- "Humanoid", "Demon", "Beast" or nil.

  local creatureType = UnitCreatureType(unit)



Arguments

UnitId
The unit name (e.g. "target", "mouseover", "player")

Returns

creatureType
A string representing the creature type or nothing if no target or invalid specification.

Examples


  DEFAULT_CHAT_FRAME:AddMessage(UnitCreatureType('target'))

Result

Prints the creature type to your default message window of whatever you have targeted.
-or-
  if (UnitCreatureType("target") == "Humanoid") then 
     CastSpellByName("Sap(Rank 3)")
  end

Result

If the creature targeted is a Humanoid and you are a rogue with Sap, Rank 3 -- it will launch that attack.



Description Returns the creature type of the specified unit -- "Humanoid", "Demon", "Beast" or nil -- if the unit does not have a creature type because you have no target, or the like.



Template:WoW API