Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Register
Advertisement

Returns true if the unit is controlled by a player.

UnitIsPlayerControlled = UnitPlayerControlled(unit)

Arguments[]

unit
string : UnitId

Returns[]

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

Example[]

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
Advertisement