Download

Problem with Random Navigation

I’m having trouble with a random waypoint navigation system I’m working on through Blueprint. The AI in the level is supposed to find a random location based on an array of defined waypoints I have set up, then navigate to them and wait there for a bit. He successfully chooses new waypoints but he entirely ignores the wait prompt. Also problematic is every time I run the simulation, he will return a null value from the array in the pathfinder function I have defined. Not every time but sometimes. I suspect it’s because the function will fire before the value has time to get there but I’m not sure how to tide that using flow control or branch/valid nodes. I’ve posted the parts of the code below that are giving me trouble.

I’m extremely new to this so any help would be greatly appreciated :slight_smile:

Update! I managed to figure out why it was occasionally firing null values, which was due to the array being at zero. I subtract one from the array length now before I fire a random integer and it works like a charm. I have a print string enabled and he sometimes sends more than one variable, which isn’t a huge deal, but it still won’t fire the wait node in the behavior tree. It seems to keep running the task then move to nodes without ever moving on to the other task I have assigned to it.