API:ClearTarget
From RoR Wiki
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.HOSTILEorGameData.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.–targetTypeis 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
