How to properly use EQS with AI

Hi everyone,

I’m currently experimenting with AI and the Environment Query System.
So far, I’ve done the UE5 tutorial for both and I wanted to go futher but I’m stuck and I don’t know if I’m doing things on the right way.

The tutorial of the EQS, teachs you how to use the grid in order to find a position for the AI to be able to see the player and to move to that position.

Here’s my current Behavior Tree and my Blackboard.


Her’s my EQS Query.

And here’s my EQS context (I’ve done it on C++).

What I want to do is to use the EQS to locate specific actors on the map (Pick Ups that I’ve created) so the AI can move move to the closest one. But I don’t want the EQS to simply return to me a Vector as it was the case in the UE tutorial, I want it to return to me the Object that is found, my Pick Up.
That’s why you can see that in my Behavior Tree, on the Run EQS Query Node, I set the Result Blackboard Key to PickUp which is an Object instead of MoveToLocation which is a Vector.

Unfortunalty, the EQS Query isn’t able to set the PickUp Blackboard Key. If I run my code, my PickUp value will remain invalid, even though the PickUpActor is found in my C++ function.

So I’m wondering. Am I using the EQS right ?
Should it be used to get a reference to an object or should I do it with a regular task ?
If the EQS can do such a thing, could you please tell me what I’m doing wrong ?
I’d really love to experimentate more on AI but I struggle to get started and I would love to have some help please.

Thank you for your time.

Hi.

I’ve found my answer and forgot to close this question.
In order to locate an Actor, you need to use GetActorsOfClass instead of SimpleGrid.
Hope it’ll help someone in the future.
Bye.