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.
asked Aug 18 '17 at 02:15 PM in Everything Else
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.
answered Aug 18 '17 at 03:08 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here