Wikia

WoWWiki

Changes: API UnitPlayerControlled

Edit

Back to page

m
 
Line 8: Line 8:
 
:("unit")
 
:("unit")
   
:;unit : String - The [[API TYPE UnitId|UnitId]] to select as a target.
+
:;unit : String - The [[API TYPE UnitId|UnitId]] to select as a target. Using a unit's name as the unit ID only works if the unit is a member of your party.
   
 
=== Returns ===
 
=== Returns ===

Latest revision as of 10:20, November 29, 2009

WoW API < UnitPlayerControlled

Return whether the "unit" is controlled by a player or an NPC.

UnitIsPlayerControlled = UnitPlayerControlled("unit")

Parameters Edit

Arguments Edit

("unit")
unit 
String - The UnitId to select as a target. Using a unit's name as the unit ID only works if the unit is a member of your party.

Returns Edit

UnitIsPlayerControlled
UnitIsPlayerControlled 
Boolean - Returns true if the "unit" is controlled by a player.
Returns false if the "unit" is an NPC.

Example Edit

if (UnitPlayerControlled("target")) then
  DEFAULT_CHAT_FRAME:AddMessage("Your selected target is a player.",1,1,0)
else
  DEFAULT_CHAT_FRAME:AddMessage("Your selected target is an NPC.",1,1,0)
end

Info Edit

DEFAULT_CHAT_FRAME:AddMessage("text",r,g,b) Edit

ScrollingMessageFrame:AddMessage("text",r,g,b,id) 
Valid Frame names:
DEFAULT_CHAT_FRAME
ChatFrame1 - ChatFrame7

Around Wikia's network

Random Wiki