Game ui: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added note to Activate input)
No edit summary
Line 4: Line 4:


{{base point|game_ui}} 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.
{{base point|game_ui}} 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.
{{note|You must have one instance of game_ui per player in multiplayer.}}
{{note|You must have one instance of game_ui per player in multiplayer.}}
 
:{{todo|What happens if you don't...?}}
{{note|Bots can use this entity and fire its outputs.}}
== Keyvalues ==
== Keyvalues ==


Line 18: Line 18:
== Flags ==
== Flags ==


* Freeze Player
* Freeze Player - The player cannot move (they can still crouch though)
* Hide Weapon
* Hide Weapon - Disables all the player's weapons
{{note|This will cause the player to go into their reference (T) pose.}}
* +Use Deactivates
* +Use Deactivates
* Jump Deactivates
* Jump Deactivates
Line 25: Line 26:
== Inputs ==
== Inputs ==


; <code>Activate</code> {{note|Expects an [[Targetname#Keywords|activator]].}}
; <code>Activate</code>
: The [[!activator]] will gain control upon this input being fired.
; <code>Deactivate</code>
; <code>Deactivate</code>
: The entity will only test FieldOfView if it is active. {{warning|Deactivating an already-inactive game_ui crashes the game! This appears to be fixed in Source Engine 2009, though.}}
: The entity will only test FieldOfView if it is active.  
{{warning|Deactivating an already-inactive game_ui crashes the game!.}}
 
:{{todo|Which games is this an issue in? Only tested on {{tf2}}, where it crashes.}}
{{I Targetname}}
{{I Targetname}}



Revision as of 16:32, 9 February 2019

Not to be confused with GameUI.

Template:Base point 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.

Note.pngNote:You must have one instance of game_ui per player in multiplayer.
Todo: What happens if you don't...?
Note.pngNote:Bots can use this entity and fire its outputs.

Keyvalues

FieldOfView <float>
How close to the entity the player's crosshair must be for it to take control. When the player leaves the active zone, they regain control.
  • 1.0 = straight ahead
  • 0.0 = +/- 90 degrees
  • -1.0 = all directions
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Flags

  • Freeze Player - The player cannot move (they can still crouch though)
  • Hide Weapon - Disables all the player's weapons
Note.pngNote:This will cause the player to go into their reference (T) pose.
  • +Use Deactivates
  • 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.
Warning.pngWarning:Deactivating an already-inactive game_ui crashes the game!.
Todo: Which games is this an issue in? Only tested on Team Fortress 2, where it crashes.


Outputs

The player is always the !activator.

PlayerOn
PlayerOff
Fired when the entity starts or stops controlling the player's input.
PressedMoveLeft
Template:EP2 add
Fired on +moveleft/-moveleft
PressedMoveRight
Template:EP2 add
Fired on +moveright/-moveright
PressedForward
Template:EP2 add
Fired on +forward/-forward
PressedBack
Template:EP2 add
Fired on +back/-back
PressedAttack
Template:EP2 add
Fired on +attack/-attack
PressedAttack2
Template:EP2 add
Fired on +attack2/-attack2
XAxis <float>
YAxis <float>
Fired whenever the X/Y axis of the player's input changes. Only useful for analogue gamepad input.
  • -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. Only useful for analogue gamepad input.
  • 1.0 = bumper is 100% depressed
  • 0 = bumper is at rest