Jump to content
Sign in to follow this  
dupa

CCIP Script for ArmA 3 is ready!

Recommended Posts

I decided to try my old CCIP script with ArmA 3. With the new physics engine and 3d icons it works like a charm. So here is the reworked version.

To use the script, just run it without any parameters from init.sqf or player init line (as in: 0 = [] execVM "ccip.sqf"). When you begin bombing, the script will do the job. Have fun!

ccip.sqf:

// CCIP script for ArmA 3 (by dupa)
// Usage: 0 = [] execVM "ccip.sqf";
// 
// For MP, run on clients only.

//If you want to use custom aircraft, add their bomb weapon classname
_bombLaunchers = ["GBU12BombLauncher"];

ccipEnabled = false;
ccipString = "";
ccipColor = [0,1,0,.5];
ccipIcon = getText (configfile >> "CfgWeaponIcons" >> "srifle");
ccipFontSize = 0.02 * SafeZoneW;

_targetElevation = 0;
_tgtMarker = "Land_HelipadEmpty_F" createVehicleLocal [0,0,0];


onEachFrame
{
 if ((ccipEnabled) and (cameraView == "Internal")) then
 {
   drawIcon3D [ccipIcon, ccipColor, ccipPos, 1, 1, 0, ccipString, 2, ccipFontSize];
 };
};


while {true} do
{
 if (currentWeapon vehicle player in _bombLaunchers) then
 {
   ccipEnabled = true;
   _plane = vehicle player;

   //Calculate impact time
   _g = 9.8;
   _v = velocity _plane;
   _vz0 = _v select 2; //Initial fall velocity

   //By solving the quadratic equation we will get the estimated freefall time
   _a = -0.5*_g;
   _b = _vz0;
   _c = ((getposASL _plane) select 2) - _targetElevation;
   _t = (-_b - sqrt (_b*_b - 4 *_a*_c))/(2*_a);

   _px = getpos _plane select 0;
   _py = getpos _plane select 1;

   _vx = _v select 0;
   _vy = _v select 1;

   //Calculate impact position
   ccipPos = [_px + (_vx*_t), _py + (_vy*_t)];

   _tgtMarker setpos ccipPos;
   _targetElevation = (getPosASL _tgtMarker) select 2;

   ccipString = format ["ELV:%1, TTI:%2", floor _targetElevation, floor _t];

    sleep .01;
 }
 else
 {
   ccipEnabled = false;
   sleep 1;
 };
};

Share this post


Link to post
Share on other sites

It's not very accurate. The GBU12s don't accelerate downwards at the 9.8 m/s^2 according to my tests.

Share this post


Link to post
Share on other sites

Thanks! Any chance for a client side addon version?

Share this post


Link to post
Share on other sites
It's not very accurate. The GBU12s don't accelerate downwards at the 9.8 m/s^2 according to my tests.

I never bothered to check this, but:

- You can still hit targets fairly accurately (I managed to destroy t100s with a single bomb)

- You may change the value of _g to whatever you like :)

---------- Post added at 09:08 PM ---------- Previous post was at 09:07 PM ----------

To the guys asking for an addon version: Sorry, I never worked with addons and I have no idea how to make them.

Edited by dupa
Typo

Share this post


Link to post
Share on other sites

^^ would be a good time to learn ;)

Or of course just ask the lovely community to help. I'm sure there are tons of folks out there that would know how.

Edited by Kremator

Share this post


Link to post
Share on other sites

Very nice script, especially from a technical aspect!

However I must say that I didn't manage to hit anything with it.

Is there anything special one has to do?

I tried to keep my plain as straight as possible and stuff like that, still no success :P

Share this post


Link to post
Share on other sites
Very nice script, especially from a technical aspect!

However I must say that I didn't manage to hit anything with it.

Is there anything special one has to do?

I tried to keep my plain as straight as possible and stuff like that, still no success :P

1. Try to bomb from above, in a dive.

2. Target the ground and not the objects you want to hit (if you want to destroy a building, aim at the basement and not at 5th floor).

3. Draw an imaginary line between the flight path marker and the CCIP crosshair. Keep it over your target. I would draw a real one, but I'm not sure how to do it.

4. It's a bit problematic with hills.

---------- Post added at 02:33 AM ---------- Previous post was at 02:22 AM ----------

^^ would be a good time to learn ;)

Or of course just ask the lovely community to help. I'm sure there are tons of folks out there that would know how.

I wasn't interested in making an it addon (or any addons in general), but since there is a lot of talking about it, I may give it a go. I'll sleep on it first.

Share this post


Link to post
Share on other sites

Cool mate..... I think it would be awesome as a mod, so that it was always enabled ! Lots of people would love you.

Share this post


Link to post
Share on other sites

Nice script, had some fun playing with it. I noticed dive bombing and slower speeds are best for accuracy.

One issue tho, sometimes the CCIP on screen display starts to flicker then it dissapears. Seems to be worse on some maps because in Takistan I could not get it to work for longer than 5 seconds but on Stratis it works 90% of the time, only on occasion will it flicker and go away.

Share this post


Link to post
Share on other sites

Hello, the script isn't working for me, I've created the ccip.sqf and then pasted the "0 = [] execVM "ccip.sqf";" either in the init.sqf or init field of the vehicle (JS F/A-18) but with no luck. I also added the weapon classnames for the hornets: _bombLaunchers = ["GBU12BombLauncher", "js_w_fa18_GBU12LGBLaucher", "js_w_fa18_GBU31BombLauncher", "js_w_fa18_GBU32BombLauncher", "js_w_fa18_GBU38BombLauncher"]; but with no luck. I'm really looking forward to make it work. Cheers

Share this post


Link to post
Share on other sites

Sorry for the late response. Try the version posted below. I haven't tested it, but i think it should compile ok. Here I replaced the onEachFrame command with call to BIS_fnc_addStackedEventHandler. It should solve some problems.

If it doesn't work, please say what happens when you run the script.

// CCIP script for ArmA 3 (by dupa)
// Usage: 0 = [] execVM "ccip.sqf";
//
// For MP, run on clients only.

//If you want to use custom aircraft, add their bomb weapon classname
_bombLaunchers = ["GBU12BombLauncher"];

ccipEnabled = false;
ccipString = "";
ccipColor = [0,1,0,.5];
ccipIcon = getText (configfile >> "CfgWeaponIcons" >> "srifle");
ccipFontSize = 0.02 * SafeZoneW;

_targetElevation = 0;
_tgtMarker = "Land_HelipadEmpty_F" createVehicleLocal [0,0,0];

["ccipHandler", "onEachFrame",
{
 if ((ccipEnabled) and (cameraView == "Internal")) then
 {
   drawIcon3D [ccipIcon, ccipColor, ccipPos, 1, 1, 0, ccipString, 2, ccipFontSize];
 };
}
] call BIS_fnc_addStackedEventHandler;

while {true} do
{
 if (currentWeapon vehicle player in _bombLaunchers) then
 {
   ccipEnabled = true;
   _plane = vehicle player;

   //Calculate impact time
   _g = 9.8;
   _v = velocity _plane;
   _vz0 = _v select 2; //Initial fall velocity

   //By solving the quadratic equation we will get the estimated freefall time
   _a = -0.5*_g;
   _b = _vz0;
   _c = ((getposASL _plane) select 2) - _targetElevation;
   _t = (-_b - sqrt (_b*_b - 4 *_a*_c))/(2*_a);

   _px = getpos _plane select 0;
   _py = getpos _plane select 1;

   _vx = _v select 0;
   _vy = _v select 1;

   //Calculate impact position
   ccipPos = [_px + (_vx*_t), _py + (_vy*_t)];

   _tgtMarker setpos ccipPos;
   _targetElevation = (getPosASL _tgtMarker) select 2;

   ccipString = format ["ELV:%1, TTI:%2", floor _targetElevation, floor _t];

    sleep .01;
 }
 else
 {
   ccipEnabled = false;
   sleep 1;
 };
};

Share this post


Link to post
Share on other sites

Just out of curiosity: Mght someone enlighten me what CCIP stands for?

Share this post


Link to post
Share on other sites
Just out of curiosity: Mght someone enlighten me what CCIP stands for?

Continuously computed impact point if I'm not mistaken.

Share this post


Link to post
Share on other sites

Ah, after quickly reading the matching wikipedia article this script makes sense to me. Thanks, Variable!

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  

×