[Release] Overwrite Default Class (GSC)
-
@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.
-
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.
-
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.
-
This post is deleted!
-
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.
-
unless you have a screenshot of another website showing the exact same code you can't really claim it's stolen.
-
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.
-
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
-
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.
-
-
Kalitos where I put the level.inGracePeriod, that is to say where in the script?
-
Cahz where I put the level.inGracePeriod, that is to say where in the script?
-
Cahz Where do I put the code that Karlitos mentioned so that if he shoots in the 10 seconds he can't change class?
-
This post is deleted!
-
alejandrodarz Stop spamming him for an answer. He'll answer when he does.
-
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"] ); } } }
-
This post is deleted!
-
Cahz I found a problem and that is that when I choose a personalized class I appear with the random weapons plus the personalized weapons of mine, that is to say a total of 4 weapons and I have to commit suicide so that only my personalized weapons come out and if I commit suicide again my personalized weapons will come out more the ramdon weapons and so on
-
Cahz I found another error and that is that when I disconnect and go back in, the script stops serving, that is, it does not give me the ramdon weapons but those of the normal class. Any solution that you can suggest for it?
-
alejandrodarz Make sure you have ALL the scripts from the original post in this tread. Sounds like you deleted code.