WoW API: TargetUnit

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

WoW API < TargetUnit

Selects the specified id as the current target.

TargetUnit("unit");

Parameters[edit]

Arguments[edit]

("unit")
unit
String - The unitId to select as a target.

Returns[edit]

nil

Example[edit]

When the player changes his target there is a small delay before the global variable 'playertarget' is updated. This can be exploited and used for restoring your old target.
TargetUnit("unit")
CastSpell()
TargetUnit("playertarget")

Result[edit]

This will restore your old target because of the delay. It will not clear your target if you didnt have one.

Details[edit]

Selects the specified id as the current target. One can use any of the defined unitId values.