Jump to content
Sign in to follow this  
cry me a river kids

Active Protection System Script

Recommended Posts

Hello all! I've taken the script shared by DayZ Medic in his CIWS video and heavily modified it to create a script that acts as an active protection system (APS). It can intercept rockets, missiles, and large calibre shells. The script file and the commentated code (separate file) are included in a dropbox folder. In order to use the script, copy the Trophy.sqf file into your mission folder. Then, after finding the class names of the vehicles you want to have the APS, copy and paste the following into an init.sqf file:

call compile preprocessFileLineNumbers "Trophy.sqf";
if(isServer)then{
{
    if (_x isKindOf "classname") then{
        [_x,15]call addToTrophy;
    };
} forEach vehicles;
};

Note that this applies to every vehicle of that type, and doesn't differentiate between which faction controls it or even if it is manned. I have not tested it in a very large, complicated scenario, but do expect performance drops if you have a lot of the vehicle type you intend on giving it the APS. Additionally, it spawns an explosion when it destroys an incoming projectile, so it is a hazard to nearby infantry (true to real life), although the infantry was probably at risk anyway if they're standing next to a vehicle about to be hit by an RPG. As noted in the commentated code (readme_2.txt), the performance of the APS is dependent upon the range declared in the init.sqf (I have it as 15 meters by default), and the interval time between checks. The greater the distance and the shorter the interval time, the fewer projectiles will get through, and the faster the projectile can be and still get intercepted. With the default settings, it will reliably stop most missiles and rockets, and a projectile from a recoilless rifle (SPG-9 from the RHS mod). You can adjust these parameters to be able to stop tank rounds, but this will increase the CPU usage to run this script. Also, there is a delay between intercepting a projectile if a salvo is engaged at the same time. Thus, the best way to defeat a vehicle with the APS is to coordinate multiple launchers to shoot simultaneously, and to use the fastest projectiles available. 

Share this post


Link to post
Share on other sites
On 8/31/2021 at 4:42 PM, cry me a river kids said:

Hello all! I've taken the script shared by DayZ Medic in his CIWS video and heavily modified it to create a script that acts as an active protection system (APS). It can intercept rockets, missiles, and large calibre shells. The script file and the commentated code (separate file) are included in a dropbox folder. In order to use the script, copy the Trophy.sqf file into your mission folder. Then, after finding the class names of the vehicles you want to have the APS, copy and paste the following into an init.sqf file:


call compile preprocessFileLineNumbers "Trophy.sqf";
if(isServer)then{
{
    if (_x isKindOf "classname") then{
        [_x,15]call addToTrophy;
    };
} forEach vehicles;
};

Note that this applies to every vehicle of that type, and doesn't differentiate between which faction controls it or even if it is manned. I have not tested it in a very large, complicated scenario, but do expect performance drops if you have a lot of the vehicle type you intend on giving it the APS. Additionally, it spawns an explosion when it destroys an incoming projectile, so it is a hazard to nearby infantry (true to real life), although the infantry was probably at risk anyway if they're standing next to a vehicle about to be hit by an RPG. As noted in the commentated code (readme_2.txt), the performance of the APS is dependent upon the range declared in the init.sqf (I have it as 15 meters by default), and the interval time between checks. The greater the distance and the shorter the interval time, the fewer projectiles will get through, and the faster the projectile can be and still get intercepted. With the default settings, it will reliably stop most missiles and rockets, and a projectile from a recoilless rifle (SPG-9 from the RHS mod). You can adjust these parameters to be able to stop tank rounds, but this will increase the CPU usage to run this script. Also, there is a delay between intercepting a projectile if a salvo is engaged at the same time. Thus, the best way to defeat a vehicle with the APS is to coordinate multiple launchers to shoot simultaneously, and to use the fastest projectiles available. 

 

Hi River, thanks for posting this however it doesn't seem to work in multiplayer. I added a chat notification to ensure it's loading correctly which it is, however when I changed spawn explosion to spawn sniper (silly way to test) it's not spawning anything when a rocket/missile comes in. I tried to get creative on seeing if the script was being triggered and after some playing around I figured out it's not.

Share this post


Link to post
Share on other sites
On 1/29/2022 at 3:11 PM, GamerDad said:

 

Hi River, thanks for posting this however it doesn't seem to work in multiplayer. I added a chat notification to ensure it's loading correctly which it is, however when I changed spawn explosion to spawn sniper (silly way to test) it's not spawning anything when a rocket/missile comes in. I tried to get creative on seeing if the script was being triggered and after some playing around I figured out it's not.

That's strange. Does it work in singleplayer? I've never scripted for multiplayer before but if it works in singleplayer then there should be a way to port this to multiplayer. It probably has to do with the isServer thing.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×