Was wondering how I would make the zombies respawn when a player walks to far away from the zombies like on Mob of the Dead, I have an elevator and a teleporter setup but when the player uses one of them It puts them In an area the zombies can't get to unless they respawn
This has most engine defined functions including dodamage();. hold ctrl + f and search for "dodamage". It'll tell you how to properly use the function.
Was wondering how I would make the zombies respawn when a player walks to far away from the zombies like on Mob of the Dead, I have an elevator and a teleporter setup but when the player uses one of them It puts them In an area the zombies can't get to unless they respawn
What this does is kill of any remaining zombies. I used a trigger mult... It will end the round and start the next one.
Hope this helps!
Thanks, you said you used a trigger mult for It? I tried putting a trig multiple In and It keeps the zombies from spawning until It's activated this Is how I put It In
Code Snippet
Plaintext
{ trigger = getent ( "axisdamage", "targetname" ); zombies = getaispeciesarray("axis"); trigger waittill ("trigger"); for (i = 0; i < zombies.size; i++) {
dist_check() { max_dist_for_respawn = 2000; too_far_away = false; all_players = GetPlayers(); while(1) { for(i = 0; i < all_players.size; i++) { zombie_distance = Distance(all_players[i].origin, self.origin); if( zombie_distance >= max_dist_for_respawn) { too_far_away = true; } else { too_far_away = false; break; } } if(too_far_away == true) { self dodamage((self.health * 100), self.origin); //level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow //Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive. } wait(1); } }
dist_check() { max_dist_for_respawn = 2000; too_far_away = false; all_players = GetPlayers(); while(1) { for(i = 0; i < all_players.size; i++) { zombie_distance = Distance(all_players[i].origin, self.origin); if( zombie_distance >= max_dist_for_respawn) { too_far_away = true; } else { too_far_away = false; break; } } if(too_far_away == true) { self dodamage((self.health * 100), self.origin); //level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow //Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive. } wait(1); } }
Sorry for the late reply, tried this script but when I get really far from the zombies they don't die/respawn
Last Edit: May 27, 2014, 10:09:10 pm by NaviLlicious
because it gets an array of the zombies of zombies once. that means i gets a list of 1 zombies at game start. then a new zombie spawn outside that array. so code wont affect it Post Merge: May 27, 2014, 10:36:35 pmthis will work using your code but i would do this stuff using zombiemodespawner. no need of getting arrays.
because it gets an array of the zombies of zombies once. that means i gets a list of 1 zombies at game start. then a new zombie spawn outside that array. so code wont affect it Post Merge: May 27, 2014, 10:36:35 pmthis will work using your code but i would do this stuff using zombiemodespawner. no need of getting arrays.
zombie = spawn_zombie( spawner );//here you need get your spawners somehow and check distance to select one close to the player //HEY HERE!!!! zombie.team = "axis"; zombie thread dozombiestuff();
self dodamage((self.health * 100), self.origin); //level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow //Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive. }
wait 1; } }
and add this
Code Snippet
Plaintext
level.max_dist_for_respawn = 2000;
under this
Code Snippet
Plaintext
init() {
edit: add this at the bottom of the file also
Code Snippet
Plaintext
dozombiestuff() { self thread zombie_spawn_init("zombie"); self thread zombie_think(); self thread zombie_setup_attack_properties(); //self thread find_flesh(); i dont rememebr if you need this one }