Help with Ai finding stuff

Okay, I have a bot that finds a tree. Then destroys the tree.

When I tried to run two at the same time they both go for the same tree despite the fact that fact that another tree is closer to one of the bots.

I just want each of the bots to go to the tree that is closest to each bot.

When you choose a tree you would need to have the object that you want to go to the tree picked otherwise it will use the location of I believe the earliest created man object. Since, I’m assuming your trees don’t move, you don’t need to use the move action on every frame, just once.

Create man
(subevent)
–Pick nearest tree to man
–Move man to tree

Like this?

It looks good. Does it work?

No :frowning:

I’ve tried messing with it and I can’t seem to get it to work

What part doesn’t work? I created this test project using the multiple objects extension and the repeat extension using a scene timer.

I created the man objects more frequently for testing so I gave the tree object a Boolean variable named picked to prevent another man object from picking it.

I also inverted the collision to prevent spawning onto a tree.

OHHHHHHH

You see I wanted just two man to spawn so they would get stuck almost immediately
(also I set it to the closest one because I thought they could act by them selfs)

Also if there was I away to stop them from spawning that would be nice.

You could add a Boolean variable or a counter or a repeat. Or create the man object at the beginning and then pick a tree later.

There are infinite ways of doing things.

When you restart the timer is up to you. Maybe after the tree is deleted is better as long as it gets started when it’s created and maybe when it reaches its destination. If you want a delay.