Summary
When using GetFocusInterface & trying to maintain focus on agent or location the guard no longer shoots at the maintain focus target. It use to work a couple months ago but I noticed recently guard just do the maintain focus part without actively shooting even full alerted or force attack is being used.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
AI
Steps to Reproduce
Create a custom script for guard spawner that uses a Maintainfocus on attacking agent.
Expected Result
Guard should look and shoot at attacking agent.
Observed Result
Guard only looks at agent.
Platform(s)
All
Hello, sorry for the very late reply.
From what I can see, this is working as intended: you are controlling the guard’s behavior through the Focus function. If you want him to attack the player, you need either to do a race with Focus and Attack. Or you can use the Tether function to prevent him from moving.
using { /Fortnite.com/AI }
using { /Fortnite.com/Teams }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
guard_static_attack_behavior := class(npc_behavior):
OnBegin<override>()<suspends>:void =
if:
Entity := GetEntity[]
GuardActions := Entity.GetComponent[guard_actions_component]
GuardAwareness := Entity.GetComponent[guard_awareness_component]
then:
loop:
Target := AwaitDetectedNPC(GuardAwareness)
race:
# Keep the guard facing the target (LockFocus defaults to true).
GuardActions.Focus(Target)
# Shoots from the current position. No MoveInRangeToAttack, so no movement.
GuardActions.Attack(Target)
AwaitTargetForgotten(GuardAwareness, Target)
# Stops a tight loop if Attack fails at once (for example, the target is no longer detected).
Sleep(0.0)
# Returns the first detected target that is not friendly.
AwaitDetectedNPC(GuardAwareness:guard_awareness_component)<suspends>:entity =
loop:
for:
Info : GuardAwareness.DetectedTargets
Info.Attitude <> team_attitude.Friendly
do:
return Info.Target
GuardAwareness.DetectTargetEvent.Await()
AwaitTargetForgotten(GuardAwareness:guard_awareness_component, Target:entity)<suspends>:void =
loop:
Forgotten := GuardAwareness.ForgetTargetEvent.Await()
if (Forgotten = Target):
break
FORT-946627 has been ‘Closed’. This is working as intended by design.