Guest User

Untitled

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