Class Customizer Can't Remove Pistols From Allowed Primarys

Report bugs of MFPS 2.0 here
Post Reply
User avatar
ThePrimePillow
Contributor
Contributor
Posts: 54
Joined: Thu Feb 22, 2018 10:10 pm

Tue Sep 01, 2020 3:41 pm

Hello, I am using "class-customization-v1.6" and I am unable to remove pistols from the allowed primary weapons in "Bl_Class Custimze." I am able to toggle them off but in the class custimzer scene I can still select them as a primary. Also clicking the change button on "Secondary" doesn't pull up the available weapons. For some reason pistols don't appear on the list of weapons in the secondary category. Also I noticed that there is no toggle for launcher weapon types.
User avatar
Lovatto
Admin
Admin
Posts: 1543
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Tue Sep 01, 2020 4:49 pm

I can replicate the problem with the pistol,
the problem is that the GunType of the example pistol in the GameData is set as Machinegun when it should be Pistol,
so simply make sure your pistols have the right type in GameData.

For active/disable launcher type as a different category, you will need some code modifications:

in ClassKey.cs -> ClassAllowedWeaponsType -> add this line:

Code: Select all

 [LovattoToogle] public bool AllowLaunchers = true;
ireplace the function in bl_ClassCustomize.cs -> isAllowedWeapon(...) with this:

Code: Select all

private bool isAllowedWeapon(bl_GunInfo info, int slot)
        {
            ClassAllowedWeaponsType rules = PrimaryAllowedWeapons;
            if (slot == 1) { rules = SecondaryAllowedWeapons; }
            else if (slot == 2) { rules = KnifeAllowedWeapons; }
            else if (slot == 3) { rules = GrenadesAllowedWeapons; }

            if ((rules.AllowMachineGuns && (info.Type == GunType.Machinegun || info.Type == GunType.Burst)) ||
                (rules.AllowPistols && info.Type == GunType.Pistol) || 
                (rules.AllowShotguns && info.Type == GunType.Shotgun) || 
                (rules.AllowKnifes && info.Type == GunType.Knife) || 
                (rules.AllowGrenades && (info.Type == GunType.Grenade || info.Type == GunType.Grenade)) || 
                (rules.AllowSnipers && info.Type == GunType.Sniper) ||
                (rules.AllowLaunchers && info.Type == GunType.Launcher))
            {
                return true;
            }
            return false;
        }
User avatar
ThePrimePillow
Contributor
Contributor
Posts: 54
Joined: Thu Feb 22, 2018 10:10 pm

Tue Sep 01, 2020 5:19 pm

Thank you, it works now.
Post Reply