Switch: Difference between revisions
No edit summary |
(I should've mentioned this before, but there is no pedestal base with a 32*64*8 unit brush, only a 64*64*8 brush.) |
||
Line 1: | Line 1: | ||
{{back | Portal Level Creation}} | {{back | Portal Level Creation}} | ||
{{Morescreenshots}} | |||
__NOTOC__ | __NOTOC__ | ||
This tutorial will show how to create the '''switch''' seen throughout the later test chambers of [[Portal]]. The switch is activated by a player [[Use|using]] it, and can either be permanently pressed, or stay pressed for a set amount of time. | This tutorial will show how to create the '''switch''' seen throughout the later test chambers of [[Portal]]. The switch is activated by a player [[Use|using]] it, and can either be permanently pressed, or stay pressed for a set amount of time. | ||
Line 6: | Line 7: | ||
=== Step 1 === | === Step 1 === | ||
Create a <code>64w*64l*8h</code> brush. Texture the sides of the brush with <code>signage/hazard_orange_03b</code>, and texture the top of the brush with <code>concrete/concrete_modular_floor001a</code>. | Create a <code>64w*64l*8h</code> brush. Texture the sides of the brush with <code>signage/hazard_orange_03b</code>, and texture the top of the brush with <code>concrete/concrete_modular_floor001a</code>. | ||
{{clr}} | {{clr}} | ||
=== Step 2 === | === Step 2 === | ||
Create a <code>[[prop_dynamic]]</code> entity and set its ''World Model'' to <code>models/props/switch001.mdl</code>, and set its ''Name'' to <code>switch1</code>. | Create a <code>[[prop_dynamic]]</code> entity and set its ''World Model'' to <code>models/props/switch001.mdl</code>, and set its ''Name'' to <code>switch1</code>. | ||
{{clr}} | {{clr}} | ||
=== Step 3 === | === Step 3 === | ||
Create a <code>[[ambient_generic]]</code> and set its ''Name'' to <code>button1_down</code>, its ''Sound Name'' to <code>Portal.button_down</code>, and its ''Source Entity Name'' to <code>switch1</code>. Create another <code>ambient_generic</code> and set its ''Name'' to <code>button1_up</code>, its ''Sound Name'' to <code>Portal.button_up</code>, and its ''Source Entity Name'' to <code>switch1</code>. | Create a <code>[[ambient_generic]]</code> and set its ''Name'' to <code>button1_down</code>, its ''Sound Name'' to <code>Portal.button_down</code>, and its ''Source Entity Name'' to <code>switch1</code>. Create another <code>ambient_generic</code> and set its ''Name'' to <code>button1_up</code>, its ''Sound Name'' to <code>Portal.button_up</code>, and its ''Source Entity Name'' to <code>switch1</code>. | ||
{{clr}} | {{clr}} | ||
=== Step 4 === | === Step 4 === | ||
Create a <code>[[logic_timer]]</code> entity. Set its ''Name'' to <code>timer_ticktock1</code>, set ''Start Disabled'' to <code>Yes</code> and set its ''Refire Interval'' to <code>1</code>. Next, create an <code>ambient_generic</code> entity and set its ''Name'' to <code>sound_ticktock1</code>, set its ''Sound Name'' to <code>Portal.room1_TickTock</code>, set its ''Max Audible Distance'' to <code>441</code> and set it ''Source Entity Name'' to <code>switch1</code>. Now add the following output to <code>timer_ticktock1</code>: | Create a <code>[[logic_timer]]</code> entity. Set its ''Name'' to <code>timer_ticktock1</code>, set ''Start Disabled'' to <code>Yes</code> and set its ''Refire Interval'' to <code>1</code>. Next, create an <code>ambient_generic</code> entity and set its ''Name'' to <code>sound_ticktock1</code>, set its ''Sound Name'' to <code>Portal.room1_TickTock</code>, set its ''Max Audible Distance'' to <code>441</code> and set it ''Source Entity Name'' to <code>switch1</code>. Now add the following output to <code>timer_ticktock1</code>: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
Line 30: | Line 27: | ||
=== Step 5 === | === Step 5 === | ||
{{todo|You can parent the button prop to a hidden func_button to make it use the prop's collision mesh for interactions. Use this instead, it's a much better method than putting a massive func_button surrounding the top.}} | {{todo|You can parent the button prop to a hidden func_button to make it use the prop's collision mesh for interactions. Use this instead, it's a much better method than putting a massive func_button surrounding the top.}} | ||
Create a <code>16w*16l*16h</code> brush 32 units above the bottom of the switch model. Texture it with <code>tools/toolsplayerclip</code> and tie it to a <code>[[func_door_rotating]]</code> entity. (Alternatively, you can use a <code>[[func_button]]</code> with the flags ''Don't Move'' and ''Use Activates'' enabled.) Set its ''Speed'' to <code>500</code>, its ''Distance'' to <code>0</code> and its ''Delay before reset'' to how long it should stay pressed for, in seconds. Set it to <code>-1</code> to make it stay pressed forever after being activated. Next, check the ''Use Opens'' and ''Door Silent'' flags. Next, add the following outputs to the door: | Create a <code>16w*16l*16h</code> brush 32 units above the bottom of the switch model. Texture it with <code>tools/toolsplayerclip</code> and tie it to a <code>[[func_door_rotating]]</code> entity. (Alternatively, you can use a <code>[[func_button]]</code> with the flags ''Don't Move'' and ''Use Activates'' enabled.) Set its ''Speed'' to <code>500</code>, its ''Distance'' to <code>0</code> and its ''Delay before reset'' to how long it should stay pressed for, in seconds. Set it to <code>-1</code> to make it stay pressed forever after being activated. Next, check the ''Use Opens'' and ''Door Silent'' flags. Next, add the following outputs to the door: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} |
Revision as of 13:21, 23 July 2021

You can upload screenshots at Special:Upload. For help, see the Help:Images.
This tutorial will show how to create the switch seen throughout the later test chambers of Portal. The switch is activated by a player using it, and can either be permanently pressed, or stay pressed for a set amount of time.
Creation
Step 1
Create a 64w*64l*8h
brush. Texture the sides of the brush with signage/hazard_orange_03b
, and texture the top of the brush with concrete/concrete_modular_floor001a
.
Step 2
Create a prop_dynamic
entity and set its World Model to models/props/switch001.mdl
, and set its Name to switch1
.
Step 3
Create a ambient_generic
and set its Name to button1_down
, its Sound Name to Portal.button_down
, and its Source Entity Name to switch1
. Create another ambient_generic
and set its Name to button1_up
, its Sound Name to Portal.button_up
, and its Source Entity Name to switch1
.
Step 4
Create a logic_timer
entity. Set its Name to timer_ticktock1
, set Start Disabled to Yes
and set its Refire Interval to 1
. Next, create an ambient_generic
entity and set its Name to sound_ticktock1
, set its Sound Name to Portal.room1_TickTock
, set its Max Audible Distance to 441
and set it Source Entity Name to switch1
. Now add the following output to timer_ticktock1
:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | sound_ticktock1 | PlaySound | 0.00 | No |
Step 5
Create a 16w*16l*16h
brush 32 units above the bottom of the switch model. Texture it with tools/toolsplayerclip
and tie it to a func_door_rotating
entity. (Alternatively, you can use a func_button
with the flags Don't Move and Use Activates enabled.) Set its Speed to 500
, its Distance to 0
and its Delay before reset to how long it should stay pressed for, in seconds. Set it to -1
to make it stay pressed forever after being activated. Next, check the Use Opens and Door Silent flags. Next, add the following outputs to the door:
The switch is now finished and ready to be implemented in a map.
Implementation
Step 1
Place the switch where it should be in the map. Rotate it if necessary.
Step 2
Add the outputs that should fire when the switch is activated. The outputs that should fire when the switch is pressed should be the OnFullyOpen output on the func_door_rotating
entity, and the OnFullyClosed output when the button is reset after its timer has run out.
See Also
- Button (Portal 2) - Portal 2 counterpart