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?
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.
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.
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 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.