Influencing your AI’s behaviour via their Aggression Level (Aggressive, Neutral, Friendly) is incredibly easy due to the design of the system.
Combining VisAI’s Behaviour Foundation with the Commandable Component, you’ll find there are minimal steps outside of creating the actual behaviour. Influencing their behaviour is easy.
The whole idea is to use the AI’s current aggression level, something determined by the player (or possibly by code), to Influence an AI’s Priority Score during decision making.
This is done by referencing aggression level while making decisions as shown in the example below;
This is a Decision function that decides how important Attacking an Enemy is to the AI.
The Switch On Aggro State Macro allows you to change the checks that you make within a decision based on the aggression level of your AI; essentially making your AI think differently depending on it’s aggression.
As shown in the image, when the AI is friendly, it’s only checking to see if it’s been damaged or if it’s been told to attack by it’s commander. However; if the AI is aggressive, it also checks to see if there are any enemies or targets in sight, or any targets at all.
This results in the Friendly AI ignoring enemies when it sees them unless it’s attacked or told to attack, while the Aggressive AI will attack anytime it sees an enemy or target, or if it has a target at all.
You can also use the “Get Aggro State” function in place of the Macro when necessary.
Both are available within any child of the VisAI_Cont_COMP class. You can get the Aggro State manually by referencing the VisBP_Interactable_Commandable_C component on any child of the VisAI_Char_COMP class.
That’s it for Designing Behaviour with The Aggro System! Everything has been simplified in order to give you maximum control with quick creation.
If you haven’t designed or created your AI yet, get started here!