WoW:API UnitIsFriend: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(added: if not (UnitIsFriend("player","target")))
(upgraded deprecated template)
Line 1: Line 1:
{{wowapi}}
This function will determine if the target is friendly towards you (i.e. is green if you target it). It has nothing to do with whether you have added the unit to your friends list or not.
This function will determine if the target is friendly towards you (i.e. is green if you target it). It has nothing to do with whether you have added the unit to your friends list or not.


Line 17: Line 18:


:;Not IsFriend : /script if not (UnitIsFriend("player","target")) then SendChatMessage("%t is evil!","SAY","Orcish"); end; <br> This is to find if the target not is friendly with you (enemy). If you target an unfriendly target with the name "60Mage" this script will write "60Mage is evil!" in /s.
:;Not IsFriend : /script if not (UnitIsFriend("player","target")) then SendChatMessage("%t is evil!","SAY","Orcish"); end; <br> This is to find if the target not is friendly with you (enemy). If you target an unfriendly target with the name "60Mage" this script will write "60Mage is evil!" in /s.
----
{{template:WoW API}}

Revision as of 18:10, 6 January 2007

WoW API < UnitIsFriend

This function will determine if the target is friendly towards you (i.e. is green if you target it). It has nothing to do with whether you have added the unit to your friends list or not.

Parameters

Function

UnitIsFriend
UnitIsFriend("unit","otherunit")
Determine whether a unit is friendly with you or not.

Arguments

unit
String - The UnitId of the first unit.
otherunit
String - The UnitId of the unit to compare with the first unit.

Returns

IsFriend
Returns either nil or 1, not a boolean value.
If the second parameter is "target" and nothing is targeted, this function returns nil.

Example

IsFriend
/script if (UnitIsFriend("player","target")) then AssistUnit("target"); end
This will determine if your target is friendly, and if it is assist.
Not IsFriend
/script if not (UnitIsFriend("player","target")) then SendChatMessage("%t is evil!","SAY","Orcish"); end;
This is to find if the target not is friendly with you (enemy). If you target an unfriendly target with the name "60Mage" this script will write "60Mage is evil!" in /s.