Jump to content

[RELEASE] Random Skin based on Sex


MattL

Recommended Posts

Hollowaddiction requested this one from me after being bugged by a female player for a couple weeks. What this does (the way I have it set up) is select a random skin (from the list given) and either spawns the player as that skin OR adds the skin to their inventory at random. This is configurable. You can add it in to your server in a couple of different ways, like as a pay for skin option when right clicking on gold or whatever you want, really. 

Requirements (PBO Manager and Notepad ++)

  • Easy = Blue <10

Installation Steps - 
1. go into your dayz_server\compiles folder and find server_playerSetup.sqf, locate the line that looks like 

dayzPlayerLogin2 = [_worldspace,_state];

and replace it with 

dayzPlayerLogin2 = [_worldspace,_state,_randomSpot];

and repack your server pbo

 

2. open up your mission folder / pbo and open the init.sqf and put this at the bottom : 

sexcheck = compile preprocessFileLineNumbers "scripts\sexcheck.sqf";
waitUntil {!isNil ("PVDZE_plr_LoginRecord")};
if (dayzPlayerLogin2 select 2) then
{
    player spawn sexcheck;
};

change the filepath accordingly
3. download this file and place it in a scripts folder 
4. configure
5. enjoy

 

Credits -

HollowAddiction for the idea

Link to comment
Share on other sites

Nice release!

Can you explain me what is buggy when you use usemorph?

And with the script I'm sure you can get random loadouts to work too ;)

 

Thanks for the release,

xBowBii

before I released it, when I was still stress testing it, some of the female skins would get you stuck in debug fields on morph, pre-release I isolated these skins and removed them from the morph list but left the notice up there as a warning that anything can, and probably will happen haha.

Link to comment
Share on other sites

why are you not implementing this into the player_monitor.fsm?

 

it would be a much better way to do it, instead of switching the players skin after he already spawned in, not to mention the switch might prevent the backpack being added to the player, as the player is not always ready right after using player_humanityMorph.

 

also, why use two diffrent checks to check for the sex?

imo you should just use the check for what skintype they are wearing since you can only spawn as either survivor or female unless edited before this (iirc bandits are switched after entering the game) and i doubt its quicker to check config than to check if the skin is in one of two in an array.

Link to comment
Share on other sites

why are you not implementing this into the player_monitor.fsm?

 

it would be a much better way to do it, instead of switching the players skin after he already spawned in, not to mention the switch might prevent the backpack being added to the player, as the player is not always ready right after using player_humanityMorph.

 

also, why use two diffrent checks to check for the sex?

imo you should just use the check for what skintype they are wearing since you can only spawn as either survivor or female unless edited before this (iirc bandits are switched after entering the game) and i doubt its quicker to check config than to check if the skin is in one of two in an array.

Firstly, if you checked the epoch block of code you would clearly see 

_pack = unitBackPack player;
_packToAdd = typeOf _pack;
removeBackpack player;
uisleep 1;
[dayz_playerUID,dayz_characterID,_morph] spawn player_humanityMorph;
uisleep 1;
player addBackpack _packToAdd;


lastly, there is only one check for sex.  it checks if they are wearing any skin that is designated as a female skin by the cfgSurvival.hpp like so, 

	_type = typeOf player;
	_girltype = "Skin_" + _type;
	_currentSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _girltype >> "sex");
	if (_currentSex == "female") then { 

and in cfgSurvival : 

	class Skin_GUE_Soldier_2_DZ : Default {
			sex = "male";
			playerModel = "GUE_Soldier_2_DZ";
		};
		
		class Skin_BanditW1_DZ : Default {
			sex = "female";
			playerModel = "BanditW1_DZ";
		};
		

but anyways, I don't know why you are pointing out flaws and asking questions when this script is now moot. 1051 added this in by default, all you have to do is put this in your init.sqf :

_male = ["Male skin1","Male skin2","Male skin3","Male skin4"] call BIS_fnc_selectRandom;
_female = ["Female skin1","Female skin2","Female skin3","Female skin4"] call BIS_fnc_selectRandom;
DZE_defaultSkin = [_male,_female];
Link to comment
Share on other sites

but anyways, I don't know why you are pointing out flaws and asking questions when this script is now moot. 1051 added this in by default, all you have to do is put this in your init.sqf :

_male = ["Male skin1","Male skin2","Male skin3","Male skin4"] call BIS_fnc_selectRandom;
_female = ["Female skin1","Female skin2","Female skin3","Female skin4"] call BIS_fnc_selectRandom;
DZE_defaultSkin = [_male,_female];

 

I tried that in my init.sqf but I didn't spawn with a random skin:

 

_male = ["Sniper1_DZ","Camo1_DZ","Rocket_DZ","Soldier1_DZ","RU_Policeman_DZ","Pilot_EP1_DZ","Haris_Press_EP1_DZ","GUE_Commander_DZ","Functionary1_EP1_DZ","Priest_DZ","Rocker1_DZ","Rocker2_DZ","Rocker3_DZ","Rocker4_DZ","GUE_Soldier_Sniper_DZ","Soldier_TL_PMC_DZ","Soldier_Sniper_PMC_DZ","Soldier_Bodyguard_AA12_PMC_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","CZ_Soldier_Sniper_EP1_DZ","Graves_Light_DZ","Drake_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","TK_Special_Forces_MG_EP1_DZ","TK_Soldier_Sniper_EP1_DZ","TK_Commander_EP1_DZ","RU_Soldier_Crew_DZ","INS_Lopotev_DZ","INS_Soldier_AR_DZ","INS_Soldier_CO_DZ","INS_Bardak_DZ","INS_Worker2_DZ"] call BIS_fnc_selectRandom;
_female = ["SurvivorWpink_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"] call BIS_fnc_selectRandom;
DZE_defaultSkin = [_male,_female];
Link to comment
Share on other sites

 

I tried that in my init.sqf but I didn't spawn with a random skin:

 

_male = ["Sniper1_DZ","Camo1_DZ","Rocket_DZ","Soldier1_DZ","RU_Policeman_DZ","Pilot_EP1_DZ","Haris_Press_EP1_DZ","GUE_Commander_DZ","Functionary1_EP1_DZ","Priest_DZ","Rocker1_DZ","Rocker2_DZ","Rocker3_DZ","Rocker4_DZ","GUE_Soldier_Sniper_DZ","Soldier_TL_PMC_DZ","Soldier_Sniper_PMC_DZ","Soldier_Bodyguard_AA12_PMC_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","CZ_Soldier_Sniper_EP1_DZ","Graves_Light_DZ","Drake_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","TK_Special_Forces_MG_EP1_DZ","TK_Soldier_Sniper_EP1_DZ","TK_Commander_EP1_DZ","RU_Soldier_Crew_DZ","INS_Lopotev_DZ","INS_Soldier_AR_DZ","INS_Soldier_CO_DZ","INS_Bardak_DZ","INS_Worker2_DZ"] call BIS_fnc_selectRandom;
_female = ["SurvivorWpink_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"] call BIS_fnc_selectRandom;
DZE_defaultSkin = [_male,_female];

 

depends on where you put it in your init.

 

Usually you would put configs like that above the compiles lines, but for BIS_fnc_selectRandom to work it has to be below them. 

Link to comment
Share on other sites

  • 3 months later...

Thanks for the awesome release Matt.

 

We had this in our server for a few days then started noticing issues with custom loadouts. Our UID based custom loadouts would work, but backpack items would not spawn in. I think this is due to the sexcheck.sqf executing after the loadout is deployed, which removes content from backpack. 

 

Is there anything that could be done to allow custom loadouts to function correctly with this?

Link to comment
Share on other sites

Thanks for the awesome release Matt.

 

We had this in our server for a few days then started noticing issues with custom loadouts. Our UID based custom loadouts would work, but backpack items would not spawn in. I think this is due to the sexcheck.sqf executing after the loadout is deployed, which removes content from backpack. 

 

Is there anything that could be done to allow custom loadouts to function correctly with this?

https://www.dropbox.com/s/a6lqr18krlb3c0j/sexcheck.sqf?dl=0

not 100% sure it will work, but it should. If you have any issues with it let me know (and let me know the issue / error)

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
  • Discord

×
×
  • Create New...