Advertisement
Guest User

Example File - player_death.sqf [Taviana 1.5.1]

a guest
Aug 27th, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. private["_isHero1_s","_isHero2_s","_isHero3_s","_isBandit1_s","_isBandit2_s","_isBandit3_s","_isHero1_p","_isHero2_p","_isHero3_p","_isBandit1_p","_isBandit2_p","_isBandit3_p","_plevel","_slevel","_isSurvi_p","_isSurvi_s","_body","_playerID","_source","_method","_id","_humanity","_wait","_array","_canHitFree","_humanityVP","_humanityVS","_MuKills_s","_HeroKills_s","_BandKills_s","_humanity_s","_myGroup","_typedeP","_nameKillerP"];
  2. if (deathHandled) exitWith {};
  3.  
  4. // ################## grave cross parameter start ##################
  5. _magazines = call player_countmagazines;
  6. _backpack = unitBackpack player;
  7.  
  8. // #### ITEM backpack check start ####
  9. private ["_newBackpackType","_backpackWpn","_backpackMag"];
  10. dayz_myBackpack = unitBackpack player;
  11. _newBackpackType = (typeOf dayz_myBackpack);
  12. if(_newBackpackType != "") then {
  13. _backpackWpn = getWeaponCargo unitBackpack player;
  14. _backpackMag = getMagazineCargo unitBackpack player;
  15. };
  16. // #### ITEM backpack check stop ####
  17. // ################## grave cross parameter stop ##################
  18.  
  19. _isHero1_s=false;_isHero2_s=false;_isHero3_s=false;
  20. _isBandit1_s=false;_isBandit2_s=false;_isBandit3_s=false;
  21. _isHero1_p=false;_isHero2_p=false;_isHero3_p=false;
  22. _isBandit1_p=false;_isBandit2_p=false;_isBandit3_p=false;
  23. _plevel=0;_slevel=0;_typedeP = 0;
  24. _isSurvi_p = false; _isSurvi_s=false;
  25. deathHandled = true;
  26. //Death
  27.  
  28. _body = player;
  29. _playerID = getPlayerUID player;
  30. _source = _this select 0;
  31. _method = _this select 1;
  32. _nameKillerP = "unknown";
  33.  
  34.  
  35.  
  36. //Send Death Notice
  37. dayzDeath = [dayz_characterID,0,_body,_playerID,dayz_playerName,_source,_method];
  38. publicVariableServer "dayzDeath";
  39. if (isServer) then {
  40. _id = dayzDeath spawn server_playerDied;
  41. };
  42.  
  43. _id = [player,50,true,getPosATL player] spawn player_alertZombies;
  44.  
  45. sleep 0.5;
  46.  
  47. player setDamage 1;
  48. 0.1 fadeSound 0;
  49.  
  50. player setVariable ["NORRN_unconscious", false, true];
  51. player setVariable ["unconsciousTime", 0, true];
  52. player setVariable ["USEC_isCardiac",false,true];
  53. player setVariable ["medForceUpdate",true,true];
  54. //remove combat timer on death
  55. player setVariable ["startcombattimer", 0, true];
  56. r_player_unconscious = false;
  57. r_player_cardiac = false;
  58.  
  59. //_id = player spawn spawn_flies;
  60.  
  61. _humanity = 0;
  62. _wait = 0;
  63. _humanity_s = 0;
  64. _humanityVP = 0;
  65. _humanityVS = 0;
  66. _MuKills_s = 0;
  67. _HeroKills_s = 0;
  68. _BandKills_s = 0;
  69. _wait = 0;
  70. _array = _this;
  71. typedeP = 0;
  72. //diag_log format ["(count _array)=%5,_array=%1,player=%3,_source=%2,_sourceT=%4",_array,_source,(typeOf player),(typeOf _source),(count _array)];
  73.  
  74. _humanityVP = (player getVariable ["humanity",0]);
  75.  
  76. if (_humanityVP >= -4000 and _humanityVP <= 4000) then { _isSurvi_p = true; _typedeP = 2;};
  77.  
  78. if (_humanityVP > 4000 and _humanityVP < 6500) then { _isHero1_p = true; _plevel = 1; _typedeP = 3;};
  79. if (_humanityVP >= 6500 and _humanityVP <= 15000) then { _isHero2_p = true; _plevel = 2; _typedeP = 3;};
  80. if (_humanityVP > 15000) then { _isHero3_p = true; _plevel = 3; _typedeP = 3;};
  81.  
  82. if (_humanityVP > -6500 and _humanityVP < -4000) then { _isBandit1_p = true; _plevel = 1; _typedeP = 1;};
  83. if (_humanityVP >= -15000 and _humanityVP <= -6500) then { _isBandit2_p = true; _plevel = 2; _typedeP = 1;};
  84. if (_humanityVP < -15000) then { _isBandit3_p = true; _plevel = 3; _typedeP = 1;};
  85.  
  86. if (count _array > 0) then {
  87.  
  88. if (!isNull _source) then {
  89. if (_source != player) then {
  90.  
  91. _canHitFree = player getVariable ["freeTarget",false];
  92.  
  93. _humanityVS = (_source getVariable ["humanity",0]);
  94. //diag_log format ["_humanityVP=%1,_humanityVS=%2",_humanityVP,_humanityVS];
  95.  
  96. if (_humanityVS >= -4000 and _humanityVS <= 4000) then { _isSurvi_s = true; };
  97.  
  98. if (_humanityVS > 4000 and _humanityVS < 6500) then { _isHero1_s = true; _slevel = 1;};
  99. if (_humanityVS >= 6500 and _humanityVS <= 15000) then { _isHero2_s = true; _slevel = 2;};
  100. if (_humanityVS > 15000) then { _isHero3_s = true; _slevel = 3;};
  101.  
  102. if (_humanityVS > -6500 and _humanityVS < -4000) then { _isBandit1_s = true; _slevel = 1; };
  103. if (_humanityVS >= -15000 and _humanityVS <= -6500) then { _isBandit2_s = true; _slevel = 2;};
  104. if (_humanityVS < -15000) then { _isBandit3_s = true; _slevel = 3;};
  105.  
  106. _MuKills_s = (_source getVariable ["humanKills",0]);
  107. _HeroKills_s = (_source getVariable["headShots",0]);
  108. _BandKills_s = (_source getVariable ["banditKills",0]);
  109.  
  110.  
  111.  
  112. //_isSurvi_s
  113. if ((!_canHitFree) && _isSurvi_s && _isSurvi_p) then
  114. { _humanity_s = -500; _source setVariable ["humanKills",(_MuKills_s + 1),true];};
  115. if ((!_canHitFree) && _isSurvi_s && (_isBandit1_p or _isBandit2_p or _isBandit3_p)) then
  116. { _humanity_s = (400*_plevel); _source setVariable ["banditKills",(_BandKills_s + 1),true];};
  117. if ((!_canHitFree) && _isSurvi_s && (_isHero1_p or _isHero2_p or _isHero3_p)) then
  118. { _humanity_s = -(500*_plevel); _source setVariable["headShots",(_HeroKills_s + 1),true];};
  119.  
  120. //_isBandit1_s
  121. if (((!_canHitFree)) && (_isBandit1_s or _isBandit2_s or _isBandit3_s) && _isSurvi_p) then
  122. { _humanity_s = -(200-(100*_slevel)); _source setVariable ["humanKills",(_MuKills_s + 1),true];};
  123. if ((!_canHitFree) && (_isBandit1_s or _isBandit2_s or _isBandit3_s) && (_isBandit1_p or _isBandit2_p or _isBandit3_p)) then
  124. { _humanity_s = -(200*(3-_slevel)*_plevel); _source setVariable ["banditKills",(_BandKills_s + 1),true];};
  125. if ((!_canHitFree) && (_isBandit1_s or _isBandit2_s or _isBandit3_s) && (_isHero1_p or _isHero2_p or _isHero3_p)) then
  126. { _humanity_s = -(500*_plevel); _source setVariable["headShots",(_HeroKills_s + 1),true];};
  127.  
  128. //_isHero1_s
  129. if ((!_canHitFree) && (_isHero1_s or _isHero2_s or _isHero3_s) && _isSurvi_p) then
  130. { _humanity_s = -(100+(100*_slevel)*_slevel); _source setVariable ["humanKills",(_MuKills_s + 1),true];};
  131. if ((!_canHitFree) && (_isHero1_s or _isHero2_s or _isHero3_s) && (_isBandit1_p or _isBandit2_p or _isBandit3_p)) then
  132. { _humanity_s = (300*_plevel); _source setVariable ["banditKills",(_BandKills_s + 1),true];};
  133. if ((!_canHitFree) && (_isHero1_s or _isHero2_s or _isHero3_s) && (_isHero1_p or _isHero2_p or _isHero3_p)) then
  134. { _humanity_s = -(500*_plevel); _source setVariable["headShots",(_HeroKills_s + 1),true];};
  135.  
  136. dayzHumanity = [_source,_humanity_s,_wait];
  137. publicVariable "dayzHumanity";
  138. //diag_log format ["_MuKills_s=%1,_HeroKills_s=%2,_BandKills_s=%3,dayzHumanity=%4",_MuKills_s,_HeroKills_s,_BandKills_s,dayzHumanity];
  139. };
  140. _nameKillerP = (name _source);
  141. };
  142.  
  143. _body setVariable ["deathType",_method,true];
  144. _body setVariable ["nameKillerP",_nameKillerP,true];
  145. _body setVariable ["typedeP",_typedeP,true];
  146. };
  147.  
  148. terminate dayz_musicH;
  149. terminate dayz_lootCheck;
  150. terminate dayz_slowCheck;
  151. terminate dayz_animalCheck;
  152. terminate dayz_monitor1;
  153. terminate dayz_medicalH;
  154. terminate dayz_gui;
  155.  
  156. //Reset (just in case)
  157. //deleteVehicle dayz_playerTrigger;
  158. disableUserInput false;
  159. r_player_dead = true;
  160.  
  161. "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2;
  162.  
  163. "colorCorrections" ppEffectEnable true;
  164. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01], [1, 1, 1, 0.0]];
  165. "colorCorrections" ppEffectCommit 1;
  166.  
  167. //Player is Dead!
  168. 3 fadeSound 0;
  169. 0 cutText ["", "BLACK",10];
  170. dayz_DeathActioned = true;
  171. sleep 1;
  172.  
  173. TitleText[localize "str_player_12","PLAIN DOWN",5];
  174.  
  175. dayz_originalPlayer enableSimulation true;
  176.  
  177. addSwitchableUnit dayz_originalPlayer;
  178. setPlayable dayz_originalPlayer;
  179. selectPlayer dayz_originalPlayer;
  180.  
  181. _myGroup = group _body;
  182. [_body] joinSilent dayz_firstGroup;
  183. deleteGroup _myGroup;
  184.  
  185. // ################## grave cross script start ##################
  186.  
  187. // --------------------player items setparameter
  188. _playerWeapons = weapons _body;
  189. _playerMagazines = _magazines;
  190.  
  191.  
  192. // ############# script ##############
  193. removeAllWeapons _body;
  194. clearMagazineCargo _body;
  195. hidebody _body;
  196.  
  197. // --------------------Create the tombstone objects.
  198. _graveBase = createVehicle ["GraveCross2", position _body, [], 0, "NO_COLLIDE"];
  199. _graveBase setPosATL position _body; // setPos again because arma.
  200. _graveBase setDir _playerDir;
  201.  
  202. // --------------------Create a loot container inside the grave.
  203. _tempContainer = createVehicle ["weaponHolder", getPosATL _graveBase, [], 0, "can_collide"];
  204. _containerLoc = getPosATL _tempContainer;
  205. _containerLoc = [((_containerLoc select 0) + 0),((_containerLoc select 1) + 0),0];
  206. _tempContainer setPosATL _containerLoc;
  207.  
  208.  
  209. // #### PLAYER items to weaponholder start ####
  210. // player add weapons
  211. {
  212. _tempContainer addWeaponCargoGlobal [_x,1];
  213. } forEach _playerWeapons;
  214.  
  215. // player add items
  216. {
  217. _tempContainer addMagazineCargoGlobal [_x,1];
  218. } forEach _playerMagazines;
  219.  
  220. // #### PLAYER items to weaponholder stop ####
  221. // #### BACKPACK items to weaponsholder start ####
  222.  
  223. if (!isNil "_newBackpackType") then {
  224. if (_newBackpackType != "") then {
  225. _backpackWpnTypes = [];
  226. _backpackWpnQtys = [];
  227. if (count _backpackWpn > 0) then {
  228. _backpackWpnTypes = _backpackWpn select 0;
  229. _backpackWpnQtys = _backpackWpn select 1;
  230. };
  231. _countr = 0;
  232. {
  233. _tempContainer addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
  234. _countr = _countr + 1;
  235. } forEach _backpackWpnTypes;
  236. _backpackmagTypes = [];
  237. _backpackmagQtys = [];
  238. if (count _backpackmag > 0) then {
  239. _backpackmagTypes = _backpackMag select 0;
  240. _backpackmagQtys = _backpackMag select 1;
  241. };
  242. _countr = 0;
  243. {
  244. _tempContainer addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
  245. _countr = _countr + 1;
  246. } forEach _backpackmagTypes;
  247. };
  248. };
  249. // #### BACKPACK items to weaponsholder stop ####
  250. // #### BACKPACK to weaponsholder start ####
  251.  
  252.  
  253. // ### vanilla dayz ###
  254. _class = typeOf _backpack;
  255. if (_class == "CZ_VestPouch_EP1") then {createVehicle ["CZ_VestPouch_EP1", position _body, [], 2, "can_collide"];};
  256. _class = typeOf _backpack;
  257. if (_class == "DZ_Patrol_Pack_EP1") then {createVehicle ["DZ_Patrol_Pack_EP1", position _body, [], 2, "can_collide"];};
  258. _class = typeOf _backpack;
  259. if (_class == "DZ_Assault_Pack_EP1") then {createVehicle ["DZ_Assault_Pack_EP1", position _body, [], 2, "can_collide"];};
  260. _class = typeOf _backpack;
  261. if (_class == "DZ_CivilBackpack_EP1") then {createVehicle ["DZ_CivilBackpack_EP1", position _body, [], 2, "can_collide"];};
  262. _class = typeOf _backpack;
  263. if (_class == "DZ_ALICE_Pack_EP1") then {createVehicle ["DZ_ALICE_Pack_EP1", position _body, [], 2, "can_collide"];};
  264. _class = typeOf _backpack;
  265. if (_class == "DZ_Backpack_EP1") then {createVehicle ["DZ_Backpack_EP1", position _body, [], 2, "can_collide"];};
  266. _class = typeOf _backpack;
  267. if (_class == "DZ_British_ACU") then {createVehicle ["DZ_British_ACU", position _body, [], 2, "can_collide"];};
  268. _class = typeOf _backpack;
  269. if (_class == "DZ_Czech_Vest_Puch") then {createVehicle ["DZ_Czech_Vest_Puch", position _body, [], 2, "can_collide"];};
  270.  
  271.  
  272. [_graveBase, _tempContainer] spawn {
  273. };
  274. hideBody _body;
  275.  
  276. // ################## grave cross script stop ##################
  277.  
  278. 3 cutRsc ["default", "PLAIN",3];
  279. 4 cutRsc ["default", "PLAIN",3];
  280.  
  281. if (count _array > 0) then {
  282. _body setVariable ["deathType",_method,true];
  283. };
  284.  
  285. _body setVariable["combattimeout", 0, true];
  286.  
  287. sleep 2;
  288.  
  289. 1 cutRsc ["DeathScreen","BLACK OUT",3];
  290.  
  291.  
  292. playMusic "dayz_track_death_1";
  293.  
  294. "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
  295. "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
Advertisement