Ads keep us online. Without them, we wouldn't exist. We don't have
paywalls or sell mods - we never will. But every month we have large bills
and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3
Making NPCs Walk in Paths
- A Tutorial for Half-Life 2.
A simple tutorial on how to make NPCs walk in paths
In this tutorial, I will explain how to make NPCs walk to specified points on a map. This is called a path...
If you don't know how to create a working NPC here is a link to my other NPC tutorial - http://www.fpsbanana.com/tuts/7772
1 - The Simple Path
Make sure your NPC is on the map placed fairly close to where you want him to walk to. I suggest you make him an ally so he wont try to kill you.
Now, select the entity tool and place a path_corner in front of your NPC. Make sure that there are no obstacles. It's easier to plan the path when the entity is placed on the ground. Name the path_corner something simple, like path1.
Next, select your NPC and go to his properties. Select Target Path Corner and type in "path1" without the quotes. Now when you compile the map, Mr. NPC should walk safely to his destination.
What's this?! The evil creator has placed a ten-foot wall in our NPC's path?
2 - Curves and Corners
To allow NPCs to avoid obstacles or cut corners, you will have to place multiple path_corner entities. Don't worry though, because this part is where it gets fun.
You wont have to name or assign path_corner entities after you've placed the first one if you hold shift, select the first path, and drag it to your next destination. If you are a beginner, this is called copying. Use it, it's helpful.
So let's make Mr. NPC walk around this mighty wall of death. Keep copying your path_corner entities until you've created a path around the wall. The more smooth you make the path, the better it looks when he walks.
3 - Walking an Endless Path
To make it so your NPC will walk in a loop - whether it be a circle, triangle, square, or any other shape - requires a tiny bit more work, but it's still incredibly easy.
So, lets make him walk in a square. Create the path_corner entities and place four down in the shape of a square. Now select the last entity you placed and go to it's properties. If you've noticed, there is nothing in the Next Stop Target box. Type in the name of the first path_corner you placed.
He should walk in a square when you've done this.
Everything about paths should now be perfectly clear. After all, it doesn't take a rocket scientist to do this. Why are you still reading this thing? Go make an amazing map, you fool!
Thanks for reading - Naythynn