I was trying to figure out waypoitns and in searching around I found the below. I'm happy to say I have a patrol of guards wandering around my city.
The details (copyright DaGaider ):
A waypoint is an invisible object that is placed in an area to mark a specific location. It has its own tag (which is set when it is created) and can optionally be made into a 'map note' (one could be labeled 'General Store', for instance, and in the mini-map an icon would appear where it was located... if the player moved his cursor over that icon it would display its label).
The generic AI that comes with NWN is set up so that you can get creatures you set down to walk a circuit of these waypoints automatically.
How is this done? It all has to do with the tag you assign to the waypoint. Take the tag of the creature(s) you want to use the waypoint... add the prefix "WP_" and the suffix "_0X"... and the creature will automatically begin walking them in that order.
Example:
I have an NPC guard who I have given the tag "GUARD". I lay down four waypoints which form his patrol circuit. I give them the tags "WP_GUARD_01", "WP_GUARD_02", "WP_GUARD_03" and "WP_GUARD_04".
According to the default AI, when the game started he would proceed to the waypoint "WP_GUARD_01" and slowly move between the others, in order, pausing 1 second at each one. Once he got to "WP_GUARD_04" he would move back to "WP_GUARD_01". If he saw anything hostile, he would move to attack... and, once the combat was over, he would return to his patrol.
The above is the simplest use of the waypoints, of course... there are many other ways to tweak it. There are likely a few questions right off the bat that might arise:
1. If I used a lot of waypoints for my NPC's, there could be a LOT of waypoints on the screen!
One waypoint doesn't only have to serve one creature... it serves one creature tag. More than one creature can have the same tag, if you wish.
There are also four different colored appearances that you can set on the waypoints to distinguish them from each other.
Even so, you could have quite a few in any given area, depending on what you were doing. Fortunately waypoints don't run scripts or take up any graphics processing power by their existence. If they get in the way of you seeing things in the toolset, there is a button which allows you to screen them out of view (there are buttons for other things, too, if you don't wish to view objects, creatures, items or whatever).
2. It sounds like a lot of work to re-name all the tags on those waypoints.
You could edit each waypoint and change its tag if you wanted to. Fortunately you can hold down the SHIFT key and select the waypoints in the order you want them... then right-click the mouse button and select 'Create Set'. If you provide the tag name ('WP_GUARD' in the above example), it will automatically change their tags and add on the numbered suffixes for you.
3. What if I want part of the circuit to cross an area transition... like going into a house or something?
As I understand it (according to a recent conversation with Preston, who wrote the AI), this works fine. I suspect you would have to have a regular area transition created by the wizard, however.
I recently tried this out, creating a peasant who walked four waypoints, two of them being in another area (inside a house). I then planted a house tile in the main area and connected the two with a door. He left the door open after he used it the first time, but otherwise it worked fine.
More Advanced Uses
Posts: Instead of walking waypoints, you can assign a creature to a 'post'. Lay down a single waypoint with the prefix 'POST_' added to the creature's name.
The creature will then remain at his post. If he moves from it to engage in combat, he will return to it as soon as he is done.
Day/Night Activities: In the generic OnSpawnIn script, you can uncomment a command called SetSpawnInCondition ( NW_FLAG _DAY_NIGHT _POSTING). This will tell the creature to differentiate between night and day.
How does this affect waypoints? Well, you can give a creature a different set of waypoints to walk (or a different post) in the day and night by changing the prefix of your waypoints:
day waypoint: prefix "WP_"
night waypoint: prefix "WN_"
day post: prefix "POST_"
night post: prefix "NIGHT_"
So you could set up the guard in the example to walk his waypoints during the day. Then, if his flag was uncommented in the OnSpawnIn script, you could set a "NIGHT_GUARD" waypoint in his barracks that he would return to when it was dark.
You could also add animations to a guard that was standing at his post (looking around, for instance) as well as other behaviors... but that will come later. This was just meant to show what regular waypoints are capable of doing... they are incredibly easy to make use of, and with some creativity they can add a lot of life to your module.
Waypoints explained by Danmar
Moderator: Event DM