if(self.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; } }
and add this
Code Snippet
Plaintext
level.max_dist_for_respawn = 2000;
under this
Code Snippet
Plaintext
init() {
just need to spawn the other zombie closer to the player good luck dual
This does kill the zombies when you get far enough away but doesn't spawn the zombies In the current zone the player Is In
ok i modified my topic whi the code. it just needs to get your spawner to trigger the closer one to the player
The zombies die and the round doesn't end but the zombies also don't respawn even when standing In a zone how would I make the spawners trigger when a player gets close to them?
if you look in the script theres a part in which i mentioned you somehow have to acquiare the spawners and then check distance :l emm can you show me your spawners kvps? Post Merge: May 28, 2014, 05:44:25 amlol i should make a tut on how to do this after it gets finished xD
The KVP's are the normal zombie KVP's here are the targetnames for them "targetname" "initial_zone_spawner" "targetname" "zone1_spawner" "targetname" "zone2_spawner" the number goes up from there
Here's my progress on my version of the respawn which I've coded into the round_spawning under zombiemode think with additional functions to making this work.
For testing I set the distance to 1000 and so far there seems to be no glitches in the process however I did this without playable_area also so I need to also make sure zombie deaths by distance don't spawn powerups.
Here's my progress on my version of the respawn which I've coded into the round_spawning under zombiemode think with additional functions to making this work.
For testing I set the distance to 1000 and so far there seems to be no glitches in the process however I did this without playable_area also so I need to also make sure zombie deaths by distance don't spawn powerups.
Update, All issues I was having before are fixed and powerups don't spawn on zombie deaths from distance. Just going to do a hard test on it before sending it out.
I've done a hard test on this script with zombie spawn delays of 0.1 and wait between rounds as 5 seconds and all worked really well.
I've harshly modified the round_spawning feature which delayed me putting this out for a little while because if round_spawning was to bug out in higher waves it could go terribly wrong so it shouldn't do this.
I won't put this up as a tutorial for now until it's properly tested so consider it as a beta.
Open up _zombiemode.gsc and search for `level.overridePlayerDamage = ::player_damage_override;` around line 103. Below add the following;
Code Snippet
Plaintext
level.zombies_to_add = 0;
Next find `round_spawning()` around line 1435. Replace the whole round_spawning() function with this;
max = get_players().size * 3 + level.round_number;
} else {
max = 6;
} } else if ( level.first_round ) { max = int( max * 0.2 ); } else if (level.round_number < 3) { max = int( max * 0.4 ); } else if (level.round_number < 4) { max = int( max * 0.6 ); } else if (level.round_number < 5) { max = int( max * 0.8 ); }
level.zombie_total = max; mixed_spawns = 0; // Number of mixed spawns this round. Currently means number of dogs in a mixed round
ai = spawn_zombie( spawn_point ); if( IsDefined( ai ) ) { level.zombie_total--; ai thread dist_check(); ai thread round_spawn_failsafe(); count++; } if(count >= max) { while(get_enemy_count() + level.zombie_total > 0) { kill_and_replace(true); if(level.zombies_to_add > 0) break; wait(0.1); } //iPrintLn("zombie_total is set to " + level.zombie_total); level.zombies_to_add = 0; // fail safe } max = run_respawn_check(max); wait( level.zombie_vars["zombie_spawn_delay"] ); wait_network_frame(); if(count >= max) { //iPrintLnBold("round_spawning() has ended"); break; } //iPrintLn("zombie_total is set to " + level.zombie_total); } thread last_zombie_runner(); }
Below the end of the round_spawning function, Add these 4 functions in;
Code Snippet
Plaintext
run_respawn_check(max) { kill_and_replace(true); if(level.zombies_to_add > 0) { //iPrintLn("zombie_to_add is set to " + level.zombies_to_add); max += level.zombies_to_add; level.zombie_total += level.zombies_to_add; level.zombies_to_add = 0; kill_and_replace(false); iPrintLn("zombie_total is set to " + level.zombie_total); } return max; }
dist_check() { self endon("death"); max_dist_for_respawn = 1000; too_far_away = false; all_players = GetPlayers(); wait(5); // time to spawn and move around a bit before checking 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) { //level.zombies_to_add++; self.kill_and_replace = true; //self dodamage((self.health * 100), self.origin); //Killing before round_spawning has a chance to pick up on it could result in round end break; } wait(1); } }
Save the _zombiemode.gsc and then open up your _zombiemode_spawner.gsc Search for `zombie_can_drop_powerups( zombie )` and replace the function with this;