WiseElec

From Valve Developer Community
Revision as of 13:04, 6 July 2011 by DarK St3alth (talk | contribs) (Cleaned up the article a little bit. You can see a lot is missing, which I may add to withing 24 hours.)
Jump to navigation Jump to search

Electrified Obstacles

Typical electrified obstacle.

In this tutorial, we will create an obstacle in which it is electrified and can be toggled by a trigger. You can any model for this, but for the tutorial we will use a railing from Half Life 2 (see right).

Note.pngNote:Remember the player has to get around the obstacle.
Note.pngNote:You could apply this concept to a ladder, door/gate or even water/ground.


For the purpose of this tutorial the rail obstacle is initially electrified, however, it can be disabled by standing on a small red carpet and re-enabled by standing on a small green carpet (the carpets are not shown in screenshots).

When a player "touches" the fence while it is electrified there will be sparks, and the player will get blown back a few feet.


Tip.pngTip:To create a realistic effect, you may want to add sounds and possibly smoke.


trigger_hurt is used to start off the series of events when the player touches it. Additionally, it outputs to entities to create the "blow back" of the player and sparks. These are: one (1) env_physexplosion, eight (8) env_sparks, one (1) trigger_push and one (1) logic_timer to lend some logic.


Note.pngNote:Load the example map file at the bottom to see each of the entities mentioned here.
Tip.pngIdea:You could easily create a switch for this, another kind of "secret" trigger or the lever like Valve used in Ravenholm.

For the On/Off switch use two trigger_multiples and place them over the red and green carpets.


Hammer design view.

In the tutorial, the prop_static entity is for the railing/electrified object but you could just as easily use motion enabled entity types.


Tip.pngIdea:This concept could be extended to a gate that would swing open once the electricity was turned off, or even a loose cable trapped under a vehicle.

Wrap up

There’s a lot more you can do, hopefully this article have stimulated your imagination.

Credits

The tutorial was originally created by wisemx, and ported from sdknuts.net/wiseElec to the VDC by Peter [AGHL] 05:55, 9 Feb 2008 (PST)