Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:World of Warcraft API
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Unit === These are functions which act on one or more units. Units are identified by [[UnitId]]s. :PROTECTED {{id|API|AssistUnit}}("unit") - Instructs your character to assist the specified unit. :{{id|API|CheckInteractDistance}}("unit",distIndex) :{{id|API|DropItemOnUnit}}("unit") - Drops an item from the cursor onto a unit. :{{id|API|FollowUnit}}("unit") - Follow an ally with the specified UnitID :PROTECTED {{id|API|FocusUnit}}("unit") - Sets your unit for focus. (protected 2.0) :PROTECTED {{id|API|ClearFocus}}() - Removes any focus you may have set. :UI {{id|API|GetUnitName}}("unit", showServerName) - Returns a string with the unit's name and realm name if applicable. :{{id|API|GetUnitPitch}}("unit") - Returns the moving pitch of the unit. (added 3.0.2) :{{id|API|GetUnitSpeed}}("unit") - Returns the moving speed of the unit. (added 3.0.2) :{{id|API|InviteUnit}}("name" or "unit") - Invites the specified player to the group you are currently in (added 2.0) :{{id|API|IsUnitOnQuest}}(questIndex, "unit") - Determine if the specified unit is on the given quest. :{{id|API|SpellCanTargetUnit}}("unit") - Returns true if the spell awaiting target selection can be cast on the specified unit. :PROTECTED {{id|API|SpellTargetUnit}}("unit") - Casts the spell awaiting target selection on the specified unit. :PROTECTED {{id|API|TargetUnit}}("unit") - Selects the specified unit as the current target. (protected 2.0) :{{id|API|UnitAffectingCombat}}("unit") - Determine if the unit is in combat or has aggro. returns nil if "false" and 1 if "true". :{{id|API|UnitArmor}}("unit") - Returns the armor statistics relevant to the specified unit. :{{id|API|UnitAttackBothHands}}("unit") - Returns information about the unit's melee attacks. :{{id|API|UnitAttackPower}}("unit") - Returns the unit's melee attack power and modifiers. :{{id|API|UnitAttackSpeed}}("unit") - Returns the unit's melee attack speed for each hand. :{{id|API|UnitAura}}("unit", index [, filter]) - Returns info about buffs and debuffs of a unit. :{{id|API|UnitBuff}}("unit", index [,raidFilter]) - Retrieves info about a buff of a certain unit. (updated 2.0) :{{id|API|UnitCanAssist}}("unit", "otherUnit") - Indicates whether the first unit can assist the second unit. :{{id|API|UnitCanAttack}}("unit", "otherUnit") - Returns true if the first unit can attack the second, false otherwise. :{{id|API|UnitCanCooperate}}("unit", "otherUnit") - Returns true if the first unit can cooperate with the second, false otherwise. :{{id|API|UnitClass}}("unit") - Returns the class name of the specified unit (e.g., "Warrior" or "Shaman"). :{{id|API|UnitClassification}}("unit") - Returns the classification of the specified unit (e.g., "elite" or "worldboss"). :{{id|API|UnitCreatureFamily}}("unit") - Returns the type of creature of the specified unit (e.g., "Crab"). :{{id|API|UnitCreatureType}}("unit") - Returns the classification type of creature of the specified unit (e.g., "Beast"). :{{id|API|UnitDamage}}("unit") - Returns the damage statistics relevant to the specified unit. :{{id|API|UnitDebuff}}("unit", index [,raidFilter]) - Retrieves info about a debuff of a certain unit. (updated 2.0) :{{id|API|UnitDefense}}("unit") - Returns the base defense skill of the specified unit. :{{id|API|UnitDetailedThreatSituation}}("unit", "[[unitId|mob]]") - Returns detailed information about the specified unit's threat on a mob. (added 3.0) :{{id|API|UnitExists}}("unit") - Returns 1 if the specified unit exists, nil otherwise. :{{id|API|UnitFactionGroup}}("unit") - Returns the faction group id and name of the specified unit. (eg. "Alliance") - string returned is localization-independent (used in filepath) :{{id|API|UnitGroupRolesAssigned}}("unit") - Returns the assigned role in a group formed via the Dungeon Finder Tool. (added 3.3) :{{id|API|UnitGUID}}("unit") - Returns the GUID as a string for the specified unit matching the GUIDs used by the new combat logs. (added 2.4) :{{id|API|GetPlayerInfoByGUID}}("guid") - returns race, class, sex about the guid. client must have seen the guid. (added 3.2) :{{id|API|UnitHasLFGDeserter}}("unit") - Returns whether the unit is currently unable to use the dungeon finder due to leaving a group prematurely. (added 3.3.3) :{{id|API|UnitHasLFGRandomCooldown}}("unit") - Returns whether the unit is currently under the effects of the random dungeon cooldown. (added 3.3.3) :{{id|API|UnitHasRelicSlot}}("unit") :{{id|API|UnitHealth}}("unit") - Returns the current health, in points, of the specified unit. :{{id|API|UnitHealthMax}}("unit") - Returns the maximum health, in points, of the specified unit. :{{id|API|UnitInParty}}("unit") - Returns true if the unit is a member of your party. :{{id|API|UnitInRaid}}("unit") - Returns the unit index if the unit is in your raid/battlegroud, nil otherwise. :{{id|API|UnitInBattleground}}("unit") - Returns the unit index if the unit is in your battleground, nil otherwise. :{{id|API|UnitIsInMyGuild}}("unit") - Returns whether the specified unit is in the same guild as the player's character. :{{id|API|UnitInRange}}("unit") - Returns true if the unit (party or raid only) is in range of a typical spell such as flash heal. (added 2.4)) :{{id|API|UnitIsAFK}}("unit") - Only works for friendly units. :{{id|API|UnitIsCharmed}}("unit") - Returns true if the specified unit is charmed, false otherwise. :{{id|API|UnitIsConnected}}("unit") - Returns 1 if the specified unit is connected or npc, nil if offline or not a valid unit. :{{id|API|UnitIsCorpse}}("unit") - Returns true if the specified unit is a corpse, false otherwise. :{{id|API|UnitIsDead}}("unit") - Returns true if the specified unit is dead, nil otherwise. :{{id|API|UnitIsDeadOrGhost}}("unit") - Returns true if the specified unit is dead or a ghost, nil otherwise. :{{id|API|UnitIsDND}}("unit") - Only works for friendly units. :{{id|API|UnitIsEnemy}}("unit", "otherUnit") - Returns true if the specified units are enemies, false otherwise. :{{id|API|UnitIsFeignDeath}}("unit") - Returns true if the specified unit (must be a member of your group) is feigning death. (added 2.1) :{{id|API|UnitIsFriend}}("unit", "otherUnit") - Returns true if the specified units are friends (PC of same faction or friendly NPC), false otherwise. :{{id|API|UnitIsGhost}}("unit") - Returns true if the specified unit is a ghost, false otherwise. :{{id|API|UnitIsPVP}}("unit") - Returns true if the specified unit is flagged for PVP, false otherwise. :{{id|API|UnitIsPVPFreeForAll}}("unit") - Returns true if the specified unit is flagged for free-for-all PVP, false otherwise. :{{id|API|UnitIsPVPSanctuary}}("unit") - Returns whether the unit is in a PvP sanctuary, and therefore cannot be attacked by other players. :{{id|API|UnitIsPlayer}}("unit") - Returns true if the specified unit is a player character, false otherwise. :{{id|API|UnitIsPossessed}}("unit") - Returns whether the specified unit is currently under control of another (i.e. "pet" when casting Mind Control). :{{id|API|UnitIsSameServer}}("unit", "otherUnit") - Returns whether the specified units are from the same server. :{{id|API|UnitIsTapped}}("unit") - Returns true if the specified unit is tapped, false otherwise. :{{id|API|UnitIsTappedByPlayer}}("unit") - Returns true if the specified unit is tapped by the player himself, otherwise false. :{{id|API|UnitIsTappedByAllThreatList}}("unit") - Returns whether the specified unit is a community monster, i.e. whether all players engaged in combat with it will receive kill (quest) credit. :{{id|API|UnitIsTrivial}}("unit") - Returns true if the specified unit is trivial (Trivial means the unit is "grey" to the player. false otherwise. :{{id|API|UnitIsUnit}}("unit", "otherUnit") - Determine if two units are the same unit. :{{id|API|UnitIsVisible}}("unit") - 1 if visible, nil if not :{{id|API|UnitLevel}}("unit") - Returns the level of a unit. :{{id|API|UnitMana}}("unit") - Returns the current mana (or energy,rage,etc), in points, of the specified unit. (replaced by 'UnitPower' 3.0.2) :{{id|API|UnitManaMax}}("unit") - Returns the maximum mana (or energy,rage,etc), in points, of the specified unit. (replaced by 'UnitPowerMax' 3.0.2) :{{id|API|UnitName}}("unit") - Returns the name (and realm name) of a unit. :{{id|API|UnitOnTaxi}}("unit") - Returns 1 if unit is on a taxi. :{{id|API|UnitPlayerControlled}}("unit") - Returns true if the specified unit is controlled by a player, false otherwise. :{{id|API|UnitPlayerOrPetInParty}}("unit") - Returns 1 if the specified unit/pet is a member of the player's party, nil otherwise (returns nil for "player" and "pet") (added 1.12) :{{id|API|UnitPlayerOrPetInRaid}}("unit") - Returns 1 if the specified unit/pet is a member of the player's raid, nil otherwise (returns nil for "player" and "pet") (added 1.12) :{{id|API|UnitPVPName}}("unit") - Returns unit's name with PvP rank prefix (e.g., "Corporal Allianceguy"). :{{id|API|UnitPVPRank}}("unit") - Get PvP rank information for requested unit. :{{id|API|UnitPower}}("unit"[,type]) - Returns current power of the specified unit. (replaced 'UnitMana' 3.0.2) :{{id|API|UnitPowerMax}}("unit"[,type]) - Returns max power of the specified unit. (replaced 'UnitManaMax' 3.0.2) :{{id|API|UnitPowerType}}("unit") - Returns a number corresponding to the power type (e.g., mana, rage or energy) of the specified unit. :{{id|API|UnitRace}}("unit") - Returns the race name of the specified unit (e.g., "Human" or "Troll"). :{{id|API|UnitRangedAttack}}("unit") - Returns the ranged attack number of the unit. :{{id|API|UnitRangedAttackPower}}("unit") - Returns the ranged attack power of the unit. :{{id|API|UnitRangedDamage}}("unit") - Returns the ranged attack speed and damage of the unit. :{{id|API|UnitReaction}}("unit", "otherUnit") - Returns a number corresponding to the reaction (aggressive, neutral or friendly) of the first unit towards the second unit. :{{id|API|UnitResistance}}("unit", "resistanceIndex") - Returns the resistance statistics relevant to the specified unit and resistance type. :{{id|API|UnitSelectionColor}}([[UnitId]]) - Returns RGBA values for the color of a unit's name. :{{id|API|UnitSex}}("unit") - Returns a code indicating the gender of the specified unit, if known. (1=unknown, 2=male, 3=female) (updated 1.11) :{{id|API|UnitStat}}("unit", statIndex) - Returns the statistics relevant to the specified unit and basic attribute (e.g., strength or intellect). :{{id|API|UnitThreatSituation}}("unit", "[[unitId|mob]]") - Returns the specified unit's threat status on a mob. (added 3.0) :{{id|API|UnitUsingVehicle}}("unit") - Returns whether the specified unit is currently using a vehicle (including transitioning between seats). :{{id|API|GetThreatStatusColor}}(status) - Returns RGB values for a given UnitThreatSituation return value. :{{id|API|UnitXP}}("unit") - Returns the number of experience points the specified unit has in their current level. (only works on your player) :{{id|API|UnitXPMax}}("unit") - Returns the number of experience points the specified unit needs to reach their next level. (only works on your player) :{{id|API|SetPortraitTexture}}(texture,"unit") - Paint a Texture object with the specified unit's portrait. :{{id|API|SetPortraitToTexture}}(texture or "texture", "texturePath") - Sets the texture to be displayed from a file applying a circular opacity mask making it look round like portraits.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)