So I’ve built a scary AI that can walk around searching the world for food. I’m using EQS for this to return all actors of class Food in a radius. When the AI finds a food, it walks up to it and picks it up. The food actor is simply destroyed and some information about the food is stored in the AI actor (like a simple inventory), such has how much hungry it will reduce.
Later on when the AI actor is hungry it can eat one of the foods from its inventory. To do this, it picks one and removes it from the array. It then spawns an actor of class Food and sets it back up as per the details from the array. The food actor is then attached to the AI actor and an eating animation is played (so it looks like the AI actor is actually eating the food). The food actor can also optionally run some custom logic when it is eaten if needed.
The problem is now that the EQS, that finds all actors of class Food, suddenly chirps up and alerts the AI actor that there is a food actor nearby (because it’s in its hands). So as soon as the AI actor finishes eating it then proceeds to try and pick up the exact same food actor it just ate. Now, I have managed to work around this by destroying the actor before the behaviour tree gets to evaluate the next action.
But here is where things getting pretty funny… All the other AI actors in the area zone in like a pack of vultures because their EQS has sensed the food in another one’s hands, so they all gather round trying to tear the food from the poor one that just wants to eat.
So, my question is, how can I exclude a specific food actor from EQS when it has been spawned purely for eating purposes and is not just simply laying around in the world waiting to be picked up?
Edit: So after posting this I found some information about EQS Tests, which sounds like what I probably need. Perhaps I could have a test that discards Food actors if they are already owned by another actor? However from what I can tell they seem to be C++ only at the moment? Are they coming to Blueprints soon?