# Can I set player friendly to Ai Perception?

**URL:** <https://forums.unrealengine.com/t/can-i-set-player-friendly-to-ai-perception/1893772>\
**Category:** AI\
**Tags:** unreal-engine\
**Created:** [June 7, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/can-i-set-player-friendly-to-ai-perception/1893772 "2024-06-07T12:10:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![civilender](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@civilender](https://forums.unrealengine.com/u/civilender)\
**Post date:** [June 7, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/can-i-set-player-friendly-to-ai-perception/1893772/1 "2024-06-07T12:10:12Z")

</div>

AI is fully set with BP, but I want to make player character in only C++ Class  
I want to make a item that when used make enemy ai doesn’t catch player  
How can I make this item with C++ code?

---

<div class="post-metadata">

**Author:** ![James.Keeling](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James.Keeling](https://forums.unrealengine.com/u/James.Keeling)\
**Post date:** [June 27, 2024, 2:24pm UTC](https://forums.unrealengine.com/t/can-i-set-player-friendly-to-ai-perception/1893772/2 "2024-06-27T14:24:58Z")

</div>

Hello!

You can achieve this by using the `IGenericTeamInterface` which allows for changing the team ID for the player. The base attitude solver function is simply that agents with the same team ID are friendly and all other team IDs are hostile. You could set the played ID temporarily to the same as the AI so it would no longer be seen as hostile. You should also have the AI forget the player in the perception system when this happens to truly reset.

While this guide covers mainly StateTree, here is a section describing setting up the interface. You may need to make some changes, but this is a good base. [Generic Team Interface Section of Your First 60 Minutes with StateTree](https://dev.epicgames.com/community/learning/tutorials/lwnR/unreal-engine-your-first-60-minutes-with-statetree#addingandimplementingtheteamagentinterface)

-James
