Guest User

Grave Cross Script - player_death.sqf

a guest
Aug 23rd, 2013
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.85 KB | None | 0 0
  1. private ["_array","_source","_kills","_killsV","_humanity","_wait","_myKills","_infected","_canHitFree","_myHumanity","_method","_body","_playerID","_id","_myGroup","_magazineArray","_control","_item","_val","_max"];
  2. if (deathHandled) exitWith {};
  3.  
  4. deathHandled = true;
  5.  
  6. // ################## grave cross parameter start ##################
  7. _magazines = call player_countmagazines;
  8. _backpack = unitBackpack player;
  9.  
  10. // ------------------items backpack check
  11. private ["_newBackpackType","_backpackWpn","_backpackMag"];
  12. dayz_myBackpack = unitBackpack player;
  13. _newBackpackType = (typeOf dayz_myBackpack);
  14. if(_newBackpackType != "") then {
  15. _backpackWpn = getWeaponCargo unitBackpack player;
  16. _backpackMag = getMagazineCargo unitBackpack player;
  17. };
  18. // ################## grave cross parameter stop ##################
  19.  
  20.  
  21. //Death
  22. _body = player;
  23. _playerID = getPlayerUID player;
  24.  
  25. _infected = 0;
  26. if (r_player_infected) then {
  27. _infected = 1;
  28. };
  29.  
  30. //Send Death Notice
  31. //["dayzDeath",[dayz_characterID,0,_body,_playerID,dayz_playerName,_infected]] call callRpcProcedure;
  32. dayzDeath = [dayz_characterID,0,_body,_playerID,dayz_playerName,_infected];
  33. publicVariableServer "dayzDeath";
  34.  
  35. _id = [player,20,true,getPosATL player] spawn player_alertZombies;
  36.  
  37. sleep 0.5;
  38.  
  39. player setDamage 1;
  40. 0.1 fadeSound 0;
  41.  
  42. player setVariable ["NORRN_unconscious", false, true];
  43. player setVariable ["unconsciousTime", 0, true];
  44. player setVariable ["USEC_isCardiac",false,true];
  45. player setVariable ["medForceUpdate",true,true];
  46. //remove combat timer on death
  47. player setVariable ["startcombattimer", 0, true];
  48. r_player_unconscious = false;
  49. r_player_cardiac = false;
  50.  
  51. _id = player spawn spawn_flies;
  52.  
  53. _humanity = 0;
  54. _wait = 0;
  55.  
  56. _array = _this;
  57. if (count _array > 0) then {
  58. _source = _array select 0;
  59. _method = _array select 1;
  60. if (!isNull _source) then {
  61. if (_source != player) then {
  62. _canHitFree = player getVariable ["freeTarget",false];
  63. _myHumanity = ((player getVariable ["humanity",0]) / 10);
  64. _myKills = ((player getVariable ["humanKills",0]) / 5) * (1000 - _myHumanity);
  65.  
  66. if (!_canHitFree) then {
  67. //Process Morality Hit
  68. _humanity = -(2000 - _myKills);
  69. _kills = _source getVariable ["humanKills",0];
  70. _source setVariable ["humanKills",(_kills + 1),true];
  71. _wait = 300;
  72. } else {
  73. //Process Morality Hit
  74. //_humanity = _myKills * 100;
  75. _killsV = _source getVariable ["banditKills",0];
  76. _source setVariable ["banditKills",(_killsV + 1),true];
  77. _wait = 0;
  78. };
  79. if (_humanity < 0) then {
  80. _wait = 0;
  81. };
  82. if (!_canHitFree) then {
  83. //["dayzHumanity",[_source,_humanity,_wait]] call broadcastRpcCallAll;
  84. dayzHumanity = [_source,_humanity,_wait];
  85. publicVariable "dayzHumanity";
  86. };
  87. };
  88. };
  89. _body setVariable ["deathType",_method,true];
  90. };
  91.  
  92. terminate dayz_musicH;
  93. terminate dayz_lootCheck;
  94. terminate dayz_slowCheck;
  95. terminate dayz_animalCheck;
  96. terminate dayz_monitor1;
  97. terminate dayz_medicalH;
  98. terminate dayz_gui;
  99. terminate dayz_zedCheck;
  100. terminate dayz_locationCheck;
  101. terminate dayz_combatCheck;
  102. terminate dayz_friendliesCheck;
  103.  
  104. //Reset (just in case)
  105. //deleteVehicle dayz_playerTrigger;
  106. disableUserInput false;
  107. r_player_dead = true;
  108.  
  109. "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2;
  110.  
  111. "colorCorrections" ppEffectEnable true;
  112. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01], [1, 1, 1, 0.0]];
  113. "colorCorrections" ppEffectCommit 1;
  114.  
  115. //Player is Dead!
  116. 3 fadeSound 0;
  117. 0 cutText ["", "BLACK",10];
  118. dayz_DeathActioned = true;
  119. sleep 1;
  120.  
  121. TitleText[localize "str_player_12","PLAIN DOWN",5];
  122.  
  123. dayz_originalPlayer enableSimulation true;
  124.  
  125. addSwitchableUnit dayz_originalPlayer;
  126. setPlayable dayz_originalPlayer;
  127. selectPlayer dayz_originalPlayer;
  128.  
  129. _myGroup = group _body;
  130. [_body] joinSilent dayz_firstGroup;
  131. deleteGroup _myGroup;
  132.  
  133. // ################## grave cross script start ##################
  134.  
  135. // --------------------player items setparameter
  136. _playerWeapons = weapons _body;
  137. _playerMagazines = _magazines;
  138.  
  139.  
  140. // ############# script ##############
  141. removeAllWeapons _body;
  142. clearMagazineCargo _body;
  143. hidebody _body;
  144.  
  145. // --------------------Create the tombstone objects.
  146. _graveBase = createVehicle ["GraveCross2", position _body, [], 0, "NO_COLLIDE"];
  147. _graveBase setPosATL position _body; // setPos again because arma.
  148. _graveBase setDir _playerDir;
  149.  
  150. // --------------------Create a loot container inside the grave.
  151. _tempContainer = createVehicle ["weaponHolder", getPosATL _graveBase, [], 1, "can_collide"];
  152. _containerLoc = getPosATL _tempContainer;
  153. _containerLoc = [((_containerLoc select 0) + 0),((_containerLoc select 1) + 0),0];
  154. _tempContainer setPosATL _containerLoc;
  155.  
  156.  
  157. // #### PLAYER items to weaponholder start ####
  158. // player add weapons
  159. {
  160. _tempContainer addWeaponCargoGlobal [_x,1];
  161. } forEach _playerWeapons;
  162.  
  163. // player add items
  164. {
  165. _tempContainer addMagazineCargoGlobal [_x,1];
  166. } forEach _playerMagazines;
  167.  
  168. // #### PLAYER items to weaponholder stop ####
  169. // #### BACKPACK items to weaponsholder start ####
  170.  
  171. if (!isNil "_newBackpackType") then {
  172. if (_newBackpackType != "") then {
  173. _backpackWpnTypes = [];
  174. _backpackWpnQtys = [];
  175. if (count _backpackWpn > 0) then {
  176. _backpackWpnTypes = _backpackWpn select 0;
  177. _backpackWpnQtys = _backpackWpn select 1;
  178. };
  179. _countr = 0;
  180. {
  181. _tempContainer addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
  182. _countr = _countr + 1;
  183. } forEach _backpackWpnTypes;
  184. _backpackmagTypes = [];
  185. _backpackmagQtys = [];
  186. if (count _backpackmag > 0) then {
  187. _backpackmagTypes = _backpackMag select 0;
  188. _backpackmagQtys = _backpackMag select 1;
  189. };
  190. _countr = 0;
  191. {
  192. _tempContainer addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
  193. _countr = _countr + 1;
  194. } forEach _backpackmagTypes;
  195. };
  196. };
  197. // #### BACKPACK items to weaponsholder stop ####
  198. // #### BACKPACK to weaponsholder start ####
  199.  
  200. _backp = createVehicle ["DZ_CivilBackpack_EP1", position _body, [], 4, "can_collide"];
  201. _backp setPosATL position _body; // setPos again because arma.
  202. _backp setDir _playerDir;
  203.  
  204. // #### BACKPACK to weaponsholder stop ####
  205.  
  206. [_graveBase, _tempContainer, _backp] spawn {
  207. };
  208. // ################## grave cross script stop ##################
  209.  
  210. 3 cutRsc ["default", "PLAIN",3];
  211. 4 cutRsc ["default", "PLAIN",3];
  212.  
  213.  
  214. if (count _array > 0) then {
  215. _body setVariable ["deathType",_method,true];
  216. };
  217.  
  218. _body setVariable["combattimeout", 0, true];
  219.  
  220. //["dayzFlies",player] call broadcastRpcCallAll;
  221. sleep 2;
  222.  
  223. 1 cutRsc ["DeathScreen","BLACK OUT",3];
  224.  
  225.  
  226. playMusic "dayz_track_death_1";
  227.  
  228. "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
  229. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;
Advertisement
Add Comment
Please, Sign In to add comment