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

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [Release] Overwrite Default Class (GSC)

[Release] Overwrite Default Class (GSC)

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
26 Posts 8 Posters 2.8k Views
  • 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.
  • Sorexundefined Offline
    Sorexundefined Offline
    Sorex
    Contributor
    wrote on last edited by
    #2
    This post is deleted!
    Cahzundefined 1 Reply Last reply
    0
    • Sorexundefined Sorex

      This post is deleted!

      Cahzundefined Offline
      Cahzundefined Offline
      Cahz
      VIP
      wrote on last edited by
      #3

      Sorex said in [Release] Overwrite Default Class (GSC):

      is not your code because u find it but okey

      I wrote the code please show your references before accusing me of stealing.
      It's a super simple script, why would I claim something that isn't mine?
      Show me where this is already posted elsewhere.

      1 Reply Last reply
      0
      • Xerxesundefined Offline
        Xerxesundefined Offline
        Xerxes
        Plutonium Staff
        wrote on last edited by
        #4

        Removed the discord link from your post.

        1 Reply Last reply
        0
        • Cahzundefined Cahz

          Overwrite Default Class (Operative)
          Developer: @ItsCahz
          Link: https://github.com/Paintball/BO2-GSC/blob/master/overwrite_default_class.gsc

          This simple GSC can be used to overwrite the default class Operative.
          The setup the script has right now is to replace Operative with a random "trickshotting" class.

          The script simply takes the Operative default weapons, and gives you a random primary, secondary, tactical, and lethal.

          How to use:

          • Add in OnPlayerConnect
          player thread doChangeClass();
          
          • Add in OnPlayerSpawned
          if(isDefined(self.RandomClass))
              self thread doLoadout();
          
          • Just add/remove weapons from the two lists to create your random generated classes
          self.Primary = strTok("dsr50_mp+steadyaim,ballista_mp+steadyaim,svu_mp+steadyaim,as50_mp+steadyaim", ",");
          self.Secondary = strTok("dualoptic_xm8_mp,dualoptic_mk48_mp,srm1216_mp,870mcs_mp,an94_mp+gl,as50_mp+fmj,ballista_mp+fmj+is,ballista_mp+fmj,beretta93r_mp,beretta93r_dw_mp,crossbow_mp,dsr50_mp+fmj,evoskorpion_mp+sf,fiveseven_mp,knife_ballistic_mp,ksg_mp+silencer,mp7_mp+sf,pdw57_mp+silencer,peacekeeper_mp+sf,riotshield_mp,sa58_mp+sf,sa58_mp+fmj+silencer,saritch_mp+sf,saritch_mp+fmj+silencer,scar_mp+gl,svu_mp+fmj+silencer,tar21_mp+dualclip,type95_mp+dualclip,vector_mp+sf,vector_mp+rf,usrpg_mp", ",");
          
          
          Tokioundefined Offline
          Tokioundefined Offline
          Tokio
          wrote on last edited by
          #5

          Cahz This isnt yours.

          Cahzundefined 1 Reply Last reply
          0
          • Tokioundefined Tokio

            Cahz This isnt yours.

            Cahzundefined Offline
            Cahzundefined Offline
            Cahz
            VIP
            wrote on last edited by
            #6

            @Xttr The original idea came from one variation of the TSD mod that was super popular on Repz back many years ago.

            I just rewrote it for BO2 and posted it here.

            Kalitosundefined 2 Replies Last reply
            1
            • Cahzundefined Cahz

              @Xttr The original idea came from one variation of the TSD mod that was super popular on Repz back many years ago.

              I just rewrote it for BO2 and posted it here.

              Kalitosundefined Offline
              Kalitosundefined Offline
              Kalitos
              wrote on last edited by
              #7

              Cahz Looking thoroughly, it is a great contribution, I already tried it and it can be implemented in a SYD mode, to be able to change the default classes for others that you will personally allow to put.

              Now all that's left is to make it work that players can't choose custom classes.

              1 Reply Last reply
              0
              • Cahzundefined Cahz

                @Xttr The original idea came from one variation of the TSD mod that was super popular on Repz back many years ago.

                I just rewrote it for BO2 and posted it here.

                Kalitosundefined Offline
                Kalitosundefined Offline
                Kalitos
                wrote on last edited by
                #8

                Cahz Trying more your publication, I noticed a problem, when I am already half a round of the specific game SYD lets me change classes at any time, this should not happen, because if we think about this, it would give the player the option of infinite grenades just selecting the same class over and over again at any point in the round.

                Cahzundefined 1 Reply Last reply
                0
                • Cahzundefined Offline
                  Cahzundefined Offline
                  Cahz
                  VIP
                  wrote on last edited by
                  #9
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • Kalitosundefined Kalitos

                    Cahz Trying more your publication, I noticed a problem, when I am already half a round of the specific game SYD lets me change classes at any time, this should not happen, because if we think about this, it would give the player the option of infinite grenades just selecting the same class over and over again at any point in the round.

                    Cahzundefined Offline
                    Cahzundefined Offline
                    Cahz
                    VIP
                    wrote on last edited by
                    #10

                    Kalitos This can easily be fixed if you add another variable to check if the player should be allowed to switch classes.

                    Basically what I was picturing is add a 10 second wait after spawn, then create a variable like self.ClassSwitch = false;
                    and then add if(isDefined(self.ClassSwitch)) into the doChangeClass function.

                    onPlayerSpawned()
                    {
                    	self endon("disconnect");
                    	level endon("game_ended");
                    	for(;;)
                    	{
                    		self waittill("spawned_player");
                    		
                    		if(isDefined(self.RandomClass))
                    			self thread doLoadout();
                    		self thread playerDeath();
                    		wait 10;
                    		self.StopClassChange = true;
                    	}
                    }
                    
                    playerDeath()
                    {
                    	self endon("self_died");
                    	level endon("game_ended");
                    	for(;;)
                    	{
                    		self waittill("death");
                    		self.StopClassChange = undefined;
                    		wait 0.05;
                    		self notify("self_died");
                    	}
                    }
                    
                    doChangeClass()
                    {
                       	self endon("disconnect");
                    	for(;;)
                    	{
                    		self waittill("changed_class");
                    		if ( !isDefined(self.StopClassChange) )
                    		{
                    			if(self.pers[ "class" ] == "CLASS_SMG")
                    			{
                    				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                    				self thread doRandomClass();
                    				self.RandomClass = true;
                    			}
                    			else
                    			{
                    				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                    				self.RandomClass = undefined;
                    			}
                    		}
                    	}
                    }
                    

                    This will give players the full 10 seconds to decide on a class after spawn, but not allow to change mid round like you said.

                    The only problem with this setup is that every time the player spawns, they have 10 seconds to change classes. But if you're trying to use this in SND, it shouldn't be an issue for you.

                    Kalitosundefined 1 Reply Last reply
                    0
                    • Mr. Androidundefined Offline
                      Mr. Androidundefined Offline
                      Mr. Android
                      Plutonium Admin
                      wrote on last edited by Mr. Android
                      #11

                      unless you have a screenshot of another website showing the exact same code you can't really claim it's stolen.

                      1 Reply Last reply
                      0
                      • Cahzundefined Cahz

                        Kalitos This can easily be fixed if you add another variable to check if the player should be allowed to switch classes.

                        Basically what I was picturing is add a 10 second wait after spawn, then create a variable like self.ClassSwitch = false;
                        and then add if(isDefined(self.ClassSwitch)) into the doChangeClass function.

                        onPlayerSpawned()
                        {
                        	self endon("disconnect");
                        	level endon("game_ended");
                        	for(;;)
                        	{
                        		self waittill("spawned_player");
                        		
                        		if(isDefined(self.RandomClass))
                        			self thread doLoadout();
                        		self thread playerDeath();
                        		wait 10;
                        		self.StopClassChange = true;
                        	}
                        }
                        
                        playerDeath()
                        {
                        	self endon("self_died");
                        	level endon("game_ended");
                        	for(;;)
                        	{
                        		self waittill("death");
                        		self.StopClassChange = undefined;
                        		wait 0.05;
                        		self notify("self_died");
                        	}
                        }
                        
                        doChangeClass()
                        {
                           	self endon("disconnect");
                        	for(;;)
                        	{
                        		self waittill("changed_class");
                        		if ( !isDefined(self.StopClassChange) )
                        		{
                        			if(self.pers[ "class" ] == "CLASS_SMG")
                        			{
                        				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                        				self thread doRandomClass();
                        				self.RandomClass = true;
                        			}
                        			else
                        			{
                        				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                        				self.RandomClass = undefined;
                        			}
                        		}
                        	}
                        }
                        

                        This will give players the full 10 seconds to decide on a class after spawn, but not allow to change mid round like you said.

                        The only problem with this setup is that every time the player spawns, they have 10 seconds to change classes. But if you're trying to use this in SND, it shouldn't be an issue for you.

                        Kalitosundefined Offline
                        Kalitosundefined Offline
                        Kalitos
                        wrote on last edited by Kalitos
                        #12

                        Cahz I thought so too. Still there is a latent problem, if within the 10 seconds that the player is given, use a grenade or shoot that, they must also block the class change.

                        Cahzundefined 1 Reply Last reply
                        0
                        • Kalitosundefined Kalitos

                          Cahz I thought so too. Still there is a latent problem, if within the 10 seconds that the player is given, use a grenade or shoot that, they must also block the class change.

                          Cahzundefined Offline
                          Cahzundefined Offline
                          Cahz
                          VIP
                          wrote on last edited by
                          #13

                          Kalitos you can easily add another function that checks if the weapon has been fired and if it has, to change self.StopClassChange to true . I'm sure that there is also another function to check if a grenade/stun has been thrown. But I personally dont need this type of script setup myself. So im not going to take the time to make it... Just recommend how it could be done

                          Kalitosundefined 1 Reply Last reply
                          0
                          • Cahzundefined Cahz

                            Kalitos you can easily add another function that checks if the weapon has been fired and if it has, to change self.StopClassChange to true . I'm sure that there is also another function to check if a grenade/stun has been thrown. But I personally dont need this type of script setup myself. So im not going to take the time to make it... Just recommend how it could be done

                            Kalitosundefined Offline
                            Kalitosundefined Offline
                            Kalitos
                            wrote on last edited by Kalitos
                            #14

                            Cahz Thanks for your help, searching google I found what I needed, the 2 things in one.

                            if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                            		{
                            			self maps\mp\gametypes\_class::setClass( self.pers["class"] );
                            			self.tag_stowed_back = undefined;
                            			self.tag_stowed_hip = undefined;
                            			self maps\mp\gametypes\_class::giveLoadout( self.pers["team"], self.pers["class"] );
                            		}
                            		else
                            		{
                            			self iPrintLnBold( game["strings"]["change_class"] );
                            		}
                            

                            With this I solved it.

                            Cahzundefined alejandrodarzundefined 2 Replies Last reply
                            0
                            • Kalitosundefined Kalitos

                              Cahz Thanks for your help, searching google I found what I needed, the 2 things in one.

                              if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                              		{
                              			self maps\mp\gametypes\_class::setClass( self.pers["class"] );
                              			self.tag_stowed_back = undefined;
                              			self.tag_stowed_hip = undefined;
                              			self maps\mp\gametypes\_class::giveLoadout( self.pers["team"], self.pers["class"] );
                              		}
                              		else
                              		{
                              			self iPrintLnBold( game["strings"]["change_class"] );
                              		}
                              

                              With this I solved it.

                              Cahzundefined Offline
                              Cahzundefined Offline
                              Cahz
                              VIP
                              wrote on last edited by
                              #15

                              Kalitos there we go. I was looking for the level.inGracePeriod yesterday and couldn't find it! Thanks for sharing your find

                              alejandrodarzundefined 3 Replies Last reply
                              1
                              • Kalitosundefined Kalitos

                                Cahz Thanks for your help, searching google I found what I needed, the 2 things in one.

                                if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                                		{
                                			self maps\mp\gametypes\_class::setClass( self.pers["class"] );
                                			self.tag_stowed_back = undefined;
                                			self.tag_stowed_hip = undefined;
                                			self maps\mp\gametypes\_class::giveLoadout( self.pers["team"], self.pers["class"] );
                                		}
                                		else
                                		{
                                			self iPrintLnBold( game["strings"]["change_class"] );
                                		}
                                

                                With this I solved it.

                                alejandrodarzundefined Offline
                                alejandrodarzundefined Offline
                                alejandrodarz
                                wrote on last edited by
                                #16

                                Kalitos where I put the level.inGracePeriod, that is to say where in the script?

                                1 Reply Last reply
                                0
                                • Cahzundefined Cahz

                                  Kalitos there we go. I was looking for the level.inGracePeriod yesterday and couldn't find it! Thanks for sharing your find

                                  alejandrodarzundefined Offline
                                  alejandrodarzundefined Offline
                                  alejandrodarz
                                  wrote on last edited by
                                  #17

                                  Cahz where I put the level.inGracePeriod, that is to say where in the script?

                                  1 Reply Last reply
                                  0
                                  • Cahzundefined Cahz

                                    Kalitos there we go. I was looking for the level.inGracePeriod yesterday and couldn't find it! Thanks for sharing your find

                                    alejandrodarzundefined Offline
                                    alejandrodarzundefined Offline
                                    alejandrodarz
                                    wrote on last edited by
                                    #18

                                    Cahz Where do I put the code that Karlitos mentioned so that if he shoots in the 10 seconds he can't change class?

                                    Cahzundefined 1 Reply Last reply
                                    0
                                    • Cahzundefined Cahz

                                      Kalitos there we go. I was looking for the level.inGracePeriod yesterday and couldn't find it! Thanks for sharing your find

                                      alejandrodarzundefined Offline
                                      alejandrodarzundefined Offline
                                      alejandrodarz
                                      wrote on last edited by
                                      #19
                                      This post is deleted!
                                      Infamousundefined 1 Reply Last reply
                                      0
                                      • alejandrodarzundefined alejandrodarz

                                        This post is deleted!

                                        Infamousundefined Offline
                                        Infamousundefined Offline
                                        Infamous
                                        wrote on last edited by
                                        #20

                                        alejandrodarz Stop spamming him for an answer. He'll answer when he does.

                                        1 Reply Last reply
                                        1
                                        • alejandrodarzundefined alejandrodarz

                                          Cahz Where do I put the code that Karlitos mentioned so that if he shoots in the 10 seconds he can't change class?

                                          Cahzundefined Offline
                                          Cahzundefined Offline
                                          Cahz
                                          VIP
                                          wrote on last edited by Cahz
                                          #21

                                          alejandrodarz Replace the old doChangeClass() function with this one

                                          doChangeClass()
                                          {
                                             	self endon("disconnect");
                                          	for(;;)
                                          	{
                                          		self waittill("changed_class");
                                          		if ( level.inGracePeriod && !self.hasDoneCombat )
                                          		{
                                          			if(self.pers[ "class" ] == "CLASS_SMG")
                                          			{
                                          				self.pers[ "class" ] = undefined;
                                          				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                                          				self thread doRandomClass();
                                          				self.RandomClass = true;
                                          			}
                                          			else
                                          			{
                                          				self.pers[ "class" ] = undefined;
                                          				self maps/mp/gametypes/_class::giveloadout( self.team, self.class );
                                          				self.RandomClass = undefined;
                                          			}
                                          		}
                                          		else
                                          		{
                                          			self iPrintLnBold( game["strings"]["change_class"] );
                                          		}
                                          	}
                                          }
                                          
                                          alejandrodarzundefined 3 Replies Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • 1
                                          • 2
                                          • Login

                                          • Don't have an account? Register

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