WoW:API UnitCreatureType

From AddOn Studio
Revision as of 07:11, 13 October 2005 by WoWWiki>Markemartin
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

  local creatureType = UnitCreatureType(unit)



Arguments

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