Page MenuHomeFeedback Tracker

[Feature Request] getLockedTarget / setLockedTarget; getLockedState
New, NormalPublic


Description: Returns the target the unit is locked onto much in the way the cursorTarget command works for a player, except that this command returns objNull if there's no target locked; can be used on any units including AI units.

Syntax 1: getLockedTarget Unit ; <OBJECT>

Return: Target ; <OBJECT>

Description:: Forces lock on of a target by the unit (or unlock the target with objNull), using the current weapon, if possible. returns true if able to lock with current weapon, false if the target was unable to lock target with current weapon. If unit is already locked onto another target, unit switches target to new target (returns true). Locking onto the target you were already locked onto returns true. Unlocking targets with objNull returns true always, even if there was no lock.

Syntax 1: Unit setLockedTarget Target ; <OBJECT>, <OBJECT>

Return: Target now locked ; <BOOL>

Description:: Returns a scalar of how 'locked on' the unit's current weapon is, e.g. -1 has no target, 0 is just starting to lock on, 1 is that the projectile will track the target with a valid solution, a decimal is that the weapon has a partial lock, i.e. will not track, but has been held on target enough that it'll be locked on sooner than a new target.

Syntax 1: getLockOnState Unit ; <OBJECT>

Returns: Lock-On State ; <SCALAR>

The command getLockedTarget provides coders access beyond just cursorTarget run locally to determine what a player is locked onto, without having the potential ambiguity of the the cursor of the player pointing generally in the direction of a target that they do not have locked on (and even if they're locked on to anything), as well as gauging lock status of nonPlayer units for scripting of advanced RWRs and fire-control systems.

The command setLockedTarget enables the development of scripted target tracking and selection for various advanced units, with examples including simulating radar auto-lock modes in a conic in front of an aircraft for air-to-air engagement or other boresight target, anti-radar 'self-protection' mode when used in tandem with the getSensorTargets/getSensorThreats command, and target hand-off capabilities to airborne units as a rudimentary augmented datalink system, with additional added 'realism' functionality such as having scripted 'loss of lock' against a tracked target based on their countermeasures and engagement parameters, and many other potential uses similar to these..

The getLockedState command helps facilitate the above two commands, and generally expands the scope of information that a scripter can access, especially for use to react for various active and passive protection systems, as well as information that may be of use in FSMs to govern, and fine tune to extraordinary degree, both target behavior and launch unit behavior based on this lock value.


Operating System
Windows 10 x64

Event Timeline

LLukeL created this task.Aug 8 2022, 9:06 PM