Portal is a first-person puzzle game. Players must solve physical challenges by opening portals to maneuver objects, and themselves, through the enigmatic Aperture Science Laboratories.

Post tutorial Report article RSS Feed How to make a switch

How to make a switch in Source SDK. Copied and pasted from Valve Develper Community: Creating a switch.

Posted by DaLuig on Oct 31st, 2010
Basic Level Design/Theory.

. Using the Entity Tool, place a prop_dynamic where you would like the switch model. Set the properties to the following: Property Name Value World Model models/props/switch001.mdl Name switch_model

How to align the func_button.

2. Create a 16x16x16 block brush covering the button on the model textured with tools/toolsinvisible. Tie it to a func_button. Under Flags, check Don't move and change the Delay before Reset to however long you want to prevent the player from activating it again.

Note:For doors, make sure you give it enough time for the door to open, stay open and close.

3. Create 3 ambient_generic entities near the switch. Give them the following properties: Property Name Value Name switch_sound_up Sound Name Portal.button_up SourceEntityName switch_model Property Name Value Name switch_sound_down Sound Name Portal.button_down SourceEntityName switch_model Property Name Value Name switch_sound_tick Sound Name Portal.room1_TickTock SourceEntityName switch_model For the switch_sound_tick entity, un-check Starts Silent under Flags. 4. Next create a logic_timer somewhere near the switch. Give it the following properties: Property Name Value Name switch_sound_tickloop Starts Disabled Yes Refire Interval 1 And the following Output: My Output Target Entity Target Input Parameter Delay Only Once Image:Io11.png OnTimer switch_sound_tick PlaySound 0.00 No


5. Select the func_button and add the following outputs:
My Output Target Entity Target Input Parameter Delay Only Once Image:Io11.png OnOut switch_model SetAnimation up 0.00 No Image:Io11.png OnOut switch_sound_tickloop Disable 0.00 No Image:Io11.png OnOut switch_sound_up PlaySound 0.00 No Image:Io11.png OnPressed switch_model SetAnimation down 0.00 No Image:Io11.png OnPressed switch_sound_tickloop Enable 0.00 No Image:Io11.png OnPressed switch_sound_down PlaySound 0.00 No

Post comment Comments
SteveZombie Oct 31 2010 says:

Great tutorial.

+2 votes     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Windows, Mac, X360, PS3
Developer & Publisher
Send Message
Official Page
Release Date
Released 2007
Game Watch
Track this game
Report Abuse
Report article
Related Games
Portal Single Player Puzzle Compilation
Related Engines
Source Commercial Released 2004
Related Groups
Valve Developer & Publisher with 6 members