How to remove actor from EQS list based on blackboard key?

Hi, I have a blackboard key that says if my player is dead or alive (because I need the mesh to persist) and an EQS Query that finds all actors around my AI pawn to target them for attack.

How can I get my EQS query to only return actors that have my PlayerAlive bool set to true? As it stands my player dies but still is returned as the closest target in the list and the AI get stuck there.

firstly use an interface not a blackboard value

so in your EQS query you get all actors, then test against the interface but i’d use a threat value instead of is dead.

So if theyre dead you can multiple threat by 0 and they wont be considered but this also allows you to check distance, health percent etc to find the best target

Is this doable in the blueprint version or will I need to use cpp to test against interfaces and use threat etc? I dont remember such options like testing for interfaces being in the EQS BP.

you can do it in the EnvQueryContext and override the Provide Actors Set,

get all actors in range and then loop over to check their threat level, or just bIsDead if you prefer then return only valid actors

Sorry I’m still new and not quite following. Should I override within the EQS blueprint, make an EQS C++ class and override there or override within the AI controller C++ class? I’m using C++ for everything but EQS because the tutorial I have used blueprint.

so you can provide custom context to EQS, create new class and search EnvQueryContext.

lets call that class FindTargets
then inside that class you can override the function i mentioned above.

then in your EQS you can provide your new custom context