; ****************************************************************
; Script file for Armed Assault
; Created by: [KH]BabyAlien
; ****************************************************************



; Example script call --> [theCar, howmany] exec "napalm.sqs"
; using too many howmanys (eg 500) might cause lag :D

;start script

_theObject = _this select 0
_howmany = _this select 1

;locate the first helepad to start bombing
_bombLoc =  GetPos _theObject
_bombLocX = _bombLoc select 0
_bombLocY = _bombLoc select 1
_bombLocZ = _bombLoc select 2

;locate the end position to start bombing
_bombfinish = GetPos bombend
_bombfinishX = _bombfinish select 0
_bombfinishY = _bombfinish select 1
_bombfinishZ = _bombfinish select 2

;find out the distances on both X & Y coordinates between start and finish
_shiftx = _bombfinishX - _bombLocX
_shifty = _bombfinishY - _bombLocY

;find out the distance in gap between each bomb dropping
_shiftx = _shiftx / _howmany
_shifty = _shifty / _howmany

;Creating the bombs, detonating them and moving along each gap counting down until
;less than 1 bomb remains (which should be 0) and then it exits (stops the bombing run)
#AGAIN
 "Bo_GBU12_LGB" createVehicle[_bombLocX, _bombLocY, _bombLocZ]
_theObject setdammage 1
_howmany = _howmany - 1
?(_howmany < 1): exit
~0.15
_bombLocX = _bombLocx + _shiftx
_bombLocY = _bombLocY + _shiftY
goto "AGAIN"