# "Error in NPC Behavior Script on NPC Setup" on NPC spawners with Verse's auto-generated NPC behavior script when stopping/playing a map. 

**URL:** <https://forums.unrealengine.com/t/error-in-npc-behavior-script-on-npc-setup-on-npc-spawners-with-verses-auto-generated-npc-behavior-script-when-stopping-playing-a-map/2312710>\
**Category:** Issues and Bug Reporting\
**Tags:** npc, unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [February 1, 2025, 2:27am UTC](https://forums.unrealengine.com/t/error-in-npc-behavior-script-on-npc-setup-on-npc-spawners-with-verses-auto-generated-npc-behavior-script-when-stopping-playing-a-map/2312710 "2025-02-01T02:27:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Shabuway](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shabuway/32/1021794_2.png) [@Shabuway](https://forums.unrealengine.com/u/Shabuway)\
**Post date:** [February 1, 2025, 4:36pm UTC](https://forums.unrealengine.com/t/error-in-npc-behavior-script-on-npc-setup-on-npc-spawners-with-verses-auto-generated-npc-behavior-script-when-stopping-playing-a-map/2312710/2 "2025-02-01T16:36:14Z")

</div>

Yeah, `GetAgent[]` in `npc_behavior` seems broken after the last update. There’s a similar thread here: [Verse AI Pathing broken after Round 1 in 33.30 - #8 by Flak](https://forums.unrealengine.com/t/verse-ai-pathing-broken-after-round-1-in-33-30/2312061/8)

I found a bad workaround to get the agent by:

1. Make an interface with a method signature of something like `NagivateAgent(InAgent : agent)`
2. Inherit your interface in your custom npc\_behavior
3. Move your `OnBegin` logic to `NavigateAgent`
4. Subscribe to your npc spawner device spawn event
5. On spawn, get the agents behavior from the agent
6. Cast the behavior to your interface
7. Call `NavigateAgent`, passing in the agent from `SpawnedEvent`

Even with the agent though, `NagivateTo` still seems to be broken. 🤦‍♂️

Edit: I just tested this morning though and navigation seems to be working again

---

_[View the full topic](https://forums.unrealengine.com/t/error-in-npc-behavior-script-on-npc-setup-on-npc-spawners-with-verses-auto-generated-npc-behavior-script-when-stopping-playing-a-map/2312710)._
