I want to learn how to make some AI...

Like the title says, I want to learn how to make an AI that would do very specific things in game. I want to make a bunch of enemies that act intelligently enough to become a challenge for the player, such as the following:

It would try to find areas that would be the most probable pathway for an enemy to pass through…
[INDENT]Then try to find a vantage point where it could view an area that covers 90% of the width of said area…
But also position itself to reveal only 10% of its surface area to anything within that pathway.
Sniper_actor would automatically shoot enemies, even at distances further than 1km away.
Sniper_actor would be able to shoot through walls. It would only do so when the enemy stays out of sight for over 2 seconds.
Sniper_actor would shoot at where it thinks the enemy went according to his velocity when last seen, and if he thinks the enemy is cowering in a corner.
Sniper_actor would also be able to know the enemy’s exact position if a comrade has line-of-sight on them.
Sniper_actor would also keep its crosshairs on the position where the enemy was previously in case they try to peek-and-shoot at it.
It would try to keep a minimum distance of 250m…
If an enemy tries to come closer, Sniper_actor would be trying to back away.
If an enemy comes closer than 120m then Sniper_actor would switch to its sidearm.
As soon as Sniper_actor reaches that minimum distance, it would try to fulfill the first four lines above.[/INDENT]

The Engineer_actor has the purpose of positioning other actors in the game, mostly things like deployable cover, mines, turrets, and drones.
Each actor should have different places for them to be positioned at.

Looks back at what I wrote…
No, this is way too much, sorry.

Okay, this is too much. I just wanted to know how to do a few things:
Have an actor find out what would likely be a high traffic area for a certain group of actors. This would enable Sniper_actor to do stuff highlighted in red.
Get an actor to check how much exposed surface area they have on them. This would make Sniper_actor be able to do the stuff highlighted in green.
Get an actor check how much distance they have away from another actor. This would make Sniper_actor able to to stuff highlighted in blue.

That sounds pretty complicated if you don’t know much about AI, since it doesn’t seem like you even have an algorithm to determine what the most probable routes are. Would you want to use shortest distance? Or maybe some kind of weighted calculation of risk/reward for each path? Or maybe something else?
What I suggest is analyzing your map, having some people playtest it and taking notes of where the most traveled paths are. Then you could use waypoints with a custom weight for each path and randomly decide based on that probability.
What I mean is basically, observe what the most traversed paths are and manually add waypoints instead of algorithmically trying to predict them. Of course this approach doesn’t work for randomly generated maps so you need to take that into consideration.

What you want for that is called EQS, Environmental Query System. You can check the documentation, but once you have the routes that you want to guard you can do line traces to determine the best vantage points.

That can also be done with EQS. There’s a series of videos where they explain how to get an AI pawn to hide from the player. It’s literally what you want for this so you should check it out at

This is all done with behavior trees you can learn about them there.

Very easily achieved with a mixture of EQS and behavior trees. After doing the quick start guides you should be on your way to do this.

It does seem a bit complicated, but not particularly hard. If you can get the basic functionality done, which you will be able to do after doing the quickstart guides, the rest is just building upon that.

Start with these!