game_ui
- Not to be confused with GameUI.
CGameUI defined in game_ui.cpp
|
game_ui is a point entity available in all
Source games. It redirects important player key presses to a series of outputs, and can be used to make the player control vehicles built in a map. It can be activated with I/O, or by the player looking at it.
Keyvalues
Targetname:
- Name
(targetname)<string> - The targetname that other entities refer to this entity by.
- FieldOfView
(FieldOfView)<float> - The amount of tolerance in the view checking when determining whether the player's input is still under control.
- 1.0 = straight ahead
- 0.0 = +/- 90 degrees
- -1.0 = all directions
Flags
- [
32] : Freeze Player - The player cannot move (they can still crouch though)
- [
64] : Hide Weapon - Disables all the player's weapons
Note:This will cause the player to go into their reference (T) pose.
- [
128] : +Use Deactivates
- [
256] : Jump Deactivates
Inputs
Activate- The !activator will gain control upon this input being fired.
Deactivate- The entity will only test FieldOfView if it is active.
Deactivate input is fired on a game_ui that was activated by a player who has since disconnected. Fixed in
Workaround: AddOutputing OnUsers to a player and using a logic_branch together can be sufficient to workaround this. If the game supports it, VScript can also be used to check if the player entity still exists before firing the input.
Outputs
The player is always the !activator.
PlayerOn
PlayerOff- Fired when the entity starts or stops controlling the player's input.
PressedMoveLeft
PressedMoveRight
UnpressedMoveRight(in all games since
)- Fired on +moveright/-moveright
Bug:The left/right movement outputs do not fire when using a controller. Elaborate?: game this was tested in
PressedForward
PressedBack
PressedAttack
PressedAttack2
XAxis<float>
YAxis<float>- Fired whenever the X/Y axis of the player's input changes.
- -1.0 = +moveleft / +back at 100% speed
- 0 = no movement in this axis
- +1.0 = +moveright / +forward at 100% speed
AttackAxis<float>
Attack2Axis<float>- An output that fires whenever the state of the player's "attack" key changes.
- 1.0 = trigger is 100% depressed
- 0 = trigger is at rest
Note:These do not actually output analog values, even when using an analog stick; it will only be 1,0, or-1depending on which keys are considered pressed. (Because of the above bug, this also means thatXAxisnever fires when using a controller.)Elaborate?: game this was tested in