game_text

From Source Entities
Jump to navigation Jump to search

Code classes:

Game text.png

game_text is a point entity present in all Source games. It displays text on players' screens. Bug: Does not work in L4d.pngL4d2-small.png.

Flags[edit | edit source]

  • 1: All Players - Makes text show to the whole server, otherwise multiplayer games will only show to the !activator.

Keyvalues[edit | edit source]

Message Text (message) <string>
Message to display onscreen. Mods doing localization (or single mappers, if possible) should insert a string from a text file in resource/. (E.g. #Valve_Move_Forward, defined in valve_english.txt will produce text saying "Move forward" in whichever language the player is using.)
Tip: Use \n signify a new line of text.
Bug: Hammer will automatically change \ to /. This can be worked around by editing the VMF with a text editor, although it will need to be done after saving.
X (0 - 1.0 = left to right) (-1 centers) (x) <float>
Horizontal position of the text. 0.0 = far left, 1.0 = far right, -1 = perfectly centered.
Y (0 - 1.0 = top to bottom) (-1 centers) (y) <float>
Vertical position of the text. 0.0 = top, 1.0 = bottom, -1 = perfectly centered.
Text Effect (effect) <choices>
How the text appears and disappears.
  • 0: Fade In/Out - The whole text fades in and fades out.
  • 1: Credits - Identical to Fade In/Out.
  • 2: Scan Out - Puts each letter in one by one and gives the letters an alternative color if they were just put in.
Color1 (color) <color255>
The primary color used by all text effects. Note: Bright backgrounds or dark text colors can result in the text being nearly invisible if it's applied additively. Valve sometimes used a fourth number, but it doesn't seem to do anything.
Color2 (color2) <color255>
The color a letter will be when it's first put on the screen when using Scan Out.
Text Channel (channel) <choices>
The game can have up to 6 game_texts active at once, but every text message must use a different channel otherwise the previous message on that channel will be erased. In some games, the text channels have different properties (rendering additively, different sizes, different fonts). If more than 6 channels are used, ones with lower numbers will be written over.
Fade in Time (or character scan time) (fadein) <float>
If Text Effect is Fade In/Out, this is how long the text takes to fade in. If it's Scan Out, this is how long each letter will take to pop in.
Hold Time (holdtime) <float>
Once all the text is fully on-screen, how long to keep it there before fading away.
Fade Out Time (fadeout) <float>
How long it takes for text to fade out after Hold Time is over.
Scan time (scan effect only) (fxtime) <float>
If Text Effect is Scan Out, this is how long it will take a newly-created letter to fade from Color2 to Color1. Note: This fade time is not taken into account by Hold Time. Hold time begins the moment the last letter pops on the screen.

Inputs[edit | edit source]

Display
Shows the text. In multiplayer games, text will only show to the activator unless All Players is checked.
SetText <string> (available in all games since L4d2-small.png)
Sets Message Text.
SetPosX <float> (available in all games since P2.png)
Sets X.
SetPosY <float> (available in all games since P2.png)
Sets X.
SetTextColor <float> (available in all games since P2.png)
Sets Color1.
SetTextColor2 <float> (available in all games since P2.png)
Sets Color2.

See Also[edit | edit source]