I followed a tutorial on a basic AI that I wanted to expand on. The basic AI wandered the scene and would have a vision check that checked if the player was in the cone of vision. If yes, it would follow the player until reaching them (whilst constantly keeping a record of the players latest location), if no, it would wander, if no (and had a memory of the players last location) it would go there then start to wander.
It looks like this:
This worked. If the AI saw me it would go up to me and stop until I move away.
I didn’t want this ‘vision check’ service to be the main behaviour of the AI so put a decorator on it that checks another blackboard variable. When the variable is the correct one it should start the vision check behaviour. It looked like this:
This makes the AI go up to me and, instead of just stopping like it used to, it just starts awkwardly turning back and forth on the spot as it seems to be looping through the three sequences under vision check. It goes up to me, turns away for some reason, then instantly turns to go to the memory of my last location even though it sees me, then turns away instantly etc.
I guess this is a result of the vision check behaviour being rerun unlike how it was before or something. I’m new to behaviour trees so any help with this is appreciated.