game_text is a point entity available in all Source games. It displays text on players' screens. This text can be defined directly in the Hammer editor (unlike the similar env_message entity which uses the
Tip: If your text is not displaying properly in a multiplayer game, try checking the "All Players" flag.
Warning: It is not suitable for any other usage, as it prevents localization and makes text editing impossible without a recompilation.
Warning: Don't use quotation characters (") in the Text Message field (not even
\"characters). It will cause fatal errors with opening and/or compiling your map and may need to be fixed by manually editing the VMF in a text editor. Instead, use detailed quotes (i.e.
Bug: Doesn't work in Left 4 Dead 2
Bug: Scales incorrectly for players that have game resolution higher than 1920x1080, text will be much larger and some text will be hidden. To do: Is this only?
- Message Text
- Message to display onscreen. \n signifies a new line in the text. Tip: AddOutput
messagecan be used to change text at runtime in older games which do not support
SetText.Bug: Hammer will automatically change
/n. This can be worked around by editing the VMF with a text editor, although it will need to be changed every time after each save.
- X (0 - 1.0 = left to right) (-1 centers)
- Horizontal position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the far left of the screen and 1 is the far right. -1 centers the text.
- Y (0 - 1.0 = top to bottom) (-1 centers)
- Vertical position on the player's screens to draw the text. The value should be between 0 and 1, where 0 is the top of the screen and 1 is the bottom. -1 centers the text.
- Text Effect
- Text scan effect
Literal value Effect Description 0 Fade In/Out The whole text is faded in, and then faded out. 1 Credits To do: Unknown - seems to act like Fade In/Out. Provide description. 2 Scan Out The text is scanned in letter by letter, and the whole text is then faded out.
- The primary color used by all the text effects. Note: The color values seem to be added to the background, so either a bright white background or black text will cause the message to be invisible.Note: This keyvalue will default to black for entities not created in Hammer.
- The scanning color for the letter being scanned if the Text Effect keyvalue is set to Scan Out - usually a different shade of Color1.
- Fade in Time (or character scan time)
- The time it should take for the text to fully fade in.
- Fade Out Time
- The time it should take for the text to fade out, after the hold time has expired.
- Hold Time
- The time the text should stay onscreen, after fading in, before it begins to fade out.Note: This value defaults to zero for entities not created in Hammer.
- Scan time (scan effect only)
- If the 'Text Effect' is set to Scan Out, this is the time it should take to scan out all the letters in the text.
- Text Channel
- You can have up to six individual game_text messages onscreen at once, stored in channels. Select which channel this text should be placed in, which will overwrite any active message already in that channel.
- Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.
- Entity Scripts
- 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
- 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: Try to avoid expensive operations in this function, as it may cause performance problems.
- 1 : All Players
- Display the message text.Note: If the All Players flag is not set, the player must be the !activator of this input in order for the text to be shown.
- Set the text to display.
Tip: In older games, AddOutput
messagecan be used to change text, although the
Displayinput must be fired again.
- Set the X position of the text. (0 - 1.0 = left to right) (-1 centers)
- Set the Y position of the text. (0 - 1.0 = top to bottom) (-1 centers)
- Set color of the front text.
- Set color of the transition text.
- Removes this entity from the world.
- Removes this entity and its children from the world. Note: Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than
- Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- 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.
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
- 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: In , the code is executed in the script scope of the entity that fires the output, not the one receiving the input.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.
- 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.
- These outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
- This output fires when the entity is killed and removed from the game.