Behaviour tree/move to - not working as expected

So far I have got my AI to wander around randomly until it senses the player. It then chases the player until it loses sight of the player for about 10-20 seconds. It will then search for the player for a further 1-3 minutes. If it doesn’t find the player then it forgets about them and goes back to wandering.

The problem is when it goes back to wandering it walks all the way back to where it first started, even if it has been chasing the player for miles. what I want is for it to just wander around the area that it reached after chasing/looking for the player.

The wander task is set to pick a random point around the AI and then walk there using the ‘Move To’ task node so why does it walk all the way back to where it started? Surely it should pick a new target point nearby when it goes back to wander?

It seems like the wander sequence is continuing from where it was interrupted, is there no way to reset it so it finds a new target?

Post your Wander Task graph here.

Without seeing it:
I’m guessing you’re using the get random point in radius node. If so, then you’re specifying the start point of this node. “origin”. Is it the spawn location? that would explain why. At the end of your “give up looking” function, get the current location of the wandering actor and have it set that as the origin for the wandering task rather than whatever it is now?

Hi, thanks for the comment. Here is my wander task. Shouldn’t it get a point around the actors current location? Or does it work in a less obvious way?

I already tried setting the destination at the end of the “give up looking” function but it made no difference :frowning:

I’ll compare it to mine tomorrow when am not on phone…and see what the options are. You can try connecting the get actor location target to your zombie cast ‘as zombie’ compile and see what that does. Might take whatever location your current zombie is at when it gives up looking and starts this task , wandering within a radius of wherever its current location is.

If it continuously changes cuz it’s location does. You may need to set the current location into a variable so that that variable stays as that origin point and doesn’t change each time the task is run. Set the variable with a do once or something.

I connected the get actor to cast as zombie and it works. It’s always something silly haha. Been working on my game only a week and the zombies already have better AI than DayZ lol. Thanks for the help very much appreciated :smiley: