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:API UnitIsEnemy
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!
{{wowapi}} This function will determine if the target is hostile towards you. == Parameters == === Function === :;UnitIsEnemy : UnitIsEnemy("unit","otherunit")<br>Determine whether a unit is hostile to you or not. === Arguments === :;unit:String - The [[API TYPE UnitId|UnitId]] of the first unit. :;otherunit:String - The [[API TYPE UnitId|UnitId]] of the unit to compare with the first unit. === Returns === ;IsEnemy: true or false, boolean.<br>If the second parameter is "target" and nothing is targeted, this function returns <tt>nil</tt>. === Example === :;IsEnemy : /script if (UnitIsEnemy("player","target")) then DEFAULT_CHAT_FRAME:AddMessage( "target health ="..UnitHealth("target") ); end <br> This will determine if your target is hostile, and if it is, it will print the target's health to the chat frame. :;Not IsEnemy : /script if not (UnitIsEnemy("player","target")) then SendChatMessage("Don't shoot! It's %t!","SAY"); end; <br> This is to find if the target is not hostile with you (friendly). If you target an friendly target with the name "60Mage" this script will write "Don't shoot! It's 60Mage!" in /s, using your faction's default language.
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)
Templates used on this page:
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Tocright
(
edit
)
Template:Wowapi
(
edit
)