Checking for one Zombie?
-
Hello there. Im trying to make a script that respawns dead players when theres one Zombie left to kill. How could I do that? I already got a script for respawning players I just want to check if the round requires one more zombie to kill.
-
if ( get_current_zombie_count() == 1 ) { //put your respawn function here }
-
Cahz said in Checking for one Zombie?:
if ( get_current_zombie_count() == 1 )
{
//put your respawn function here
}Thanks. But for me to execute the function do I need to add a flag_wait or something then call the function?
-
techboy04gaming you can put it in a for loop and allow it to constantly be checking the zombie count
Respawn_Players_If_One_Zombie() { level endon ( "end_game" ); for(;;) { if ( get_current_zombie_count() == 1 ) { foreach ( player in level.players ) { if ( player.sessionstate == "spectator" ) player [[ level.spawnplayer ]](); } } wait 0.05; } }
notes: if there is no wait or waittill, there will be a crash bc the script will try to run too many times. Also, it is good practice to end loops at the end of game to prevent crashes.
and if you want to use the script above, call this inside of your Init function
level thread Respawn_Players_If_One_Zombie();
-
Cheers Cahz, I might use this too
-
Cahz hi bro, i am trying use this script but i get error, can you help me? thanks