WoW:API UnitCreatureType

From AddOn Studio
Revision as of 19:52, 2 August 2006 by WoWWiki>Kneeki
Jump to navigation Jump to search

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