# Boss AI NPC's in UEFN are not targeting the appropriate player

**URL:** <https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270>\
**Category:** Verse\
**Tags:** unreal-engine, unreal-editor-for-fortnite, fortnite-creative, question, Blueprint, fortnite\
**Created:** [July 20, 2023, 3:24am UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270 "2023-07-20T03:24:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeBroPro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JoeBroPro](https://forums.unrealengine.com/u/JoeBroPro)\
**Post date:** [July 20, 2023, 3:24am UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/1 "2023-07-20T03:24:26Z")

</div>

My Boss AI NPC’s are not targeting the player that activates that mutator zone. Instead they just target one particular player for the entire game and every boss just teleport to that one player instead. Is there any way to fix this?

> using { /Fortnite.com/Devices }  
> using { /Verse.org/Simulation }  
> using { /UnrealEngine.com/Temporary/Diagnostics }  
> using { /Fortnite.com/Characters }  
> using { /UnrealEngine.com/Temporary/SpatialMath }  
> using { /Fortnite.com/Playspaces }
> 
> BossDevice := class(creative\_device):
> 
> ```
> PlayerChar : ?agent = false
> 
> @editable
> Bossprop : creative_prop = creative_prop{}
> 
> @editable
> Zonedevice : mutator_zone_device = mutator_zone_device{}
> 
> ProptranslationAxis : vector3 = vector3:
> X := 0.0
> Y := 0.0
> Z := -1.0
> 
> OnBegin<override>()<suspends>:void=
> Zonedevice.AgentEntersEvent.Subscribe(OnTriggered)
> 
> OnTriggered(Agent: agent):void =
> spawn{FollowPlayer()}
> 
> FollowPlayer()<suspends>:void = 
> 
> loop:
> Sleep(0.01)
> if (PlayerList := GetPlayspace().GetPlayers(), FortCharacter := PlayerList[0].GetFortCharacter[]):
> Playerpostion : vector3 = FortCharacter.GetTransform().Translation
> Proptranslation : vector3 = Bossprop.GetTransform().Translation
> 
> VectorToPlayer : vector3 = Playerpostion - Proptranslation
> 
> RadiansVectorToPlayer: float = ArcTan(VectorToPlayer.X, VectorToPlayer.Y) - (PiFloat / 2.0)
> 
> NewRotation : rotation =MakeRotation(axis := ProptranslationAxis, AngleRadians := RadiansVectorToPlayer)
> 
> Bossprop.MoveTo(Playerpostion, NewRotation, 1.0)
> 
> else:
> break
> 
> ```

---

<div class="post-metadata">

**Author:** ![PurpleElephant55](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/purpleelephant55/32/698558_2.png) [@PurpleElephant55](https://forums.unrealengine.com/u/PurpleElephant55)\
**Post date:** [July 20, 2023, 3:58am UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/2 "2023-07-20T03:58:19Z")

</div>

@JoeBroPro Thank you for your report! We would like to look into this further, would you be able to submit a bug report using the form available here? [Fortnite Creative](https://creative.fortnite.com/s/bug-report)

---

<div class="post-metadata">

**Author:** ![EV\_WAKA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EV\_WAKA](https://forums.unrealengine.com/u/EV_WAKA)\
**Post date:** [July 24, 2023, 7:46pm UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/3 "2023-07-24T19:46:42Z")

</div>

In your code, you’re not doing anything with the agent that’s given to you from the mutator zone (OnTriggered). When you get this agent after it enters the zone, you need to pass it to the FollowPlayer function where the optional gets set to the agent for the prop to MoveTo(). Right now you have it so it only goes for Player 1 in the game. So if Player 2 steps in mutator zone, it’ll still go for Player 1.

---

<div class="post-metadata">

**Author:** ![JoeBroPro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JoeBroPro](https://forums.unrealengine.com/u/JoeBroPro)\
**Post date:** [July 24, 2023, 11:53pm UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/4 "2023-07-24T23:53:52Z")

</div>

Gotcha, that makes sense. Do you know any similar code I can look at that does something like this? I really don’t understand verse or coding in general and maybe a visual could help me.

Thanks!

---

<div class="post-metadata">

**Author:** ![JoeBroPro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JoeBroPro](https://forums.unrealengine.com/u/JoeBroPro)\
**Post date:** [July 27, 2023, 9:54pm UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/5 "2023-07-27T21:54:49Z")

</div>

@EV_WAKA

---

<div class="post-metadata">

**Author:** ![EV\_WAKA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EV\_WAKA](https://forums.unrealengine.com/u/EV_WAKA)\
**Post date:** [July 31, 2023, 5:52am UTC](https://forums.unrealengine.com/t/boss-ai-npcs-in-uefn-are-not-targeting-the-appropriate-player/1234270/6 "2023-07-31T05:52:25Z")

</div>

Sorry for the delay, I’d checkout Wahlbeck Warforge’s channel.

> **[Wahlbeck Warforge](https://www.youtube.com/@WahlbeckWarforge)**
>
> Welcome to Wahlbeck Warforge, the ultimate channel for learning how to code and make Fortnite games with Unreal Editor for Fortnite (UEFN) and Verse programming language. UEFN is a new PC application that lets you create your own games and...
