Switch (Portal 2): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (moved Buttons (Portal 2) to Switch (Portal 2) over redirect: let's try this...)
(redirect to Button (Portal 2))
 
Line 1: Line 1:
{{otherlang2
#REDIRECT [[Button (Portal 2)]]
|ru=Button (Portal 2):ru
}}
[[Image: Portal_2_buttons.png|thumb|right|400px]]
There are several types of switches used throughout portal 2. This article list them and also provides tutorials on how to create them in the hammer editor.
 
==Pillar Button==
[[Image:prop_button.png|thumb|left|70px|The pillar style button]][[Image:Prop under button.png|thumb|right|80px|The Old Aperture pillar button]]
 
The tall, red, player activated buttons used in [[Portal 2]] are very simple to create.  The button is used as a trigger for doors and many other entities in the game, as well as a self contained timer.
 
===Creation===
Firstly place a [[prop_button]] entity on the ground and position it where you want it. Direct the '''OnPressed''' output to a [[logic_relay]] or instance containing the actions that should occur when the button is pressed.
 
To have the button act as a timer, set the '''Delay Before Reset''' property to the desired amount of time and '''Play timer sound?''' to "Yes." Direct the '''OnButtonReset''' to the trigger you want to activate when time runs out.
 
[[prop_under_button]] functions in the same way, but has a different model, and is used in the underground sections of old Aperture.
 
==Super Button==
===Original Button===
[[Image:Super_button_p2_blue.jpg|thumb|left|100px|The Super button]]
The 1500 Megawatt Aperture Science Heavy Duty Super-Colliding Super Button. Used in [[Portal 2]] to open doors, raise stairs and turn entities on and off. It can be activated by cubes, the player, and other objects. It is usually made of only one [[prop_floor_button]], but in official maps it is commonly found as part of one of the [[List of Portal 2 Instances#buttons | button instances]].
 
====Creation====
Select the entity creation tool and choose [[prop_floor_button]] from the list. Spawn it, an place it where you want on the map. By going into the properties of the button, you can choose what you want to happen when it is pressed (OnPressed) or when it is released (OnUnPressed).
Under the 'Button model' property in the 'Class Info' tab you can change the way the floor button looks. Just filter "portal_button" in the model browse menu.
 
{{note| not in a way that it'll look like the cube only button.}}
 
In order to create the base, as they appear in-game, simply add an [[instance]] with the 'base' .VMF. There are four diffrent bases: destroyed\intact black, destroyed\intact white
[[File:prop_floor_cube_button.jpg|right|thumb|100px|The cube-specific floor button.]]
 
===Cube-Specific Button===
Created by placing a [[prop_floor_cube_button]].  A version of the button that is square, mostly because it is activated '''only''' by a [[prop_weighted_cube]].  Has the same outputs as the older button.  Outputs are the same as the older button.
 
[[File:prop_floor_ball_button.jpg|right|thumb|100px|The sphere-specific floor button.]]
===Sphere-Specific Button===
Created by placing a [[prop_floor_ball_button]].  A version of the button that is round and smaller, mostly because it is activated by a [[prop_weighted_cube]] with CubeType set to Sphere.  Outputs are the same as the older button.
 
==Underground Button==
[[Image:Underground button.jpg|thumb|left|100px|The Old Aperture style button]]
This button, acts exactly as the Super Button does, the only difference is the appearance. It can be triggered by the player and cubes. For consistency this button is used only in the [[Underground (Portal 2)|Old Aperture]] parts of official maps, and usually is activated by the 'antique cube'.
 
===Creation===
In the entity creation list find the [[prop_under_floor_button]] and spawn it in the desired place. As it acts like the normal Super Button, the outputs are the same, what happens when the button is pressed (OnPressed) and when it is released (OnUnpressed).
Interestingly, even when the 'regular' cube is on the button, it will change its inner color to yellow - just as it would do on the newer Super Button ones.
 
==Button Lights==
To create those lights that direct what you are activating when you press the button, here is how to make them:
[[Image:Buttonlights.jpg|thumb|left|100px|Button Light Path]]
 
Step 1: Select the texture "indicator_lights_wall" and apply overlays to make a light path.
 
Step 2: Name them all the same name (for me I am going to go with button_lights_01)
 
Step 3: Make a env_texturetoggle entity and place it next to your lights, name it light_change. Set the target brush(es) to button_lights_01 (or what you named the overlays of all the lights)
 
Step 4: With your button selected, hit alt+enter to bring up the properties, go to the output tab, and make an 2 outputs like this:
 
::{| class=standard-table
!  || My Output || Target Entity || Target Input || Parameter || Delay || Only Once
|-
| [[Image:Io11.png]] || OnButtonReset || light_change || SetTextureIndex || 0 || 0.00 || No
|-
| [[Image:Io11.png]] || OnPressed || light_change || SetTextureIndex || 1 || 0.00 || No
|}
 
There you go! That should work!
 
 
'''Hint:'''
For a straight length of lightstrip that is longer than the length of one strip (four circles), you can adjust the overlay properties to make it longer rather than make duplicates of the strip. This is accomplished by editing the '''U Start''' or '''U End''' [[keyvalue]] in the properties window for the overlay.
 
When you first place a strip with the overlay tool, either '''U Start''' or '''U End''' will be ''1''. This is a multiplier for repeating the overlay - how many strips long the overlay will be. So if you change the value to ''2'', this will make the overlay have two lengths of strip, which effectively puts 8 circles into it. Note ''this does not change the length of the overlay'', and you have to ''stretch the overlay'' to fit the desired length of the strip so the circles are the correct aspect ratio.
 
To stretch the overlay, turn off SmartEdit. uv0, uv1, uv2 and uv3 are four coordinates (corners of your overlay) towards a center orientation point (your info_overlay position), like an axis system. The first value of a coordinate represents the x-value, the second the y-value and the third the z-value (always 0 here). As you can see from the default coordinates they form a rectangle. If you chose a scale of 2, your x-coordinates should be doubled too. But don't touch the y-values!
{{note|You can use decimal values to fine-tune the strip's length - for example, a '''U Start''' or '''U End''' of ''1.25'' will make the strip 5 circles long, and ''2.5'' will make the strip 10 circles long.}}
 
==Other Switches==
(To do)
*Gel Pump control switch
*CD Drive trigger
 
 
[[Category:Portal 2 Level Design]]
[[Category:Portal 2 Tutorials]]

Latest revision as of 19:17, 6 July 2011

Redirect to: