Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.21
more ▼

asked Apr 18 '19 at 11:31 PM in Using UE4

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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: https://www.youtube.com/watch?v=1pmPb_TWG-8&list=PLZlv_N0_O1gb5sdygbSiEU7hb0eomNLdq∈dex=1

Part with setting up AI (chase player and attack): https://www.youtube.com/watch?v=INL1_DiHaEk&list=PLZlv_N0_O1gb5sdygbSiEU7hb0eomNLdq∈dex=8

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.

more ▼

answered Apr 19 '19 at 12:04 AM

avatar image

28 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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!


more ▼

answered Apr 19 '19 at 09:02 PM

avatar image

507 3 5 6

avatar image NeonCatWv Apr 22 '19 at 01:16 PM

Is the "cast to my character" a function or a macro?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question