141_Soap
-
Content Count
4 -
Joined
-
Last visited
-
Medals
Posts posted by 141_Soap
-
-
On 12/18/2018 at 7:09 AM, kirumy said:if(isServer)then{ FSG_fnc_addCram = { params["_cram","_range"]; _null = [_cram,_range]spawn{ private["_cram","_range","_incoming","_target","_targetTime"]; _cram = _this select 0; _range = _this select 1; while{alive _cram}do{ _incoming = _cram nearObjects["ShellBase",_range]; _incoming = _incoming + (_cram nearObjects["MissileBase",_range]); _incoming = _incoming + (_cram nearObjects["RocketBase",_range]); if(count _incoming > 0)then{ _target = _incoming select 0; _fromTarget = _target getDir _cram; _dirTarget = direction _target; if(_dirTarget < _fromTarget + 25 && _dirTarget > _fromTarget - 25 && ((getPos _target) select 2) > 20 && alive _target)then{ _targetTime = time + 5; while{alive _cram && alive _target && _targetTime > time}do{ _cram doWatch _target; if((_cram weaponDirection (currentWeapon _cram)) select 2 > 0.15)then{ _cram fireAtTarget[_target,(currentWeapon _cram)]; }; }; }; if(alive _target && alive _cram && _target distance _cram < FSG_CRAMDIS && _target distance _cram > 40 && (getPos _target) select 2 > 20)then{ _null = [_target,_cram]spawn{ private["_target","_cram","_expPos","_exp"]; _target = _this select 0; _cram = _this select 1; _expPos = getPos _target; deleteVehicle _target; sleep 1; _exp = "helicopterexplosmall" createVehicle _expPos; }; }; }; if(count _incoming == 0)then{ sleep 1; }; }; }; }; FSG_fnc_addSam = { params["_sam", "_range"]; _null = [_sam, _range]spawn{ private ["_sam","_range", "_incoming","_target","_interceptor"]; _sam = _this select 0; _range = _this select 1; _magazine = weaponState [_sam, [0]]; _ammo = getText (configFile >> "CfgMagazines" >> magazines _sam select 0 >> "ammo"); while {alive _sam}do{ _incoming = _sam nearObjects ["ShellBase", _range]; //advisable to comment this one out, unless you're roleplaying the IDF _incoming = _incoming + (_sam nearObjects["MissileBase", _range]); _incoming = _incoming + (_sam nearObjects["RocketBase", _range]); hint format ["%1 incoming projectiles", count _incoming]; if (count _incoming > 0) then{ _missile = selectRandom _incoming; _fromTarget = _missile getDir _sam; _dirTarget = direction _missile; _target = position _missile; _sam lookAt _target; sleep (random 4)+3; _engaged = _missile getVariable "engaged"; if(_dirTarget <_fromTarget + 60 &&_dirTarget >_fromTarget - 60 && alive _missile && isNil "_engaged") then { _missile setVariable ["engaged", 123,true]; [_sam, _magazine select 1] call BIS_fnc_fire; _interceptor = position _sam nearObjects [_ammo, 5] select 0; sleep 0.1; //moved to catch missile immediately. hint format ["%1 Launched!", _interceptor]; _failCount = 0; _boostTimer = time + 1.5; _boostAngle = _interceptor call BIS_fnc_getPitchBank select 0; //sleep 0.09; boost stage can now be used for guidance without breaking muh immersion while {alive _missile} do { _minDist = _missile distance _interceptor; drawIcon3D["", [1,0,0,1], ASLtoAGL getPosAsl _interceptor, 1,1,45,"Interceptor",1,0.05, "TahomaB"]; drawIcon3D["", [1,0,0,1], ASLtoAGL getPosAsl _missile, 1,1,45,"Target",1,0.05,"TahomaB"]; //_velocity = (velocityModelSpace _interceptor) vectorMultiply 1.00001; _velocity = (velocityModelSpace _interceptor) vectorMultiply 1.01; _velocityTrue = velocityModelSpace _interceptor; _dirHor = [_interceptor, _missile] call BIS_fnc_DirTo; _interceptor setDir _dirHor; _dirVer = acos ((_missile distance2D _interceptor) /(_missile distance _interceptor)); hint format ["Direction: %1, distance2d: %2, Distance3d: %3", _dirVer, _missile distance2D _interceptor, _missile distance _interceptor]; // idk?_dirVer = (_dirVer * -1); if (serverTime > _boostTimer) then { if (_boostAngle < 70) then {_boostAngle = _boostAngle+2.5}; [_interceptor, _boostAngle, 0] call BIS_fnc_setPitchBank; _interceptor setVelocityModelSpace _velocityTrue; } else { [_interceptor, _dirVer, 0] call BIS_fnc_setPitchBank; _interceptor setVelocityModelSpace _velocity; };//boosts up for 3 seconds. sleep 0.002; // adjust if laggy if (_minDist < _missile distance _interceptor) then { _failCount = _failCount + 1; } else {_failCount = 0}; if (_interceptor distance _missile < 60 or _failCount > 3) /* Cheat mode*/ then { "HelicopterExploBig" createVehicle (getPos _missile); deleteVehicle _missile; }; }; sleep 0.1; if (alive _interceptor) then { sleep 0.5; "HelicopterExploBig" createVehicle (getPos _interceptor); deleteVehicle _interceptor; }; }; }; if (count _incoming == 0) then { sleep 0.5; }; }; }; }; };
Hey @kirumy I'm very interested in outcome of this. One thing i don't know is where exactly do I put this? "Init" part in init.sqf or weapon's init field? And where to put the main part with FSG_fnc_addCram and FSG_fnc_addSam? -
On 12/18/2018 at 7:09 AM, kirumy said:
[Release] C-RAM Script
in ARMA 3 - MISSION EDITING & SCRIPTING
Posted
Hey,
I know this thread is a year old but just wanted to give a quick heads up.
The script seems somewhat working.
The incoming shells/missiles do explode in the air but the Preatiorians are not firing at them.
Maybe if you possibly read this, you can figure out what's going on.
Edit:
Nevermind... Arma was just doing it's own shit as always 😉