Was using the Behavior Tree Quick Start Guide and attempted to Add Hearing to AI Perception but it doesnt work no matter what i Do.

So i added “hearNoise” to the behavior tree and no matter what i do i cant get it to trigger despite it’s connected Enemy_Controller that is connected to the tree triggering the hearing code i have attached by printing text upon code executing and even triggering Debug sphere at stimulus location which is all correct. What am i Doing wrong here t

Hi There, welcome to community!

So

  • Hearing Sense is working as you said, still are you able to see the bHeardNoise = true?
  • I see that you start with a selector which doesn’t have a condition you can actually start with a Sequence to branch, So its
Sequence 
     ->Selector (Line Of Sight)
     ->Selector(Heard Noise)
      ->Sequence
           ->Task (RandomPatrol)
           ->Task (Move)
           ->Task (Wait)

Since if you use a selector in the beginning and your chase sequence fails it will try again and again since it’s failed basically never reacing the next sequence. If you use Sequence then selectors even it fails if will try next one to the right which is your Selector (Heard Noise)

The only thing to remember is when a selector fails it will always try to go back to its root and try evaluate again, it literally selects a valid in its children. Think you can make it work by maybe not aborthing both but just self in (Line Of Sight) and (Heard Noise) think that should fix it.

Hello, thank you for responding. I appreciate the feedback you are giving me. So in my AIController Blueprint i can confirm that it is printing the string “I hear you” to confirm to me that the ai is hearing the trigger. I also can confirm that the decorator node for Heard Noise is set to True or “Is Set”.

I do believe you might be getting your Nodes mixed up between Sequence and selector but i did try your method and swapped sequence/Selector with the ones you said to look like so but the ai failed to patrol anymore and would not move on from the Chase Player Node.

I also changed both “Heard Noise” and “Has line of sight?” to abort self with both methods but it lead to the same results that the HeardNoise Node within the behavior branch was still always skipped

I don’t think I am mixing them but its ok :slight_smile: Selector is a selector when gets run and success it will re-evaluate.

What I think right now since you say bool of bHeardNoise changes, in your original graph the “InvestigateNoise” never been reached.

That mean couple of things.

  1. Your graph is stuck on “ChasePlayer” for some reason, either its not finishing or the condition of it "bHasLineOfSight’ is always true never false, so it always retries.
  2. Since you said the “Patrol” is running in your original graph that means, neither of your “LoS” and “HeardNoise” is true at that moment so it can run. Once they become true, patrol will not be executed unless they become false.

Main Selector
├─ Selector A (HasLineOfSight → Chase)
├─ Selector B (HeardNoise → Investigate)
└─ Sequence (Patrol)

A True , B False = Patrol will not run.
A False, B True = Patrol will not run.
A False, B False = Patrol will run.
A True , B True = HeadNoise will not run also Patrol will not run since A (Chase) Won (Selected) already.

So to recap, when selectors condition returns true, that doesn’t mean that it will be run. Also incase having trouble debugging, you can open debug view in the behaviour tree while playing in editor. It should look like something like this

In the behaviour tree, Alt+P (Play in Editor) and in the behaviour tree you can see the spawned instance in the debug drop down.