Defining Paths for Monsters

Edited by Tony "Mad Dog" Ferrara and David Hyde

If you want to give your levels that extra "edge" of realism, one of the things you can employ is having monsters doing something other than just standing there, waiting for the player to show up.

Here's what this tutorial will explain:

1. A soldier patrolling a hangar door that he's supposed to be guarding.

2. Another soldier exiting a door, walking up a ramp, and entering  another door.


To start off, grab the pre-made map here and load it up into QERadiant.

To explain the layout, the player is standing on an elevated floor, facing northeast. The area is a night scene, which I'll explain later. There's a mock hangar door and two small doors. Behind the player is a hallway connecting two openings. Let's start off by adding a soldier who patrols back and forth in front of the hangar door.


1. Ctrl-Tab until you are in the Top View mode, looking down at the map.

2. Right-click and a drop down menu will appear. Select monster/monster_soldier. Place the soldier at the left side and in front of the hangar doors. Ctrl-Tab to check the other views so that you can make sure the soldier is on the floor.

3. Since Radiant defaults entity orientation to the east (0 degrees), you don't have to concern yourself with facing directions. However, it's generally a good practice to have the entity facing the path it will be taking. Make sure that the soldier has the sight flag checked so it doesn't see you.

4. Right-click again to access the drop-down menu. This time, select path/path_corner, and place it in front of the soldier. See the screenshot below.

5. In Fig. 1 above, you can see how I've placed my two path corners, which will define the patrol route of the soldier.

Fig. 2: The path_corners (p_c) do NOT have to rest on the floor. In fact, as long as you maintain the p_c's coordinates at floor level or above, they will work. They must, as a rule, be within 16 units of the monster's bounding box to be effective.


Targeting

1. Holding down the left shift key, select the soldier and then the path_corner. Now press CTRL-K. QERadiant automatically targets the solder to the path_corner.

2. Assuming you've plopped another path_corner down at the other end of the hangar door, again, hold down the left shift key. FIRST, select the path_corner nearest the soldier. Now, select the OTHER path_corner. Press CTRL-K to connect them. Press ESCape to de-select everything.

3. To make the soldier turn around, select the SECOND path_corner FIRST, and target it to the first path_corner using the same method in Step 2.

What you now have should look exactly like the screenshot in Figure 1. Go ahead and compile the map. When it loads into the game, you should see the soldier walking back and forth between the two points we've just defined. If the soldier walks to the other path_corner and stops, it means that you did not target THAT corner BACK to the FIRST path_corner. If you're not sure what's going on, run MapSpy on your map to diagnose the problem.


If a path_corner has the teleport spawnflag and is embedded in the floor, a monster will teleport to that point and be stuck. 

If you place a teleport path_corner in the air, the monster will spawn there then fall to the ground. 

Path_corners use a 16x16x16 pseudo trigger field. Monsters will never reach a normal path_corner that's embedded in the floor or walls or up in the air above the monster's bounding box. If the path_corner's box (field) can't be touched, nothing will happen. The monster will continually try and reach the path_corner--and fail--until he has an "enemy" (usually, the player) to distract him.


The Second Path

Now we're going to have another soldier come out of the north room, walk up the ramp, and enter the east room. We'll be setting up a teleport loop so the action repeats itself.

Go ahead and set up your soldier in the north room and face him south (270 degrees). Lay down your path_corners as shown in the screenshot below. Remember to place the last two higher, so that they're on the ramp and east room floors.

Fig 3

Although CTRL-K is a quick and easy way to connect and target entities, you'll soon run into problems on large maps if you're not consistent with targeting methods. In other words, if you manually define targets and target names and ALSO using CTRL-K to target other entities, Radiant will suddenly start targeting multiple entities after reaching a default maximum of "t99". As a rule, I like to manually define target and targetname values.

As shown in Fig 3 above, connect the soldier to the first path_corner. (Make sure that this soldier also has the sight flag checked.) Then target the others sequentially. As you can see, the last path_corner is targeted BACK to the FIRST path_corner.


Path Teleport

To have the soldier repeat a looping path, select the FIRST path_corner and check the Teleport flag. If you did everything right, re-compile your map and watch how the door opens, the soldier walks out, goes up the ramp, enters the open door, where it closes behind him.

Before you do compile however, look carefully at Fig 3. See how the targetline connecting the first and last path_corners intersect through the wall brushes? When the game loads up, watch, and you will see a flicker in this corner as the teleporting soldier whizzes back to the north room.


Busted By The Light

There's one more thing we need to look at, which I mentioned in the beginning. Since one picture is worth a thousand words, follow these steps:

1. Copy the nearby brush that makes up a ceiling light in the hallway behind the player.

2. Paste this brush near to where the player entity stands.

3. Compile and run the map and don't move.

What happened? The soldiers saw you, didn't they? This illustrates how light and distance will affect path_corner animations in the game. Generally speaking, if your map is lit to even a small degree, the monsters will see you after you get within so many units. 


Things to Know

Once a monster has "broken" the link to a defined path, they won't return to it after the player leaves the area. The one exception seems to be if you've set up a looping path (not teleporting), where a monster can walk in circles. Depending on the monster, this may or may not work.

  • Some monster entities are dumber than others. Soldiers, for example, generally need more p_c's than the tank commander. If you find a soldier not turning around on a back-and-forth patrol, adding an extra p_c at the problem p_c may solve the problem.
  • Events can be triggered when a monster reaches a given path_corner.
  • Trigger_spawn monsters won't target p_c's. 
  • If you trap the monster behind a func_wall he won't start the path until the wall gets out of his way. If you use this trick then path_corners don't have to be in a loop. To prevent the player from hearing a monster banging around trying to get at the p_c, add an areaportal to the func_wall. (Courtesy of Brian Griffith)
  • If you remember the original iD levels, you'd be coming around a corner and see a soldier walking away from you. What happened was the player triggered the path. Again, it's an effective illusion, adding life to your level instead of merely sneaking up behind an idle entity that is waiting to be ambushed.

 


Lastly, don't get too carried away with patrol paths. Although you can do some interesting things (marching ranks of soldiers, flying airplanes) but they easily fall apart once the player makes him or herself known to the monster(s). A good rule of thumb, is when you have too many monsters "standing around" when you bust into the room, it's time to add a few paths to enhance the realism.


Copyright 1999, by Terry DeLaney. Permission is granted to distribute this file as long as the author receives credit.