Advertisement
Guest User

Untitled

a guest
Nov 21st, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1.  
  2. /* Remove Weapons when killed */
  3. call compile format["
  4. _this addEventHandler ['Killed',{ private['_unit','_z','_ran'];
  5. _unit = _this select 0;
  6. _killer = _this select 1;
  7. {_unit removeWeaponGlobal _x}count (%1 + ['EpochRadio0','ItemMap','ItemRadio','ItemWatch','ItemCompass','ItemGPS']);
  8. {if(_x in (magazines _unit))then{_unit removeMagazines _x}}count %2;
  9.  
  10. if(SEM_AIdropGearChance < ceil(random 100))then{
  11. _unit call SEM_fnc_removeGear;
  12. {deleteVehicle _x}forEach nearestObjects [(getPosATL _unit), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 1];
  13. };
  14. if (isplayer _killer && _killer == vehicle _killer) then {
  15. _cIndex = EPOCH_customVars find 'Crypto';
  16. _vars = _killer getVariable['VARS', call EPOCH_defaultVars_SEPXVar];
  17. _current_cryptoRaw = _vars select _cIndex;
  18. _reward = 30 + random 20;
  19. _playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
  20. _playerCryptoLimit params ['_playerCryptoLimitMax','_playerCryptoLimitMin'];
  21. _current_crypto = ((_current_cryptoRaw + _reward) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
  22. _current_crypto remoteExec ['EPOCH_effectCrypto',_killer];
  23. _vars set[_cIndex, _current_crypto];
  24. _killer setVariable['VARS', _vars];
  25. };
  26.  
  27. _unit spawn{
  28. sleep .1;
  29. {_z = _x;
  30. if(_x in (getweaponcargo _z))exitWith{deleteVehicle _z}count %1;
  31. if(_x in (getmagazinecargo _z))exitWith{deleteVehicle _z}count %2;
  32. }forEach nearestObjects [(getPosATL _this), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3];
  33. };
  34. }];
  35. ", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI];
  36.  
  37. /* AI run over by vehicle */
  38. if(SEM_punish_AIroadkill || SEM_reward_AIkill)then{
  39. _this addEventHandler ["killed", { private["_u","_k","_vk","_s"];
  40. _u = _this select 0;
  41. _k = _this select 1;
  42. _vk = vehicle _k;
  43.  
  44. if(SEM_damage_AIroadkill)then[{
  45. if(_vk isKindOf "Car")then{
  46. if(abs speed _vk > 0)then{
  47. if(_vk distance _u < 10)then{
  48. if(isEngineOn _vk || !isNull (driver _vk))then{
  49.  
  50. SEM_vehDamage = _vk;
  51. (owner _vk) publicVariableClient "SEM_vehDamage";
  52.  
  53. if(SEM_Krypto_AIroadkill > 0)then{
  54. {if(isPlayer _x)then{
  55. (owner _x) publicVariableClient "SEM_Krypto_AIroadkill";
  56. }}forEach (crew _vk);
  57. };
  58.  
  59. {deleteVehicle _x}forEach nearestObjects [(getPosATL _u), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3];
  60. _u call SEM_fnc_removeGear;
  61.  
  62. if({alive _x}count units group _u < 1)then{
  63. _u spawn{sleep 5; createMine ["APERSTripMine", (position _this),[],0]};
  64. };
  65.  
  66. }}}}else{
  67. if(SEM_reward_AIkill)then{
  68. SEM_Krypto_AIkill = ceil(skill _u * 10);
  69. (owner _vk) publicVariableClient "SEM_Krypto_AIkill";
  70. };
  71. };
  72. },{
  73. if(SEM_reward_AIkill)then{
  74. SEM_Krypto_AIkill = ceil(skill _u * 10);
  75. (owner _vk) publicVariableClient "SEM_Krypto_AIkill";
  76. };
  77. }];
  78. }];
  79. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement