[AI] Finding Random Actor Location

Hey,
i’m in need for some help.

I’m trying to make a simple AI for some animals via Behavior Tree.
There are some “FeedingGround” Actors spawning Random between a few given Locations.

I created a BTTask to make an Array of all “FeedingGround” classes and Pick a random one as its Destination Point.
But it doesn’t work, it never finds any actor.

I tested this code with a temporary actor and played it in the world, that worked fine.

is there a limitation in the Behavior Tree i’m not aware of or is the way i trying it completely wrong?

Thanks in advance!

That covers some random waypoints.
I implemented my own way of doing it as well.

Also im thinking your world location will always return a 0,0,0 value.
Well at least in my BP i need to add a Cast to after the get, and from the cast i need to get world location.

If i do a Get world location directly from the referenced object i get 0,0,0 values. Try adding a Print String before Set blackboard node and print on the screen the values.
If it returns 0,0,0 you need to use the cast node.

I got tired of having to do a cast every time so what i did was only cast once to all the waypoints and placed their locations in an array. And worked from that array instead. But i guess both methods are equal.

0a55e5e9cfddd510b750919ecc4ebfb1d9ac3266.jpeg

The section in the red is what i needed to do in order to get the correct world locations.

Thanks i will give it a try :slight_smile: