Can't change a BlackBoard value from Player's BP

I have an AI wandering random (working perfectly) and I want to access to a Bool Key in my BlackBoard to trigger a decorator and make the AI come to the player.
What’s up? I can’t acces to the value.

Behaviour tree:

Accessing the key value from Player:

Task itself:

Error:

1 Like

I can acces inside of my AI blueprint, so can’t it be accessed from outside? Do I have to Enable Inputs inside my AI blueprint to change behaviours manually?

Attach Enemy Controller BP screenshot

You’re trying to Cast EnnemyController from PlayerPawn, the cast will always fail.

You should make a child Class for the ennemy(RightClick).

Then in ThirdPersonCharacter BeginPlay>>GetAllActorOfClass(Ennemy)>>Get(0)>>You got your EnnemyPawnRef.
From there you can get the controller you’re looking for.

Only has the “Run Behaviour” node.

Thx for caring

Thx, I will try it right now!

Still getting error.

Moreover, I have some doubts. Why making a child if I can get all actors from Enemy BP itself?

Yeah, keep EnnemyBP if you made one, I thought you were using ThirdPersonCharacter.

GetAllActorOfClass(EnnemyBP)>>Get(0)>>CastTo>>SetEnnemyRef should work.

You can not run it in Construction Script. Do it on Begin Play instead.

Ok, I will, but every other sequence and key variables works fine. Let me try it.

Still not working :confused:

Still not working :confused:

Remove the cast to enemy, because it fails you never get to the GetAllActorsOfClass. Get controller will return your own player controller which is not an AI controller and that’s why the cast fails.

IT WORKS!!! THX MAN!! Was that. the failed cast interrupts the node flow.

Nice, go ahead and mark your question as answered so others can find it easier.