View Full Version : Spawn NPCs from trigger

05-13-2002, 04:41 AM
Can someone tell me how to spawn NPC from a trigger?
I want my level to have a load of stormtroopers appear when Kyle goes through a sheet trigger.

05-13-2002, 03:16 PM
Can someone help me?
I want to to spawn loads of Troopers when Kyle obtains a key in a SP level I am making.
Pleazzzz Help :(

05-13-2002, 04:09 PM

Create a trigger around the key, which will activate a target_teleport. This teleport area is in a blank room outside your map, which is filled with Stormtroopers. Once you pick up the key, the stormtroopers are teleported to wherever you place the target_position.

Here is the tutorial:

Create an empty room (solid!) outside your map. Fill it with stormtroopers or whatever you want.

Place a trigger_teleport into the room and set it to "inactive"!

Give the trigger the variables "target" "key_teleport" and "targetname" "activate_teleport"

Place a target_location, wherever you want the troopers to appear and give it the variable "targetname" "key_teleport". The trigger_teleport and the target_location are linked now.

Place a trigger_once around the key and give it the variable "target" "key_trigger". No further variables or changes are needed.

Create a target_activate (wherever you want) and give it the variables "targetname" "key_trigger" and "target" "activate_teleport".

What happens, if you pick up the key?

You will fire the trigger_once (5), which will fire the target_activate (6), which in turn activates the teleporter (2). The stormtroopers are then teleported to the target_location (4).

happy mapping!

Gidion, a.k.a. Dalboz

05-13-2002, 06:54 PM
Excellent idea, thanks very much gidion!
I hope my map is worth it ;)

05-13-2002, 06:56 PM
Does anyone know a way to do the same thing by scripting?
i.e. spawning them from a script? :confused:

Your help is appreciated..... :)

Caster Troy
05-14-2002, 02:25 AM
I have found a much much MUCH easier way of doing this.

1. Create all of the storm troopers in the exact location that you want them to be after they spawn.

2. Give each storm trooper the same "targetname" (in the entity window, add a key named "targetname" and a value of whatever you want. Perhaps "1") Make sure all storm troopers (and whatever units you want to spawn at the same time) have the same target name.

3. Create your key.

4. Create a trigger_once around your key. Set it to "playeronly" and add a key named "target" with the value of whatever you set your storm troopers targetname to ("1" if you took my suggestion). There should now be lines and arrows pointing from the trigger to all of the units you want to spawn.

You are now done! When the trigger is set off, the storm troopers will be spawned just as you arranged them, but not before. I guess you can change the trigger to trigger_multiple if you want them to keep coming back if the player trips the trigger again. Play around with it. -Caster

05-14-2002, 11:37 AM
Cheers Caster.

Thanks to you both, I wanted another example to help me understand.

You're both great!