Recently I have been working on an active countermeasure script. The issue I have run into is that I cannot find a straight forward way to 'intercept' the incoming projectile.
My current attempts and their results have been so far:
Attempt 1: Use ProtectionZone_Ep1 to detonate the RPG.
Result: Works. Protection Zone is visible to all but the server despite setting its alpha to 0.
Attempt 2: Spawn another projectile to 'intercept' the other,
Result: Didn't work.
Attempt 3: Delete the incoming projectile, spawn another projectile to explode to simulate the detonation of the first.
Result: Partially worked. Created explosion at ground level, despite the altitude of the incoming projectile.
Now, is there any way to 'detonate' any projectile via a script, is my main question. I would also like to get some help figuring out why the ProtectionZone_Ep1 object doesn't like to set its alpha for everyone (even when the script is run on all clients. (cba_fnc_globalExecute doesn't work either, might be an issue on their part)
Here is a download for a test mission containing my current version of the scripts and etc. I don't know how much of a working condition it is in at the moment. I believe it is currently in Attempt 3's method of dealing with the threat. The script is currently running a isServer check to reduce issues with spawning of multiple objects, etc.
Here is the code-blocks that does all the fancy stuff with the projectile:
In-Range Distance Check:
Tracking of Projectile's Distance:Code:{_rDistArray = _rDistArray + [((_x select 0) distance _unit)];} forEach vehArray; {if (_x <= _maxDetect) then {_rCheck = _rCheck + [1]} else {_rCheck = _rCheck + [0]};} forEach _rDistArray; { if (_rCheck select _x == 1) then { _defVeh = _defVeh + [vehArray select _x]; }; } forEach _vehCount; _run = true; /* (Ballistics Formula, not used currently) _prH = (getPosATL _projectile select 0); _gc = 9.8; _vel = .2777 * (speed _projectile); _theta = [(vectorDir _projectile select 0), (vectorDir _projectile select 1), (vectorDir _projectile select 2)] call CBA_fnc_vectElev; _dist = ((_vel * cos _theta) / _gc) * ( (_vel * sin _theta) + sqrt( ( (_vel * sin _theta) ^ 2 ) + (2 * _gc * _prH) )); _height = _prH + (_dist * tan _theta) - ((_gc * (_dist^2)) / (2 * ((_vel * cos _theta)^2))); hintC format ["Theta = %1 : D = %2 : H = %3", _theta,_dist, _height]; */
Code:{_projDist = _projDist + [[_projectile distance (_x select 0), _x]]} forEach _defVeh; { if ((_x select 0) <= 35) then { if ((((_x select 1) select 1) > 0) && alive _projectile) then { /* {_prZone = "ProtectionZone_Ep1" createVehicle [0,0,0]; _prZone setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"]; In dedicated, this appears to not work...? (Object still flashes in as a red cylinder) */ _prDir = getDir _projectile; _yC= 1.1 * (cos _prDir); _xC= 1.1 * (sin _prDir); _xF= _xC + (getpos _projectile select 0); _yF= _yC + (getpos _projectile select 1); /* _prZone setPosATL (getPosATL _projectile); _prZone setPos [_xF, _yF]; */ { if (isServer) then { _num = (((vehArray select _x) select 1) - 1); vehArray select _x set [1, _num]; publicVariable "vehArray"; }; } forEach ((_x select 1) select 2); } else {_run = false;}; }; } forEach _projDist; _timeNow = time;
The test mission requires ACE, CBA, and Fallujah to my knowledge. Sorry!
Download Link: http://www.mediafire.com/?d7dt4apotku3khj
HOME
Reply With Quote
