SHOW:
|
|
- or go back to the newest paste.
| 1 | // Created by [GEEK SQUAD]Churchie | |
| 2 | // Contributors to getting it working are:| cyrq | Manatee Hunter | Deasil | Seaweeduk |Thank you! | |
| 3 | player removeAction s_clothes; | |
| 4 | s_clothes = -1; | |
| 5 | private["_body","_result"]; | |
| 6 | _body = _this select 3; | |
| 7 | _model = typeOf _body; | |
| 8 | if( _model in ["Sniper1_DZ","Camo1_DZ"] ) then { _model = "Skin_" + _model;
| |
| 9 | _rnd = random 1; | |
| 10 | if (_rnd > 0.4) then {
| |
| 11 | _result = [player,_model] call BIS_fnc_invAdd; | |
| 12 | } | |
| 13 | else {
| |
| 14 | _model = "Skin_Survivor2_DZ"; | |
| 15 | _result = [player,_model] call BIS_fnc_invAdd; | |
| 16 | cutText ["The clothing tears as you try to remove it from the corpse", "PLAIN DOWN"]; | |
| 17 | }; | |
| 18 | if (_result) then { player playActionNow "PutDown";
| |
| 19 | private["_name","_method","_methodStr"]; | |
| 20 | - | _name = _body getVariable["bodyName","unknown"]; |
| 20 | + | _name = _body getVariable["bodyName","unknown"]; |
| 21 | _method = _body getVariable["deathType","unknown"]; | |
| 22 | _methodStr = localize format ["str_death_%1",_method]; | |
| 23 | _class = "Survivor2_DZ"; | |
| 24 | _position = getPosATL _body; | |
| 25 | _dir = getDir _body; | |
| 26 | _currentAnim = animationState | |
| 27 | _body; private ["_weapons","_magazines","_primweapon","_secweapon"]; | |
| 28 | _weapons = weapons _body; | |
| 29 | _primweapon = primaryWeapon | |
| 30 | _body; _secweapon = secondaryWeapon _body; | |
| 31 | if(!(_primweapon in _weapons) && _primweapon != "") then { _weapons = _weapons + [_primweapon]; };
| |
| 32 | if(!(_secweapon in _weapons) && _secweapon != "") then { _weapons = _weapons + [_secweapon]; };
| |
| 33 | _magazines = magazines _body; | |
| 34 | private ["_newBackpackType","_backpackWpn","_backpackMag"]; dayz_myBackpack = unitBackpack _body; | |
| 35 | _newBackpackType = (typeOf dayz_myBackpack); | |
| 36 | if(_newBackpackType != "") then { _backpackWpn = getWeaponCargo unitBackpack _body;
| |
| 37 | _backpackMag = getMagazineCargo unitBackpack _body; }; | |
| 38 | _currentWpn = currentWeapon _body; | |
| 39 | _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles"); | |
| 40 | if (count _muzzles > 1) then { _currentWpn = currentMuzzle _body; };
| |
| 41 | diag_log "Attempting to switch model"; | |
| 42 | diag_log str(_weapons); | |
| 43 | diag_log str(_magazines); | |
| 44 | diag_log (str(_backpackWpn)); | |
| 45 | diag_log (str(_backpackMag)); | |
| 46 | _body setPosATL dayz_spawnPos; | |
| 47 | _oldUnit = _body; | |
| 48 | _group = createGroup west; | |
| 49 | _newUnit = _group createUnit [_class,position player,[],0,"NONE"]; | |
| 50 | _newUnit setPosATL _position; | |
| 51 | _newUnit setDir _dir; {_newUnit removeMagazine _x;} forEach magazines _newUnit;
| |
| 52 | removeAllWeapons _newUnit; {
| |
| 53 | if (typeName _x == "ARRAY") then {_newUnit addMagazine [_x select 0,_x select 1]
| |
| 54 | } else { _newUnit addMagazine _x };
| |
| 55 | } forEach _magazines; { _newUnit addWeapon _x; } forEach _weapons;
| |
| 56 | if(str(_weapons) != str(weapons _newUnit)) then { { _weapons = _weapons - [_x];
| |
| 57 | } forEach (weapons _newUnit); {
| |
| 58 | _newUnit addWeapon _x; | |
| 59 | } forEach _weapons; }; | |
| 60 | if(_primweapon != (primaryWeapon _newUnit)) then { _newUnit addWeapon _primweapon; };
| |
| 61 | if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then { _newUnit addWeapon _secweapon; };
| |
| 62 | if (!isNil "_newBackpackType") then {
| |
| 63 | if (_newBackpackType != "") then { _newUnit addBackpack _newBackpackType;
| |
| 64 | _oldBackpack = dayz_myBackpack; dayz_myBackpack = unitBackpack _newUnit; _backpackWpnTypes = []; | |
| 65 | _backpackWpnQtys = []; | |
| 66 | if (count _backpackWpn > 0) then { _backpackWpnTypes = _backpackWpn select 0;
| |
| 67 | _backpackWpnQtys = _backpackWpn select 1; }; | |
| 68 | _countr = 0; { dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
| |
| 69 | _countr = _countr + 1; | |
| 70 | } forEach _backpackWpnTypes; | |
| 71 | _backpackmagTypes = []; | |
| 72 | _backpackmagQtys = []; | |
| 73 | if (count _backpackmag > 0) then { _backpackmagTypes =
| |
| 74 | _backpackMag select 0; | |
| 75 | _backpackmagQtys = _backpackMag select 1; }; | |
| 76 | _countr = 0; { dayz_myBackpack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
| |
| 77 | _countr = _countr + 1; | |
| 78 | } forEach _backpackmagTypes; }; }; | |
| 79 | diag_log "Taking Clothes. Equipment:"; | |
| 80 | diag_log str(weapons _newUnit); diag_log str(magazines _newUnit); | |
| 81 | diag_log str(getWeaponCargo unitBackpack _newUnit); | |
| 82 | diag_log str(getMagazineCargo unitBackpack _newUnit); | |
| 83 | removeAllWeapons _oldUnit; {_oldUnit removeMagazine _x;
| |
| 84 | } forEach magazines _oldUnit; deleteVehicle _oldUnit; | |
| 85 | _newUnit setDamage 1; | |
| 86 | _newUnit setVariable["bodyName",_name,true]; | |
| 87 | _newUnit setVariable["deathType",_method,true]; | |
| 88 | } else {
| |
| 89 | cutText ["You need a free slot to take clothing.", "PLAIN DOWN"]; | |
| 90 | }; | |
| 91 | }; |