Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Checking for one Zombie?

Checking for one Zombie?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 4 Posters 201 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • techboy04gamingundefined Offline
    techboy04gamingundefined Offline
    techboy04gaming
    wrote on last edited by
    #1

    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.

    Cahzundefined 1 Reply Last reply
    0
    • Cahzundefined Offline
      Cahzundefined Offline
      Cahz VIP
      replied to techboy04gaming on last edited by
      #2

      techboy04gaming

      if ( get_current_zombie_count() == 1 )
      {
          //put your respawn function here
      }
      
      1 Reply Last reply
      0
      • techboy04gamingundefined Offline
        techboy04gamingundefined Offline
        techboy04gaming
        wrote on last edited by
        #3

        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?

        Cahzundefined 1 Reply Last reply
        0
        • Cahzundefined Offline
          Cahzundefined Offline
          Cahz VIP
          replied to techboy04gaming on last edited by
          #4

          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();
          
          Izi selvaundefined 1 Reply Last reply
          1
          • luigistyleundefined Offline
            luigistyleundefined Offline
            luigistyle Plutonium Staff
            wrote on last edited by
            #5

            Cheers Cahz, I might use this too 😄

            1 Reply Last reply
            0
            • Izi selvaundefined Offline
              Izi selvaundefined Offline
              Izi selva
              replied to Cahz on last edited by
              #6

              Cahz hi bro, i am trying use this script but i get error, can you help me? thanks

              1 Reply Last reply
              0

              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Donate