This article demonstrates how to make a monster follow a path until it's AI kicks in (usually when it sees a player). This effect can be used to give a level a more dynamic feel and better replayability -- monsters won't always be in the same spot. This method is perfect for making patrolling groups of soldiers and other nasties.
The setup for this method is quite simple. Create a path of path_corners. In the example map the path_corners form a continuous loop (see picture below). Now, create a monster. In this example, we've used a monster_barney security guard. In his properties, set the Target value to the name of the first path_corner.
Hey -- that's pretty much all there is to it!
The example map is laid out so that the barney follows his path around a square set of corridors. You are in an area above him, but the floor is transparent so you can follow his movements.
The monster will follow the path until it's AI kicks in. In this case, if Barney were to see you, he'd stop following the path and greet you. If we'd used a soldier instead, upon seeing the player he'd start shooting. You can test these situations out by noclipping through the floor of the example map and letting the monster see you.
If you want the monster to do something in particular when his AI kicks in and he stops following the path, set the Trigger Condition and Trigger Target properties of the monster. More information on these can be found in the entity guide page for each entity.
Grr! Argh! Bug!
Due to a bug, the method described here will not
work properly if a game is saved and reloaded. The NPCs state is not saved properly. Upon reloading the saved game, the NPC will just stand where he is and will not continue to follow the path. This tutorial will be expanded at a later date with different solutions to this problem.
Below is a list of entities related to this tutorial.
For a more concrete illustration, check out the example map linked below.