Rotating Button: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Unicodifying, replaced: [[Image: → [[File: (2))
(formatting)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Multiple issues|
{{Orphan|date=May 2025}}
}}
[[File:Button Normal2.png]]
[[File:Button Normal2.png]]
----


{{toc-right}}
==Introduction==
==Introduction==


In HL2, EP1, EP2; players occasionally encounter a scenario, where they must
In {{hl2|4}}, {{ep1|4}}, {{ep2|4}}; players occasionally encounter a scenario, where they must toggle a (rotating) button to achieve an effect or progress in the game.   
toggle a (rotating) button to achieve an effect or progress in the game.   
This page will describe steps on how to build a functional '''Rotating Button''' prop for use in your custom map, where:
This page will describe steps on how to build a functional '''Rotating Button''' prop for  
use in your custom map, where:  


* The player can +USE the button object and it will turn to the ON position.
* The player can {{mono|[[Use|+use]]}} the button object and it will turn to the ON position.
* With the ''Toggle'' flag option '''checked''', the player can repeat the +USE action and the button object will turn back to the OFF position.  
* With the '''Toggle''' flag option ''checked'', the player can repeat the {{mono|+use}} action and the button object will turn back to the OFF position.  
* With the ''Toggle'' flag option '''unchecked''', the button object will automatically return to the OFF position.
* With the '''Toggle''' flag option ''unchecked'', the button object will automatically return to the OFF position.


== Required entities and objects ==
== Required entities and objects ==
1)  '''FUNC_ROT_BUTTON''' (''This is a brush-model entity.'')
A)  '''{{ent|func_rot_button}}''' (''This is a [[brush entity]].'')
:a) Create a new texture brush on your map.
:# Create a new texture brush on your map.
:b) Use your editor's 'MOVE SELECTED TO:' feature to convert the brush from ''World'' to ''Entity''.
:# Use your editor's 'MOVE SELECTED TO:' feature to convert the brush from ''World'' to ''Entity''.
:c) Set the entity's class as a ''func_rot_button''.
:# Set the entity's class as a {{ent|func_rot_button}}.
:d) Name the entity as "Func_for_Bttn"
:# Name the entity "{{code|func_for_bttn}}".
:e) Select and apply the brush-texture: "Invisible" to the entity.
:# Select and apply the brush-texture: "{{code|tools/toolsinvisible}} to the entity.
:f) Set the following flags
:# Set the following flags
::* '''Not Solid'''      ''Checked''
::* '''Not Solid'''      ''Checked''
::* '''Toggle'''          ''Unchecked (optional)''
::* '''Toggle'''          ''Unchecked (optional)''
Line 27: Line 29:
::* '''Use Activates'''  ''Checked''
::* '''Use Activates'''  ''Checked''


2) '''PROP_DYNAMIC''' (''This is a point entity (Button prop).'')
B) '''{{ent|prop_dynamic}}''' (''This is a [[point entity]] (Button prop).')
:a) Place a new prop_dynamic entity on your map.
:# Place a new {{ent|prop_dynamic}} entity on your map.
:b) Select its world model skin as: '''[Props_Citizen_Tech/firetrap_button01a.mdl]'''
:# Select its world model as: {{path|props_citizen_tech/firetrap_button01a|mdl|icon=file}}
:c) Name the entity as "Bttn"
:# Name the entity "{{code|bttn}}"
:d) Select its Parent as [''Func_for_Bttn'']
:# Select its Parent as "{{code|func_for_bttn}}"
   
   
3) '''PROP_STATIC''' (''This is a point entity (Buttonpad prop))  
C) '''{{ent|prop_static}}''' (''This is a [[point entity]] (Button pad prop)'')  
:a) Place a new prop_static entity on your map.
:# Place a new {{ent|prop_static}} entity on your map.
:b) Select its world model skin as: '''[Props_Citizen_Tech/firetrap_buttonpad.mdl]'''
:# Select its world model as: {{path|props_citizen_tech/firetrap_buttonpad|mdl|icon=file}}.
:c) Naming this entity is not required''


== Set Inputs/Outputs (I/O) ==
== Set Inputs/Outputs (I/O) ==
1) Set the following output trigger(s) in the (''Func_for_Button'') brush's I/O.  
# Set the following output trigger(s) in the "{{code|func_for_bttn}}" brush's [[Inputs and Outputs|I/O]].
 
:{| border=1 cellpadding="2" cellspacing="1"
|- align=left style="background:#DCDCDC; color:black"
!
! My Output > !! Target Entity !! Target Input !! Parameter !! Delay !! Only Once
|-
| [[File:Io11.png]] || OnPressed || {{mono|bttn}} || SetAnimation ||   || 0 || No
|}


[[File:Bttn Func IO.png]]
{{confirm|Is this part unfinished ? This section shouldn't have any purpose at its current stage.}}


==Place, Align, and Group the objects==
==Place, Align, and Group the objects==
Follow these steps:
Follow these steps:


*Center the origin of the prop_static entity ( the button pad).
*Center the origin of the {{ent|prop_static}} entity (the button pad).
*Place the prop_dynamic entity '''"Bttn"''' into the desired position on the button pad.
*Place the {{ent|prop_dynamic}} entity "{{code|bttn}}" into the desired position on the button pad.
*Place "Bttn" and button pad into the desired position on the map (i.e equipment console or a wall)
*Place "{{code|bttn}}" and button pad into the desired position on the map (i.e equipment console or a wall).
*Set the desired Pitch Yaw Roll (Y Z X ) values for entity "Bttn".   
*Set the desired [[Pitch Yaw Roll]] values for entity "{{code|bttn}}".   
*Center the origin for "Bttn".
*Center the origin for '{{code|bttn}}".
*Align "Bttn"'s origin with the prop_static's origin ''as close as possible''.
*Align "{{code|bttn}}"'s origin with the {{ent|prop_static}}'s origin ''as close as possible''.
*Place the momentary_rot_button brush entity '''"Func_for_Bttn"''' over "Bttn", making sure that "Func_for_Bttn" completely encloses "Bttn". Allow enough extension of "Func_for_Bttn" for the player to ''touch'' it.  
*Place the {{ent|momentary_rot_button}} brush entity "{{code|func_for_bttn}}" over "{{code|bttn}}", making sure that "{{code|func_for_bttn}}" completely encloses "{{code|bttn}}". Allow enough extension of "{{code|func_for_bttn}}" for the player to ''touch'' it.  
*Center the origin for "Func_for_Bttn".
*Center the origin for "{{code|func_for_bttn}}".
*Align "Func_for_Bttn"'s origin with "Bttn"'s origin ''as close as possible''.   
*Align "{{code|func_for_bttn}}"'s origin with "{{code|bttn}}"'s origin ''as close as possible''.   
*Set the (X) and (Y) values for "Func_for_Bttn" equal to the (X) and (Y) values of "Bttn". (''Note; If you move and/or re-orient these objects to a different position in the map, repeat this step.'')
*Set the X and Y values for "{{code|func_for_bttn}}" equal to the X and Y values of "{{code|bttn}}".  
*Group all the objects. (You can also save the finished group as a pre-fab)
:{{note|If you move and/or re-orient these objects to a different position in the map, repeat this step.}}
== ==
*Group all the objects. (You can also save the finished group as a [[prefab]] or [[instance]])
==='''''From "The PaperDog"'''''===
 
 
----
Credits : '''''"The PaperDog"'''''


[[Category:Level Design]]
[[Category:Level Design]]

Latest revision as of 17:33, 27 May 2025

Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)

Button Normal2.png

Introduction

In Half-Life 2 Half-Life 2, Half-Life 2: Episode One Half-Life 2: Episode One, Half-Life 2: Episode Two Half-Life 2: Episode Two; players occasionally encounter a scenario, where they must toggle a (rotating) button to achieve an effect or progress in the game. This page will describe steps on how to build a functional Rotating Button prop for use in your custom map, where:

  • The player can +use the button object and it will turn to the ON position.
  • With the Toggle flag option checked, the player can repeat the +use action and the button object will turn back to the OFF position.
  • With the Toggle flag option unchecked, the button object will automatically return to the OFF position.

Required entities and objects

A) func_rot_button (This is a brush entity.)

  1. Create a new texture brush on your map.
  2. Use your editor's 'MOVE SELECTED TO:' feature to convert the brush from World to Entity.
  3. Set the entity's class as a func_rot_button.
  4. Name the entity "func_for_bttn".
  5. Select and apply the brush-texture: "tools/toolsinvisible to the entity.
  6. Set the following flags
  • Not Solid Checked
  • Toggle Unchecked (optional)
  • X Axis Checked
  • Y Axis Checked
  • Use Activates Checked

B) prop_dynamic (This is a point entity (Button prop).')

  1. Place a new prop_dynamic entity on your map.
  2. Select its world model as: Fileprops_citizen_tech/firetrap_button01a.mdl
  3. Name the entity "bttn"
  4. Select its Parent as "func_for_bttn"

C) prop_static (This is a point entity (Button pad prop))

  1. Place a new prop_static entity on your map.
  2. Select its world model as: Fileprops_citizen_tech/firetrap_buttonpad.mdl.

Set Inputs/Outputs (I/O)

  1. Set the following output trigger(s) in the "func_for_bttn" brush's I/O.
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnPressed bttn SetAnimation   0 No
Confirm:Is this part unfinished ? This section shouldn't have any purpose at its current stage.

Place, Align, and Group the objects

Follow these steps:

  • Center the origin of the prop_static entity (the button pad).
  • Place the prop_dynamic entity "bttn" into the desired position on the button pad.
  • Place "bttn" and button pad into the desired position on the map (i.e equipment console or a wall).
  • Set the desired Pitch Yaw Roll values for entity "bttn".
  • Center the origin for 'bttn".
  • Align "bttn"'s origin with the prop_static's origin as close as possible.
  • Place the momentary_rot_button brush entity "func_for_bttn" over "bttn", making sure that "func_for_bttn" completely encloses "bttn". Allow enough extension of "func_for_bttn" for the player to touch it.
  • Center the origin for "func_for_bttn".
  • Align "func_for_bttn"'s origin with "bttn"'s origin as close as possible.
  • Set the X and Y values for "func_for_bttn" equal to the X and Y values of "bttn".
Note.pngNote:If you move and/or re-orient these objects to a different position in the map, repeat this step.
  • Group all the objects. (You can also save the finished group as a prefab or instance)



Credits : "The PaperDog"