Triggers

From The DarkMod Wiki
Revision as of 14:56, 3 March 2014 by RJFerret (talk | contribs) (→‎trigger_fade: nuance)
Jump to navigationJump to search

There are many different ways of triggering entities, the Trigger entities themselves, as well as through Stim/Response, Conversations, Movers, Objectives, and more. How the trigger occurs will typically dictate which manner you choose for your map.

Triggers

To create triggers that rely on boundaries (once, multiple and their derivations), you need to drag out a worldspawn brush, right-click, select "Create Entity". They need to be connected to their subjects, either via "Connect Selected Entities" menu option/shortcut key, or adding "Target", "Target0", "Target1" or subsequent "Target"# spawnargs. The triggers below are listed roughly by frequency of usage, with related triggers beneath.

trigger_once

When the origin of an entity enters the bounds of this entity, the target(s) will be triggered one time only. (Note, to resize the brush after creating the entity, select it then press Tab once.)

trigger_once_entityname

Similar to trigger_once, but may be set to only respond to the entity specified by the spawnarg, "entityname". Note the entity must move into the boundaries itself, not be moved by the player (AI walking themselves for example). (If you want something to happen based on the player dropping or placing an item somewhere, use the Objectives system instead.)

trigger_multiple

Similar to trigger_once but will activate again and again, use "Wait" spawnarg to control how many seconds between triggerings.

trigger_entityname

Similar to trigger_multiple but only reacts to the entity defined by the "entityname" spawnarg.

trigger_facing

Also similar to trigger_multiple, but requires the triggering entity to be within 30° of the specified "angle" spawnarg. For details see Trigger Facing.

trigger_relay

Most commonly used to trigger many targets, or do so after a delay (per the "delay" spawnarg). May be set to only work once (spawnarg "wait" "-1") or limit firing based upon how many seconds have passed. The "random" spawnarg may be used with "wait" to vary the firings. Very useful as the target of worldspawn, to trigger things at map start (since worldspawn currently only activate one "Target"), or as the target of Objectives.

trigger_count

This will fire at it's targets upon a specific number of times being triggered itself, based upon the "count" spawnarg. If "count" "3" is set, it will do nothing until the third triggering.

trigger_timer

This trigger will fire repeatedly every "wait" # seconds. The spawnarg "start_on" defines if it should do so at the start of the map, or wait to be triggered (defaults to 0, off at map start). Spawnarg "random" adds variability to the triggerings.

trigger_fade

Will cause the display to fade or dissolve to a specified color. The spawnarg "fadeColor" specifies which color, and how transparent in RGBA (red, green, blue, and alpha, ranging from 0-1). Default is fade to black: "fadeColor" "0 0 0 1". To fade up from whatever, use alpha of 0, IE to fade up from black, "0 0 0 0". "fadeTime" controls how quickly the fade transpires.

trigger_hurt

(needs experienced write-up, compare with stim/response damage please)

trigger_presize

(needs experienced write-up)

trigger_touch

Continuously checks if entities are touching, costly performance wise, probably done via Objectives more efficiently.

Triggering via Stim/Response

Within the Stim/Response editor, add a response stim set to "Trigger", now when this entity is targeted, whatever specified effect will occur.

Triggering via Conversation

The command, ActivateTarget will trigger the specified entity at that time in the Conversation script.

Triggering via Doors, Buttons, Levers, Movers

Doors trigger their targets by default upon opening (spawnarg "trigger_on_open" "1"). They may also trigger when completely open by changing "trigger_when_opened" to 1 instead of the default 0, or when fully closed via "trigger_on_close". Note, those conditions on Buttons came from doors, so are counter-intuitive.

Triggering via Objectives

In the Objectives Editor you may select an entity to be triggered upon an objective succeeding or failing. Therefore all the possible objective conditions may become trigger events (knock out an AI, move an object away from another or to a spot, cause another objective to become visible, disappear or complete, etc.)

Triggering via Worldspawn

You may set "Target" on Worldspawn (usually at a trigger_relay since it only may target one entity currently) to cause things to be triggered at map start. If you use this to kill an AI or other affect with audio, note if in range of the player's start, it will be heard during the fade up from black.

Triggering via Lights

Lights trigger their target(s) both upon being extinguished and lit. This is useful to match window glow to actual light condition. Depending on the light, it may be tricky to set the targets however. A basic light entity can simply have target(s) spawnargs, but a candle, lamp or torch with attached flame entity, you need to use the "set" spawnarg. For example, "set target0 on flame" "EntityToBeTriggered".