Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ClearTarget

From RoR Wiki
Revision as of 19:41, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Target functions
Version: WAR 1.4.8

Clears the player's hostile or friendly target.

ClearTarget(targetType)

Arguments

targetType
number – Which target to clear: GameData.TargetType.HOSTILE or GameData.TargetType.FRIENDLY. Only the values 0 and 1 are accepted.

Returns

Nothing.

Details

  • The client takes the object in the given target slot and removes that object from both the hostile and the friendly slot.
  • If the slot is empty, nothing happens.
  • If there is no player object, nothing happens.

Errors

  • Error in Function Call 'ClearTarget': Invalid Target Type. – targetType is not 0 or 1.
  • The generic Invalid Parameters message when the argument is missing or not a number.

Example

From easystem_windowutils/source/windowutils.lua (the Escape key handler):

if( TargetInfo:UnitName(TargetInfo.HOSTILE_TARGET) ~= L"" )
then
    ClearTarget( GameData.TargetType.HOSTILE )
    return
end

See also