Help passing value from AI blueprints to character and animation blueprints.

I am trying to activate an animation state with a boolean and the value needs to be set by a service in my behavior tree. For example the service scans for pawns and on hit it sets the blackboard key to true. How can I get this value from the blackboard into the event graph of my anim blueprint?

Thanks.

You can create Custom Events in your Character Blueprint to set and clear the bool within the Character Blueprint. In your BT Service you need to cast to your AI Controller first, then get its controlled pawn and cast to the right Character type from there. From Character cast you can access the Custom Event, put it in your Service and active it.

Then in your Animation Blueprint you can cast to your Character too, get the bool in the Animation BP’s Event Graph and set / clear a local bool appropriately and reference that bool in your Anim Graph in the Animation Blueprint.

If there is an easier way to do this then I would love to know. I would love to have one Blackboard per character that can be referenced by its Character’s BP, It’s Animation BP, it’s AI Controller BP and the Behaviour Tree & its components.

Interface would save you a lot of castTo so you can reuse BP for different character. BUT you need to redirect RPC call as interface calls can’t be RPC calls.

Also, keep them separate would be better instead of letting them access everything all the time.
controller use BT/blackboard to drive character, character’s variables drives animation bp.

What’s an RPC call?

I’m trying a system where most of my anims are pose blends via Ints. It’s been easier to keep those Ints in the Character Blueprint, cast to them from the BT if need be and cast to them and set local variants in the Anim Blueprint.

RPC calls are events used for replications, the reason to keep things in clean access hierarchy is later down the road if you want to enable multiplayer, you will have less headache.
But the correct way to do it is implement multiplayer from the get go. Even if you are just doing single player, interface will enable you to use one blueprint with different say charater BP, weapon BP, etc.

I’m trying to do this but when I hit run my editor crashes. Is behavior tree inherently unstable or something? Running version 4.2

at 4.2 BT is still experimental, and it did crash editor from time to time for me in the past.
So better upgrade to 4.4, it’s a lot more stable for BT.
(and most of my blueprint migrates fine without problem.)

I’m on 4.4 too and would recommend that too.

I’m currently prototyping all major systems for a game, including AI, to give me the best possible understanding of BPs before I chuck everything in the bin and start it all again from scratch. I’ll give interfaces a go before wiping the slate clean.

I got my AI working on the latest version, now I’m trying to make multiple instances of this and have the AI ignore it’s own type when doing scans. When I use the AI spawner does it automatically create instances of all the assets associated with the AI? I noticed that if I manually place the actors in the level, they all work off of a single blackboard which causes errors in behavior, also I tried using the get all actors blueprint to create an ignore list when doing scans, but this is too resource intensive and causes freezing. I need something like a faction system.

Is this the best way of doing this ?

We are on 4.25 now, and BT trees have advanced a little, have things changed ?