WiseOneWayWall: Creating One-way Walls

From Valve Developer Community
Jump to: navigation, search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

Introduction

To go with my WiseOneWayGlass tutorial is this one-way wall method. What I’ve done is start with my Sawblade shack, from the Files page.

Todo: WiseSawBlades?

I removed the sawblade objects and the door. In place of the door I created a brush and converted it to func_wall_toggle. This is an interesting entity. It’s a brush based entity that can be toggled on and off. The awesome thing about it is that when off the brush is non-solid and invisible.

A few words of warning: since they have the ability to toggle you will need to consider how and when to toggle them on and off. You wouldn't want the player to become stuck inside one or see it magically appear or disappear, unless your game involves magic, in which case judge for yourself I guess.

Creation

On one side of the func_wall_toggle I’ve applied the texture effects\combine_binocoverlay. On the outside face I’ve used the same texture as the outside of the shack: metal\metalwall017a. All other faces are textured with tools\toolsnodraw. Obviously, change textures as needed for your map.

There are several properties for the func_wall_toggle, however I have not changed any of the default settings, such as FX or Shadows, but I did give it a name, Wall01. It needs a name because we are going to toggle it with a trigger_multiple.

  • Start Disabled: No
  • Delay Before Reset: 1
  • Flags: Clients
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch Wall01 Toggle 0.00 No
Io11.png OnEndTouch Wall01 Toggle 0.00 No

Placement of this trigger_multiple is very important for the effect to work properly. We want players in the shack to have the ability to walk out, but players can not get back in.

See how the trigger_multiple is placed, and how it goes to the opposite face of the door?
Notice how the func_wall_toggle blends right in on the outside of the shack.
Note.pngNote:If you are not sure how to create a trigger_multiple please refer to my tutorial on sliding doors, WiseSlidingDoor.

Obviously this method can be used for a variety of map features, such as traps, secret passages or simple One-way sections. As a bonus I went ahead and created a trap on the outside of the shack. This trap is made from 9 func_wall_toggles all with the same name, Wall02.

On the ground I’ve placed a decal so you can see the spot that will activate the trap. When the game loads the trap will not be visible and it will not be solid.

There are two trigger_multiples inside the trap. One of them is small and is named TrapTrigger, so it can be disabled and enabled. The other larger one is has the same dimensions as the inside of the trap. This is so we can hide the trap once the player leaves/dies.

Small trigger:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch Wall02 Toggle 0.00 No
Io11.png OnStartTouch TrapTrigger Disable 0.25 No

Large trigger:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnEndTouch Wall02 Toggle 0.00 No
Io11.png OnEndTouch TrapTrigger Enable 0.25 No

Notice that we’ve added a 1/4 second delay to the Enableing and Disableing of TrapTrigger. This 1/4 second is for insurance, helps to smooth things out. When the player steps on the decal, actually in the small trigger, they will be trapped. The player can not get out of the trap. If they die the trap will hide once again and be ready for the next victim ;). One more thing I should have done is add a series of explosions after a few seconds. If you want to do that check WiseExplosion.

See also