x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

EQS Custom Test not working

Hi, I am writing a custom test fo filter out an actor of a particular type. I have added the AIModule and the EQS generator i am using is the generate Actors around Context. The output log gives the following warning : LogEQS:Warning: Query [FindTargetSoldier] can't use test [FindAttackingSoldierTest_0] in option 0 [], removing it

The code:

FindTargetSoldier.h #pragma once

 #include "EnvironmentQuery/EnvQueryTest.h"
 #include "FindAttackingSoldierTest.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class CHILDNOMORE_API UFindAttackingSoldierTest : public UEnvQueryTest
 {
     GENERATED_BODY()
         UPROPERTY(EditDefaultsOnly, Category = Trace)
         TSubclassOf<UEnvQueryContext> Context;
         virtual void RunTest(FEnvQueryInstance& QueryInstance) const override;
         virtual FText GetDescriptionTitle() const override;
         virtual FText GetDescriptionDetails() const override;
 
         virtual void PostLoad() override;
 };
 DECLARE_LOG_CATEGORY_EXTERN(YourLog, Log, All);

FindTargetSoldier.cpp

 #include "ChildNoMore.h"
 #include "FindAttackingSoldierTest.h"
 #include"EngineUtils.h"
 #include"SoldierCharacter.h"
 #include "Engine.h"
 DEFINE_LOG_CATEGORY(YourLog);
 
 void UFindAttackingSoldierTest::RunTest(FEnvQueryInstance& QueryInstance) const
 {
     //Now go thrui the queries
     UE_LOG(YourLog, Warning, TEXT("RINNONG TEST"));
     GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::White, FString("TESTING!!!!"));
     float MinThresholdValue = FloatValueMin.GetValue();
     float MaxThresholdValue = FloatValueMax.GetValue();
     TArray<AActor*> ActorsInQuery;
     QueryInstance.GetAllAsActors(ActorsInQuery);
     TArray<FVector> ContextLocations;
     if (!QueryInstance.PrepareContext(Context, ContextLocations))
     {
         GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::White, FString("TESTING!!!!"));
         return;
     }
     for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
     {
         if (Cast<ASoldierCharacter>(GetItemActor(QueryInstance,*It)))
         {
             It.SetScore(TestPurpose, FilterType, 0.75f, MinThresholdValue, MaxThresholdValue);
         }
         GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::White, FString("TESTING!!!!"));
     }
 }
 
 FText UFindAttackingSoldierTest::GetDescriptionTitle() const
 {
     return FText::FromString(FString("FIND SOLDIER"));
 }
 FText UFindAttackingSoldierTest::GetDescriptionDetails() const
 {
     return FText::FromString("SOldier test");
 }
 void UFindAttackingSoldierTest::PostLoad()
 {
     Super::PostLoad();
 }


Product Version: UE 4.10
Tags:
more ▼

asked Apr 12 '16 at 02:39 PM in C++ Programming

avatar image

ash9991win
86 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first
 UEnvQueryTest* TestOb = SortedTests[TestIndex];
 if (TestOb == NULL || !TestOb->IsSupportedItem(GeneratedType))
 {
     UE_LOG(LogEQS, Warning, TEXT("Query [%s] can't use test [%s] in option %d [%s], removing it"),
         *GetNameSafe(LocalTemplate), *GetNameSafe(TestOb), OptionIndex, *MyOption->Generator->OptionName);
 
     SortedTests.RemoveAt(TestIndex, 1, false);
 }

Where (for distance example): GeneratedType = {Class=0x0000000002dd1080 (Name=0x0000000002fa69f0 "EnvQueryItemType_Point") }

What type of generator you are using?

See in your test:

 /** Validation: item type that can be used with this test */
     TSubclassOf<UEnvQueryItemType> ValidItemType;

From distance test:

 UEnvQueryTest_Distance::UEnvQueryTest_Distance(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 {
     .......
     ValidItemType = UEnvQueryItemType_VectorBase::StaticClass();
 }
more ▼

answered Apr 18 '16 at 05:45 AM

avatar image

v.s.
347 10 12 27

avatar image mtrebi Apr 25 '16 at 10:09 AM

This solved my problem! Just needed to include #include "EnvironmentQuery/Items/EnvQueryItemType_VectorBase.h" at the top of the .cpp file. Thanks

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question