Last active
January 11, 2024 06:47
-
-
Save Drofseh/59d72b8e62c86031cb00f3d0da4fafb5 to your computer and use it in GitHub Desktop.
Random Arty Barrages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
supportFire_numberOfBatteries = 1; | |
supportFire_numberOfGunsPerBattery = 5; | |
supportFire_shotsPerBatteryPerBarrage = 10; | |
supportFire_timeBetweenBarrages = 30; | |
supportFire_shellsHE_Type = "Sh_155mm_AMOS"; | |
supportFire_shellDispersion = 100; | |
supportFire_randomPositions = [ | |
getMarkerPos "marker_randomArty_1", | |
getMarkerPos "marker_randomArty_2", | |
getMarkerPos "marker_randomArty_3", | |
getMarkerPos "marker_randomArty_4", | |
getMarkerPos "marker_randomArty_5" | |
]; | |
supportFire_randomBarrageCancel = false; | |
FNC_SupportFire_Barrage = { | |
params ["_supportFire_type","_supportFire_targetXY","_supportFire_targetName","_supportFire_layingDelay"]; | |
private _supportFire_targetX = _supportFire_targetXY select 0; | |
private _supportFire_targetY = _supportFire_targetXY select 1; | |
private _supportFire_timeToImpact = 0; | |
[ | |
{ | |
params ["_supportFire_type","_supportFire_targetX","_supportFire_targetY","_supportFire_targetName"]; | |
private _supportFire_bombType = supportFire_shellsHE_Type; | |
private _supportFire_shotDelay = (random [0.1, 0.2, 0.5]); | |
private _supportFire_rounds_fired = 0; | |
for "_i" from 1 to supportFire_shotsPerBatteryPerBarrage do { | |
[ | |
{ | |
params ["_supportFire_bombType","_supportFire_targetX","_supportFire_targetY"]; | |
private _supportFire_bomb = _supportFire_bombType createVehicle [_supportFire_targetX, _supportFire_targetY, 300]; | |
private _supportFire_bombPosition = _supportFire_bomb getPos [random supportFire_shellDispersion, random 360]; | |
private _supportFire_bombPositionX = (_supportFire_bombPosition select 0); | |
private _supportFire_bombPositionY = (_supportFire_bombPosition select 1); | |
_supportFire_bomb setPos [_supportFire_bombPositionX, _supportFire_bombPositionY, 300]; | |
_supportFire_bomb setVelocity [0, 0, -10]; | |
}, | |
[_supportFire_bombType, _supportFire_targetX, _supportFire_targetY], | |
_supportFire_shotDelay | |
] call CBA_fnc_waitAndExecute; | |
_supportFire_rounds_fired = _supportFire_rounds_fired + 1; | |
_supportFire_shotDelay = _supportFire_shotDelay + (random [0.1, 0.2, 0.5]); | |
if (_supportFire_rounds_fired >= supportFire_numberOfGunsPerBattery) then { | |
_supportFire_shotDelay = _supportFire_shotDelay + 3; | |
_supportFire_rounds_fired = 0; | |
}; | |
}; | |
}, | |
[_supportFire_type,_supportFire_targetX,_supportFire_targetY,_supportFire_targetName], | |
_supportFire_timeToImpact + _supportFire_layingDelay | |
] call CBA_fnc_waitAndExecute; | |
}; | |
FNC_Random_Barrage = { | |
if (supportFire_randomBarrageCancel) exitWith {}; | |
for "_i" from 1 to supportFire_numberOfBatteries do { | |
[ | |
{ | |
if (supportFire_randomBarrageCancel) exitWith {}; | |
private _position = selectRandom supportFire_randomPositions; | |
["HE", _position,"random position",1] call FNC_SupportFire_Barrage; | |
}, | |
[], | |
(random 5) | |
] call CBA_fnc_waitAndExecute; | |
}; | |
[ | |
{ | |
if (supportFire_randomBarrageCancel) exitWith {}; | |
[] call FNC_Random_Barrage; | |
}, | |
[], | |
supportFire_timeBetweenBarrages | |
] call CBA_fnc_waitAndExecute; | |
}; | |
if (isServer) then { | |
[] call FNC_Random_Barrage; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment