Found something useful on KatsBits? Support the site and help keep content free
Or click here to learn more about this important message »

Using a trigger_hurt entity chain in RtCW to Trigger_kill an AI

Using a trigger_kill Entity chain in RtCW

Sometimes it's simpler to use entities to carry out player and/or triggered actions in custom single player levels for Return to Castle Wolfenstein; it avoids the need to set up a complex scripts that have to be tracked to make sure no 'empty' or 'null' calls are made, crashing the game when run.

Instead GTK Radiant can be used to set up a simple entity chain that when triggered will carry out the desired action, in this case killing an AI.

To get the most from this tutorial it's assumed you know how to use and understand the basics of both GTK radiant and editing Return to Castle Wolfenstein to make single player levels and mod's.

Entities needed ^

The simplest way to kill an AI via a triggered event is to use a series of brush based "trigger_" entities chained together. Brush based entities are normal brush volumes that are 'flagged' or 'converted' to brush entities using the Right Mouse Button (grid view) pop-up menu. For this chain to work two are needed; a trigger_once and a trigger_hurt.

Draw out two normal brush volumes, select one, RMB to open the entity menu and convert it in to a "trigger_once" via the "trigger > trigger_once" option. Deselect and do the same for the other brush volume this time converting it in to a "trigger_hurt" via the "trigger > trigger_hurt" menu option. Deselect. Also needed is a "target_relay", so RMB click and place a one of those via the "target > target_relay" menu option.

Entity set-up and positioning ^

The entity set-up, their connection along the chain are important, else the triggered action won't work, or, the wrong AI will be killed (namely the player). To kill a specific AI in a level, position the 'ai_' entity inside the trigger_hurt - the brush volume needs be big enough to completely envelope the entity with room on all sides to allow for any movement by the AI if/when it activates any default animation sequences in default mode.

Place the 'trigger_once' where it's to be triggered by the player and then put the 'target_relay' near it or the trigger_hurt - make sure that the relay isn't submerged in any type of level brushwork (walls and so on). See below.

Position of entities used to kill and AI in RtCW single player levels

Position of entities used to kill and AI in RtCW single player levels

Entity chain connections ^

In addition to the position of entities, their relative connections are also important because the player needs to trigger the 'hurt' entity and not have that self-affecting; this is why a 'relay' is used, it acts as a go-between so the triggered action doesn't backfire onto the player.

To correctly set up the chain connections, select the 'trigger_once' first and then the 'target_relay', press "Ctrl+K" to connect those entities. Once done, select the target_relay, then the trigger_hurt, pressing Ctrl_K to connect those two entities together - this should result in "trigger_once > target_relay > trigger_hurt", no other connections are necessary; so long as the ai_ is inside the trigger_hurt, when that fires the AI will be killed.

Correct entity connection to kill and ai with a trigger event

Correct entity connection to kill and ai with a trigger event

Entity key/value pairs ^

The trigger_hurt needs to have a damage ability associated with it, a key/value pairing that's higher than any health value that might be applied to the AI to be killed - this is what actually 'kills' the AI so keep in mind that different AI have different default health values, a SuperSoldat is much stronger than a standard foot soldier for example. Using the 'Entity Inspector' add the "key/value" pair of "dmg/[n]" (where "[n]" is a number above "100") to the selected trigger_hurt entity as shown below.

Additional required settings include; "start_off" to force the trigger_hurt to activate only when triggered as well as preventing issues where the trigger entity activates on load before the AI is present (the order in which entities are loaded into a map are not always 'logical' or 'hierarchical'); "silent" so no 'death' noise is heard by the player on trigger activation; "no_protection" to ignore any additional script or entity based settings (an otherwise 'invulnerable' ai_ will be killed); and "once" so the trigger is destroyed after use to prevent accidental re-triggering.

Adding a "dmg" damage value to the trigger_hurt to kill the AI

Adding a "dmg" damage value to the trigger_hurt to kill the AI

Compile the map and test ^

Use "spdevmap [mapname]" from the in-game console to load up the test map in developers mode, walking between the two pillars will trigger each scenario; the soldier is correct so the player activating the trigger_once will kill the AI inside the trigger_hurt. On the other hand, the player walking between the pillars in front of the Super Soldat will be killed because the trigger 'backfires' onto the player due to it being incorrectly set up.

Killing an enemy AI using entities in RtCW single player levels

Killing an enemy AI using entities in RtCW single player levels. trigger_once[1] connected to a target_relay[2], which is in turn is connected to the trigger_hurt[3] used to kill the ai_soldier[4].

In game. Soldier AI is alive and alert - note the pose as a result of defaul animations

Running the trigger kill test map inside RtCW in spdevmap mode. The trigger_once brush is set between the two pillars either side of the screen, the soldier AI being alive and alert at load time - note the pose as a result of default animations being active due to the proximity of the player

AI killed by player walking through trigger_once which activate the chain and kills the soldier

The AI is killed as soon as the player walks through the trigger_once brush volume which activate the entity chain killing the soldier. The same principle can be applied to any and all ai_ based entities in RtCW

KatsBits Web
Search KatsBits using StartPage
Hottest item in Store right now!
Hot Product in Store
Visit the Store Now
  • Blender Art Magazine
^