Popup messages: Difference between revisions
m add |
fix incorrect entity name |
||
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
Often it can be useful to show the player messages on the screen, this is used for instance for | Often it can be useful to show the player messages on the screen, this is used for instance for instructions in the [[Training Mission (OM)|training mission]]. This article describes how to make this work. | ||
== Usage == | == Usage == | ||
For each message you want to show, insert one '''atdm:gui_message''' entity in your map. Set the proper spawnargs, then | For each message you want to show, insert one '''atdm:gui_message''' entity in your map. The place does not matter, but putting it near the location where the message appears makes sense. Set the proper spawnargs, then simply target that entity from any trigger. | ||
You can also use '''atdm: | You can also use '''atdm:target_message_disable''' and '''atdm:target_message_enable''' entities to disable/enable a certain message. | ||
If you want your message to appear only once, no matter what, use ''' | If you want your message to appear only once, no matter what, use '''trigger_once'''. If it should appear multiple times until a certain condition is fulfilled, use a '''trigger_multiple''' and then a '''atdm:target_message_disable''' entity to disable the message entity. | ||
[[Image:Messages.jpg|right|400px]] | [[Image:Messages.jpg|right|400px]] | ||
Line 15: | Line 15: | ||
Here is an example screenshot from <code>maps/test/trigger_messages.map</code>. The highlighted entity itself is the message. It is targeted by the trigger in the door, showing the message everytime the player steps through the door. The red and green boxes are the '''atdm:target_message_disable''' and '''atdm:target_message_enable''' entities, that are targeted by two levers. | Here is an example screenshot from <code>maps/test/trigger_messages.map</code>. The highlighted entity itself is the message. It is targeted by the trigger in the door, showing the message everytime the player steps through the door. The red and green boxes are the '''atdm:target_message_disable''' and '''atdm:target_message_enable''' entities, that are targeted by two levers. | ||
{{ | == Reappearing Messages == | ||
By default, each message entity shows the message only once, when triggered. | |||
This means: | |||
* if you use a '''atdm:trigger_once''' to trigger it, it will be shown '''exactly once''' | |||
* if you use a '''atdm:trigger_multiple''' to trigger it, it will be shown '''one time whenever the trigger fires''' (which is typically when the player steps through the trigger) | |||
* if you use a '''atdm:trigger_once''' to trigger it, and set '''wait''' on the message entity, it will be shown '''multiple times''' and the time between each showing is '''wait''' seconds long. | |||
== Spawnargs == | |||
=== show (float, default: 0) === | |||
The time in seconds the message is shown, will be longer by approx. one second to fade the message out. If set to 0, shows the message for 6 seconds plus 1s fade out. | |||
=== delay (float, default: 0) === | |||
Time in seconds before the message will appear. | |||
=== wait (float, default: 0) === | |||
If set to a value > 0, the message entity will display the same message after the specified time '''again'''. If you use this, make sure '''wait''' is longer than '''show''', or the message might flicker. | |||
Please see also the section about "reappearing messages". | |||
=== text (string) === | |||
The text to display. | |||
The displayed text can be changed during gameplay (e.g. to use variables like "X of 3 objects found"), by using a script with the "setKey" script command before activating the message entity. | |||
=== lines (int, default: 1) === | |||
The number of lines, will is relayed to the GUI and can influence the vertical alignment of the text. | |||
=== force (boolean, default: 0) === | |||
If true, the message is always shown, regardless of the CVAR. It is wise to set force to 1 for messages that are not pop-up messages, but instead overlay titles. Think of the "movie titles" '''Brideport, late night" that appear transparent over the entire screen. You don't want these to disappear just because the user has the CVAR (see below) set to off. | |||
=== gui (string, default "guis/tdm_message.gui") === | |||
Name of the GUI file used to display the message. The default provides an opaque "aged paper" rectangular background in the upper left corner. For a transparent centered overlay with white text, try "guis/tdm_message_no_art.gui" . | |||
== CVAR == | |||
=== tdm_show_trainer_messages === | |||
If true, the messages are shown, if false, suppressed unless they have "force" on them. | |||
{{GUI}} |
Latest revision as of 13:18, 11 March 2023
Introduction
Often it can be useful to show the player messages on the screen, this is used for instance for instructions in the training mission. This article describes how to make this work.
Usage
For each message you want to show, insert one atdm:gui_message entity in your map. The place does not matter, but putting it near the location where the message appears makes sense. Set the proper spawnargs, then simply target that entity from any trigger.
You can also use atdm:target_message_disable and atdm:target_message_enable entities to disable/enable a certain message.
If you want your message to appear only once, no matter what, use trigger_once. If it should appear multiple times until a certain condition is fulfilled, use a trigger_multiple and then a atdm:target_message_disable entity to disable the message entity.
Here is an example screenshot from maps/test/trigger_messages.map
. The highlighted entity itself is the message. It is targeted by the trigger in the door, showing the message everytime the player steps through the door. The red and green boxes are the atdm:target_message_disable and atdm:target_message_enable entities, that are targeted by two levers.
Reappearing Messages
By default, each message entity shows the message only once, when triggered.
This means:
- if you use a atdm:trigger_once to trigger it, it will be shown exactly once
- if you use a atdm:trigger_multiple to trigger it, it will be shown one time whenever the trigger fires (which is typically when the player steps through the trigger)
- if you use a atdm:trigger_once to trigger it, and set wait on the message entity, it will be shown multiple times and the time between each showing is wait seconds long.
Spawnargs
show (float, default: 0)
The time in seconds the message is shown, will be longer by approx. one second to fade the message out. If set to 0, shows the message for 6 seconds plus 1s fade out.
delay (float, default: 0)
Time in seconds before the message will appear.
wait (float, default: 0)
If set to a value > 0, the message entity will display the same message after the specified time again. If you use this, make sure wait is longer than show, or the message might flicker.
Please see also the section about "reappearing messages".
text (string)
The text to display.
The displayed text can be changed during gameplay (e.g. to use variables like "X of 3 objects found"), by using a script with the "setKey" script command before activating the message entity.
lines (int, default: 1)
The number of lines, will is relayed to the GUI and can influence the vertical alignment of the text.
force (boolean, default: 0)
If true, the message is always shown, regardless of the CVAR. It is wise to set force to 1 for messages that are not pop-up messages, but instead overlay titles. Think of the "movie titles" Brideport, late night" that appear transparent over the entire screen. You don't want these to disappear just because the user has the CVAR (see below) set to off.
gui (string, default "guis/tdm_message.gui")
Name of the GUI file used to display the message. The default provides an opaque "aged paper" rectangular background in the upper left corner. For a transparent centered overlay with white text, try "guis/tdm_message_no_art.gui" .
CVAR
tdm_show_trainer_messages
If true, the messages are shown, if false, suppressed unless they have "force" on them.