1.19.2006

Waves

Right before bed last night I was looking up something in the WorldEdit command glossary, and I think I figured out a problem. In the next section of the level, I'm planning to have the player fight waves of enemies that spawn one after the other-- a bit of an endurance battle, but nothing too serious. I wasn't sure how to script that, though. What I wanted was for a wave of four guys to stream into the room, and when the last of the four of them gets killed, another four spawn and take their place. The method I decided I could use: At the beginning of the level, a global variable is set to 0. When the player crosses a trigger brush, four AISpawners in the adjoining area spawn CAI. Each of the CAI has an OnDeath command that adds 1 to the global variable. When the variable equals 4, the next wave of CAI spawns in, and the variable is reset to 0. And so on.

But now I'm thinking maybe that each CAI should just have a delayed OnDeath command that spawns a new CAI from the AISpawner, creating a constant press from the enemies instead of a series of discrete waves.

Regardless, at the end of the area, the player crosses a trigger which disables the AISpawner, ending the onslaught. Or maybe for balance it would be better if the onslaught ended after a set number of enemies spawned. I'll see what works best.

So yeah, that was my breakthrough. Just wanted to share.

No comments: