Popup messages: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
add section about reappearing messages
Fidcal (talk | contribs)
Line 5: Line 5:
== Usage ==
== 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 simple target that entity from any trigger.
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.
You can also use '''atdm:target_message_enable''' and '''atdm:target_message_enable''' entities to disable/enable a certain message.

Revision as of 14:51, 30 October 2009

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_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 atdm:trigger_once. If it should appear multiple times until a certain condition is fulfilled, use a atdm: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)

Time in seconds the message will be shown.

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.

lines (int, default: 1)

The number of lines, will influence the vertical alignment of the text.

is_long (boolean, default: 0)

If set to true, a long message is assumed, this will influence the default show time, which is longer for long message.