Hello, I’m trying to figure out how to pass parameters to a EQS Query when I’m calling it from a behaviour tree task with the “Run EQSQuery” node. When I put a “Set Named Param” node right after the “Run EQSQuery” node UE freezes my whole computer when I run the game.
If I could store multiple locations generated by the EQS Query on a blackboard key (an array of vectors type variable would be needed but didn’t find how to make a BB key into an array) I could call the Query from the behaviour tree and simply tie the EQS Query parameter to a BB value instead of having to call a node from the BTTask blueprint. But I didn’t find a way to do this.
putting this here since is the 1st thread i found, and found nothing else to help.
i really really wish epic could improve this.
apparently there are two ways (at least).
binding a property to a query param. then setting the query param on the behavior tree. this seems ideal but not all properties allows binding. (looking at you generate around actor).
creating your own eqs context. which is poorly documented and very inflexible, hard to maintain, and potentially much slower.
specially if you need/like to use blackboard values, which you should since that’s why the bb exists.
you’ll probably have to do many sub-optimal casts.
since the instance of the context is not editable in the eqs window, you can’t really set properties. this means you’d need one class per specific value you wanna read and hard-code many stuff. :´(
UObject* const QuerierObject = QueryInstance.Owner.Get();
AActor* ResultingActor = NULL;
// ----- your logic ----
// store the result only if it's a valid actor, otherwise the FEnvQueryContextData will think it succeeded
// and proceed with the query
if (ResultingActor)
{
UEnvQueryItemType_Actor::SetContextHelper(ContextData, ResultingActor);
}
in “your logic” you can do something like (please check for nulls or it might crash)