- Spot the player
- Stop current "patrol" and chase after player
- Call in reinforcements from a certain distance
- Implement combat so that AI is smart (will use cover), but not unbeatable (no instant reload, aimbot, instant turn, etc...)
- ...
1. use a raytrace between the enemy and the player. If the raytrace is unobstructed and the angle of the line is within the enemy's field of view, the player is visible.
2. Once the player is found, save the old path and position, and set a new path towards the player.
3. Use the distance formula. If you're within a certain distance, call a method on the other enemies to alert them to the player, so they can do #2
4. I don't know about cover, you might need to place some sort of "cover hint" entity. to avoid instant turn give each entity a turn speed which it will turn by until it hits the right angle.
to avoid instant reload, use a countdown.