if (ObjectLocation := MaybeObjectLocation?):
# Navigate to the object
NavigationTarget := MakeNavigationTarget(ObjectLocation)
if (DebugAI?):
DebugNpc("{NPCName} - Navigating to {ObjectLocation} - {(if (SelectTagBy = TagFindOptions.Closest) then "closest" else "random")} object with tag", ?Duration := AIDebugDrawTime, ?TextColor := NamedColors.CadetBlue)
Logger.Print("{NPCName} - Navigating to {ObjectLocation} - {(if (SelectTagBy = TagFindOptions.Closest) then "closest" else "random")} object with tag")
race:
set NavResults = NpcData.Navigatable.NavigateTo(NavigationTarget, ?MovementType := (/Fortnite.com/AI/movement_types:)Walking, ?ReachRadius := 100.0, ?AllowPartialPath := true)
block:
Sleep(Timeout)
Logger.Print("{NPCName} - GoDo - Navigation to the object with tag failed, timeout", ?Level := log_level.Warning)
if (DebugAI?):
DebugNpc("{NPCName} - Navigation to the object with tag failed, timeout", ?Duration := AIDebugDrawTime, ?TextColor := NamedColors.Red)
#return TaggedObject
# Check if the navigation was successful
NavigateResult := NavResults
if (NavigateResult = navigation_result.Reached):
# Perform actions on the object
race:
FocusOnObject := NpcData.InFocus.MaintainFocus(ObjectLocation)
block:
Sleep(1.0)
sync:
PlayAnimation(NpcData.InAgent, PlayAnimSeq)
NPCAudio.PlayAudio(NpcData.InAgent, PlaySound)
block:
#if:
NPCLookingAt := NpcData.InCharacter.GetViewRotation()
NPCLocation := NpcData.InCharacter.GetTransform().Translation
#then:
set NPCFinalLocation = option{NPCLocation}
PlayVFX(PlayFX, NPCLocation, ?VFXRotation := NPCLookingAt, ?VFXDelay := 0.0)
else if (NavigateResult = navigation_result.PartiallyReached):
Logger.Print("{NPCName} - GoDo - Navigation to the closest object was partially reached, playing interrupted sequence", ?Level:=log_level.Normal)
PlayAnimation(NpcData.InAgent, AnimSeq_CanNotReach)
NPCAudio.PlayAudio(NpcData.InAgent, "CanNotReach")
else if (NavigateResult = navigation_result.Interrupted):
Logger.Print("{NPCName} - GoDo - Navigation to the closest object was Interrupted, playing interrupted sequence", ?Level:=log_level.Normal)