Horror AI (Help MEE!)

I need to make an AI that roams around the map until the player is spotted, then chases the player until caught or out of sight! Plz help.

You are asking for 20 minutes of clicking through the editor, so i’ll just provide you with a link to a tutorial from where you can adapt ur code:

Part 1:

Part with setting up AI (chase player and attack):

*Another method is to use a pawn sensing component and run your logic from that.
**Or you can even just setup a collision area around the character or the AI, and use overlap events to trigger your chasing logic.

Hello there. You can find some nice tutorials on this subject on YouTube! But since I have spent some time recently playing around with similar thing I thought I will help out a bit.

I’m quite new to UE4 so there probably is a better way of doing it.

You want to start with adding PawnSensing component to your AI Character and NavMeshBoundVolume so that your AI can actually sense something and move around. Toggle the with using P key, green field are places where AI can go to.

When you start the game you want your AI to roam, right? Open your AI’s blueprint and
Create a new CustomEvent for your Roaming action.
Use GetRandomPointInNavigableRadius node. I suggest you randomize radius to make it more real. Then plug it to your AI move to, add a bit of delay and Roam again.

Click on your PawnSensing component and in the bottom right cornet click On See Pawn Event.

All you have to do now is Cast to your character to get location and plug it to a new AI move to node.

I’ve added some basic screenshots, maybe it will help you.


So far I’ve managed to get my AI’s to roam around/patrol. When they see me then are trying to get in shooting range and then the real fun starts. I have them set to run away if they receive too much damage, when they heal to full they will start patroling again. UE4 is so much fun.

Please let me know if this was helpful in any way.

If you AI get’s stuck with a funny rotation/titl just add a new event where you reset the rotations. I think it was Z Y but you can figure this out. Good luck!

Is the “cast to my character” a function or a macro?