AI can't detect Player and can't move (BehaviorTree)

Hello Community :smile:

I am new in Unreal Engine and currently learning with Videos and the UE-Guide. I’m creating my own little Top-Down Game, which is growing every day. Currently I’m building an AI based on the BehaviorTree, but I’m facing a problem I can’t get fixed. I followed this UE-Guide two times and checked it step by step but can’t find my mistakes… I’m very frustrated because I want to know what exactly went wrong. :disappointed_relieved:
What I can tell so far is that the AI stuck on detect Player and find Patrol, so he is just standing there doing nothing. I saved all my screens, can somebody help me spot my error? :pensive:




BB_Enemy






maybe this post of mine that only one person cared about can help :slight_smile:

maybe :smiley:

check this part first

to make it work first in the “Enemy_Character” blueprint, on the Character Movement component enable “Use Acceleration for Paths” this way the walk animation actually works.

1 Like

Did you put NavMesh on your scene?

@dorusoftware It is already enabled.
@Semantyx Yes and the walkable area is green.

then disable it?

maybe they have changed the code in 5.0 as the 4.27 didn’t not required that flag to be enabled

Nothing changed :pensive:

@dorusoftware @Semantyx

Just noticed that friendly smilie in debug mode. Does that mean he doesnt see me as enemy?

Yes, your character is Neutral by default, so you need to change some parameters in perception config:
Screenshot_507

Hey @ZenOh! Welcome to the forums!

Looking at your code on the AI controller, I noticed that your key name being passed in isn’t named the same as your BB key. Make sure the actual name itself (not the variable name, but it does help to have it all be called the same thing for thought process purposes) is EXACTLY what it is on the BB. It sounds like your “Has Spottet” key isn’t being set to “True”.

Same for the “Player” tag. No extra spaces, caps must match, etc.

Now good news is, while the game is open, you can open up that BT and WATCH it work! Up at the top of the screen on the BT window (it’s likely hidden by the “<<” ) while the game is running, you can select the specific actor using the BT. This will let you watch the logic in real time, and you can see if your variables are updating correctly! :slight_smile:

3 Likes

Many Thanks!
I will try it as soon as possible and post the outcome.

1 Like

Update
It worked, many many thanks! :grin:
Sadly the movement animation doesn’t work anymore. It has 3 animation transitioning to each other, but only the idle one is used somehow. I will try to find a solution by my own and will only ask again if my brain is about to explode. :upside_down_face:

1 Like

Hi there @ZenOh. Hope you’re well!

This topic has been moved from International to Programming & Scripting.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

2 Likes