Random Clothing Parcels

seaweeduk

OpenDayZ Rockstar!
Random Clothing Parcels


What it does....
If you loot a soldier skin in game, wearing the skin will give you a random new skin from a list of additional models which work in dayz 1.7.7.1

Requirements
A Custom loot table to add the soldier skin items to
A brain and the ability to read and edit text
Easy - 10 mins

Here's my method for having random clothing parcels spawn in on your server without the need for client downloads. These skins all work for 1.7.7.1, big thanks to Grafzahl for adding the steps to remove the additional items some skins add to your inventory.

Because there is only one parcel item you can loot in the default vanilla code this modification makes that parcel spawn a random skin from a list of your choosing.

In your dayz_server .pbo's server_playerLogin.sqf locate this code

Code:
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Survivor3_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","Bandit1_DZ","Rocket_DZ"])) then {
_model = "Survivor2_DZ";
};

Change it to

Code:
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ","TK_INS_Soldier_EP1","Soldier1_DZ","CZ_Soldier_DES_EP1","US_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","BAF_Soldier_Officer_MTP","BAF_Soldier_Officer_DDPM"])) then {
        _model = "Survivor2_DZ";
};

Next we need to take some code from the client and move it to the mission file for our modification to work. Open up your dayz_code.pbo and find player_wearClothes.sqf copy this file to a "fixes" folder inside your server's mission.pbo

In this file change the case statement for the Soldier clothing (lines 40 -43 for me) to the following

Code:
case "Skin_Soldier1_DZ": {
 
        _model = ["TK_INS_Soldier_EP1","Soldier1_DZ","CZ_Soldier_DES_EP1","US_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","BAF_Soldier_Officer_MTP","BAF_Soldier_Officer_DDPM"] call BIS_fnc_selectRandom;
    };

You can add or remove models from the random selection here.

Next you will need to change the player_wearClothes reference in compiles.sqf this file is not in your mission file by default, it is a clientside file from dayz_code.pbo. If you don't already have this file in your mission file you need to edit your init.sqf.

Once you have compiles in the mission file change the player_wearClothes line to the following

Code:
    player_wearClothes = compile preprocessFileLineNumbers "fixes\player_wearClothes.sqf";

Next we need to stop the new skins adding items like GPS to players when they put the skins on

You need to take three more files from dayz_code.pbo and bring them into your mission file now.

player_switchModel.sqf, player_monitor.sqf and player_monitor.fsm, I placed them in my "fixes" folder.

Edit the last line of player_monitor.sqf so it as follows

Code:
_id = [] execFSM "fixes\player_monitor.fsm";

Then in compiles.sqf change the player_monitor line to the following

Code:
player_monitor = compile preprocessFileLineNumbers "fixes\player_monitor.sqf";

and player_switchModel to the following

Code:
player_switchModel = compile preprocessFileLineNumbers "fixes\player_switchModel.sqf";

Next open up the player_monitor.fsm

Search for these lines
Code:
      "dayzGearSave = false;" \n
      "_inventory call player_gearSet;" \n

Before these lines insert this:
Code:
      "player removeWeapon ""ItemRadio"";" \n
      "player removeWeapon ""ItemMap"";" \n
      "player removeWeapon ""ItemCompass"";" \n
      "player removeWeapon ""ItemWatch"";" \n
      "player removeWeapon ""ItemGPS"";" \n
      "player removeWeapon ""NVGoggles"";" \n
      "player removeWeapon ""APSI"";" \n
      "player removeWeapon ""mut_heart"";" \n

Then in player_switchModel.sqf search for these lines

Code:
//Clear New Character
    {_newUnit removeMagazine _x;} forEach  magazines _newUnit;
    removeAllWeapons _newUnit;

After these lines insert this:
Code:
    _newUnit removeWeapon "ItemRadio";
    _newUnit removeWeapon "ItemMap";
    _newUnit removeWeapon "ItemCompass";
    _newUnit removeWeapon "ItemWatch";
    _newUnit removeWeapon "ItemGPS";
    _newUnit removeWeapon "NVGoggles";
    _newUnit removeWeapon "APSI";
    _newUnit removeWeapon "mut_heart";

Finally use a modified loot table to add the soldier skin parcel (Skin_Soldier1_DZ) to your servers loot table.

Terms & Conditions - When you download or copy this code you agree to not charge any money for installing this script. You may not use the code for profit in any way and all modifications with the original code must be shared publicly.
 
Back
Top