Skip to content
  • 0 Unread 0
  • Recent
  • Popular
  • Users
  • Donate
Collapse
Home Docs Stats Discord Donate
Download
  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 3.0k 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.
  • Deicide
    Deicide
    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 YT
      Duui YT
      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
      • Deicide
        Deicide
        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 YT 2 Replies Last reply
        0
        • Deicide Deicide

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

          Duui YT
          Duui YT
          Duui YT
          wrote on last edited by Duui YT
          #5

          Deicide how do i take all the weapons from the bots

          1 Reply Last reply
          0
          • Deicide Deicide

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

            Duui YT
            Duui YT
            Duui YT
            wrote on last edited by
            #6

            Deicide how do i remove the weapons from the bots

            1 Reply Last reply
            0
            • kefry
              kefry
              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
              • Deicide
                Deicide
                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 YT 1 Reply Last reply
                1
                • Deicide Deicide
                  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 YT
                  Duui YT
                  Duui YT
                  wrote on last edited by Duui YT
                  #9

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

                  Cahz 1 Reply Last reply
                  0
                  • Duui YT Duui YT

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

                    Cahz
                    Cahz
                    Cahz
                    VIP
                    wrote on last edited by
                    #10

                    Duui YT do research!

                    Duui YT 1 Reply Last reply
                    1
                    • Cahz Cahz

                      Duui YT do research!

                      Duui YT
                      Duui YT
                      Duui YT
                      wrote on last edited by
                      #11

                      Cahz i did

                      Cahz 1 Reply Last reply
                      0
                      • Duui YT Duui YT

                        Cahz i did

                        Cahz
                        Cahz
                        Cahz
                        VIP
                        wrote on last edited by
                        #12

                        Duui YT So you found the answer to your question 🙂

                        Duui YT 1 Reply Last reply
                        1
                        • Cahz Cahz

                          Duui YT So you found the answer to your question 🙂

                          Duui YT
                          Duui YT
                          Duui YT
                          wrote on last edited by
                          #13

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

                          Cahz 1 Reply Last reply
                          0
                          • Duui YT Duui YT

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

                            Cahz
                            Cahz
                            Cahz
                            VIP
                            wrote on last edited by
                            #14

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

                            Duui YT 1 Reply Last reply
                            1
                            • Cahz Cahz

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

                              Duui YT
                              Duui YT
                              Duui YT
                              wrote on last edited by
                              #15

                              Cahz like this

                              if(self is_bot()) self takeallweapons();
                              
                              Cahz 1 Reply Last reply
                              0
                              • Duui YT Duui YT

                                Cahz like this

                                if(self is_bot()) self takeallweapons();
                                
                                Cahz
                                Cahz
                                Cahz
                                VIP
                                wrote on last edited by
                                #16

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

                                1 Reply Last reply
                                2

                                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                With your input, this post could be even better 💗

                                Register Login
                                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
                                • Unread 0
                                • Recent
                                • Popular
                                • Users
                                • Donate