WoW:API UnitCanAttack: Difference between revisions
Jump to navigation
Jump to search
UnitCanAttack -Documentation by danboo-
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<center>'''UnitCanAttack''' ''-Documentation by [[user:danboo|danboo]]-''</center> | <center>'''UnitCanAttack''' ''-Documentation by [[user:danboo|danboo]]-''</center> | ||
Returns | Returns 1 if the first unit can attack the second, nil otherwise. | ||
UnitCanAttack(attacker, attacked); | UnitCanAttack(attacker, attacked); | ||
Line 16: | Line 16: | ||
;''Returns'' | ;''Returns'' | ||
: | :1 if the <tt>attacker</tt> can attack the <tt>attacked</tt>, nil otherwise | ||
---- | ---- | ||
Line 34: | Line 33: | ||
;''Description'' | ;''Description'' | ||
: Returns | : Returns 1 if the first unit can attack the second, nil otherwise. | ||
---- | ---- | ||
{{WoW API}} | {{WoW API}} |
Revision as of 20:10, 18 March 2006
Returns 1 if the first unit can attack the second, nil otherwise.
UnitCanAttack(attacker, attacked);
- Arguments
- (String attacker, Table attacked)
- attacker
- the unit that would initiate the attack (e.g., "player" or "target")
- attacked
- the unit that would be attacked (e.g., "player" or "target")
- Returns
- 1 if the attacker can attack the attacked, nil otherwise
- Example
if ( UnitCanAttack("target", "player") ) then -- Hostile players are red if ( UnitCanAttack("player", "target") ) then TargetFrameNameBackground:SetVertexColor(1.0, 0.0, 0.0); end end
- Result
- If the target can attack the player and the player can attack the target then the target's name will appear red to the player.
- Description
- Returns 1 if the first unit can attack the second, nil otherwise.