AI Spawning Enemy

Ai : Spawning Enemy :: Manstein --- There are two ways to get enemies spawning in your level:

(1) Run through a trigger and enemies spawning only one time. (2) Enemies spawning for each enemy killed before.

The second is more complicated and will be explained later on in another tutorial maybe. The first one is really simple. Let me show you how to do it! Ok, let´s start with the MOHRAD. Build a simple map with a wall in the middle. Next, place an ai_actor in your map. I placed it behind the wall to let it run to the players view after he has touched the trigger. Give the ai_actor the following keys / values :

targetname - enemyspawner group - 1 set - 1 model - human/german_panzer_obershutze.tik

Now we give the enemyspawner a destination to run to: Place an info_pathnode near the ai_actor and give it the following keys / values :

targetname - enemyspawnerdestination group - 1 set - 1

Note to give the enemyspawnerdestination the same #set and #group value as the enemyspawner! Now we need a trigger_multiple with these keys and values :

targetname - enemyspawnertrigger set - 1 cnt - 1

That´s it for the map. As soon as the player runs through the trigger, an enemy will appear and start shooting him. Save your map as test_yourmapname.map and open your script editor.

Put a

exec global/ai.scr

before the level waittill prespawn, then call

thread global/ai.scr::spawngroup #1 #1

That´s it. Save your mapscript as test_yourmapname.scr and compile the map. Play it and have fun.

Some hints: 1. You can have more than one enemy get spawned by the trigger. Just add as many ai_actors with the same values as descripted above, except the #group value!

The #set determines, which \"wave\" of enemies should be spawned. For example, if you have more than one group of ai_actor(s), info_waypoint(s), and trigger_multiple(s), you will have to give each group another, unique #set - value (1, 2, 3, ...).

The #group determines how many enemies should be spawned by running through the trigger. You can have three or more enemyspawners getting spawned. So you will have to put three ai_actors in your map, each with it´s own, unique #group value.

Have fun Manstein