WiseLadder: Ladders
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
Introduction
In this tutorial we’re going to:
- Use a static ladder model from HL2.
- Turn it into a ladder that players and NPCs can use.
Creation
The first thing I’ve done is place the model for the ladder I’m going to use. As you probably know it’s only good for looking at once we place it, players won’t be able to use it yet. When you use models for your ladders make them prop_static
and adjust the properties setting Collisions to Use VPhysics if you want to use physics for the ladder as it looks, Use Bounding Box' if you want to block off the area around the ladder (the yellow frame you see when the model is selected in Hammer) or best yet for most ladder models Not Solid which means the player and other physics can go right through it.
The following are the settings for the prop_static
I’m using for this tutorial:
- World Model: models/props_c17/metalladder002.mdl
- Collisions: Use VPhysics
- Disable Shadows: No
We could create this same ladder without any model at all, for example to allow players to climb up the side of trash dumpsters.
The entity we are going to create next is a func_useableladder
.
- Click the Hammer Entity tool.
- With your 2D view ports place the
func_useableladder
where you want it. - You should see a large red rectangle.
- Expand one of the small white circles in the 2D view ports until you have stretched out the
func_useableladder
. The size of your ladder will be determined by the two red blocks. Make the bottom block flush with the ground and raise the top block above the highest stepping plane if you want the player to be able to face the ladder and climb back down, lower it some if you want to force the player to turn and climb down, up to you.
Now we need to place a few info_ladder_dismount
entities. These are used to create enter and exit points for your ladder. Use the Entity tool and place these at each end of your ladder where the player will be entering and exiting.
Give your func_useableladder
a name, like Ladder1. Select all your info_ladder_dismount
s and set LadderName to Ladder1, the name of our func_useableladder
. (Porter's note: You only need to set this if there's other ladders very closeby.)
Run your map and go test the new ladder. Your ladder should already be working perfectly with the few steps it took here. Experiment with the placement of your info_ladder_dismount
s and the position of your func_useableladder
. It really is simple so if you’re having trouble just delete them and start over, it may be easier, especially at times when the points for a func_useableladder
can mess up in Hammer, when that happens it may be a lot quicker to recreate them.
Once you’ve created a few HL2 ladders you’ll have the hang of it.