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. :´(
this is the closest but it’s incomplete
how to get a bb value from the query
basically:
- inherit from UEnvQueryContext
- implement
virtual void ProvideContext(FEnvQueryInstance& QueryInstance, FEnvQueryContextData& ContextData) const override
then inside do
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)
ACharacter* const QuerierActor = Cast<ACharacter>(QuerierObject);
AAIController* const contr = Cast<AAIController>(QuerierActor->GetController());
UBlackboardComponent* const bb = contr->GetBlackboardComponent();
UObject* const Object = bb->GetValueAsObject(KeyName);
AActor* const TargetActor = Cast<AActor>(Object);
if (TargetActor) ResultingActor = TargetActor;