EQS does not scale well when running many instances of it. It has been known to negatively affect performance. However, you can definitely set a key in another controller using an EQS that is run in a single instance of the original controller.
First, create your AI Controller, Behavior Tree, and Blackboard that you want to use to run your EQS. What I did was create an AI Character specifically to run the EQS. This can even be an empty actor if you so desire, because its sole purpose is to run the EQS to set the value that we are looking for, which in my case is TargetPlayer. Ensure that you run your Behavior Tree in your AI Controller.
Then, create your EQS. I am looking for TargetPlayer, which is looking for a TopDownCharacter.
Once you have your initial EQS set up, run it in your Behavior Tree.
Now that you’ve gotten the value of TargetPlayer, we need to pass this to another AI Controller, which will be the one that we use for our actual AI Characters. So go ahead and create another AI Character, and create and assign it a new AI Controller. I called my second AI Controller PassKeyValueHere. After you have created a new AI Controller, AI Character, Behavior Tree, and Blackboard (ensure that you create a new key to store the value that will be passed in), you can begin to set up the task that passes the value from your original AI Controller (the one running the EQS) to your new AI Controller (i.e. the one that you want to use to control your AI). Go into your original Behavior Tree (the one that is running the EQS) and create a new task.
In this task, I got all instances of the Pass Key Value Here AI Controller (the one that we are using to control our characters) and then ran a ForEachLoop. For each instance of that controller, we go through and set the value of the Player key in Pass Key Value Here’s behavior tree. In order to do this, we get the blackboard of the AI Controller that is running the EQS, and then get the value of the TargetPlayer key. We then use this value to set the value of the Player key in the other AI Controller.
Finally, we need to run this task in the Behavior Tree.
Also, if you are unsure of how to set the key value as I have done in the Task, you’ll need to promote the Key Name pin to a variable. Call the variable whatever you’d like (I typically like to use the name of the Blackboard Key). Then Compile your blueprint, and enter the actual name of the Blackboard Key into the Default Value section. This will ensure that the variable is connected to that Blackboard Key.
Feel free to ask any additional questions, or mention if anything needs to be clarified or expanded upon.
Have a great day,