WoW API: UnitCanAssist

Revision as of 04:47, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API UnitCanAssist to API UnitCanAssist without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WoW API < UnitCanAssist

Indicates whether the first unit can assist the second unit.

canAssist = UnitCanAssist(unitToAssist, unitToBeAssisted);

ParametersEdit

ArgumentsEdit

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")

ReturnsEdit

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

ExampleEdit

  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

ResultEdit

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