Switch: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{ | ==Introduction== | ||
This tutorial will show you how to create a switch that when pushed will go in and tick for a certain amount of time, then pop back out. | |||
==Entity Creation== | |||
1. 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 | |||
|} | |||
[[Image:Switch1.jpg|right|thumb|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: | |||
1 | |||
:{| | |||
! 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 || <none> || 0.00 || No | |||
|} | |||
[[Image:Switch2.jpg|right|thumb|In-game]] | |||
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 || <none> || 0.00 || No | |||
|- | |||
| [[Image:Io11.png]] || OnOut || switch_sound_up || PlaySound || <none> || 0.00 || No | |||
|- | |||
| [[Image:Io11.png]] || OnPressed || switch_model || SetAnimation || down || 0.00 || No | |||
|- | |||
| [[Image:Io11.png]] || OnPressed || switch_sound_tickloop || Enable || <none> || 0.00 || No | |||
|- | |||
| [[Image:Io11.png]] || OnPressed || switch_sound_down || PlaySound || <none> || 0.00 || No | |||
|} | |||
{{note|The time you have for '''Delay before Reset''' will be how long it takes for the OnOut outputs to trigger. Make sure you have it timed accordingly!}} | |||
Add in your door open triggers with OnPressed and closing triggers with OnOut. You can also put in some [[Creating indicator lights|indicator lights]] for added effect. Download the tutorial map [http://www.remmiz.com/portal/maps/switchtutorial.zip here]. |
Revision as of 21:09, 22 November 2007
Introduction
This tutorial will show you how to create a switch that when pushed will go in and tick for a certain amount of time, then pop back out.
Entity Creation
1. 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
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.

3. Create 3 ambient_generic entities near the switch. Give them the following properties: 1
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 OnTimer switch_sound_tick PlaySound <none> 0.00 No
5. Select the func_button and add the following outputs:

Add in your door open triggers with OnPressed and closing triggers with OnOut. You can also put in some indicator lights for added effect. Download the tutorial map here.