WoW:API UnitCanAssist: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New material)
 
m (Move page script moved page API UnitCanAssist to API UnitCanAssist without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
Indicates whether the first unit can assist the second unit.
Indicates whether the first unit can assist the second unit.


  canAssist = UnitCanAttack(unitToAssist, unitToBeAssisted);
  canAssist = UnitCanAssist(unitToAssist, unitToBeAssisted);


==Parameters==
==Parameters==
Line 12: Line 12:


==Example==
==Example==
  -- Added by [[User:FormlessOne|FormlessOne]]
   if (UnitCanAssist("player", "target")) then  
   if (UnitCanAssist("player", "target")) then  
       DEFAULT_CHAT_FRAME:AddMessage("You can assist the target.")
       DEFAULT_CHAT_FRAME:AddMessage("You can assist the target.")

Latest revision as of 04:47, 15 August 2023

WoW API < UnitCanAssist

Indicates whether the first unit can assist the second unit.

canAssist = UnitCanAssist(unitToAssist, unitToBeAssisted);

Parameters[edit]

Arguments[edit]

unitToAssist
UnitId - the unit that would assist (e.g., "player" or "target")
unitToBeAssisted
UnitId - the unit that would be assisted (e.g., "player" or "target")

Returns[edit]

canAssist
Bool - 1 if the unitToAssist can assist the unitToBeAssisted, nil otherwise.

Example[edit]

  if (UnitCanAssist("player", "target")) then 
     DEFAULT_CHAT_FRAME:AddMessage("You can assist the target.")
  else 
     DEFAULT_CHAT_FRAME:AddMessage("You cannot assist the target.")
  end

Result[edit]

A message indicating whether the player can assist the current target is displayed in the default chat frame.