Tune targeting¶
Designer · 30 min · No code
Result: lock-on reaches as far as you want, the character faces its target only when close, out-of-reach Arts make the character run in the way you like, the target marker looks right, and enemies notice the party at the distances you choose.
Before you start¶
- Controls: how to lock on, cycle targets and leave target mode.
- Glossary: Target mode, Engage, Aggro.
Where targeting is set¶
| What | Asset |
|---|---|
| Lock-on range | Battle/Targeting/GA_XenoCore_TargetMode, Class Defaults |
| Line of sight, on-screen rule | Nodes inside GA_XenoCore_TargetMode's graph |
| Facing, camera focus, running in for Arts, marker, arrows, HUD widgets | GA_XenoCore_TargetMode, Class Defaults |
| When enemies notice, chase and give up | Characters/Enemies/Core/BP_AIC_XenoCore_Enemy, Class Defaults, with per-enemy overrides on the enemy |
Steps¶
1. Lock-on range¶
Open GA_XenoCore_TargetMode, click Class Defaults, and find XenoCore › Targeting › Range:
| Setting | Default | What it does |
|---|---|---|
| Lock Acquire Range | 3000 |
How far away, in cm, a target can be locked onto or cycled to |
| Lock Keep Range | 3000 |
How far away a locked target can go before the lock drops. Never less than Lock Acquire Range |
Set Lock Keep Range a little above Lock Acquire Range (for example 3000 and 3500) so a
target picked at the edge is not dropped the moment it steps back.
The two cannot cross: editing either one in Class Defaults pushes the other so keep stays at or above acquire, the data validator reports a saved asset where they differ the wrong way, and the graph reads keep through a getter that never returns less than acquire.
The graph's Step Target From and Is Target Still Valid nodes read these settings through Get Lock Acquire Range and Get Lock Keep Range. Leave those pins wired.
On the same two nodes, Require Line Of Sight drops targets behind walls, and Require On Screen (on Step Target From) ignores enemies you cannot see. These are still node pins: change them in the graph, then Compile and Save.
2. Facing while locked¶
Under XenoCore › Target Mode in Class Defaults:
| Setting | Default | What it does |
|---|---|---|
| Strafe While Locked | on | Face the target while close, side-stepping and backpedalling instead of turning |
| Strafe Max Range | 400 |
"Close" means within this, in cm. Beyond it you run normally even while locked |
| Strafe Range Release Scale | 1.2 |
Hysteresis: facing lets go only at 1.2 × the range, so the boundary does not flicker |
| Retreat Dot Threshold | -0.9 |
Only moving almost straight away counts as backing off; any diagonal turns and runs |
| Strafe Stationary Speed | 20 |
Below this speed you count as standing still, and keep facing |
| Strafe Evaluate Interval | 0.05 |
How often facing is re-checked, in seconds |
| Camera Focus Duration | 0.3 |
When a fight starts, the camera eases onto the target once over this time, then lets go. 0 turns it off |
Keep Strafe Max Range a little inside the auto-attack's Attack Range (Tune auto-attacks), so "close" means "trading blows".
3. Running in for an out-of-reach Art¶
Confirming an Art whose target is beyond its Distance makes the character run in and strike on arrival. Under XenoCore › Targeting › Approach:
| Setting | Default | What it does |
|---|---|---|
| Approach Timeout | 4 |
Give up after this many seconds. Nothing is spent |
| Approach Arrive Margin | 60 |
Stop this far inside the Art's Distance, so a target stepping back is still in reach |
| Approach Stick Cancel | 0.35 |
Pushing the stick past this cancels the run. Nothing is spent |
| Approach Move Action | Lyra's IA_Move |
The action read to tell the player's stick from the run's own steering |
4. The marker and arrows¶
Under XenoCore › Targeting:
- Target Indicator Material, Target Indicator Size (
250), Target Indicator Height Fraction (0.35of the target's capsule half-height), Target Indicator Screen Space Size (off: the marker shrinks with distance). - Offscreen Arrow Material, Offscreen Arrow Mesh, Arrow Screen Edge Inset (
0.88), Arrow Camera Distance (200), Arrow Screen Size Fraction (0.16), Invert Arrow Direction. An empty arrow material means no arrows. - Target Acquired Sound: a 2D sound played on lock.
- Target Plate Class, Player Plate Class, Arts Palette Class: the three HUD widgets that exist only while locked. Swap in your own children of these widgets to restyle them.
5. When enemies notice the party¶
Open BP_AIC_XenoCore_Enemy, Class Defaults › XenoCore › AI:
| Setting | Default | What it does |
|---|---|---|
| Engage Radius | 1600 |
An enemy that has noticed the party, or been attacked, fights inside this |
| Disengage Radius Scale | 2.5 |
It stays engaged out to 2.5 × Engage Radius; beyond that you have outrun it |
| Leash Radius | 7000 |
Measured from its home (where it spawned or was placed): beyond this it gives up, heals and walks home |
| Ignore When Levels Below | 6 |
An enemy this many levels below the leader does not notice the party. Attacked, it still fights back |
| Always Aggro | off | Ignore the level rule: for bosses and unique enemies |
How an enemy notices the party is set on the enemy, not the controller: its Detection (XenoCore › AI › Detection: None, Sight, Sound or Ether) and the matching Sight Radius, Sound Radius or Ether Radius. See Place enemies in a map.
These are the defaults for every enemy the controller possesses. To give one enemy different radii, set its own overrides. Open the enemy Blueprint's Class Defaults (for a whole enemy type) or select a placed enemy in the level (for one placement), under XenoCore › AI:
| Setting | Default | What it does |
|---|---|---|
| Engage Radius Override | -1 |
This enemy's engage radius, in cm |
| Leash Radius Override | -1 |
This enemy's leash radius, measured from where it started |
| Disengage Radius Scale Override | -1 |
This enemy's disengage scale. Values from 0 to 1 count as 1 |
-1 means "use the controller's value". 0 is a real value, not "off": an Engage Radius
Override of 0 means the enemy never gets close enough to engage, even when provoked.
The controller reports the values in force with Get Effective Engage Radius, Get Effective Leash Radius and Get Effective Disengage Radius Scale. An override changed at runtime (a boss phase) applies on the next check.
Test it¶
- Press Play in
Maps/L_XenoCore_Gym. - Lock on from further away than before, and cycle targets. Nothing beyond the range is offered.
- Walk towards the target: within Strafe Max Range you face it and side-step; walk away and you turn and run.
- Select an Art from far away and confirm: you run in and strike. Push the stick during the run: it stops and the Art is not on cooldown.
- Run up to an unengaged Grunt (it hears by sound): it notices you inside its Sound Radius.
- Lock on to one of two engaged minions and defeat it. The lock moves to the other one and you stay in battle with your weapon drawn.
If it doesn't work¶
The character strafes all the way across the field
Strafe Max Range is too large. Facing should only hold at fighting distance.
An enemy ignores the party
Its Detection is None (passive), it hears by Sound and you are walking, or it is Ignore When Levels Below or more levels below the leader. Intended; change its Detection, or tick Always Aggro on its controller if it must notice you.
Defeating the locked enemy mid-fight
When the locked enemy dies and another enemy is still fighting the party, the lock moves to it (one on screen first, then the one with most aggro on the leader, then the nearest) and the battle goes on. Only when no enemy is still fighting does target mode end and the party sheathe. Enemies that are not fighting are never picked.
Enemies chase forever
Leash Radius is measured from the enemy's start point, not from you. A very large leash lets a kited enemy cross the whole map.
One enemy ignores my change to the controller
That enemy, or its placement, has an override that is not -1. Check XenoCore › AI on the
placed actor as well as on its Blueprint.
Going further¶
- Targeting: why the lock is an ability, not a component.
- Enemies and AI
- Tune the camera feel