Switching between Combat and Evasion
For this update I have improved the way that my game switches between Combat and Evasion. This includes a better timer, UI elements and AI spawning. To start off I improved the timer by using a timeline instead of "Set timer by event" that I was previously using. I am much more familiar with timelines so I knew that i could stop and restart the timer using events. I could also use the progression of the timeline as a "Float" variable, which I get a reference to in my UI elements.
Timer
Combat UI
For the UI elements I added an image to the HUD to represent which state the AI is in. The Red image means they are alerted and yellow for searching. This image is then set as visible using variables from the gamemode.
AI spawning
Instead of spawning and destroying AI characters, I have set up functions to activate and deactivate them instead. This involves Un-possessing them from the AI controller (so that no logic runs) and setting them as hidden in the game. I think this is a better way to go about it, because I can now set up my backup team in the editor using the same sort of patrol system as my original team, but in search locations. I can set the teams up using a bool I exposed, which is checked on "Begin play" do decide if they are deactivated or not.
When the search phase is over, A task runs in the patrol behavior tree to tell the search team to return to base. Once they reach a marker I set up on the map, they are deactivated again, ready for when the player is spotted.
Progress video
I still have a lot of bugs I need to sort out, the combat has a few gaps that need filling in and the AI really doesn't like being around each other. I have added new contexts to the EQS system so they know not to take cover near each other. Its just a case of tweaking it until I get it right.