Tutorials
Rotating Lever
Rotating Lever
Just like my last tutorial, this one will also be divided into steps, which will make it as easy as possible to both follow and understand it.
This time I will teach you how to create a leverhandle, which will rotate a bit when the player press a specific button. In the end you’ll have something like this:

(The picture is from Half Life 2, Nova Prospect)
Step 1
I pressume you already have your area, so start with selecting the Entity Tool (Shift + E).
Place your info_player_start, or whatever your standard entity is, somewhere in your map by pressing the left mouse button. Now press Alt + Enter to bring up the Object Properties dialog box for that entity.
As Class, select prop_static and paste this:
models/props_wasteland/panel_leverbase001a.mdl
as the World Model, and then press the Apply button.

You should now have something like this, apart from my fancy brushwork. <!-- s:wink: --><img src="https://www.interlopers.net/forum/images/smilies/icon_wink.gif" alt=":wink:" title="Wink" /><!-- s:wink: -->

As you can see the panel is leaning a bit. If you also want your panel to do that, simply right click on it and press Transform (Ctrl + M) and write –45 in the Y-textbox. Press the OK button, and you’re finished!

Of course you don’t need to do this. If you want your panel in a 90 degree angle and up against a wall, that’s fine!
Now it’s time to add the leverhandle. Select the Entity Tool (Shift + E) and place a prop_dynamic entity. Paste this:
models/props_wasteland/panel_leverhandle001a.mdl
in the keyvalue called World Model and then press the Apply button.

Step 2
We now have the basic things and it’s time to make the lever rotate.
Brows the toolsorgin texture, select the Block Tool (Shift + B) and make a brush with these dimensions:
Width: 2
Length: 8
Height: 2
(This acts as the axel for the entity.)
Now brows the toolsnodraw texture, select the Block Tool and make a brush with these dimensions.
Width: 4
Length: 8
Height: 4
Place the orgin brush, you made earlier, inside the nodraw brush you just made. It should look like this:

Select both the nodraw brush and the orgin bursh and press Ctrl + T. This brings up a Object Properties dialog box. As Class select func_rotating then give your entity this name: lever01.
Select the keyvalue called Pitch Yaw Roll (Y Z X) and write this:

Select the Max Rotation Speed keyvalue and write 30. To me that’s a perfect speed, but if you want it to rotate slower or faster, just write another number.
Set the Disable shadows keyvalue to Yes.
Select the Rotating sound WAV keyvalue and brows the sound you want the player to hear, IF you want any sound. I do, and I choosed this sound:
buttons/lever8.wav
Now press the Flags tab and make these changes:

Now for a very important thing! Select your leverhandle, the prop_dynamic entity, and then select the keyvalue called Parent and write lever01.
Step 3
It’s now time to adjust the location of everything. Depending on how you want some of the things to be, my way might not be the correct way for you, nevertheless, the basic things will always be the same.
In my case, the leverhandle has this position:
Adjust your func_rotating entity, so it’s position is like this
In other words, at the bottom of the leverhandle.

Step 4
We only need one more thing to make the lever rotate. Yes you guessed it, a button!
Brows the toolsnodraw texture and make a brush that covers the leverhandle. Press Ctrl + T and select func_button as Class. Set the Delay Before Reset keyvalue to –1.
Open the Outputs tab and make this output:

If you want the lever to rotate further; change the delay value of the second output to a higher number. But be careful though! If you set the value too high, the lever will countine inside the panel, which will look very odd!
If you choose not to do the 5:th and optional step, you’re work are finished. Complie your map and see the result! Thank you for reading my tutorial! I hoped it improved the gameplay of your map!
Step 5 (Optional)
So, you’ve choosen to do the 5:th step also! Well, good for you! This will make your leverhandle even more jaw-dropping! Let’s begin!
Select the Entity Tool (Shift + E) and place a env_sprite entity, adjust the location, so it looks like this:

Give the env_sprite this name: env_sprite01 and make these changes to the keyvalues:
Render Mode: World Space Glow
FX Color (R G B): 255 0 0
Scale: 0.20
Size of Glow Proxy Geometry: 2.0
Press the Flags tab and check the Start on checkbox.
Create a env_spark entity and give it this name: env_spark01. Place it like the picture is showing:

Adjust the location of the button you created earlier and make these new outputs:

So when the player press the invisible button, the leverhandle starts to rotate. At the same time the env_sprite turns off. After two seconds, the leverhandle stops and the env_sprite is again visible, but now in a green color and at the same time, some sparks fly away, indicating that the power is on.
That concludes the tutorial and thank you for reading it!
There’s a lot more you can do, I hope I’ve stimulated your imagination
PS: Yes, that final line above is from aKilling Source mapping… but the tutorial, is my own!!
Tranced_Psycho
