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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Supporting] Spawning bots in SND

[Supporting] Spawning bots in SND

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 3 Posters 327 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mikzyundefined Offline
    mikzyundefined Offline
    mikzy
    Banned
    wrote on last edited by mikzy
    #1

    sorry for opening a forum post and i feel dumb asking this because it's probably common sense and i tried a bunch of work arounds but i'm trying to see, how do you only spawn 2 bots via gsc in SND and not make it spawn 2 more every round?

    i tried multiple ways. heres one example of a check I tried to do:

    botCount = 0;
    foreach (player in level.players)
    {
       if (isDefined(player.pers["isBot"]) && player.pers["isBot"])
       {
             botCount++;
       }
    }
    if (botClient < 2)
    {
         level thread handleBot();
    }
    
    Cahzundefined 1 Reply Last reply
    0
    • mikzyundefined mikzy

      sorry for opening a forum post and i feel dumb asking this because it's probably common sense and i tried a bunch of work arounds but i'm trying to see, how do you only spawn 2 bots via gsc in SND and not make it spawn 2 more every round?

      i tried multiple ways. heres one example of a check I tried to do:

      botCount = 0;
      foreach (player in level.players)
      {
         if (isDefined(player.pers["isBot"]) && player.pers["isBot"])
         {
               botCount++;
         }
      }
      if (botClient < 2)
      {
           level thread handleBot();
      }
      
      Cahzundefined Offline
      Cahzundefined Offline
      Cahz
      VIP
      wrote on last edited by
      #2

      mikey another method could be using a DVAR since they don't reset like normal variables.

      level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 );
      if( !level.botsSpawned )
      {
          setDvar( "botsSpawned", 1 );
          level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 );
          thread handleBot();
      }
      

      but then the DVAR would need to be reset at the end of the game

      level waittill( "game_ended" );
      setDvar( "botsSpawned", 0 );
      
      mikzyundefined 1 Reply Last reply
      0
      • Cahzundefined Cahz

        mikey another method could be using a DVAR since they don't reset like normal variables.

        level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 );
        if( !level.botsSpawned )
        {
            setDvar( "botsSpawned", 1 );
            level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 );
            thread handleBot();
        }
        

        but then the DVAR would need to be reset at the end of the game

        level waittill( "game_ended" );
        setDvar( "botsSpawned", 0 );
        
        mikzyundefined Offline
        mikzyundefined Offline
        mikzy
        Banned
        wrote on last edited by mikzy
        #3

        Cahz does game_ended get called on SND round switch or actual endgame? and also, how would i set after endgame if the GSC resets every round? a for loop?

        birchyundefined 1 Reply Last reply
        0
        • mikzyundefined mikzy

          Cahz does game_ended get called on SND round switch or actual endgame? and also, how would i set after endgame if the GSC resets every round? a for loop?

          birchyundefined Offline
          birchyundefined Offline
          birchy
          wrote on last edited by birchy
          #4

          mikey Consider:

          level waittill("game_ended");
          

          Followed by a check to see if it was the last round:

          waslastround()
          
          1 Reply Last reply
          1
          • mikzyundefined Offline
            mikzyundefined Offline
            mikzy
            Banned
            wrote on last edited by
            #5

            you can do a check for last round? if so, this helps so much. thank you!

            birchyundefined 1 Reply Last reply
            0
            • mikzyundefined mikzy

              you can do a check for last round? if so, this helps so much. thank you!

              birchyundefined Offline
              birchyundefined Offline
              birchy
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

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