I want to use the EQSRequest query config to give a custom Query Generator some data from the blackboard. The built-in generators allow me to bind variables to a parameter which the behavior tree can access but my custom query generator variables do not have that option.
From what I understand, query generators made in C++ can use AIDataProvider to give variables the data binding functionality, however, I have yet to find anything on a blueprint equivalent. Does blueprint have an equivalent or workaround or is this something that can only be done in C++?
I’ve been looking into this as well - hopefully it’s on its way; there is already a wrapper for context providers.
Instead of making each one in C++ you could write a blueprint wrapper. I’m not great at interpreting UScript but I was able to get a very basic one working a while back. This was in 4.16
h:
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "DataProviders/AIDataProvider_QueryParams.h"
#include "AIDataProvider_Params.generated.h"
UCLASS(BlueprintType, Blueprintable, EditInlineNew, meta = (DisplayName = "Params"))
class MEGADEATH_API UAIDataProvider_Params : public UAIDataProvider_QueryParams
{
GENERATED_BODY()
protected:
public:
UAIDataProvider_Params(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void BindData(const UObject& Owner, int32 RequestId) override;
virtual FString ToString(FName PropName) const override;
UFUNCTION(BlueprintImplementableEvent)
float GetValueForBind(UObject* Owner);
};
cpp:
#include "Megadeath.h"
#include "AIDataProvider_Params.h"
#include "EnvironmentQuery/EnvQueryManager.h"
UAIDataProvider_Params::UAIDataProvider_Params(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
FloatValue = 0.0f;
}
void UAIDataProvider_Params::BindData(const UObject& Owner, int32 RequestId)
{
FloatValue = GetValueForBind(const_cast<UObject*>(&Owner));
IntValue = FMath::RoundToInt(FloatValue);
BoolValue = (IntValue != 0);
}
FString UAIDataProvider_Params::ToString(FName PropName) const
{
return FString::Printf(TEXT("Params"));
}
I haven’t touched this project in a while but I want to try and wrap up this question for anyone who is still wondering about this.
Revisiting this question, I realize how confusing my question might have been, but I believe that I actually wanted a blueprint equivalent to the UEnvQueryTest.
The short answer: as of 4.19, it doesn’t appear that there is a way to make QueryTests using only Blueprint. However, it is probably better just to write all your EQS stuff in C++ for better performance.
The long answer: I’m not an Unreal Engine developer nor have I had much experience with most the engine’s intricacies so take everything I’m about to say with a grain of salt. I believe that things like the EnvQueryTest cannot be made in Blueprint due to performance worries. From what I understand, Blueprint has a slight performance impact which when added to the Environment Querry systems in mass quantities, you might start experiencing some performance loss.