Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Created by [GEEK SQUAD]Churchie
- // Contributors to getting it working are:| cyrq | Manatee Hunter | Deasil | OnlyblackSurvivor | Thank you!
- //epoch version and updates to check for ai, humanity and gender by HALV
- player removeAction s_clothes;
- s_clothes = -1;
- private["_body","_result","_models2use","_femodels","_defmodels","_model","_humanity","_side","_hero","_bandit","_survivor","_Fside","_Hside"];
- _body = _this select 3;
- _model = typeOf _body;
- _side = side (group _body);
- _humanity = _body getVariable ["humanity",0];
- ////////////////////settings area////////////////////
- //models that can be taken
- _models2use = ["RU_Policeman_DZ","Priest_DZ","Haris_Press_EP1_DZ","Pilot_EP1_DZ","Functionary1_EP1_DZ","Rocker3_DZ","Rocker1_DZ","Rocker2_DZ","Rocker4_DZ","SurvivorW3_DZ","BanditW2_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ","SurvivorWpink_DZ","Rocket_DZ","Soldier1_DZ","Sniper1_DZ","CZ_Soldier_Sniper_EP1_DZ","Camo1_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","Graves_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","Soldier_Bodyguard_AA12_PMC_DZ","Soldier_Sniper_PMC_DZ","GUE_Soldier_Sniper_DZ","GUE_Soldier_Crew_DZ","GUE_Soldier_CO_DZ","GUE_Soldier_2_DZ","GUE_Commander_DZ","Ins_Soldier_GL_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","GUE_Soldier_MG_DZ"];
- //all female models
- _femodels = ["SurvivorW3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ","SurvivorWpink_DZ","BanditW2_DZ"];
- //all default models
- _defmodels = ["Survivor2_DZ","Bandit1_DZ","SurvivorW2_DZ","BanditW1_DZ","Survivor3_DZ","Soldier_Crew_PMC"];
- //amount of humanity to define hero
- _hero = (_humanity >= 5000);
- //amount of negative humanity to define bandit
- _bandit = (_humanity <= -5000);
- //in between these amount will end up survivor
- _survivor = (_humanity <= 5000) or (_humanity >= -5000);
- //friendly ai side
- _Fside = resistance;
- //hostile/Bandit ai side
- _Hside = east;
- /////////////////////////////////////////////////////
- switch (true) do {
- case (_bandit and (_model in _femodels)):
- {Skin_switch_class = "BanditW1_DZ"; diag_log "bandit female detected";};
- case (_bandit and !(_model in _femodels)):
- {Skin_switch_class = ["Bandit1_DZ","Bandit2_DZ"] call bis_fnc_selectrandom; diag_log "bandit male detected";};
- case (_hero and (_model in _femodels)):
- {Skin_switch_class = "SurvivorW2_DZ"; diag_log "hero female detected";};
- case (_hero and !(_model in _femodels)):
- {Skin_switch_class = "Survivor3_DZ"; diag_log "hero male detected";};
- case ((_humanity !=0) and (_survivor) and (_model in _femodels)):
- {Skin_switch_class = "SurvivorW2_DZ"; diag_log "survivor female detected";};
- case ((_humanity !=0) and (_survivor) and !(_model in _femodels)):
- {Skin_switch_class = ["Survivor2_DZ","Soldier_Crew_PMC"] call bis_fnc_selectrandom; diag_log "survivor male detected";};
- case ((_side == _Hside) and (_model in _femodels)):
- {Skin_switch_class = "BanditW1_DZ"; diag_log "Bandit (east) ai female detected";};
- case ((_side == _Hside) and !(_model in _femodels)):
- {Skin_switch_class = ["Bandit1_DZ","Bandit2_DZ"] call bis_fnc_selectrandom; diag_log "Bandit (east) ai male detected";};
- case ((_side == _Fside) and (_model in _femodels)):
- {Skin_switch_class = "SurvivorW2_DZ"; diag_log "resistance ai soldier female detected";};
- case ((_side == _Fside) and !(_model in _femodels)):
- {Skin_switch_class = ["Survivor2_DZ","Soldier_Crew_PMC","Survivor3_DZ"] call bis_fnc_selectrandom; diag_log "resistance ai soldier male detected";};
- default
- { //should not happend
- if(_model in _femodels)then{
- Skin_switch_class = ["BanditW1_DZ","SurvivorW2_DZ"] call bis_fnc_selectrandom;
- }else{
- Skin_switch_class = ["Bandit1_DZ","Survivor2_DZ"] call bis_fnc_selectrandom;
- };
- _txt = format["Something went wrong while checking skin %1 %2 %3 %4 %5 %6",_body,typeOf _body,_side,_humanity,Skin_switch_class,_this];
- // cutText [_txt, "PLAIN DOWN"];
- diag_log _txt;
- };
- };
- if(_model in _models2use) then {
- _model2skin = "Skin_" + _model;
- _result = [player,_model2skin] call BIS_fnc_invAdd;
- if (_result) then {
- player playActionNow "PutDown";
- private["_name","_method","_methodStr"];
- _isGutted = _body getVariable["meatHarvested",false];
- _name = _body getVariable["bodyName","unknown"];
- _method = _body getVariable["deathType","unknown"];
- _methodStr = localize format ["str_death_%1",_method];
- _position = getPosATL _body;
- _dir = getDir _body;
- _currentAnim = animationState _body;
- private ["_weapons","_magazines","_primweapon","_secweapon"];
- _weapons = weapons _body;
- _primweapon = primaryWeapon _body;
- _secweapon = secondaryWeapon _body;
- if(!(_primweapon in _weapons) && _primweapon != "") then {
- _weapons = _weapons + [_primweapon];
- };
- if(!(_secweapon in _weapons) && _secweapon != "") then {
- _weapons = _weapons + [_secweapon];
- };
- _magazines = magazines _body;
- private ["_newBackpackType","_backpackWpn","_backpackMag"];
- dayz_myBackpack = unitBackpack _body;
- _newBackpackType = (typeOf dayz_myBackpack);
- if(_newBackpackType != "") then {
- _backpackWpn = getWeaponCargo unitBackpack _body;
- _backpackMag = getMagazineCargo unitBackpack _body;
- };
- _currentWpn = currentWeapon _body;
- _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
- if (count _muzzles > 1) then {
- _currentWpn = currentMuzzle _body;
- };
- diag_log "Attempting to switch model";
- diag_log str(_weapons);
- diag_log str(_magazines);
- diag_log (str(_backpackWpn));
- diag_log (str(_backpackMag));
- _body setPosATL dayz_spawnPos;
- _oldUnit = _body;
- _group = createGroup west;
- _newUnit = _group createUnit [Skin_switch_class,position player,[],0,"NONE"];
- _newUnit setPosATL _position;
- _newUnit setDir _dir;
- {
- _newUnit removeMagazine _x;
- } forEach magazines _newUnit;
- removeAllWeapons _newUnit;
- {
- if (typeName _x == "ARRAY") then {
- _newUnit addMagazine [_x select 0,_x select 1]
- } else {
- _newUnit addMagazine _x
- };
- } forEach _magazines;
- {
- _newUnit addWeapon _x;
- } forEach _weapons;
- if(str(_weapons) != str(weapons _newUnit)) then {
- {
- _weapons = _weapons - [_x];
- } forEach (weapons _newUnit); {
- _newUnit addWeapon _x;
- } forEach _weapons;
- };
- if(_primweapon != (primaryWeapon _newUnit)) then {
- _newUnit addWeapon _primweapon;
- };
- if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
- _newUnit addWeapon _secweapon;
- };
- if (!isNil "_newBackpackType") then {
- if (_newBackpackType != "") then {
- _newUnit addBackpack _newBackpackType;
- _oldBackpack = dayz_myBackpack;
- dayz_myBackpack = unitBackpack _newUnit;
- _backpackWpnTypes = [];
- _backpackWpnQtys = [];
- if (count _backpackWpn > 0) then {
- _backpackWpnTypes = _backpackWpn select 0;
- _backpackWpnQtys = _backpackWpn select 1;
- };
- _countr = 0;
- {
- dayz_myBackpack 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;
- {
- dayz_myBackpack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
- _countr = _countr + 1;
- } forEach _backpackmagTypes;
- };
- };
- diag_log "Taking Clothes. Equipment:";
- diag_log str(weapons _newUnit);
- diag_log str(magazines _newUnit);
- diag_log str(getWeaponCargo unitBackpack _newUnit);
- diag_log str(getMagazineCargo unitBackpack _newUnit);
- removeAllWeapons _oldUnit;
- {
- _oldUnit removeMagazine _x;
- } forEach magazines _oldUnit;
- deleteVehicle _oldUnit;
- _newUnit setDamage 1;
- _newUnit setVariable["bodyName",_name,true];
- _newUnit setVariable["deathType",_method,true];
- if (_isGutted) then {
- _newUnit setVariable["meatHarvested",true,true];
- };
- } else {
- cutText ["You need a free slot to take clothing", "PLAIN DOWN"];
- };
- }else{
- if (_model in _defmodels) then {
- cutText ["You cant take default clothes", "PLAIN DOWN"];
- } else {
- _txt = format["You cant take these clothes (%1 not supported)",_model];
- cutText [_txt, "PLAIN DOWN"];
- diag_log _txt;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement