Download

Waiting only one time before chasing

Hey all, it’s been a while x)
So, my problem is, this time, that I want my monster to wait a bit when he first see the player, then chase him. I thought that I could add a wait before going into chasing, like this :

There, I added the sequence with the “CanSeePlayer”, that come from the second sequence, I just moved it, and the wait. But, of course, with a sequence, once the AI have waited, then went to the player location (with the ChasePlayer), it wait again. And if I replace it with a selector, it wait forever. I already tried with a cooldown decorator too, putting it a bit everywhere, but guess I’m doing all wrong x) So, what would be the way to do so ? I hate Behavior Trees x)

Thanks in advance !

Hi there!
Could you just add the 5 sec wait in between the CannotSeePlayer and CanSeePlayer?

Hey ! Just tried, but I guess it’s because it’s a selector, if I add a wait between them, it wait forever ^^ I tried doing a new task instead of the wait, with a delay and the finish execute without “Success” ticked, but it do like previously, it go to the player location, then go back to wait, then chase, etc

Sweet Jebus I did it ! Here’s the thing :


So, in short, I created an enum with only two states, FirstSight and NotFirstSight (I tried to do with a boolean, but or I messed up the thing, or it wasn’t working. Plus, I would have need two tasks for a boolean to switch on and off, so don’t know if it’s better with an anum or a bool, but it works like that, so I don’t care anymore x) ). And so, when the monster see the player, he enter the first sequence as (I guess x) ) the “basic” state is “FirstSight”, he wait, then turn to “NotFirstSight”, and so go to chase player. I turn back to “FirstSight” in the sequence with the “HaveBeenChasing” decorator, on the left. If I put it before the sequence with the “FirstSight” decorator, it just loop, of course.