- 1 Introduction
- 2 Usage
- 3 Reappearing Messages
- 4 Spawnargs
- 5 CVAR
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.
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_enable 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.
By default, each message entity shows the message only once, when triggered.
- 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.
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".
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, filename, default "guis/tdm_message.gui")
Name of the GUI file, which is used to display the message.
If true, the messages are shown, if false, suppressed unless they have "force" on them.