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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How would you make an enemy AI react to a certain event or action? For example, the AI attacks when I show my gun or show it.

I am trying to create a simulator where an enemy character or ai reacts based if they can see my weapon or if I am aiming at them.

Product Version: UE 4.17
more ▼

asked Aug 18 '17 at 02:15 PM in Everything Else

avatar image

3 1 1

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

1 answer: sort voted first

I'm assuming you are using your using blackboard or similar setup for your AI. The simplest way to make then react is to flag your player has having gun visible when you pull it up. Then you can check the flag during AI processing and handle when the flag is true or false as you see fit. To determine if you are pointing at them do a line trace from your character every tick, or every few ticks, to determine if your player is pointing at an NPC. If your player is then set a flag on the AI with a timer to auto clear and again check the flag during normal processing of the AI.

more ▼

answered Aug 18 '17 at 03:08 PM

avatar image

296 6 7 10

avatar image supermoore1025 Aug 18 '17 at 03:20 PM

Hey that's definitely something I thought about doing. Thanks for your help.

(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