Guest User

Untitled

a guest
Jul 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. //TROPHY Active Countermeasure Script
  2. //Script by Blackpython of TacticalGamer.com
  3. //Currently supports one vehicle.
  4.  
  5. private ["_unit","_weapon","_ammo","_vehArray","_wepArray","_ammoArray","_maxDetect","_rDistArray","_rCheck","_projectile","_vehCount","_defVeh","_projDist","_run","_prZone"];
  6. //Event handler
  7. //{nul= _x addEventHandler ["fired", {nul=_this execVM "TROPHY.sqf";}]} forEach allUnits;
  8. //End Event Handler
  9. private ["_unit","_weapon","_ammo","_vehArray"];
  10. _unit = _this select 0; //Unit who fired weapon
  11. _weapon = _this select 1;
  12. _ammo = _this select 4;
  13. _projectile = nearestObject [_unit, _ammo];
  14. _vehArray = [hmmwv]; //Vehicle you wish to be defended by TROPHY
  15. _vehCount = [0]; //Number of vehicles, starting as 0 for 1 vehicle. Exp: 3 vehicles _vehCount = [0,1,2];
  16. _wepArray = ["RPG7V"]; //Weapons to be detected.
  17. _ammoArray = ["R_PG7V_AT", "R_PG7VL_AT", "ACE_R_PG7VM_AT", "R_PG7VR_AT", "R_PG9_AT", "ACE_Rocket_PG29", "ACE_R_TBG7V_AT", "ACE_Rocket_TBG29"]; // Ammunition you want to be intercepted.
  18. _maxDetect = 300;
  19. _rCheck = [];
  20. _rDistArray = [];
  21.  
  22. if (_weapon in _wepArray && _ammo in _ammoArray) then
  23. {
  24. {
  25. _rDistArray = _rDistArray + [(_x distance _unit)];
  26. } forEach _vehArray;
  27. {
  28. if (_x <= _maxDetect) then {_rCheck = _rCheck + [1]} else {_rCheck = _rCheck + [0]};
  29. } forEach _rDistArray;
  30. _defVeh = [];
  31. {
  32. if (_rCheck select _x == 1) then
  33. {
  34. _defVeh = _defVeh + [_vehArray select _x];
  35. }
  36. } forEach [0];
  37. _run = true;
  38. while {_run} do
  39. {
  40. _projDist = [];
  41. {_projDist = _projDist + [(_projectile distance _x)]} forEach _defVeh;
  42. {
  43. if (_x <= 20) then
  44. {
  45. _prZone = "ProtectionZone_Ep1" createVehicle [0,0,0];
  46. _prZone setPos (getpos HMMWV);
  47. sleep 0.01;
  48. deleteVehicle _prZone;
  49. }
  50. } forEach _projDist;
  51. if (!alive _projectile) then {_run = false;};
  52. };
  53. };
Add Comment
Please, Sign In to add comment