entity chain set-up for triggering props_flamethrower effect in RtCW
Like most actions in custom single player levels for Return to Castle Wolfenstein they can be triggered directly through the use of an entity or, indirectly through script event - the former is easier, the latter allows for more complex interactions between the game and what the player does.
The following tutorial explains how to set-up a props_flamethrower entity in a single player environment so it's triggered directly by the user (player) through a series of entities called an 'entity chain.
The tutorial assumes basic knowledge of using GTK Radiant, compiling and testing levels in-game.
Required entities ^
For this effect to work correctly it's best to use a chain of entities rather than triggering the props_flamethrower entity directly, in a literal sense, so at a minimum a 'trigger' is needed along with a 'relay' and a 'target'. Typically this means a "trigger" is a brush based entity, in this instance that's a 'trigger_once', 'trigger_multiple' or 'func_button'; the "relay" is a 'target_relay', an entity that usually sits between activator and event, often preventing trigger actions from backfiring on to the player. And two types of "target", one being the 'props_flamethrower' itself, the other being an 'info_notnull' for the flamethrower.
Entities needed to set-up a trigger props_flamethrower event
Connecting the entities ^
The key to correctly setting up the props_flamethrower is to think of the action as a two part process. First is the flamethrower itself; the entity needs a direction, a 'target' at which the flames will be 'thrown', the 'info_notnull' entity is used for this. Select the props_flamethrower then the info_notnull, use Ctrl+K to connect the entities together, the props_flamethrower targets the info_notnull - 'props_flamethrower > info_notnull' and not 'info_notnull > props_flamethrower'.
Second is the trigger and it's relay which, depending on the situation the effect is to be used in, will be a brush based 'trigger_once', a 'trigger_multiple', a 'func_button' or some other user based actuator (for example 'func_invisible_user'). This this component of the set up the 'trigger' is connected to the target_relay - 'trigger_once > target_relay' and not 'target_relay > trigger_once'.
Once both parts are set up, the target_relay section then needs to be connected to the props_flamethrower component with the result that the full entity chain looks similar to the following; 'trigger_once > target_relay > props_flamethrower (> info_notnull)'.
Connecting the entities together to form an "entity chain" which triggers the props_flamethrower
Entity Settings ^
Although there are a number of entity settings available for use in this situation (read the available per-entity information in the 'Entity Inspector', "N"), there is only really one general consideration that need to be kept in mind with the props_flamethrower effect and that's the 'wait' time involved, especially if a trigger_multiple is used. Ideally the props_flamethrower needs a 'duration/[n]' key/value pairing set (where "[n]" is a number of seconds) so the blast from the effect lasts for a fix amount of time. This is important as it relates to the rest of the set up in such a way that similar 'wait' durations need to be set for any 'constant' trigger to stop them firing at the entity in succession, causing an infinite loop.
So, any trigger_multiple or other trigger than can be fired constantly whilst the player or an AI is activating it needs a 'wait/[n]' key/value pairing (where "[n]" is a length of time in seconds) that's at least two or more seconds longer in duration than the value set in the props_flamethrower entity itself. For example, if the flamethrower is set for a duration of "3" seconds ("duration/3"), a trigger_multiple should have a wait time of "5" ("wait/5"), similarly so should a func_button ("wait/5") and so on; this prevents the re-activation of the trigger before the flamethrower effect has had time to reset and switch off ready for the next trigger event.
"duration[n]" key/value pair setting the length of time of the flamethrower effect
Entity placement ^
Placement of the props_flamethrower is critical because if it's buried or any part of it is occluded it stands a good chance of 'breaking' and simply not working. This means it must be place free of any brushwork; it can be touching but not buried, channels may need to be cut into brushwork to make allowance for this.
Placement of the entity is critical for the effect to work
Flamethrower won't turn off once triggered ^
In certain circumstances the props_flamethrower entity won't turn off once it's activated unless it receives another activation impulse (the trigger impulses 'toggle' the effect on/off); for instance, once triggered, walking back through a trigger_multiple will sent an impulse causing the effect to turn off. One way to get around this problem, without using complex scripting, is to use a 'target_delay' entity which fires a few seconds after it has been triggered, the impulse it then sends out deactivates the flamethrower.
For this to work correctly, the target_delay needs a 'wait/[n]' key/valuing paring that's less than the time between each reset of the main user trigger. For example, if a trigger_multiple, or func_button have a 'wait' time of "5" seconds, the target_delay would need to have a wait time of less than that, say "3" or "4" seconds. This makes sure the chain has time to turn off the effect and reset itself before the next triggering.
To set this up make sure the target_delay has the same "target_name" as the props_flamethrower, this ensures that the target_relay entities are pointing at both the delay and the flamethrower so they get triggered at the same time.
Using a target_delay to de-activate the flamethrower effect
Compile and test in game ^
Compile the level and load into RtCW using "/spdevmap [mapname]" from the in-game console, if the entity chain has been set up correctly the props_flamethrower effect should fire on being triggered by any of the activators placed in level. Check durations and timing to make sure the flamethrower stops before it's re-triggered by one of the other activators; if it seems to stay active longer than expected go back to GTK radiant and inspect the entity settings to make sure the time related key/value pairings are correct.
Entity set-up to trigger the props_flamethrower effect in single player RtCW levels
props_flamethrower effect in game showing the func_button that activated it in the foreground waiting to be reset (after "5" seconds)