Randomized skins for survivor and or humanity morphs.

Inkko

Valued Member!
I finally got this working the other day after staying up all night. I'm fairly sure I've tested it all and gotten it to work, the only bugs i can seem to find are switching from survivor to hero and then hero to survivor or vice-versa for bandits. It doesn't seem to want to switch from hero/bandit to survivor unless you die. I haven't tested getting a humanity morph and then dying then trying to see if i can get back to survivor but I felt like it wouldn't be that bad to go ahead and share what I've done. I feel like its still in testing but it seems to be working pretty well so far on 1.7.7.1.

The files you will need to do it are in your mission, server, and your dayz_code pbo. All files will end up in the mission pbo you just need to pull some files from dayz_code (mainly due to .st not allowing access to dayz_code).

Unpack your mission and server pbo.

In your server pbo go into the compile folder and open server_playerlogin.sqf for editing.
look for the line containing:
Code:
    if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ"])) then {

This portion is where you will add skins that will be usable. I added all the skins that are unbanned in 1.7.7.1 so my results looked like this (some skins ended up not working):
Code:
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ","Ins_Soldier_1","CDF_Soldier","CDF_Soldier_Militia","CDF_Soldier_AR","Citizen3","Worker1","Villager1","TK_CIV_Takistani01_EP1","TK_CIV_Takistani05_EP1","TK_INS_Soldier_EP1","CZ_Soldier_DES_EP1","US_Soldier_EP1","GER_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","BAF_Soldier_Officer_MTP","BAF_Soldier_Officer_DDPM","BAF_Soldier_Sniper_MTP","BAF_Soldier_SniperH_MTP","BAF_Soldier_SniperN_MTP","Soldier_Crew_PMC"])) then {

After this step we will now modify the skins that survivors will spawn with. It is the line right under the previous line we just edited that should say:
Code:
_model = "Survivor2_DZ";

You can pick which skins you would like survivors to be able to spawn with and add them in like this:
Code:
_model = ["CZ_Soldier_DES_EP1","US_Soldier_EP1","GER_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","Survivor2_DZ"] select floor random 8;

Make sure to test each skin you will use, not all skins will allow back packs, I went through and checked all the ones I used. If you use different skins then I used make sure to change the 'select floor random #' to however many skins you chose. After this step you are done with the server pbo and I have hopefully not completely confused you. You should keep this file open for reference. On to the next step where it gets even more confusing.

Unpack you dayz_code and you will need to take out the compiles.sqf (init folder), player_spawn_2.sqf (system), and player_wearClothes.sqf (actions folder). Place those 3 files in the root of your mission folder (I don't like making fixes folders I like it all in one folder so you can adjust and make folders if needed). After this step you are done with the dayz_code pbo and can exit out of it. Now all thats left is the mission pbo and the remaining files to edit.

Now we are in the mission folder. Open up your init.sqf and look for:
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

change this to:
Code:
call compile preprocessFileLineNumbers "compiles.sqf";

or if you are putting it in a folder make the correct adjustments. Then you are done with the init.sqf. Next open up compiles.sqf and look for these two lines to make changes to (they are nott next to eachother:
Code:
player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
 
player_spawn_2 = compile preprocessFileLineNumbers "player_spawn_2.sqf";

for each of those lines change them to look like this (unless using a fixes folder):
Code:
player_wearClothes = compile preprocessFileLineNumbers "player_wearClothes.sqf";
 
player_spawn_2 = compile preprocessFileLineNumbers "player_spawn_2.sqf";

You are now done with the compiles.sqf. Next we will open player_wearClothes.sqf. This is where it will get even more confusing.

We will be changing this portion of code:
Code:
switch (_item) do {
    case "Skin_Sniper1_DZ": {
        _model = "Sniper1_DZ";
    };
    case "Skin_Camo1_DZ": {
        _model = "Camo1_DZ";
    };
    case "Skin_Soldier1_DZ": {
        _model = "Soldier1_DZ";
    };
    case "Skin_Survivor2_DZ": {
        _model = "Survivor2_DZ";
        if (_isBandit) then {
            _model = "Bandit1_DZ";
        };
        if (_isHero) then {
            _model = "Survivor3_DZ";
        };
    };
};

We will be adding the new survivor skins we added in to be able to change to their respective bandit/hero skins I believe this part is only for if there are skin parcels that you can use but I believed I should do it just incase it effected anything. After completing mine it looked like this (using server_playerlogin.sqf as a reference):
Code:
switch (_item) do {
    case "Skin_Sniper1_DZ": {
        _model = "Sniper1_DZ";
    };
    case "Skin_Camo1_DZ": {
        _model = "Camo1_DZ";
    };
    case "Skin_Soldier1_DZ": {
        _model = "Soldier1_DZ";
    };
    case "Skin_Survivor2_DZ": {
        _model = "Survivor2_DZ";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "CZ_Soldier_DES_EP1": {
        _model = "CZ_Soldier_DES_EP1";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "US_Soldier_EP1": {
        _model = "US_Soldier_EP1";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "GER_Soldier_EP1": {
        _model = "GER_Soldier_EP1";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "BAF_Soldier_MTP": {
        _model = "BAF_Soldier_MTP";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "BAF_Soldier_DDPM": {
        _model = "BAF_Soldier_DDPM";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "BAF_Soldier_L_MTP": {
        _model = "BAF_Soldier_L_MTP";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
    case "BAF_Soldier_L_DDPM": {
        _model = "BAF_Soldier_L_DDPM";
        if (_isBandit) then {
            _model = ["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2;
        };
        if (_isHero) then {
            _model = ["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2;
        };
    };
};

Above I added a case for each skin, and then created the 2 randomized skins for each humanity morph. You can switch up the skins however you like as long as its repetitive for what bandits and heros will change to.
 
Now open player_spawn_2.sqf and you will need to modify it a lot. Look for the lines that look like this (will not have the added comment lines):
Code:
// Bandit Morph
if (_humanity < -2000 and !_isBandit) then {
        _model = typeOf player;
        if (_model == "Survivor2_DZ" || _model == "Survivor3_DZ") then {
            [dayz_playerUID,dayz_characterID,"Bandit1_DZ"] spawn player_humanityMorph;
        };
        if (_model == "SurvivorW2_DZ") then {
            [dayz_playerUID,dayz_characterID,"BanditW1_DZ"] spawn player_humanityMorph;
        };
    };
// Survivor Morph
    if (_humanity > 0 and (_isBandit || ( _humanity < 5000 and _isHero))) then {
        _model = typeOf player;
        if (_model == "Bandit1_DZ" || _model == "Survivor3_DZ") then {
            [dayz_playerUID,dayz_characterID,"Survivor2_DZ"] spawn player_humanityMorph;
        };
        if (_model == "BanditW1_DZ") then {
            [dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
        };
    };
// Hero Morph
    if (_humanity > 5000 and !_isHero) then {
        _model = typeOf player;
        if (_model == "Survivor2_DZ" || _model == "Bandit1_DZ") then {
            [dayz_playerUID,dayz_characterID,"Survivor3_DZ"] spawn player_humanityMorph;
        };
    };

we will need to add skins in several places. Once completed mine looks like this:
Code:
// Bandit Morph
if (_humanity < -2000 and !_isBandit) then {
_model = typeOf player;
if (_model == "Survivor2_DZ" || _model == "Survivor3_DZ" || _model == "BAF_Soldier_Officer_MTP" || _model == "CZ_Soldier_DES_EP1" || _model == "US_Soldier_EP1" || _model == "GER_Soldier_EP1" || _model == "BAF_Soldier_MTP" || _model == "BAF_Soldier_DDPM" || _model == "BAF_Soldier_L_MTP" || _model == "BAF_Soldier_L_DDPM" ) then {
[dayz_playerUID,dayz_characterID,["Bandit1_DZ","TK_INS_Soldier_EP1"] select floor random 2] spawn player_humanityMorph;
};
if (_model == "SurvivorW2_DZ") then {
[dayz_playerUID,dayz_characterID,"BanditW1_DZ"] spawn player_humanityMorph;
};
};
// Survivor Morph
if (_humanity > 0 and (_isBandit || ( _humanity < 5000 and _isHero))) then {
_model = typeOf player;
if (_model == "Bandit1_DZ" || _model == "TK_INS_Soldier_EP1" || _model == "Survivor3_DZ" || _model == "BAF_Soldier_Officer_MTP" ) then {
[dayz_playerUID,dayz_characterID,["CZ_Soldier_DES_EP1","US_Soldier_EP1","GER_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","Survivor2_DZ"] select floor random 8] spawn player_humanityMorph;
};
if (_model == "BanditW1_DZ") then {
[dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
};
};
// Hero Morph
if (_humanity > 5000 and !_isHero) then {
_model = typeOf player;
if (_model == "Survivor2_DZ" || _model == "Bandit1_DZ" || _model == "TK_INS_Soldier_EP1" || _model == "CZ_Soldier_DES_EP1" || _model == "US_Soldier_EP1" || _model == "GER_Soldier_EP1" || _model == "BAF_Soldier_MTP" || _model == "BAF_Soldier_DDPM" || _model == "BAF_Soldier_L_MTP" || _model == "BAF_Soldier_L_DDPM" ) then {
[dayz_playerUID,dayz_characterID,["Survivor3_DZ","BAF_Soldier_Officer_MTP"] select floor random 2] spawn player_humanityMorph;
};
};

In this file we will be adding in all the posibilities for changing skins once the correct humanity level is reached. Pretty much in short it means, if a player is in any skin other then a bandit skin and gets enough negative humanity to become a bandit then it will switch them from their current skin to a randomized bandit skin vice versa for each different humanity switch.

If you do not use the randomized survivor skins on start it takes out a large portion of what you need to do to get this working but it should be easy to figure it out. Hopefully I covered everything and I'll include a link to my server_player login, player_spawn_2, and player_wearclothes once I add them to drop box. This is all to the best of my knowledge.


https://www.dropbox.com/sh/sxzq1pj3mxgmehj/Uq4HogMmfj - 3 files for reference or use. Make sure to place them in the correct spot and change the preprocessFileLineNumbers lines to point to the correct locations.
 
I actually just noticed what the bug I was having was resulting in. It was me not adding all the skins to player_login_2.sqf correctly I should have it fixed now. Guess thats what happens when you stay up all night trying to get something to work correctly >.<
 
Works but you still have to solve the problem of the skins coming with additional items.

You need to take player_monitor.fsm and player_switchModel.sqf from dayz_code, call them from init.sqf and then do this.

Also needs edit to battleye selectplayer filter.
 
Nice I had no idea there were still so many unbanned skin classes. Going to revisit my old random skin parcel code tonight :D
 
Nice I had no idea there were still so many unbanned skin classes. Going to revisit my old random skin parcel code tonight :D

I used most of the unbanned skins for 1.7.7.1 I just made sure to check to make sure they were all backpack compatible. I also forgot to note that the randomized survivor skins are variants of soldier clothing, the bandit skin has a terrorist skin added and the hero skin has a skin similar to the rocket skin added.

I had done this all with dayz.st so I was forced to use the mission pbo to get it all to work properly.
 
Works but you still have to solve the problem of the skins coming with additional items.

You need to take player_monitor.fsm and player_switchModel.sqf from dayz_code, call them from init.sqf and then do this.

Also needs edit to battleye selectplayer filter.

Thanks for pointing that out, completely forgot about that.
 
Well I removed this due couple issues.

1. Skins from different fractions causes major problems for getting in same vehicle.

2. It keeps randomly resetting humanity after dead.
 
Well I removed this due couple issues.

1. Skins from different fractions causes major problems for getting in same vehicle.

2. It keeps randomly resetting humanity after dead.

Thats odd, I knew there was that vehicle issue at one point but for some reason it doesn't occur anymore on my server. Not sure why it doesn't happen anymore.

As for the humanity reset I haven't noticed that either, is it just randomly happening?
 
Finally someone on my server let me know, its just the bandit skin that I was using (tk soldier), all the other skins are on the same side i believe.
 
Yeah, I think it was that bandit skin causing those problems. All soldier skins should be from same side.

All I know about humanity resetting is when I added this I got many reports that humanity goes back to 2500 after death but skin still remains bandit.
 
Can't get this working...
The problem is actually using skins that are not default. ALL the skins I try to use that are different from the default it's automatically set to the invisible skin.
So that's it: I spawn, I get the invisible skin. Doesn't care how. I found something that told me to put the new models at "variables.sqf". I tried it but still no lucky.
 
Can't get this working...
The problem is actually using skins that are not default. ALL the skins I try to use that are different from the default it's automatically set to the invisible skin.
So that's it: I spawn, I get the invisible skin. Doesn't care how. I found something that told me to put the new models at "variables.sqf". I tried it but still no lucky.

You need to edit server_playerlogin.sqf in the server pbo to add the skins into so that they wont be invisible.
 
You need to edit server_playerlogin.sqf in the server pbo to add the skins into so that they wont be invisible.

I open server_playerlogin.sqf and edit the part like it says in this thread.
I put all the skins I want, but when I log in the game by editing the _model in the database (or however I change it) when it completes the login I am invisible. Then I go to the database and my skin is "survivor1_DZ". Doesn't matter how I change my _model, I always get an invisible skin (doesn't happen with the default skins: camo, ghilie, bandit, hero, rocket, soldier). If I put any other I get the invisible skin.
 
I open server_playerlogin.sqf and edit the part like it says in this thread.
I put all the skins I want, but when I log in the game by editing the _model in the database (or however I change it) when it completes the login I am invisible. Then I go to the database and my skin is "survivor1_DZ". Doesn't matter how I change my _model, I always get an invisible skin (doesn't happen with the default skins: camo, ghilie, bandit, hero, rocket, soldier). If I put any other I get the invisible skin.

are you running dayz 1.7.7.1?
 
are you running dayz 1.7.7.1?

Yes, I am running dayz 1.7.7.1. I don't know what to do.
Say if I am wrong:
I want, for an example, add the "Camo2_DZ" skin for the RESPAWN. Just it.
I go to the playerLogin located at my server.pbo file and edit it, changing the "survivor2_dz" as the model.
I save it, go in game and I am invisible.
I get out the game, go to the database and it says "survivor1_DZ". I set it to Camo2_DZ, save, go in game, and boom. Invisible again.
I really don't know how to fix it.
It would help if you link me a playerLogin file with the edit I just said, to compare with mine and see if something is wrong.
Note: Doesn't matter what model I use. Camo2_DZ or any other of the unbanned list of models. :/
 
Yes, I am running dayz 1.7.7.1. I don't know what to do.
Say if I am wrong:
I want, for an example, add the "Camo2_DZ" skin for the RESPAWN. Just it.
I go to the playerLogin located at my server.pbo file and edit it, changing the "survivor2_dz" as the model.
I save it, go in game and I am invisible.
I get out the game, go to the database and it says "survivor1_DZ". I set it to Camo2_DZ, save, go in game, and boom. Invisible again.
I really don't know how to fix it.
It would help if you link me a playerLogin file with the edit I just said, to compare with mine and see if something is wrong.
Note: Doesn't matter what model I use. Camo2_DZ or any other of the unbanned list of models. :/

It is camo1_DZ that you would need to use.

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

This would make all survivors spawn in camo clothing, if you used just this humanity changes wouldn't have any effect since the camo clothing isn't included in the humanity morphs.
 
Yeah, I think it was that bandit skin causing those problems. All soldier skins should be from same side.

All I know about humanity resetting is when I added this I got many reports that humanity goes back to 2500 after death but skin still remains bandit.

I finally got reports of the humanity changing randomly so I'm gonna look through and see if I can figure out what is causing it.
 
Back
Top