AI Searching for object the player places down

Hello. I am fairly new to this. I have created some pretty basic stuff. I am trying to make an extremely simple simulation of people walking around in a amusement park (think of Roller Coaster tycoon).
So far I have created a couple of Blueprints to do the following:

  • AI walking around on paths.
  • Simple Hunger system for the AI
  • AI can eat to get hunger back
  • Simple Money system for the AI to use to get hunger back
  • An extreme basic UI where I can press a button and place a food stall.

When I was testing all of this, I had a set position for them to go to get their food back.I am now wanting the AI to find and use the food stall that I place down on the path. Before they use to head toward my set location once food drops beneath a certain level. Now I need to find a way for them to search the area for a food stall and use it.

This is a section of my Blueprint. This area eventually tells them to seek out food and then afterwards pay for the food and eat it. Before when I had a set location, I set the actor location where that set location was, which then became the destination and it worked just fine. I attempted to do it the same way. The “Build Food” is a object reference to my food stall when I place it down. When I play it though, it tells me that “Variable is not in scope”. I am not exactly sure what that means.

I did try another way using “OnSeePawn”, thinking that maybe they could use their vision cones to find it if they run past it, but nothing happens.

Do you guys have any ideas? Let me know if I need to put more information, make it more clear, or show more of my blueprint!

You will benefit from using the Behavior Trees, because it seems like you are making a simulation and will want to increasingly add more detail in to what your Agents do.

There is a Twitch Stream dedicated to the Behavior Trees coming out this coming Thursday.

You could have a branch of the tree for searching for food, it could enter into executing on that branch based on the hunger level dropping, or rising above a threshold, depending on how you use it. I do a similar thing for my AI Cats, except instead of hunger they get attracted by things and have levels of attraction.

Check here to get started with the Behavior Trees, plus look on the forums. Quick Start Behavior Trees

Thank you. I was about to look into this tomorrow, because it defiantly seemed like something I should implement.