Jump to content
  • 0
OnkelDom

Skin Change by Humanity

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

Share this post


Link to post
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... ;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By salival
      Hi guys,
      Quite a few admins asked me to release my Change Code script so here it is, It comes with BattlEye filters, too.
      This will allow players to set the code on placement/upgrade of doors, lockboxes and safes as well as changing them after they are placed.
      https://github.com/oiad/changeCode
    • By Dzhabrailov
      how to do it humanity for animals killed ?
    • By calinova22
      I was wondering if it is possible to make it so that a players humanity would not change for a certain amount of time? I have a PVP arena with a teleport in and I was wanting to make it so people could TP in and fight without worrying about gaining or losing humanity.
    • By Dzhabrailov
      How it possible to give humanity for killing animals? :D
    • By totis
      Hi
      This is a restriction to vehicle seat according to humanity.
      It may be handy to PVE servers out there.
      Special thanks to Juandayz with his fantastic skills and salival. Both sometimes working unseen for the benefit of this community.
      Step 1.
      Make a new file, Name it veh_hum.sqf with the below contents and put into dayz_epoch/addons folder. If you dont have addons just create one.
      In this example we have a hero superhero and agenthero traders with 20k/40k/60k humanity respectively. Adjust according to your needs.
       
      private ["_vehicle","_inVehicle","_driver","_humanity","_txt"]; while {true} do { _vehicle = vehicle player; _inVehicle = (_vehicle != player); if (_inVehicle) then { _driver = driver (vehicle player); if (({(isPlayer _driver) && (alive _driver)} count (crew _vehicle) > 0)) then { _humanity = _driver getVariable["humanity",0]; if (typeOf _vehicle in DZE_heroHumanity && _humanity <= 20000 || (typeOf _vehicle in DZE_superHeroHumanity && _humanity <= 40000) || (typeOf _vehicle in DZE_agentHumanity && _humanity <= 60000)) then { player action ["getOut", (vehicle player)]; titleText ["","WHITE IN"]; _txt = "<img image='addons\vehicon.paa' /><br/><t size='0.7' color='#ea2828' align='center'>prohibited vehicle</t>"; [_txt, [safezoneX, safezoneW], [0.20 * safezoneH + safezoneY, 0.3 * safezoneH], 2, 0.5] spawn BIS_fnc_dynamicText; }; }; }; sleep 3; };  Step 2: Download this file http://www.mediafire.com/file/bdpt5d96o5cttk3/vehicon.rar
      Unzip and put paa file into addons folder.
      Step 3: Edit your custom variables file    dayz_code/init/variables.sqf
      Put the vehicles you want to restrict below call dayz_resetselfactions; ike this:
      // Custom below s_givemoney_dialog = -1; s_bank_dialog = -1; s_player_checkWallet = -1; s_bank_dialog1 = -1; s_bank_dialog2 = -1; s_player_copyToKey = -1; s_player_claimVehicle = -1; s_collect_heli = -1; }; call dayz_resetSelfActions; DZE_heroHumanity = ["Mi17_rockets_RU","Mi24_D","UH1Y_DZE"]; DZE_superHeroHumanity = ["Mi24_V","Mi24_P","Ka52"]; DZE_agentHumanity = ["AV8B2","AV8B","A10","F35B"]; DZE_safeVehicle = DZE_heroHumanity + DZE_superHeroHumanity + DZE_agentHumanity +["ParachuteWest","ParachuteC"]; Step 4: Edit your init file to exec the script. Above the   (false,12)execVm.... like below
          [] execVM "addons\veh_hum.sqf";
          //[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
      Thats it. Enjoy!
        Hide contents
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...