Skip to content

Target Lock Ability

The UCombatAbility_TargetLock ability is responsible for acquiring combat targets. It is integrated with the Target Manager Component, which is responsible for storing the current Combat Target.

Targets are obtained using the Gameplay Targeting System, so you have a lot of flexibility filter and sort potential targets. The first target is then selected and stored.

Once a target is selected, the Ability will track the distance between the Target and the Avatar. If the distance is greater than the value in the DistanceThreshold, then the target is dismissed and the Ability ends. The Target is also discarded if/when it triggers the Death delegate.

This ability is active while a target is selected. During this time, the Gameplay Effect assigned to the TargetLockEffectClass property is also applied to the Avatar. When the Ability ends, the effect is removed and the target is dismissed.

For an in-depth guide of the targeting system, visit the Combat Targets page.

External Events

This task can be activated from external events, meaning you can lock on a target by sending a Gameplay Event with the Combat.Event.Target.Acquired event and dismiss a target with the Combat.Event.Target.Dismissed.

When sending the "Target Acquired" event, make sure to send the actual Actor being targeted as the first Optional Object in the event's payload. If a target is not provided in the payload, the Ability will be cancelled.

Ninja Input Integration

If you are using the Ninja Input plugin, then you can leverage its Input Handlers to toggle the Target Lock Ability. Any activation Handler will work fine, just make sure that the handler is set to toggle the activation.

This will make the Ability activate when the Target Lock key is pressed, and then it will make the Ability end when the key is pressed again.

Target Lock Toggle