Can I set player friendly to Ai Perception?

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?

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

-James