goto _this
titleText ["!!!  E R R O R  !!!  SCRIPT ENDS  !!!  E R R O R  !!!","Plain"]
exit


#SETUP
;*******************
ECP_lod_enable = false
setAccTime 1; 0 fadeMusic 0.5; 0 fadeSound 0.5

AllGroups = []
AllUnits = [E1,R1,W1,E2,R2,W2]
Markers = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19"]
MarkerCount = (count Markers)
UnitCount = (count AllUnits)

_rdm = (random UnitCount)
_rdm = _rdm - (_rdm mod 1)
MERCSCamUnit = (AllUnits select _rdm)

_modx = 50
? (random 1) < 0.5 : _modx = -50
_mody = 50
? (random 1) < 0.5 : _mody = -50
_rdm = (random UnitCount)
_rdm = _rdm - (_rdm mod 1)

MercsCamTarget = "HeliHEmpty" createVehicle getPos MERCSCamUnit
_HeightDummy = "HeliHEmpty" createVehicle getPos MERCSCamUnit

MercsMateCam = "Camera" camCreate [(getPos MERCSCamUnit select 0)+_modx, (getPos MERCSCamUnit select 1)+_mody, 50]
MercsMateCam cameraEffect ["Internal","Front"]
MercsMateCam camSetTarget MercsCamTarget
MercsMateCam camSetPos [(getPos MERCSCamUnit select 0)+_modx, (getPos MERCSCamUnit select 1)+_mody, 50]
MercsMateCam camSetFov 0.976
MercsMateCam camCommand "Inertia On"
MercsMateCam camCommit 0
@camCommitted MercsMateCam
~1
{_x exec "ai.sqs"} forEach AllUnits
~1
{MUSIC} exec "intro.sqs"


#CAM_LOOP
;*******************
MercsMateCam camCommit 0.4
_vhlTemp = vehicle MERCSCamUnit

_Divider = 100 - (speed _vhlTemp * 2)
? _Divider < 10 : _Divider = 10
_moX = (getPos MercsCamTarget select 0) + (((getPos _vhlTemp select 0) - (getPos MercsCamTarget select 0))/_Divider)
_moY = (getPos MercsCamTarget select 1) + (((getPos _vhlTemp select 1) - (getPos MercsCamTarget select 1))/_Divider)
_moZ = ((getPos MercsCamTarget select 2)-1.7) + (((getPos _vhlTemp select 2) - ((getPos MercsCamTarget select 2)-1.7))/_Divider)
_HeightDummy setPos [getPos _vhlTemp select 0,getPos _vhlTemp select 1,0]
_h2 = _vhlTemp distance _HeightDummy
_h1 = _h2 + 1.7
? vehicle MERCSCamUnit == MERCSCamUnit : _moZ = ((_h1)-1.7) + (((_h2) - ((_h1)-1.7))/_Divider)
MercsCamTarget setPos [_moX,_moY,_moZ  + 1.7]
MercsCamTarget setDir getDir _vhlTemp
MercsMateCam camSetRelPos [0, -2, 0.3] 
? alive MERCSCamUnit : goto "CAM_LOOP"
~3
MERCSCamUnit = (AllUnits select 0)
_modx = 50
? (random 1) < 0.5 : _modx = -50
_mody = 50
? (random 1) < 0.5 : _mody = -50
_distance = MERCSCamUnit distance _heightDummy
_dur = 10 + (_distance / 25)
MercsMateCam camSetPos [(getPos MERCSCamUnit select 0)+_modx, (getPos MERCSCamUnit select 1)+_mody, 50]
MercsMateCam camCommit _dur
@camCommitted MercsMateCam
~2
goto "CAM_LOOP"
;-------------------


#MUSIC
;*******************
~(random 5)
_skip = (random 1)
? _skip < 0.33 : goto "MUSIC_SKIP1"
? _skip < 0.66 : goto "MUSIC_SKIP2"
#MUSIC_LOOP
playMusic "Track4"
~152
#MUSIC_SKIP1
playMusic "Track7"
~180
#MUSIC_SKIP2
playMusic "Track8"
~134
goto "MUSIC_LOOP"
;-------------------
