mando_airsupport_carpetcode: Code global var with code for carpet bombing, receives plane and target position as arguments.
Code variable example for carpet bombing using AV8B with 6 bombs, this might be setup directly into your init.sqf
// Carpet bombing custom code global variable for AV8B
mando_airsupport_carpetcode =
{
private["_plane", "_targetpos"];
_plane = _this select 0;
_targetpos = _this select 1;
// Wait until horizontal distance between plane and target position is < 2000m or until plane is destroyed
while {(([getPos _plane select 0, getPos _plane select 1, 0] distance _targetpos) > 2000) && (alive _plane)} do
{
Sleep 1;
};
// If the plane is alive, it drops 6 bombs in sequence.
if (alive _plane) then
{
for [{_i=0}, {_i<6}, {_i=_i+1}] do
{
// A bomb is dropped, index 0 is for LGBs in the AV8B, if you change the plane type, set here the correct weapon index for bombs
_plane action ["useWeapon",_plane,driver _plane, 0];
Sleep 0.4;
};
};
};
This variable applies for carpet bombing missions. The last parameter of "useWeapon" action is the weapon index of the plane type you want to use for carpet bombing. For example, 0 for the AV8B makes it to drop a single LGB. In the example above this is executed in a loop to drop the six bombs of the AV8B with an small delay of 0.4 secs between each bomb. The distance from target for the first bomb is set to 2000m, this applies to the combo of av8B + LGB, you may adjust it at will for your desired plane/bombs combo.