AI Target Player when Damage Taken
Author: Zak Levine
Date May 4, 2023
A significant aspect of a good AI is that it should target the player. A massive issue within Slimegeon's AI was that the enemies only targeted the player when they had a line of sight. That means the player can go behind the enemy and kill it without repercussions. To fix this issue, I altered the AI to target the player when damaged.
To gain the link between the AI and the character, I added a new bool to the Blackboard called DamageTaken. I duplicated the line of sight branch and swapped the line of sight bool with the Damage Taken bool. The new link allows me to target the player without making the AI believe it already has Line of Sight. Although a notify could work too, I instead opted to use a loop that stores the health and checks if the current health is less than the held health. If the statement is true, it will set the AI DamageTaken bool to true, while if it is false, it will loop again after a delay. The function allowed the AI to target the player after the player damaged the enemy.
Although the above solution worked, it added another issue: the enemy would never un-target the player. To enable the enemy to un-target the player, I added a reset function to restart the loop and set the AI DamageTaken bool to false. I also added a check to the bool to re-loop on a longer delay if the enemy already targets the player. After fixing the un-targeting issue, I fixed a final point that disabled the loop if the player possesses the enemy.
Overall, this solution allowed for the correct functionality within the AI and the re-usability, as I can reuse it for all enemies and their respective AIs.
Slimegeon
Status | In development |
Author | zaklev |
More posts
- Finalizing the Skill Trees and the Missile TurtleMay 25, 2023
- Creating Modular UIMay 25, 2023
- Sword Reveal Over TimeMay 25, 2023
- Bug Fixes and CinematicsMay 25, 2023
- Fixing Pawn JittersMay 18, 2023
- Reworking the skill treesMay 18, 2023
- Reorder Save List by Date Last PlayedMay 18, 2023
- Possession, Lock-On Blips, and YetiMay 18, 2023
- Loading Screen and Lock On AdjustmentsMay 11, 2023
- Snowballs Destructive MeshMay 11, 2023
Leave a comment
Log in with itch.io to leave a comment.