From Valve Developer Community
Revision as of 08:08, 12 March 2018 by Smelt93 (talk | contribs)

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: 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 use detailed quotes (i.e. and ).

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: 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.
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.
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.
Note:This value defaults to zero for entities not created in Hammer.
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 (medium text size)
  • 2 : Channel 2 (small text size)
  • 3 : Channel 3 (large text size)
  • 4 : Channel 4 (medium text size)
  • 5 : Channel 5 (Mainly have to type this in Channel 5)
Master <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.


Name <string>
The targetname that other entities refer to this entity by.
Entity Scripts <scriptlist> (New with 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 <string> (New with 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: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.
SetText  <string> (New with Alien Swarm)
Set the text to display.
SetPosX  <float> (New with Portal 2)
Set the X position of the text. (0 - 1.0 = left to right) (-1 centers)
SetPosY  <float> (New with Portal 2)
Set the Y position of the text. (0 - 1.0 = top to bottom) (-1 centers)
SetTextColor  <color255> (New with Portal 2)
Set color of the front text.
SetTextColor2  <color255> (New with Portal 2)
Set color of the transition text.


Removes this entity and any entities parented to it from the world.
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster than Kill.
AddOutput  <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
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. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
RunScriptFile  <script> (New with 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> (New with 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: 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: 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> (New with Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin  <coordinates> (New with 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> (New with 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 the Left 4 Dead series)
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.

Tutorials about Game_text (Russian)

Lessons created by Project-S