So my scenario is that i have AI character and different actors on the map which this actor can perceive, all of these actors have int variable “Team” which represents their…team… and since they are inherited from actor i can not just get all percepted actors and get “Team” from them since i created these variables separetely from one another. So the question is, how should i properly do this, or filter the array of percepted actors and if so, how do i filter it?
make a blueprint interface called iTeam, and give it a function that returns a team number. any actors on a team can implement that interface.
To preserve encapsulation, simply create a macro or function in the parent class, such as “GetTeamID”, and you would just have to use the reference to the AI’s instance in order to access it.
To solve your problem, simply setup nodes to generate a stimuli reference. Then, generate one for the other team. Once you have two separate instances, you can apply the senses so that each team sees the other team’s stimuli as the enemy.
[Edit]: My bad. I hit “refresh” but it didn’t load the post with the accepted answer. I had done some research to figure out the perception system for myself.
I figured out that i’ll have to do it for a lot of variables like IsAlive, Damage, Health etc. is it a good practice to make blueprint interfaces for all of that stuff?
Or should i make all-in-one-interface with lots of imputs and outputs? And what about blueprint components, is it possible to make this kind of logic using them without interfaces?