Zombie, go there, there, there and there.

With any luck you have compiled your scripts and everything is hunky dory. Time to add your bots to your level. Start by placing a bunch of notes in the positions you want your zombies to be spawned. I use notes as they have no function like pathnodes or playStarts so take up no more time when rendering paths.

Placement of note objects in a level

4 rows of 12 notes to give an army of 48 startpoints for zombies.

All of this will be initated through Kismet

Kismet setup for generating large numbers of bots that are spread out.

Kismet setup for generating large numbers of bots that are spread out.

Step 1

Step 1. We need to start this process by an event, so for testing purposes we will use the Level Loaded event (New Event/Level Loaded) and when the level is loaded and visible we link that to...

 

Step 2

Step 2. The next step to take is to create a list of all of the zombies that we will create. To do this we will use the Modify ObjectList (New Action / Object List / Modify ObjectList)

Step 3

Step 3. Next we need variable for all of our notes. To speed thing up for now if you go into the level, right click on one note Select/Select all note actors. Go back to Kisment and on the Object Ref node on the Modify ObjectList (2) right click and select New Object Vars Using... You will need to sort out the vars so they are out of the way later.

Step 4

Step 4. Now we need a variable to store all of these notes. In Kismet these are called ObjectLists but you may think of them as arrays. Right Click anywhere and select New Variable / Object/ObjectList. Make sure you give it a sensible name. Attach this to the Object ListVar node on Modify ObjectList (2). Call the list ZombieSpawnList

Step 5

Step 5. Next we will want to keep tabs on how many zombies start points are in the list we will generate. Create a integer variable (New Variable / Int / Int) and attach it to the List EntriesCount node on Modify ObjectList (2) Call the variable ZombieListLength

Step 6

Step 6. Connect the out from Modify ObjectList (2) to Compare Int (New Condition / Comparison / Compare Int). Hook up ZombieListLength (5) to A. We will use this to see if we have spawned more zombies than we have spawn points. We will hook up A>B to the a Access ObjectList.

Step 7

Step 7. Create a new integer variable called SpawnCount so we can keep a check on how many zombies have been spawned. Hook this up to B on the Compare Int (6)

Step 8

Step 8.Create an Access ObjectList handler (New Action / Object / Access ObjectList) Hook up the SpawnCount (7) to Index. Hook up the ZombieSpawnList object (4) to the Object List node. Then we will need to create an empty object variable (9) to store the object that is stored at the index point from SpawnCount.

Step 9

Step 9. Create the CurrentSpawnPoint object variable (new Variable / Object / Object)

Step 10

Step 10. Create an Add Int (New action / Math / Add Int). Hook Spawn Count (7) to A and IntResult. Click on Add Int and under Seq Act Add Int, set value A to 0 and value B to 1.

Step 111

Step 11. Hook currentSpawnPoint (9) to SpawnPoint and loop finished all the way back to Compare Int (6)

So what just happened?

When the level loaded (1), we created a list (2) by taking all of the notes (3) and adding them into a list called ZombieSpawnList (4). This list numbers them by an index that starts at zero. Once the list is complete we store the amount of objects as a variable in ZombieListLength (5).

Now as we start this, in this instance, ZombieListLength is 48. We will compare this number by using Compare Int (6) to a variable called SpawnCount (7) which is initally set to 0 as no zombies have been spawned. As 48 is greater than 0 (A>B) We will access the list we created using Access ObjectList (8). As SpawnCount (7) is currently at 0 we will access the object that is at position 0 in the ZombieSpawnList (4) and set this as CurrentSpawnPoint (9). We then add 1 onto Spawn Count (10) and Spawn the zombie (11) at the position of the note that is currently CurrentSpawnPoint.We then loop back to Compare Int.

This time SpawnCount is 1 and 48 is greater than 1 so we repeat the loop, this time using the note that is stored in SpawnPointList at index 1. 1 gets added to SpawnCount making it 2 and we repeat this until 48 is not greater then 48 and the cycle is broken, but with 48 spawned Zombies, each at their individual spawn points.

But I haven’t got to the point where we are spawning our zombies that we scripted from the last page.

Click on Actor Factory and look at the properties.

Spawn Options.

Under factory, select ActorFactoryAI

If your scripts from earlier have compiled, you should have a TestZombieBot under the controller Class and a TestZombiePawn under the pawn class.

And that’s it. Run the game and you should see 48 zombies shambling and then hunting you down.

Again thanks to tegleg for his initial tutorial http://forums.epicgames.com/showthread.php?t=755213

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Zombie, go there, there, there and there.

  1. TRINITY-JMF says:

    Hey Darren,

    This seems like a lot of unnecessary hassle to set up and link each note in Kismet. What happens if you have over 100 zombies? surely that’s just gonna give you RSI?

    Why don’t you just drag your Zombie Pawns directly into the scene from the Actor Classes? As long as you tell the Pawn class which Controller class it’s supposed to use within your code it should know what to do.

    Surely that would be easier? as then you wouldn’t even need all this kismet hassle…

    Jo

Comments are closed.