Rotating Button

From Valve Developer Community
Jump to navigation Jump to search
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"