These functions are used a lot, that's why there is a separate page for them, I will also show some examples of where and how they were used.

First the most obvious and by far the easiest line of code in the whole script, this just changes the target of the AI to a new target. By making it a function instead of just a line it's easier to see what it does.

Next up is something that returns a function's name, this was needed for the next, last and most difficult out of these 3.

This code will check for the range between the AI and the target, it's used by almost every single behavior since this thing can be used for any behavior if needed.

It will only keep going as long as the behavior does not change. As said earlier it checks the distance between itself and it's target, once that distance is below or equal to the specified range, it will invoke the function that was asked right away and break the cycle.

Here is a small amount of code that shows how often the CheckForRange is used:

As shown, all of this code is based on Arrive, which is why it needs to check for range, to check when a new behavior needs to start.

All of the above examples also send the currentBehavior, as well as their own range and function they need to activate once the distance has been reached.