Difference between revisions of "Game text"

From Sven Co-op
Jump to navigation Jump to search
(Import of converted entguide pages from Sven Manor.)
 
(Put resolution and position in a table for increased readability)
 
Line 9: Line 9:
 
{{Entity_keyvalue|Message text|message|The message to send. Can have a maximum of 490 chars. However, Valve Hammer Editor will truncate the string to 128 if longer than that and crash if the keyvalue is displayed while having more than 127 chars. If you need a message that long, it is adviced to manually assemble it once using a few trigger_changevalue entities. Using '\n', you can get into the next line.}}
 
{{Entity_keyvalue|Message text|message|The message to send. Can have a maximum of 490 chars. However, Valve Hammer Editor will truncate the string to 128 if longer than that and crash if the keyvalue is displayed while having more than 127 chars. If you need a message that long, it is adviced to manually assemble it once using a few trigger_changevalue entities. Using '\n', you can get into the next line.}}
 
{{Entity_keyvalue|X|x|Horizontal positioning. 0.0 to 1.0. 0.0 means left. 1.0 means right. More accurately, this defines the horizontal offset of where every line of the message starts. A value of 1.0 would literally shove the message off of the right side of the screen. '-1' centers every line depending on its length.}}
 
{{Entity_keyvalue|X|x|Horizontal positioning. 0.0 to 1.0. 0.0 means left. 1.0 means right. More accurately, this defines the horizontal offset of where every line of the message starts. A value of 1.0 would literally shove the message off of the right side of the screen. '-1' centers every line depending on its length.}}
{{Entity_keyvalue|Y|y|Vertical positioning. 0.0 to 1.0. 0.0 means top. 1.0 means bottom. '-1' centers the whole message as one, if it has multiple lines. It is adviced to not center this, as it obscures the players view too much and looks shabby when drawn over the crosshair. Try values like 0.4 or 0.6 instead. Note that depending on the resolution, too high/low values may end up out of screen. Try to stay between 0.2 and 0.8. In case you ever wondered how big of an y-value equals exactly one line break, here is a list showing that in dependence on the player's resolution:
+
{{Entity_keyvalue|Y|y|Vertical positioning. 0.0 to 1.0. 0.0 means top. 1.0 means bottom. '-1' centers the whole message as one, if it has multiple lines. It is adviced to not center this, as it obscures the players view too much and looks shabby when drawn over the crosshair. Try values like 0.4 or 0.6 instead. Note that depending on the resolution, too high/low values may end up out of screen. Try to stay between 0.2 and 0.8. In case you ever wondered how big of an y-value equals exactly one line break, here is a list showing that in dependence on the player's resolution:}}
 +
 
 +
{| class="wikitable sortable"
 +
|-
 +
! Resolution !! Position
 +
|-
 +
|1600 x 1200||0.016666
 +
|-
 +
|1280 x 960||0.020800
 +
|-
 +
|1280 x 1024||0.019550
 +
|-
 +
|1152 x 864||0.023150
 +
|-
 +
|1024 x 768||0.026000
 +
|-
 +
|800 x 600||0.033333
 +
|-
 +
|720 x 576||0.034700
 +
|-
 +
|640 x 480||0.041600
 +
|-
 +
|960 x 600||0.033333
 +
|-
 +
|1088 x 612||0.032700
 +
|-
 +
|1280 x 720||0.027800
 +
|-
 +
|1280 x 800||0.025000
 +
|-
 +
|1600 x 900||0.022222
 +
|}
 +
 
  
1600 x 1200: 0.0166661280 x 960: 0.0208001280 x 1024: 0.0195501152 x 864: 0.0231501024 x 768: 0.026000800 x 600: 0.033333720 x 576: 0.034700640 x 480: 0.041600960 x 600: 0.0333331088 x 612: 0.0327001280 x 720: 0.0278001280 x 800: 0.0250001600 x 900: 0.022222}}
 
 
{{Entity_keyvalue|Text effect|effect|Specify a text effect. 'Fade in/out' has a time-value to fade in, to stay on screen and to fade out. 'Credits' is the same as 'Fade in/out', except that it causes the message to flicker. 'Scan out' has a time-value for per-char color transition and fade-in time per char.}}
 
{{Entity_keyvalue|Text effect|effect|Specify a text effect. 'Fade in/out' has a time-value to fade in, to stay on screen and to fade out. 'Credits' is the same as 'Fade in/out', except that it causes the message to flicker. 'Scan out' has a time-value for per-char color transition and fade-in time per char.}}
 
{{Entity_keyvalue|Color 1 (Add 4th number >0 for opaque)|color|Color with which the text is rendered. Note that HUD messages are rendered additive. If you want your text to appear darker, make the color darker. You can add optional 4th parameter for opaque.}}
 
{{Entity_keyvalue|Color 1 (Add 4th number >0 for opaque)|color|Color with which the text is rendered. Note that HUD messages are rendered additive. If you want your text to appear darker, make the color darker. You can add optional 4th parameter for opaque.}}

Latest revision as of 12:46, 7 January 2023

game_text
Type

point

Status

supported

 


An entity to display HUD messages to the player who activated it, or all players.

1 Keyvalues

Message text : message

The message to send. Can have a maximum of 490 chars. However, Valve Hammer Editor will truncate the string to 128 if longer than that and crash if the keyvalue is displayed while having more than 127 chars. If you need a message that long, it is adviced to manually assemble it once using a few trigger_changevalue entities. Using '\n', you can get into the next line.

X : x

Horizontal positioning. 0.0 to 1.0. 0.0 means left. 1.0 means right. More accurately, this defines the horizontal offset of where every line of the message starts. A value of 1.0 would literally shove the message off of the right side of the screen. '-1' centers every line depending on its length.

Y : y

Vertical positioning. 0.0 to 1.0. 0.0 means top. 1.0 means bottom. '-1' centers the whole message as one, if it has multiple lines. It is adviced to not center this, as it obscures the players view too much and looks shabby when drawn over the crosshair. Try values like 0.4 or 0.6 instead. Note that depending on the resolution, too high/low values may end up out of screen. Try to stay between 0.2 and 0.8. In case you ever wondered how big of an y-value equals exactly one line break, here is a list showing that in dependence on the player's resolution:

Resolution Position
1600 x 1200 0.016666
1280 x 960 0.020800
1280 x 1024 0.019550
1152 x 864 0.023150
1024 x 768 0.026000
800 x 600 0.033333
720 x 576 0.034700
640 x 480 0.041600
960 x 600 0.033333
1088 x 612 0.032700
1280 x 720 0.027800
1280 x 800 0.025000
1600 x 900 0.022222


Text effect : effect

Specify a text effect. 'Fade in/out' has a time-value to fade in, to stay on screen and to fade out. 'Credits' is the same as 'Fade in/out', except that it causes the message to flicker. 'Scan out' has a time-value for per-char color transition and fade-in time per char.

Color 1 (Add 4th number >0 for opaque) : color

Color with which the text is rendered. Note that HUD messages are rendered additive. If you want your text to appear darker, make the color darker. You can add optional 4th parameter for opaque.

Color 2 (Add 4th number >0 for opaque) : color2

Another color with which the text is rendered. It comes to use with 'Credits'- and 'Scan out'-effect only. Note that HUD messages are rendered additive. If you want your text to appear darker, make the color darker. You can add optional 

4th parameter for opaque.

Fade in time (or character scan time) : fadein

If the effect is 'Fade in/out' or 'Credits', this specifies the fade-in time. If the effect is set to 'Scan out', this sets the time that is taken for every single char to change its color from 'Color 2' to 'Color 1'. Fade-in time should be short.

Fade out time : fadeout

If the effect is 'Fade in/out' or 'Credits', this specifies the fade-out time. If the effect is set to 'Scan out', this has no effect. Fade-out time should be longer than fade-in time, so the player notices that the message is going to disappear and can react by trying to read faster.

Hold time : holdtime

Time the message stays on screen after fading in, before it will being to fade out. For effect 'Scan out', this delay will start after all chars have faded in.

Scan time : fxtime

For effect 'Scan out', this defines the time required for a character to fade in to 'Color 2'. The next char will only start fading in as the previous one finishes. Small values like 0.01 to 0.1 seconds make sense here.

Text channel : channel

Select one of four channels to use. If a message already exists in one channel, it will be replaced.

2 Flags

1 : All players

If set, the game_text's message will be displayed to all players instead of just the activator.

2 : No console echo

If set, players will not receive a duplicate of the message in their console. Set this for messages that can be reread or are sent often to prevent console-spam and reduce network-bandwidth-usage.

3 Notes

The game_text's target will be fired when the game_text entity is triggered. This is very useful when you want to use a single notification sound consistently on all your game_text entities. Sven Co-op features a HUD monster-/player-info, which uses HUD message channel 3. Avoid using that channel for important messages. Even if you disable monster-info by setting the CVar 'mp_allowmonsterinfo' to '0', player-info will still display on that channel.

4 Issues

If a text message is replaced by another one because it is set to use the same channel, the time-values won't be updated, causing the new message to expire earlier than desired. Furthermore, only one text message can exist at a specific screen coordinate at a time, even if two different channels are provided. If one line of the message is too long to fit on a player's screen, it will crash the game.

5 Changes

5.0 Steam Release: Colour can now have opacity parameter specified.