Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Summary
Casting an Instigator to Agent is broken. (im working in npc_behavior_script_device). I was following the NPC medic tutorial on the forums, and tried using the line from the tutorial at Understanding NPC Behavior in Unreal Editor for Fortnite | Fortnite Documentation | Epic Developer Community , under the header “NPC States and Verse”. The OnDamaged method includes a case in it’s if statement THAT DOES NOT WORK. Specifically this line. InstigatingAgent := agent[Instigator?]. Currently you must use Instigator.GetInstigatorAgent for the agent to be returned as expected. Im not sure if this is because I am getting my damage_result from an Await() statement, but it’s only the cast to agent from game_instigator that seems to be broken.
Steps to Reproduce
Heres my code.. “navigating” never prints, but “Start navigating to the InstigatingAgent” does print.
BeginChaseIfDamaged():void=
if (Ag := GetAgent):
if (fc := Ag.GetFortCharacter):
dmg_result := fc.DamagedEvent().Await()
Print(“NPC TOOK DAMAGE, BEGIN CHASE”)
if:
# Get the Agent and the Navigatable interface
Navigatable := fc.GetNavigatable
Instigator := dmg_result.Instigator?
# Get the agent that instigated the damage
then:
Print("Start navigating to the InstigatingAgent")
if (InstigatingAgent := agent[Instigator]):
Print("navigating...")
NavigationTarget := MakeNavigationTarget(InstigatingAgent)
Navigatable.NavigateTo(NavigationTarget)
Expected Result
“navigating” should print, and the npc should move to the player agent location
Observed Result
navigating print statement never prints. Manually casting the game instigator, via Instigator.GetInstigatorAgent. DOES MAKE THIS WORK AS EXPECTED!
Platform(s)
UEFN VERSE