Running an EQS Query from a service

Can’t seem to find another post that relates to this.

I basically have an EQS query that searches for a location nearby ( < 1000 units ) furthest away from all actors of a certain class. If I run the task by itself inside a Behavior tree, it operates properly.

Now I take the same EQS query and run it inside a behavior tree service using ‘Run EQSQuery’. Using the event ‘Event Receive Tick AI’, I pass the controller pawn as the Querier, have the query template set to my EQS Query, and Run mode is set to single best item. I take the return value and retrieve them as locations. But if i print the results or set them as blackboard values, they return incorrectly as 0,0,0 which makes no sense to me.

My blueprints:

The eqs query

The behavior tree itself

The service running the eqs query

Running the EQS query by itself in the behavior tree, this works! gives a location

Running the EQS query in a service, this DOESN’T work! notice the hiding spot vector location is zero’d out

Hello,

I have been able to reproduce your issue, and have entered a bug report (UE-24769). Thank you for your report, and for providing information on how to reproduce the issue.

Have a great day,

Sean Flint

Thanks! Didn’t know it was a bug. Thought it was something I was doing wrong. Looking forward to the fix so I can continue!

I actually wanted to report that I fixed my problem. I updated to 4.10, and tried the same blueprints I used. No luck. Then I tried checking out all the different functions and variables accessible to the Run EQSQuery blueprint output node ‘Return Value’. I was able to successfully retrieve the right data after binding an event, that should be run every time the query has finished itself. In my case, it the query is ran every tick, so the Query finish event is also repeatedly.

I believe this was because Run EQSQuery returns a result asynchronously when its actually finished querying. I was attempting to get the return values synchronously and immediately after the query starts.

Here is the blueprint for the Service running the query that worked for me. In my blueprint, I was only looking for the single best query answer.

By the way, I believe I found my answer, see my new answer post.

Yes, EQS queries get processed asynchronously, so you need to wait until a query is done before you get meaningful data from it.

However, another thing wrong with your setup is that you have a service on a task-less composite node. This will result in BT re-running every tick, and might (depending on specific setup) result in lots of wasted performance, and no meaningful results.

Cheers,

–mieszko

Thank you nkl-nkl!
You really helped me :smiley: