Random Clothing Parcels

seaweeduk

OpenDayZ Rockstar!
Here's my method for having random clothing parcels spawn in on your server without the need for client downloads.

The clothing parcel I use is the soldier clothing parcel that is already in the game code, we just change the available models to a choice of 7 different soldier skins picked at random when you put the skin on.

First open your server pbo and in server_playerLogin.sqf you need to comment out 3 lines

Find

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"])) 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 = ["Ins_Soldier_Base","RU_Soldier_Base","GUE_Soldier_Base","CDF_Soldier_Base","Soldier1_DZ","MVD_Soldier_Base","RUS_Soldier_Base"] call BIS_fnc_selectRandom;
    };


You can add or remove models from the random selection here, I used Xyberviri's list to find models which were not banned. Unfortunately I could only find 6 with inventory's of the correct number of slots, but I may have missed some...

In your mission init.sqf add the following under the end of the if ((!isServer) && (player != player)) section


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

This will use our code whenever a client changes skin rather than the original clientside code.



Grafzahl solved the problem of the skins coming with additional items here - Random Clothing Parcels

Follow these steps on your dayz_code.pbo to make sure your skins don't give players additional items. You will need to include these in the fixes directory and add them to your init.sqf in the same way as player_wearClothes.sqf was added.




This is all you need to make the soldier parcels functional. If you want these items to spawn in game I suggest you take a look at this thread and follow the steps there http://www.tunngle.net/community/to...tion-or-suppression-in-mpmission/page__st__20

I used the same random function on my loot substitutions so I didn't need to replace one item with the soldier skin.

Code:
case "Skin_Sniper1_DZ": { _holderItem = ["Skin_Soldier1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ"] call BIS_fnc_selectRandom };

I haven't noticed any problems running this mod on my server the last few days but I imagine there could be on higher pop servers. There are already issues with the anti teleport script and skin changes and not sure if running the code in the mission file will help that. Can't say I've had any problems so far although I'm still testing the effectiveness of the loot substitutions....

Thanks to everyone more knowledgeable than me who has shared information to show me how make mods like these. I shared my work because without other members of the community doing the same, I would not have learned enough to make my own. Please give credit for other peoples code and do not steal it to pass off as your own. If you make improvements or find bugs please share them.

Xyberviri created the thread listing unbanned classes and did all the hard work to make this possible- http://opendayz.net/index.php?threa...y-arma2_oa_build_102678-ie-without-rmod.8277/
 
is it possible to lower the spawnrate of weapons and food on this way ? like dayz2017 style

Yeah should be I havent fully tested that duplicate entries in the array increase that items chances of spawning over the others but it should.....

I used the same technique to rebalance the weapons on my server only thing you need to making sure of is that you replace things with items of the same type. You cant replace a gun with ammo etc.

Clothing items are ammo
 
Hey man First of all thx for the tut, now i have a problem everytime i changed the skin to Soldier and wear then again Civillian Clothing the Cloth package changed to Civillian, and i cant log out with the new Solider Skin any Idea what wrong ?

Secound thing what you mean with this Down there ?

First open your server pbo and in server_playerLogin.sqf comment out the following 3 lines


Code:
//if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ"])) then {
// _model = "Survivor2_DZ";
//};
 
How does this line even work for you:
case "Skin_Sniper1_DZ": { ["Skin_Soldier1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ","Skin_Sniper1_DZ"] call BIS_fnc_selectRandom };

You didn't even add the selected skin to _holderitem so..
Maybe I'm being stupid here, correct me if I'm wrong
 
How does this line even work for you:


You didn't even add the selected skin to _holderitem so..
Maybe I'm being stupid here, correct me if I'm wrong

You are right that was a bad copy paste on my part will update OP now thankyou
 
Hey man First of all thx for the tut, now i have a problem everytime i changed the skin to Soldier and wear then again Civillian Clothing the Cloth package changed to Civillian, and i cant log out with the new Solider Skin any Idea what wrong ?

Secound thing what you mean with this Down there ?

First open your server pbo and in server_playerLogin.sqf comment out the following 3 lines


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


You said you didn't follow all the instructions then you ask why you can't logout with the new skin...

I wonder why?

Open your dayz_server.pbo and follow the instructions the three lines I showed aren't commented out put // in front of them as in the example

I guess the civilian clothing thing is because else where in the code you need to define what type of clothing a model is. I don't really care about this though I just told my players about the problem. It stops them being able to change in and out of the skin till they get a specific model also.
 
Problem i have with custom skins is that every person that gets a skin like Ins_Soldier_Base , the player automaticly gets a map, compass, clock and such things after the next relog...some skins also get a gps, nvgs...
 
Problem i have with custom skins is that every person that gets a skin like Ins_Soldier_Base , the player automaticly gets a map, compass, clock and such things after the next relog...some skins also get a gps, nvgs...

Yeah we noticed that too, can't really see a way round it without creating new classes though that's why the dayz ones all have _DZ.

We are trying to make them as rare as possible on my server, to counter this, just wish I could find a substitution that spawned in only military locations, rather than residential etc with ghillies.

If you don't want the extra items you can check each skin Soldier1_DZ will definitely be ok, might want to try the Rocket skin too. That was banned in the 1.7.6 patch but I haven't tried it since making the server pbo changes.
 
Rocket_DZ is also fine, no extra Items... i would say the best way to kill the extra items is to use http://community.bistudio.com/wiki/removeWeapon before the player spawns and gets his gear from the DB.

Code:
player removeWeapon "ItemGPS";
player removeWeapon "ItemRadio";
player removeWeapon "ItemMap";
player removeWeapon "ItemCompass";

Checked playerSetup.sqf and playerlogin.sqf in server.pbo, but couldnt find the code that looks for the inventory of the player and puts it into the char.
 
Rocket_DZ is also fine, no extra Items... i would say the best way to kill the extra items is to use http://community.bistudio.com/wiki/removeWeapon before the player spawns and gets his gear from the DB.

Code:
player removeWeapon "ItemGPS";
player removeWeapon "ItemRadio";
player removeWeapon "ItemMap";
player removeWeapon "ItemCompass";

Checked playerSetup.sqf and playerlogin.sqf in server.pbo, but couldnt find the code that looks for the inventory of the player and puts it into the char.

Thanks for the info I've missed having the Rocket skin available since the patch :)

Why not run removeWeapon in wearClothes and remove the items right after they put the skin on? Trouble is what if they had a legitimately acquired GPS before they put their skin on?

I'll have to have a play around tonight see if I can get something working too.

We found another bug yesterday that I'll try and fix, if a player is in a Soldier skin other players will not be able to get in their vehicle whilst they are in it, and the option to hide zombie bodies doesn't work
 
Mhm, nope, you didnt get the items when you change the skin, you get the items when you spawn again... so relog and you have all the tools.

So you have to delete the items everytime you login...
 
Mhm, nope, you didnt get the items when you change the skin, you get the items when you spawn again... so relog and you have all the tools.

So you have to delete the items everytime you login...

Ah I was seeing the items appear as soon as I put the skin on in my testing didn't realise the game also reapplied them with every login.

Since we're never going to know if a player had a GPS or not before they put the skin on I'm not sure there's a lot we can do about removing that. I will play around tonight and hopefully the radio can at least be removed.
 
Normaly, the game spawns a empty charakter and then puts all the stuff the player has in its inventory...so if you delete items BEFORE this is done, the player gets his gps/map and stuff automaticly back and he can wear the skin with normal loadout.
 
Normaly, the game spawns a empty charakter and then puts all the stuff the player has in its inventory...so if you delete items BEFORE this is done, the player gets his gps/map and stuff automaticly back and he can wear the skin with normal loadout.


Then from memory I believe it is player_switchModel.sqf we will need to look at in the client dayz_code.pbo

When I'm home from work I'll have a look too let me know if you make any progress

edit: got a look at the file in question does indeed look like the right place (to remove them on skin change not sure about relogging...) Looks like this bit of code is already removing all weapons from the new model before it is applied though?

//Clear New Character
{_newUnit removeMagazine _x;} forEach magazines _newUnit;
removeAllWeapons _newUnit;
 
One thing I never tested was what happens if you manually edit a characters model in the db to have a Soldier skin, do they still get the new items added to their inventory on next login?
 
Back
Top