From Valve Developer Community
Jump to: navigation, search

func_rot_button is a brush entity available in all Source games. It is a rotating version of func_button. When used, it rotates to a pressed position instead of sliding to one.

In code it is represented by class CRotButton, defined in buttons.cpp.


Master (Obsolete) (master) <string> <Obsolete>
Deprecated. Legacy support: The name of a master entity. If the master hasn't been activated, this button cannot be used.
Speed (speed) <integer>
The speed that the button rotates, in degrees per second.
Health (Obsolete) (health) <integer> <Obsolete>
Deprecated. Legacy method of specifying whether or not the button can be shot to activate it. Use the 'Damage Activates' spawnflag instead.
Sounds (sounds) <choices>
Sound when pressed
  • 0: None (Silent)
  • 21: Squeaky
  • 22: Squeaky Pneumatic
  • 23: Ratchet Groan
  • 24: Clean Ratchet
  • 25: Gas Clunk
Note.png Note: These sounds are for <Half-Life 2> and <Counter-Strike: Source>.

For other games, you need to check the sounds declared in scripts/game_sounds_world.txt.
Choose a sound declared with a name like "Buttons.sndXX" (where XX is a number), AND be sure that the sound file exists in the vpk.

Then deactivate smartedit, and put the number (XX) as value.

Delay Before Reset (-1 stay) (wait) <integer>
Amount of time, in seconds, after the button has been pressed before it returns to the starting position. Once it has returned, it can be used again. If the value is set to -1, the button never returns.
Distance (deg) (distance) <integer>
The amount, in degrees, that the button should rotate when it's pressed.
Minimum Light Level (_minlight) <string>
The minimum level of ambient light that hits this brush.


Name (targetname) <string>
The targetname that other entities refer to this entity by.
Entity Scripts (vscripts) <scriptlist> (in all games since <Left 4 Dead 2>)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since <Left 4 Dead 2>)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call.
Note.png Note: Try to avoid expensive operations in this function, as it may cause performance problems.


Parent (parentname) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.


Origin (X Y Z) (origin) <origin>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.


Pitch Yaw Roll (Y Z X) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.


Global Entity Name (globalname) <string>
Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.


Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).


  • 1 : Not solid
  • 2 : Reverse Dir
  • 32 : Toggle
  • 64 : X Axis
  • 128 : Y Axis
  • 256 : Touch Activates
  • 512 : Damage Activates
  • 1024 : Use Activates
  • 2048 : Starts locked



Removes this entity from the world.
Removes this entity and its children from the world.
Note.png Note: Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than Kill.
AddOutput <string>
Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
KV Format: <key> <value>
I/O Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything depending on the entity. Can also be invoked by firing an output that does not specify an input.
RunScriptFile <script> (in all games since <Left 4 Dead 2>)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since <Left 4 Dead 2>)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Bug.png Bug: In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning.png Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
CallScriptFunction <string> (in all games since <Left 4 Dead 2>) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin <coordinates> (in all games since <Alien Swarm>) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since <Alien Swarm>) !FGD
Set this entity's angles.


SetParent <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
Removes this entity from the the movement hierarchy, leaving it free to move independently.


Lock the button, preventing it from functioning.
Unlock the button, allowing it to function.
Activate the button as if it was pressed.
Activate the button as if it was pressed, sending it to the bottom position.
Unpress the button, sending it to the top position.


Enable/disable this entity from performing its task. It might also disappear from view.



OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (only in Left 4 Dead <Left 4 Dead 2>)
This output fires when the entity is killed and removed from the game.


Fired when the button is damaged.
Fired when the button is pressed.
Fired when the button is used while locked.
Fired when the button reaches the in/pressed position.
Fired when the button reaches the out/released position.

See also