Jump to content

[Release]Class/Loadout Selection


Incar

Recommended Posts

Note: This will work with custom loadout scripts if desired. Though I don't see much point.

 

Works fine with 1.0.5.1

 

This script was not created entirely by me, it is a modification of the loadout selection from ebay's Scroll menu - pick your spawn point and loadout script.

 

What this script does is give players the option to select a class (loadout) on a fresh spawn. Checks are provided to ensure you're not a zombie, as well as determine your gender in order to provide proper skins. Humanity checks are also added so players may unlock better classes as the reach higher or lower humanity. Randomization options on gear are also provided.

 

Credits For Base Script
- ebay (Original Creator)
- FreakingFred (scrollmenu structure)
- Player2 (init.sqf login code)
- Matt L (for the idea)
- lazyink (servercleanup exception code)

 

Credits For Updated Script

- Incariuz (Feature Updates)

- raymix (Gender/Skin check)

 

Also thanks to everyone in the community who is willing to give help to those new to Epoch. It helps people like me get stuff done. Now to the script.

 

Open your init.sqf and at the bottom add.

//Class Selection
p2_newspawn = compile preprocessFileLineNumbers "Classes\init_classes.sqf";
waitUntil {!isNil ("PVDZE_plr_LoginRecord")};
if (dayzPlayerLogin2 select 2) then {player spawn p2_newspawn;};

In your dayz_server\compile\server_playerSetup.sqf find.

dayzPlayerLogin2 = [_worldspace,_state];

and replace it with.

dayzPlayerLogin2 = [_worldspace,_state,_randomSpot];

Now in your MPMissions create a new folder called "Classes".

-Inside the "Classes" folder create a new sqf titled "init_classes.sqf" and place the following code inside.

if(player isKindOf "PZombie_VB") exitWith {};
sleep 5;
waitUntil {!dialog};
systemChat ('New classes can be unlocked through humanity levels!');
cutText ["                 \nUse your mouse wheel to select a class!","PLAIN"];
execVM "Classes\select_class.sqf";

Create another sqf titled "select_class.sqf" inside the Classes folder and place the following code inside.

pathtoclasses = "Classes\loadout\";
EXECscript1 = 'player execVM "'+pathtoclasses+'%1"';

Private ["_humanity"];
_humanity = (player getVariable["humanity",0]);

if ((getPlayerUID player) in ["0","0","0"]) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
        ["Legendary Hero", [4], "#USER:LegendHero", -5, [["expression", ""]], "1", "1"],
        ["Bandit Classes", [5], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
        ["Legendary Bandit", [6], "#USER:LegendBandit", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
         ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
     ];
} else {
    if(_humanity >= 25000) then {
        classes =
        [
            ["",false],
            ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
            ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
                ["Legendary Classes", [4], "#USER:LegendHero", -5, [["expression", ""]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
            ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
        ];
    }else {
         if(_humanity >= 5000) then {
            classes =
            [
                ["",false],
                ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
                ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
                ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
             ];
        }else {
            if(_humanity <= -25000) then {
                classes =
                [
                    ["",false],
                    ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
                    ["Bandit Classes", [3], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
                    ["Legendary Classes", [4], "#USER:LegendBandit", -5, [["expression", ""]], "1", "1"],
                    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
                ];
            }else {
                if(_humanity <= -2500) then {
                    classes =
                    [
                        ["",false],
                        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
                        ["Bandit Classes", [3], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
                        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
                    ];    
                }else {
                    classes =
                    [
                    ["",false],
                    ["Select Class", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
                    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
                     ];    
                }
            };
        };
    };
};

Peasant =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

Hero =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

Bandit =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

LegendHero =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

LegendBandit =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

showCommandingMenu "#USER:classes";

The following was left in for admin testing purposes. Simply add UID's.

if ((getPlayerUID player) in ["0","0","0"]) then {

I'm only going to include example script for a class loadout, so changes will need to be made to above script to load the files properly. You can add additional lines for more class (loadout) options in each category if desired.

 

["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf]]], "1", "1"],

 

Red: The name that will show up on scroll menu.

Orange: The list number for the class.

Blue: The sqf file it will call for a loadout.

 

You will need to create a new folder inside the Classes folder titled "loadout" and place all class loadout.sqf's inside of it.

 

Here are Two Loadout examples, I will talk about them in further detail below.

private ["_object","_uniqueid","_model"];
_model = ["SurvivorW2_DZ"];

if (dayz_combat == 1) then {
    titleText ["You can't select a class while in combat.", "PLAIN DOWN", 3];
    sleep 5;
    titleFadeOut 1;
} else {
    titleText ["Selecting class...", "PLAIN DOWN", 3];
    sleep 2;
    if (typeOF player in _model) then {
        [dayz_playerUID,dayz_characterID,'SurvivorW3_DZ'] spawn player_humanityMorph;
    }else{
        [dayz_playerUID,dayz_characterID,'INS_Worker2_DZ'] spawn player_humanityMorph;
    };
    sleep 2;
    showCommandingMenu '';
    
    removeAllWeapons player;
    removeAllItems player;
    removeBackpack player;
    player addWeapon 'LeeEnfield';
    player selectWeapon 'LeeEnfield';
    player addMagazine '10x_303';
    player addMagazine 'FoodSteakRaw';
    player addMagazine 'ItemWaterbottle';
    player addMagazine 'ItemBandage';
    player addWeapon 'ItemMatchbox_DZE';
    player addWeapon 'ItemCompass';
    player addWeapon 'ItemKnife';
    player addBackpack 'DZ_Czech_Vest_Puch';
    reload player;
    
    sleep 5;
    titleFadeOut 1;
};

 

Random Weapons Loadout.

private ["_object","_uniqueid","_model","_random"];
_model = ["SurvivorW2_DZ"];
_random = round(random(2));

if (dayz_combat == 1) then {
    titleText ["You can't select a class while in combat.", "PLAIN DOWN", 3];
    sleep 5;
    titleFadeOut 1;
} else {
    titleText ["Selecting class...", "PLAIN DOWN", 3];
    sleep 2;
    if (typeOF player in _model) then {
        [dayz_playerUID,dayz_characterID,'SurvivorWcombat_DZ'] spawn player_humanityMorph;
    }else{
        [dayz_playerUID,dayz_characterID,'Soldier_Sniper_PMC_DZ'] spawn player_humanityMorph;
    };
    sleep 2;
    showCommandingMenu '';

    removeAllWeapons player;
    removeAllItems player;
    removeBackpack player;
    
    switch (_random) do {
        case 0 :{
            player addWeapon 'bizon';
            player selectWeapon 'bizon';
            player addWeapon 'Colt1911';
            player addMagazine '64Rnd_9x19_Bizon';
            player addMagazine '7Rnd_45ACP_1911';
        };
        case 1 :{
            player addWeapon 'G36C';
            player selectWeapon 'G36C';
            player addWeapon 'Colt1911';
            player addMagazine '30Rnd_556x45_G36';
            player addMagazine '7Rnd_45ACP_1911';
            player addMagazine '7Rnd_45ACP_1911';
        };
        case 2 :{
            player addWeapon 'M240_DZ';
            player selectWeapon 'M240_DZ';
            player addMagazine '100Rnd_762x51_M240';
        };
    };
    
    player addMagazine 'ItemBandage';
    player addMagazine 'FoodCanBakedBeans';
    player addMagazine 'ItemWaterbottle';
    player addWeapon 'ItemMachete';
    player addWeapon 'ItemCompass';
    player addBackpack 'DZ_TerminalPack_EP1';
    reload player;
    
    sleep 5;
    titleFadeOut 1;
};

 

The following checks to see if you're male or female by looking for the default female skin. Then equips a new skin.

_model = ["SurvivorW2_DZ"]; //Change if you do not use default skin for females.
    if (typeOF player in _model) then {
        [dayz_playerUID,dayz_characterID,'SurvivorWcombat_DZ'] spawn player_humanityMorph;  //Female
    }else{
        [dayz_playerUID,dayz_characterID,'Soldier_Sniper_PMC_DZ'] spawn player_humanityMorph; //Male
    };

Make sure whatever skin you add does not have "Skin_" as it auto equips.

 

You'll also notice in the second loadout script example there are items in each random case and some more below. The ones below are static and will be assigned regardless which random is selected. I just liked using the random for weapons just to mix things up. If you wish to add more random cases, go nuts, just be sure to increase the increment of...

_random = round(random(2));

Antihax

-At the end of your AHConfig's allowed menus add.

,"#USER:classes","#USER:Peasant","#USER:Hero","#USER:Bandit","#USER:LegendHero","#USER:LegendBandit"

Make BLOCK ALL CMDMenus

BLOCK ALL CMDMenus */ _BCM = false;

And Remove "itemsAdded"

/*  Remove "itemsAdded"  */ _RAI =  false;

If you have any questions or issues, feel free to leave a response.

Link to comment
Share on other sites

Reserved for additional notes or changes.

 

6/26/2014

-Changed some spelling, had loadout spelt loudout at a bunch of places.

 

The following may be better for the select_class.sqf. I haven't tested or tried to redo my script at this point in time.

pathtoclasses = "Classes\loadout\";
EXECscript1 = 'player execVM "'+pathtoclasses+'%1"';

Private ["_humanity"];
_humanity = (player getVariable["humanity",0]);

if ((getPlayerUID player) in ["0","0","0"]) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
        ["Legendary Hero", [4], "#USER:LegendHero", -5, [["expression", ""]], "1", "1"],
        ["Bandit Classes", [5], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
        ["Legendary Bandit", [6], "#USER:LegendBandit", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
    ];
};
if(_humanity >= -2499 && _humanity <= 4999) then {
    classes =
    [
        ["",false],
        ["Select Class", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
    ];    
};
if(_humanity >= 5000 && _humanity <= 24999) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
    ];
};
if(_humanity >= 25000) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Hero Classes", [3], "#USER:Hero", -5, [["expression", ""]], "1", "1"],
        ["Legendary Classes", [4], "#USER:LegendHero", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
    ];
};
if(_humanity <= -2500 && _humanity >= -24999) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Bandit Classes", [3], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
    ];    
};
if(_humanity <= -25000) then {
    classes =
    [
        ["",false],
        ["Regular Classes", [2], "#USER:Peasant", -5, [["expression", ""]], "1", "1"],
        ["Bandit Classes", [3], "#USER:Bandit", -5, [["expression", ""]], "1", "1"],
        ["Legendary Classes", [4], "#USER:LegendBandit", -5, [["expression", ""]], "1", "1"],
        ["", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]            
    ];
};

Peasant =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

Hero =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

Bandit =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

LegendHero =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

LegendBandit =
[
    ["",false],
    ["Class1", [2], "", -5, [["expression", format[EXECscript1,"class1.sqf"]]], "1", "1"],
    ["Class2", [3], "", -5, [["expression", format[EXECscript1,"class2.sqf"]]], "1", "1"],
    ["", [-1], "", -5, [["expression", ""]], "1", "0"],
    ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

showCommandingMenu "#USER:classes";

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...

does this work with overpoch and zuppa new coins 3.0 and trader 1.0 , snap Build, Plot for life .. etc .. and issues with any of these ??

Thank You in advance :D

I've never done Overpoch, so haven't tested. To be honest I stopped running a server period for now. However I see no reason why this wouldn't work, you don't need to alter or remove any other functionality to add this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...