; ; This is a part of the Group Link II script. ; ; /KeyCat ; ; ########### DEBUG ########### ;hint "DEBUG: Artillery" ; ############################# ; Set global variable false KEY_ArtilleryReady = false ; Randomize artillery availability if (random 100 < 30) then {goto "delay_until_next_try"} ; Init variable _friendly_close = false ; Check if any of the AI leaders in occupied is closer than 150 m to the targetspot, ; this to prevent they are calling in artillery on top of their own guys. "if ((leader _x) distance TargetSpot < 150) then {_friendly_close = true}" forEach KEY_occupied ; Exit if any friendly AI are to close if (_friendly_close) then {goto "delay_until_next_try"} ; Get position for the fire mission _pos = (getPos TargetSpot) ; Set height of explosions _hgt = 2 ; Set spread of explosions ;_acc = 60 _acc = 80 ; Set number of shells for fire _tofire = (random 8) + 8 ; Select ammo type ;_ammotype = "Shell120" ;_ammotype = "Heat120" ;_ammotype = "Heat125" _ammotype = "Shell125" ;_ammotype = "Grenade" ; ---------------------------------------------------------------------------- #artillery ; Randomly pause before firing starts ~random 20 + 10 goto "ranging" ; ---------------------------------------------------------------------------- #shellcount ; Check how many shells been fired if (_fired >= _tofire) then {goto "delay_until_ready"} goto "fireforeffect" ; ---------------------------------------------------------------------------- #ranging ; Clear variable _fired = 0 ; Pause random ~random 2 ; ---------------------------------------------------------------------------- #fireforeffect ; Pause random ~random 1 ; Create the object to explode at random place _tmp = _ammotype createVehicle [(_pos select 0) + (random (_acc*2)) - _acc, (_pos select 1) + (random (_acc*2)) -_acc, _hgt] ; Detonate object _tmp setDamage 1 ~1 _tmp setDamage 0.3 ; Delete object when done deleteVehicle _tmp ; Check how many shells being fired ? _fired >= _tofire : goto "firedelay" ; Increase variable _fired = _fired + 1 goto "shellcount" ; ---------------------------------------------------------------------------- #firedelay ; Pause random ~random 3 + 1 ; Increase variable _fired = _fired + 1 goto "shellcount" ; ---------------------------------------------------------------------------- #delay_until_next_try ; Delay until next request for artillery is possible ~30 + random 30 ; Set global variable True KEY_ArtilleryReady = true ; Exit script exit ; ---------------------------------------------------------------------------- #delay_until_ready ; Delay until artillery is available next time ~240 + random 240 ; Set global variable True KEY_ArtilleryReady = true ; Exit script exit ; ----------------------------------------------------------------------------