AIPerception - Affiliation implementation in C++
I’m trying to implement AIPerception by Affiliation (Enemies, Neutrals, Friendlies), but I’m struggling to find the correct way for the implementation in C++
I’m very unexperienced with C++ in Unreal 4 and hopefully someone can point me into the right direction for this. Any help is really appreciated.
The main question is where and how I could set the affiliation. I’m also not sure if it has to be on the character, the controller or both...
Thank you in advance.
asked Dec 10 '16 at 08:01 PM in C++ Programming
Terry J. N.
Take a look inside AIModule/Classes/GenericTeamAgentInterface.h. Basically you need to implement that interface in you characters or PlayerController (as you prefer), AIController already implement that. Override the following function from that interface to get and set the Team of that entity
Bind a function to OnTargetPerceptionUpdated in you AIController to be notified each time the perception system is updated
Now, in your OnTargetPerceptionUpdated you can get the "Team Attitude" of you AIController toward the senced actor
also you can override GetTeamAttitudeTowards if you want to change how retrieve owner attitude toward the given actor
Hope this help you
Best regards Fernando
answered Dec 12 '16 at 01:23 PM
You''ll want to create enums that store different factions or whatever you're looking for, ie
And then give each monster or player a Faction. Also add an TArray that the monster is aggressive against. When the enemy sees you, check that your faction is an enemy faction, and if it is, then begin attacking the player. I won't go into more detail about the AI stuff, because it would take too long, but you're welcome to view my tutorials if you want some info on AI. You can search Reuben Ward on youtube.
Hope this helps!
answered Dec 10 '16 at 11:02 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here