I created a behaviour tree where the AI moves to random locations but when it sees the player it follows him. The follow player part is working fine but when it doesn’t see the player, the behaviour tree keeps running the task where it sets a random location for the ai and moves it there. How can I fix that?
isnt that how the roaming behavior is supposed to work? i mean you want the ai to roam as long as it doesnt see the character right? you will need to explain what happening a bit more. though you could also be having issue setting the location due to whats in your third picture where you are getting all actors of class and setting the location every tick. what this does is it will be setting the location to a different value many times per second (30-120ish). also your second picture that you posted is to low resolution to read or be of any use.
what i would do to solve the issue in the third bp is to create a task that just gets the location and saves it to a blackboard key value. then have a second task that is just a move to. below are a few pictures on how i implemented this into a behavior tree for a project i did awhile back. my work was based on the streams by epic.