User:ThePaperDog/Rotating Button

From Valve Developer Community
Jump to navigation Jump to search
Icon-essay.png
This is an essay.
It contains the advice or opinions of one or more of the Valve Developer Community's contributors.
This page is not an encyclopedia article, nor is it one of the Valve Developer Community's policies or guidelines, as it has not been thoroughly vetted by the community.
Some essays represent widespread norms; others only represent minority viewpoints.

HOW TO MAKE A ROTATING BUTTON TURN (SWITCH ON/OFF)

Button Normal2.png


Introduction:

In HL2, EP1, EP2; players occasionally encounter a scenario, where they must toggle a (rotating) button in order 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

1) FUNC_ROT_BUTTON (This is a brush-model entity.)

a) 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.
c) Set the entity's class as a func_rot_button.
d) Name the entity as "Func_for_Bttn"
e) Select and apply the brush-texture: "Invisible" to the entity.
f) Set the following flags
  • Not Solid Checked
  • Toggle Unchecked (optional)
  • X Axis Checked
  • Y Axis Checked
  • Use Activates Checked

2) PROP_DYNAMIC (This is a point entity (Button prop).)

a) Place a new prop_dynamic entity on your map.
b) Select its world model skin as: [Props_Citizen_Tech/firetrap_button01a.mdl]
c) Name the entity as "Bttn"
d) Select its Parent as [Func_for_Bttn]

3) PROP_STATIC (This is a point entity (Buttonpad prop))

a) Place a new prop_static entity on your map.
b) Select its world model skin as: [Props_Citizen_Tech/firetrap_buttonpad.mdl]
c) Naming this entity is not required

SET INPUTS/OUTPUTS (I/O)

1) Set the following output trigger(s) in the (Func_for_Button) brush's I/O.

Bttn Func IO.png

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 (Y Z X ) 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; 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 pre-fab)

NOTES

See also:

--The PaperDog 06:16, 15 March 2009 (UTC)