How to interupt wander to do an action, then continue to wander

Hi,

I am trying a very basic scenario where I have a wandering AI. When this AI sees the player, it waves for 2 seconds, then continues wandering. How can I achieve this in Behaviour Designer?

I tried the below but I think the issue is that "Can see object" is only checked once on entry, then never again. It works if the agent is enabled while looking at my player, so this is obviously what is happening, but shouldnt "Can see object" be a continuous check that will interupt Wander when it sees the object? Seems like that in all tutorials I can find.

Even if this works, Im not sure how to do an action for X seconds (waving), then continue wandering. How can this be achieved?

dtq.jpg
 
Last edited:
I'd create a sequence where first is the Can see -task and next is Smooth look at -task.

Create a object variable, put it to the Can see object task to store the Returned object. Then on Smooth look at -task put the object variable to "Target object".
 
I'd create a sequence where first is the Can see -task and next is Smooth look at -task.

Create a object variable, put it to the Can see object task to store the Returned object. Then on Smooth look at -task put the object variable to "Target object".

Thanks, Ill see if I can figure this out :) Started with BT today so a lot of stuff to learn!
 
You're welcome! I don't have much experience either. I got Behavior Designer week ago.
I got everything to work so thats awesome, but there is one thing I dont understand.

Why do we need to return a failure? Isnt the point of a repeater that once the sequence is done, it goes back to to selector? I mean it works, just seems unintuitive so Im trying to understand. In the video by Unity it repeats fine without returning a failure, but I cant recreate it, only way it works is with your failure method.

 
My logic with that Inverter was that it returns success when it can't see it after the 2 sec wait. When "can't see" returns success then that sequence returns success too. I thought it has to "unsee" it before it can run the next "i see you". I'm not 100% sure it works all the time without additional logic after the 2 sec wait but it seems to work.
 
My logic with that Inverter was that it returns success when it can't see it after the 2 sec wait. When "can't see" returns success then that sequence returns success too. I thought it has to "unsee" it before it can run the next "i see you". I'm not 100% sure it works all the time without additional logic after the 2 sec wait but it seems to work.

I realised that a normal repeat forever does not work here since Can see object will always return true. So in my case it will just keep waving forever. I guess I need to add some cooldown to it. I wish there was an option to only trigger can see object "On Enter". So its only called once.
 
Top