Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TROPHY Active Countermeasure Script
- //Script by Blackpython of TacticalGamer.com
- //Currently supports one vehicle.
- private ["_unit","_weapon","_ammo","_vehArray","_wepArray","_ammoArray","_maxDetect","_rDistArray","_rCheck","_projectile","_vehCount","_defVeh","_projDist","_run","_prZone"];
- //Event handler
- //{nul= _x addEventHandler ["fired", {nul=_this execVM "TROPHY.sqf";}]} forEach allUnits;
- //End Event Handler
- private ["_unit","_weapon","_ammo","_vehArray"];
- _unit = _this select 0; //Unit who fired weapon
- _weapon = _this select 1;
- _ammo = _this select 4;
- _projectile = nearestObject [_unit, _ammo];
- _vehArray = [hmmwv]; //Vehicle you wish to be defended by TROPHY
- _vehCount = [0]; //Number of vehicles, starting as 0 for 1 vehicle. Exp: 3 vehicles _vehCount = [0,1,2];
- _wepArray = ["RPG7V"]; //Weapons to be detected.
- _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.
- _maxDetect = 300;
- _rCheck = [];
- _rDistArray = [];
- if (_weapon in _wepArray && _ammo in _ammoArray) then
- {
- {
- _rDistArray = _rDistArray + [(_x distance _unit)];
- } forEach _vehArray;
- {
- if (_x <= _maxDetect) then {_rCheck = _rCheck + [1]} else {_rCheck = _rCheck + [0]};
- } forEach _rDistArray;
- _defVeh = [];
- {
- if (_rCheck select _x == 1) then
- {
- _defVeh = _defVeh + [_vehArray select _x];
- }
- } forEach [0];
- _run = true;
- while {_run} do
- {
- _projDist = [];
- {_projDist = _projDist + [(_projectile distance _x)]} forEach _defVeh;
- {
- if (_x <= 20) then
- {
- _prZone = "ProtectionZone_Ep1" createVehicle [0,0,0];
- _prZone setPos (getpos HMMWV);
- sleep 0.01;
- deleteVehicle _prZone;
- }
- } forEach _projDist;
- if (!alive _projectile) then {_run = false;};
- };
- };
Add Comment
Please, Sign In to add comment