How to - Init BlackBoard variables from a Blueprint?

Hey all !

I’m struggling a bit on something about Behavior Tree and BlackBoard variables.

I have a Weapon Component (projectiles) that handle logic and settings about weapon/auto attack/parameters of current weapon (damage, range, …). This component is on the parent actor of my enemies BP. What I want to achieve is, at the init of each instance of an enemy, set the BlackBoard variable “AttackRange_Key” as the variable “Range” that is inside the “WeaponSettings” struct, which is inside my WeaponComponent. Then, I’ll use this BB Key in task and service to do my logic to check distance / launch projectile and so on.

But 'till now, I can’t find a way to put a Blueprint variable from a custom BP.

I’ve tried some ways with GetAIController and Set Value as Float but nothing works.

Any way to achieve this in a optimized way ?

Thanks !

I’m doing it like this. Maybe it can help you.

If you find a better way to do it please let me know.

Hi there,

Inside your AI controller, you can use like this:

This variable also needs to be declared in the black board first. Then, inside a custom task, you want to declare the desired variables as “blackboard key” so they will show up when you select the task and go to details panel.


1 Like

Thanks both for your answer !

Solution :

At the init of the AI Controller, Get Controlled Pawn then get all variables I need from my component, pass theses values to the Blackboard through Set Value as X, then manipulate these values inside my task/service/BT.