EQS: Not all actors are being added using AddGeneratedActor

I wrote an eqs custom generator in blueprints to get all AI actors in the current map during runtime. I expected the generator to return all the AI actors on the map. However, when I examined the EQS query by opening the EQS debugger during runtime, I recieved all the AI except one in every instance I ran the generator. The same AI actor was missing in each of the instances I ran the generator.

This is a picture of the code I used in my generator:

Debug Info showing the missing AI using the above generator:

Thanks for replying. The blueprints you have provided does not describe my problem because I am creating a child blueprint based off Env_Query_Blueprint_Base, not BTTask_Blueprint_Base. I overrode the Do Item Generation method found in the Env_Query_Blueprint_Base and called Do Item Generation for each pawn the method Get All Actors of Class found.

I apologize if the pictures I have provided did not convey this already.

Hey Random_NPC,

I have tried to recreate what you are doing and I do not have the same issue. Here is what I am doing:

Can you give me any more information on your project that might cause the issue you are describing?

Thanks.

Can you show how you are using your Environmental Query? I am curious if you are using any distance check(s) that might limit a “all” sort because some are out of range of the distance check.

Thanks.

Also, I went through this tutorial:

[https://docs.unrealengine.com/latest/INT/Engine/AI/EnvironmentQuerySystem/QuickStart/index.html][1]

Instead of using the “ActorsOfClass: generate set of actors of ThirdPersonCharacter_C around Querier”, I used what is below:

Here is my map:

Which the logs show the same 6 AICharacters.

I am not sure what is causing your issue but it appears that the generator is working correctly on my end.

Let me know if you can provide anymore information.

The query I am working on is to have an AI medic follow another AI based on:

  • Distance to other AI from the medic’s position
  • Other AI’s health based on a health ratio which is defined as the AI’s current health to its maximum health

AI’s with the lowest health ratio get first priority. My Implementation is as follows:

Medic AI’s behavior tree:

The EQS Query I use in the Medic AI’s behavior tree:

Distance To settings are: Distance 3D, Distance to EnvQueryContext_Querier, Test Purpose: Score Only, and Scoring Equation: Inverse Linear

EQS_GetAllAIInRoom: I use the querier to get the AI in the current area using the array “AIList” and only add AI that are not the querier itself.

MedicPriority Custom Test: For each AI found in EQS_GetAllAIInRoom, the score is caculated using 1 - health ratio. Dead AI (isDead variable) are not possible follow candidates; as a result, their score is set to zero:

MedicPriority.cpp

void UEQS_MedicPriority::RunTest(FEnvQueryInstance & QueryInstance) const
{
	for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
	{
		ACharacterStats* character = Cast<ACharacterStats>(GetItemActor(QueryInstance, It));
		if (character)
		{
			float weight = 1 - (character->stats.CurrentHP / character->stats.MaxHealth);
			It.SetScore(TestPurpose, FilterType, (character->isDead) ? 0.0f : weight, FloatValueMin.GetValue(), FloatValueMax.GetValue());
		}
	}
}

UEQS_MedicPriority::UEQS_MedicPriority()
{
	ValidItemType = UEnvQueryItemType_ActorBase::StaticClass();
}

I am not sure how this came from your original post so let’s try to get the original issue sorted before diving into your whole project.

Without all of what you just showed, are you able to simply get all of a single class in a Environment Query? - without any sort of conditioning against health or Querier. Simply make sure that your original bug is valid or not, without your project behind it.

Thanks

I was able to get all actors of a single class using the ActorsOfClass Generator.

I couldn’t reproduce the problem after resetting and updating my branch in source control.

Hey Random_NPC,

Thank you for submitting a bug report, however at this time we believe that the issue you are describing is not actually a bug with the Unreal Engine, and so we are not able to take any further action on this. If you still believe this may be a bug, please provide steps for us to reproduce the issue, and we will continue our investigation.