From Valve Developer Community
Revision as of 06:48, 26 July 2011 by Barracuda (talk | contribs) (Cleanup)
Jump to: navigation, search
Game text.png

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 titles.txt file). This entity is suitable only for standalone bsp maps.

If your text is not displaying properly in a multiplayer game, try checking the "All Players" flag.

Warning.png Warning: It is not suitable for any other usage, as it prevents localization and makes text editing impossible without a recompilation.
Warning.png 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 use detailed quotes (i.e. and ).
Note.png Note: Does not function in Counter-Strike Source.

In code it is represented by class CGameText, defined in maprules.cpp.


Message Text <string>
Message to display onscreen. \n signifies a new line in the text.
Bug.png Bug: Hammer will automatically change \n to /n. The only known workaround is to edit the vmf in notepad.
X (0 - 1.0 = left to right) (-1 centers) <string>
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) <string>
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 <choices>
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.
Color1 <color255>
The primary color used by all the text effects.
Color2 <color255>
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) <string>
The time it should take for the text to fully fade in.
Fade Out Time <string>
The time it should take for the text to fade out, after the hold time has expired.
Hold Time <string>
The time the text should stay onscreen, after fading in, before it begins to fade out.
Scan time (scan effect only) <string>
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 <choices>
You can have up to four 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.
  • 1 : Channel 1
  • 2 : Channel 2
  • 3 : Channel 3
  • 4 : Channel 4
Master <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.


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.


  • 1 : All Players


Display the message text.


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.



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.

See also

  • point_message - A similar entity that displays a small custom message at a specific position in the game world.
  • Customizable triggered HUD-message - How to create a new entity that is similar to game_text but can receive the message string via a triggered input.