I have a problem right now and I honestly don’t know how to do it. I would like my AI to follow and attack the player with the most aggressiveness. (Multiplayer game) I have currently created a float with which I calculate the aggressiveness of the player. However, I don’t know how to look at each player in the AI who has attacked them and which of these players has the highest aggressiveness and set this player as a target.
If you break this down its probably more simple tha you think.
You need some variables for memory. So everytime an ai attacks or is attacked by a player. Store the player reference in a variable. And a second variable with the aggression rating.
Best way is create a structure of these 2 variables. Then store them as an array in your ai
When a player dies remove them from the list. Each time they fight add them or increase the aggression level if they already in the list.
Then its a simple check of the array to find the entry with highest aggression. If there is nothing in array then attack nearest player or whatever you need to do.