Hey. So here’s an example of path-finding using nodes, but rather than just positions stored in an array, they are actual objects in the scene. This means that it’s quite easy to have a path point to objects, even objects that move because you can simply parent a node to the object that you want to go towards. The script is complex, but you can simply change some variables to get the desired behavior (turn around on path completion, etc.), and the script only runs in the follower, meaning that the nodes are simple ‘filler’ objects (they perform no functions other than occupy a position in space and specify a position in the path). Also, since the paths are stored in the ‘pathnode’ variable in the object, you can even exchange paths between objects (for example, have one guard go to another and then that guard will take the first guard’s path). You recalculate the path using the RecalculatePath function, but since the path uses objects, you shouldn’t have to use that.
Note that you can turn around mid-path by changing the object’s ‘pathdir’ variable (1 is forward, -1 is back). However, turning around will only work once the object is on a node. I also made a TurnAround function that will make the object turn around on the path immediately. In order to implement this, you’ll have to copy the function to the object to call it, or you’ll have to put the updating portion of the script into a function and import the script as a module to execute the update function. The way I have it in the file is just that all objects run the script. So… That’s it. Here’s the file (it should work in 2.49, but it was made for 2.5). It also includes a normal map noise image that you can use for free in your projects, commercial and otherwise! Yeah, it’s cruddy, but hey, it’s free.