Jump to content
  • 0

Skin Change by Humanity


OnkelDom

Question

Can anyone say me, how can i add a method, that the skin change for new humanity is random and work this script? I have found this in this forum.

private ["_humanity","_model","_oldBackPack","_oldBackPackType","_newBackPack","_backpackWpn","_backpackMag","_countr"];
 
if (isServer || isDedicated) exitWith {};
	// Humanity Skins
	waitUntil {!isNil "dayz_animalCheck"};
		_oldBackPack = unitBackpack player;
		_oldBackPackType = (typeOf _oldBackPack);
	if(_oldBackPackType != "") then { 
		_backpackWpn = getWeaponCargo unitBackpack player;
		_backpackMag = getMagazineCargo unitBackpack player; 
	};
 
_humanity = round (player getVariable["humanity", 0]); 
 
//Check Survivor
if (_humanity > -5000 && _humanity < 5000) exitWith {};
	if (!(typeOf player in ["Survivor2_DZ","SurvivorW2_DZ"])) exitWith {
		systemchat "<System>: Humanity skin change being run on an existing player.";
	};
 
//Check Hero
if (_humanity < 15000 && _humanity >= 5000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "INS_Worker2_DZ";
	} else {
		_model = "SurvivorWpink_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};

if (_humanity < 30000 && _humanity >= 15000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "CZ_Special_Forces_GL_DES_EP1_DZ";
	} else {
		_model = "SurvivorWurban_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
 
if (_humanity >= 30000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "Camo1_DZ";
	} else {
		_model = "SurvivorWcombat_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
 
//Check Bandit
if (_humanity > -15000 && _humanity <= -5000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "Bandit1_DZ";
	} else {
		_model = "BanditW1_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};

if (_humanity > -30000 && _humanity <= -15000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "GUE_Soldier_Sniper_DZ";
	} else {
		_model = "SurvivorWurban_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
 
if (_humanity <= -30000) then {
	if (typeOf player == "Survivor2_DZ") then { 
		_model = "GUE_Commander_DZ";
	} else {
		_model = "SurvivorWdesert_DZ";
	};
	[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
 
sleep 4;
 
if (!isNil "_oldBackPackType") then {
	if (_oldBackPackType != "") then {
		player addBackpack _oldBackPackType;
			_newBackPack = unitBackpack player; 
			_backpackWpnTypes = [];
			_backpackWpnQtys = [];
		if (count _backpackWpn > 0) then { 
			_backpackWpnTypes = _backpackWpn select 0;
			_backpackWpnQtys = _backpackWpn select 1; 
		};
	 
		_countr = 0; { 
			_newBackPack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
			_countr = _countr + 1;
		} forEach _backpackWpnTypes;
			_backpackmagTypes = [];
			_backpackmagQtys = [];
		if (count _backpackmag > 0) then { 
			_backpackmagTypes = _backpackMag select 0;
			_backpackmagQtys = _backpackMag select 1; 
		};
	 
		_countr = 0; { 
			_newBackPack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
			_countr = _countr + 1;
		} forEach _backpackmagTypes; 
	}; 
};

Thank you for help. My englisch is a little mad, sorry

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I also tried around to change Skins on spawn and this is an working example of how i do it..

if(!isDedicated) then 
{
	[] spawn {
		private ["_skin","_isNew","_model"];
		waitUntil {!isNil "dayz_Totalzedscheck"};
		_isNew = dayzPlayerLogin select 4;
		_model = typeOf player;	
		if (!_isNew) exitWith{SystemChat "not is new player";};
		if (_isNew)then {	
//your humanity stuff here
			if (_model in ["Survivor1_DZ","Survivor2_DZ"])	then {
				_skin = AllPlayers call BIS_fnc_selectRandom;//change global array 
				SystemChat (format ["CUSTOM MODEL CHANGE:: SWITCHED MODEL TO %1",_skin]);												
				[player,_skin] call player_serverModelChange;
			};
		};	
	};
};	

By changing Skins only on fresh spawned players there shouldn't be any problems with not saving backpacks gear...You can modify this to your needs, for example with humaniy checks...keep in mind, that this is not checking the sex (allplayers array contains also femal models) So make your own global array of the skins you want to use, or make a check for each single case...ii'll try to do this as well,when i got  time

Hope this helps... ;)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...