1 // Zombie Apocalypse mutator - small side project
2 // Spawns a defined number of zombies at the start of a match
5 entity PickZombieSpawn()
9 RandomSelection_Init();
13 for(sp = world; (sp = find(sp, classname, "info_player_team1")); )
15 RandomSelection_Add(sp, 0, string_null, 1, 1);
20 for(sp = world; (sp = find(sp, classname, "info_player_deathmatch")); )
22 RandomSelection_Add(sp, 0, string_null, 1, 1);
26 return RandomSelection_chosen_ent;
29 void zombie_spawn_somewhere ()
31 if(gameover) { return; }
35 if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
37 mon = spawnmonster("zombie", self, self, self.origin, TRUE, 2);
38 tracebox(mon.origin, mon.mins, mon.maxs, mon.origin, MOVE_NOMONSTERS, mon);
42 sp = PickZombieSpawn();
44 setorigin(mon, sp.origin);
50 zombie_spawn_somewhere();
58 print("Them zombies be spawnin'!\n");
60 numzoms = autocvar_g_za_monster_count;
65 e.think = zombie_spawn_somewhere;
80 e.think = spawn_zombies;
81 e.nextthink = time + 3;
84 MUTATOR_HOOKFUNCTION(Zombies_BuildMutatorsString)
86 ret_string = strcat(ret_string, ":Zombies");
90 MUTATOR_HOOKFUNCTION(Zombies_BuildMutatorsPrettyString)
92 ret_string = strcat(ret_string, ", Zombies");
96 MUTATOR_DEFINITION(mutator_zombie_apocalypse)
98 MUTATOR_HOOK(BuildMutatorsString, Zombies_BuildMutatorsString, CBC_ORDER_ANY);
99 MUTATOR_HOOK(BuildMutatorsPrettyString, Zombies_BuildMutatorsPrettyString, CBC_ORDER_ANY);