; PRIKALD : [[9677,3874]] Exec "flare.sqs"
; [9677.81,3874.67] = Pozicia , kde sa ma vytvorit Svetlica ... OSA X,Y.

? FLARECutScena : Exit

_Pos = (_this Select 0)

_LokalFlareCREATE = False
_LokalFlarePOS = False
_ObjFlare = ObjNull
_ReObjFlare = ObjNull

_flarePosX = (_Pos Select 0)
_flarePosY = (_Pos Select 1)

_ObjFlare = "Flare" CreateVehicle [_flarePosX,_flarePosY,30]

~2

_Sounding = ["fx_Flare01","fx_Flare02","fx_Flare03"];
PlaySound (_Sounding Select Random Count _Sounding)

_Velocity = 25
_live = 0

#fix
_ObjFlare SetVelocity [3+Random 2,(Velocity _ObjFlare Select 1),_Velocity]
~0.01
_live = _live + (0.01 * (AccTime))

? (_Velocity > -7) : _Velocity = _Velocity - (0.20 * (AccTime))
? (_live >= 2.9) && (!_LokalFlareCREATE) : Goto "create"
? (_live >= 4.9) && (!_LokalFlarePOS) : Goto "pos"
? FLARECutScena : DeleteVehicle _ObjFlare,DeleteVehicle _ReObjFlare , Exit
If (_live < 5) Then {Goto "fix"} Else {Exit}

#create
_LokalFlareCREATE = True
_ReObjFlare = "FlareRed" CreateVehicle [(GetPos _ObjFlare Select 0),(GetPos _ObjFlare Select 1),(GetPos _ObjFlare Select 2)+100000]
Goto "fix"

#pos
_LokalFlarePOS = True
_Dir = Direction _ObjFlare
_ReObjFlare SetPos [(GetPos _ObjFlare Select 0),(GetPos _ObjFlare Select 1),(GetPos _ObjFlare Select 2)+30]
_ReObjFlare SetVelocity [(Velocity _ObjFlare Select 0),(Velocity _ObjFlare Select 1),(Velocity _ObjFlare Select 2)]
_ReObjFlare SetDir _Dir
DeleteVehicle _ObjFlare

#reFix
_ReObjFlare SetVelocity [2+Random 2,(Velocity _ReObjFlare Select 1),(Velocity _ReObjFlare Select 2)]
~0.01
? FLARECutScena : DeleteVehicle _ReObjFlare , Exit
?! (IsNull _ReObjFlare) : Goto "reFix"

Exit