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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. How Do I Get The Bots To Have Different Weapons

How Do I Get The Bots To Have Different Weapons

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
16 Posts 4 Posters 643 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.
  • Duui YTundefined Offline
    Duui YTundefined Offline
    Duui YT
    wrote on last edited by
    #1

    How Do I Get The Bots To Have Different Weapons

    1 Reply Last reply
    0
    • Deicideundefined Offline
      Deicideundefined Offline
      Deicide
      wrote on last edited by Deicide
      #2
      /*
      *	 Black Ops 2 - GSC Studio
      *
      *	 Creator : Deicide
      *	 Project : Example Script
      *    Mode : Multiplayer
      *	 Date : 2020/05/26 - 12:03:49	
      *
      */	
      
      #include maps\mp\_utility;
      #include common_scripts\utility;
      #include maps\mp\gametypes\_hud_util;
      #include maps\mp\gametypes\_hud_message;
      
      init()
      {
          level thread onPlayerConnect();
      }
      
      onPlayerConnect()
      {
          for(;;)
          {
              level waittill("connected", player);
              player thread onPlayerSpawned();
          }
      }
      
      onPlayerSpawned()
      {
          self endon("disconnect");
      	level endon("game_ended");
          for(;;)
          {
              self waittill("spawned_player");
      		if(self is_bot()) self giveweapon("riotshield_mp");//Example
          }
      }
      

      Example for replacing a bot's weapon on spawn if you want something specific. If you want something more unpredictable you can use this.

      GiveRandomWeapon()
      {
      	id = random(level.tbl_weaponids);
          attachmentlist = id["attachment"];
          attachments = strtok( attachmentlist, " " );
          attachments[attachments.size] = "";
          attachment = random(attachments);
          self GiveWeapon((id["reference"] + "_mp+") + attachment, 0, false);
          self switchToWeapon((id["reference"] + "_mp+")+ attachment,0,false);
          Camo=RandomIntRange(1,45);
          self takeWeapon((id["reference"] + "_mp+")+ attachment);
          self giveWeapon((id["reference"] + "_mp+")+ attachment,0,true(Camo,0,0,0,0));
          self switchToWeapon((id["reference"] + "_mp+")+ attachment,0,false);
          self iPrintln("Given Random Weapon!");
      }
      

      And call it on spawn (don't thread) with only bots like shown above. It'll take their weapon away and give them a weapon with random attachments & random camo.

      1 Reply Last reply
      0
      • Duui YTundefined Offline
        Duui YTundefined Offline
        Duui YT
        wrote on last edited by Duui YT
        #3

        Deicide i do it like this but don't work

        onplayerspawned()
        {
           self endon( "disconnect" );
           level endon( "game_ended" );
           self freezecontrols(false);
           self.MenuInit = false;
           isFirstSpawn = true;
           for(;;)
           {
               if(isFirstSpawn)
               {
               	if (self isHost())
               	{
               		self iPrintln(" ^1 ");
                   }
                   isFirstSpawn = false;
               }
           	self waittill( "spawned_player" );         
           	        if(self is_bot()) self giveweapon("knife_mp");
           	self setPerk("specialty_fallheight");
           	if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified")
        
        1 Reply Last reply
        0
        • Deicideundefined Offline
          Deicideundefined Offline
          Deicide
          wrote on last edited by
          #4

          You need to take all their weapons before you give them the knife. All bots have a knife on spawn.

          Duui YTundefined 2 Replies Last reply
          0
          • Duui YTundefined Offline
            Duui YTundefined Offline
            Duui YT
            replied to Deicide on last edited by Duui YT
            #5

            Deicide how do i take all the weapons from the bots

            1 Reply Last reply
            0
            • Duui YTundefined Offline
              Duui YTundefined Offline
              Duui YT
              replied to Deicide on last edited by
              #6

              Deicide how do i remove the weapons from the bots

              1 Reply Last reply
              0
              • kefryundefined Offline
                kefryundefined Offline
                kefry
                wrote on last edited by
                #7

                Deicide me to i the have the same problem what is code to remove the weapons from the bots

                1 Reply Last reply
                0
                • Deicideundefined Offline
                  Deicideundefined Offline
                  Deicide
                  wrote on last edited by
                  #8
                  self takeallweapons();
                  

                  Next time, please try to do some research, as this function is very common.

                  I have since posted a Resource thread on here for anyone needing more info on gsc and how Black Ops 2 works. I will update the thread when i see fit with more helpful stuff.

                  Duui YTundefined 1 Reply Last reply
                  1
                  • Duui YTundefined Offline
                    Duui YTundefined Offline
                    Duui YT
                    replied to Deicide on last edited by Duui YT
                    #9

                    Deicide it removes the weapons for everyone how will i make it only for the bots

                    Cahzundefined 1 Reply Last reply
                    0
                    • Cahzundefined Offline
                      Cahzundefined Offline
                      Cahz VIP
                      replied to Duui YT on last edited by
                      #10

                      Duui YT do research!

                      Duui YTundefined 1 Reply Last reply
                      1
                      • Duui YTundefined Offline
                        Duui YTundefined Offline
                        Duui YT
                        replied to Cahz on last edited by
                        #11

                        Cahz i did

                        Cahzundefined 1 Reply Last reply
                        0
                        • Cahzundefined Offline
                          Cahzundefined Offline
                          Cahz VIP
                          replied to Duui YT on last edited by
                          #12

                          Duui YT So you found the answer to your question 🙂

                          Duui YTundefined 1 Reply Last reply
                          1
                          • Duui YTundefined Offline
                            Duui YTundefined Offline
                            Duui YT
                            replied to Cahz on last edited by
                            #13

                            Cahz no i cant how will i do it i was doing research for over 1 hour

                            Cahzundefined 1 Reply Last reply
                            0
                            • Cahzundefined Offline
                              Cahzundefined Offline
                              Cahz VIP
                              replied to Duui YT on last edited by
                              #14

                              Duui YT you have the answer posted in this thread already.

                              Duui YTundefined 1 Reply Last reply
                              1
                              • Duui YTundefined Offline
                                Duui YTundefined Offline
                                Duui YT
                                replied to Cahz on last edited by
                                #15

                                Cahz like this

                                if(self is_bot()) self takeallweapons();
                                
                                Cahzundefined 1 Reply Last reply
                                0
                                • Cahzundefined Offline
                                  Cahzundefined Offline
                                  Cahz VIP
                                  replied to Duui YT on last edited by
                                  #16

                                  Duui YT big brain moves right here. just test it make sure it works

                                  1 Reply Last reply
                                  2

                                  • Login

                                  • Don't have an account? Register

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