CBaseButton
Jump to navigation
Jump to search
Code classes:
CBaseButton
CBaseToggle
CBaseEntity
(all ents)
CBaseButton
is a base class for button entities which move when interacted with.
Classnames:
func_button
- Moves the entire length of itself when pressed.
Note: func_button
s that are compiled into entity groups are converted to the entity script_func_button
.
Flags[edit | edit source]
- 1: Don't move
- 32: Toggle - Allows the button to be sent back to its original position at any time. Otherwise, it will only go back down once Delay Before Reset is over.
- 256: Touch Activates - Makes OnPressed fire when players physically bump into the button.
- 512: Damage Activates - Makes OnPressed fire when the entity takes damage. Does not affect OnDamaged. Note: Will fire multiple times at once when shot by shotguns in some games.
- 1024: Use Activates - Makes OnPressed fire when the entity is
+use
d.
- 2048: Starts locked
- 4096:
Sparks- Broken. Useenv_spark
.
- 16384: Non-solid (Not in FGD) (only available in )
Keyvalues[edit | edit source]
- Move Direction (Pitch Yaw Roll)
(movedir)
<angle>
- Specifies the direction of motion to move when the button is used. Once the entity has moved so far that it's not occupying its original space anymore, it will stop moving.
- Speed
(speed)
<integer>
- The speed that the button moves, in units per second or degrees per second if rotating.
Health (Obsolete)(health)
<integer>
- Legacy method of specifying whether or not the button can be shot to activate it. Use the Damage Activates spawnflag instead.
- Lip
(lip)
<integer>
- The amount, in units, of the button to leave its original space when pressed. Negative values make the button move even farther.
Master (Obsolete)(master)
<string>
- Legacy support. Name of a
multisource
. If the master hasn't been activated, this button cannot be pressed. - Delay Before Reset (-1 stay)
(wait)
<integer>
- Amount of time in seconds after the button has moved to the pressed position 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.
- Press Sound 1
(sounds)
<choices>
- Sound to play when pressed and unlocked. Note: The list below was made for Half-Life 2. All games support this keyvalue, but some don't have a number of these sound files. To edit these sounds, look for
Buttons.snd
(followed by a number from the Value column in this table) inhl2/scripts/game_sounds_world.txt
or your game's appropriate soundscript file.
Value Description Default Sound Buttons 0
None (Silent) common/null.wav 1
Big zap & Warmup buttons/button1.wav 2
Access Denied buttons/button2.wav 3
Access Granted buttons/button3.wav 4
Quick Combolock buttons/button4.wav 5
Power Deadbolt 1 buttons/button5.wav 6
Power Deadbolt 2 buttons/button6.wav 7
Plunger buttons/button7.wav 8
Small zap buttons/button8.wav 9
Keycard Sound buttons/button9.wav 10
Buzz buttons/button10.wav 11
Buzz Off buttons/button11.wav 12
latch locked doors/latchlocked2.wav 13
Latch Unlocked doors/latchunlocked1.wav 14
Lightswitch buttons/lightswitch2.wav 15
small bleek buttons/button15.wav 16
small deny buttons/button16.wav 17
small doop buttons/button17.wav 18
small tech deny buttons/button18.wav 19
click and combine screen fuzz buttons/button19.wav 20
roomy beep buttons/button20.wav Levers 21
lever or wheel: turn + move sqeek buttons/lever1.wav 22
lever or wheel: latch + release gas buttons/lever2.wav 23
lever or wheel: ratchet + sqeek buttons/lever3.wav 24
lever or wheel: large ratchet buttons/lever4.wav 25
lever or wheel: clanky + gas release buttons/lever5.wav 26
lever or wheel: latch + large metal thud buttons/Lever6.wav 27
lever or wheel: smaller ratchet buttons/Lever7.wav 28
lever or wheel: smaller lever move buttons/Lever8.wav New buttons 31
shock buzz buttons/button21.wav 32
clickbeep buttons/button22.wav 33
tech blip buttons/button23.wav 34
clickbeepbeep open buttons/button24.wav 35
small high blip buttons/button12.wav 36
small tech fuzz blip buttons/button13.wav 37
small click bleep (change to lightswitch) buttons/button14.wav Combine Buttons 40
combine door lock - locked buttons/combine_button_locked.wav 41
combine blip growl buttons/combine_button1.wav 42
combine squick growl buttons/combine_button2.wav 43
combine whine purr buttons/combine_button3.wav 44
combine click talk buttons/combine_button4.wav 45
combine click growl fizz buttons/combine_button5.wav 46
combine click fizz (deny) buttons/combine_button6.wav 47
combine click talker buttons/combine_button7.wav
- Press Sound 2
(unlocked_sound)
<choices>
- Sound played when the button is pressed while unlocked. If set, the sound that plays alternates between this and Press Sound 1, even if the first one is set to None.
Value Description Default Sound 0
None common/null.wav 1
Big zap & Warmup buttons/button1.wav 3
Access Granted buttons/button3.wav 4
Quick Combolock buttons/button4.wav 5
Power Deadbolt 1 buttons/button5.wav 6
Power Deadbolt 2 buttons/button6.wav 7
Plunger buttons/button7.wav 8
Small zap buttons/button8.wav 9
Keycard Sound buttons/button9.wav 10
Buzz buttons/button10.wav 13
Latch Unlocked doors/latchunlocked1.wav 14
Lightswitch buttons/lightswitch2.wav
- Locked Sound
(locked_sound)
<choices>
- Sound played when the player tries to use the button, and fails because it's locked.
Value Description Default Sound 0
None common/null.wav 2
Access Denied buttons/button2.wav 8
Small zap buttons/button8.wav 10
Buzz buttons/button10.wav 11
Buzz Off buttons/button11.wav 12
Latch Locked doors/latchlocked2.wav
- Locked Sentence
(locked_sentence)
<choices>
(only available in Half-Life: Source) - A sentence played when the player tries to use the button, and fails because it's locked.
Value Description 0
None 1
Gen. Access Denied 2
Security Lockout 3
Blast Door 4
Fire Door 5
Chemical Door 6
Radiation Door 7
Gen. Containment 8
Maintenance Door 9
Broken Shut Door
- Unlocked Sentence
(unlocked_sentence)
<choices>
(only available in Half-Life: Source) - A sentence played when the button is unlocked.
Value Description 0
None 1
Gen. Access Granted 2
Security Disengaged 3
Blast Door 4
Fire Door 5
Chemical Door 6
Radiation Door 7
Gen. Containment 8
Maintenance area
- Glow Entity
(glow)
<targetname>
(only available in ) - Optional entity that will be forced to glow. (Such as a button prop.) Needs either Touch Activates, Damage Activates, or Use Activates checked in order to show the glow. Bug: If using Touch Activates or Damage Activates, the prop won't glow until the button has been pressed and unpressed once.
- Use Look-At Limit
(min_use_angle)
<string>
(only available in ) - How far away a player can be looking away from the button while
+use
still counts as pressing that button. -1 allows all angles, 0 is looking perpendicular, 1 is looking directly at it.
- Shadows (Not in FGD)
(vrad_brush_cast_shadows)
<choices>
- Determines if this entity will cast lightmap shadows.
- 0: No shadows
- 1: Cast shadows
- Render Mode
(rendermode)
<choices>
- A special rendering mode to use on this entity.
- Render Amount/Transparency
(renderamt)
<integer>
- Transparency amount, requires a Render Mode
(rendermode)
other than Normal. 0 is invisible, 255 is fully visible.
- Render Color (R G B)
(rendercolor)
<color255>
- Color channel filter to add to this entity's texture(s). Bug: Broken for brush entities.
- Render FX
(renderfx)
<choices>
- Preset appearance effects. Partially supported in , completely non-functional in . Bug: Sometimes functions incorrectly if changed with AddOutput, but is the only way to change effects other than making multiple versions of the object.
- Minimum Light
(_minlight)
<float>
- Minimum amount of light to hit this brush. 0 is none, 1 is "fullbright". Useful because the lightmaps will not update as the entity moves.
- Render in Fast Reflections
(drawinfastreflection)
<boolean>
(available in all games since ) - Makes the entity be rendered in reflections from water materials using
$reflectonlymarkedentities
.
- Damage Filter Name
(damagefilter)
<filterclass>
- When this entity receives damage, it will filter by this entity.
Inputs[edit | edit source]
- Lock
- Locks the button, preventing it from functioning.
- Unlock
- Unlocks the button, allowing it to function.
- Press
- Activates the button as if it was pressed.
- PressIn
- Activates the button as if it was pressed, sending it to the pressed position.
- PressOut
- Unpresses the button, sending it to the unpressed position.
- Alpha
<integer>
- Sets Render Amount/Transparency
(renderamt)
.
- Color
<color255>
- Sets the Render Color
(rendercolor)
.
- EnableDrawInFastReflection (available in all games since )
- Sets Render in Fast Reflections to true.
- DisableDrawInFastReflection (available in all games since )
- Sets Render in Fast Reflections to false.
- SetDamageFilter
<target_destination>
- Sets Damage Filter Name.
Outputs[edit | edit source]
- OnDamaged
- Fires when the button is damaged.
- OnPressed
- Fires when the button is pressed.
- OnUseLocked
- Fires when the button is pressed but locked.
- OnIn
- Fires when the button reaches the in/pressed position.
- OnOut
- Fires when the button reaches the out/released position.