Can anyone give me a hand with this error.
_one = _ver2 select _n0
Error zero divisor
here is the script
_Firer = _this select 0
_rng = _this select 1
_rng2 = 5000
_var = []
_var2 = []
_tgts = _Firer NearTargets _rng
_ntgts = count _tgts
?(_ntgts == 0) : [_Firer] exec "findtgt.sqs" ; exit
_v = 0
_n0 = 0
_n1 = 1
_tgtvar = ["DSHKM","AGS","D30","BRDM2","UAZMG","UAZ_AGS30","BRDM2_ATGM","BMP2","ZSU","KA50","MI17_MG","SU34B","RHIB","RHIB2Turret"]
;~~~~~~~~~~~~ screen for selected target types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Screen
_nt = _tgts select _v
_type = _nt select 1
?(_type in _tgtvar) : _var = _var + [_nt select 4]
_v = _v + 1
?(_v > _ntgts) : _v = 0 ; _idcount = count _var ; goto "Distance"
goto "Screen"
;~~~~~~~~~~~~ get range to every target matching _tgtvar variable and put them in an array ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Distance
_Fpos = getpos _Firer
_varid = _var select _v
_dis = _Fpos distance getpos _varid
_var2 = _var2 + [_dis]
_v = _v + 1
?(_v == _idcount) : goto "Whoisclosest"
goto "Distance"
;~~~~~~~~~~~~ find out what ID is closest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Whoisclosest
_v2count = count _var2
_one = _var2 select _n0 <----------------THE PROBLEM IS HERE
?(_v2count > 1) : _two = _var2 select _n1
?(_v2count == 1) : _two = _rng
?(_one < _two) && (_one < _rng) : _rng = _one
?(_two < _one) && (_two < _rng) : _rng = _two
_n0 = _n0 + 1
_n1 = _n1 + 1
?(_n1 == _v2count) : _v = 0 ; goto "end"
goto "Whoisclosest"
;~~~~~~~~~~~~~~~~~~~~end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#end
~5
_Varid = _var select _v
_Fpos = getpos _Firer
_dis = _Fpos distance getpos _varid
? (_dis < _rng + 5)&&(_dis > _rng - 5) : [_firer,_varid] exec "tgt.sqs" ; exit
_v = _v + 1
?(_v == _idcount) : goto "Screen"
goto "end"
Now, the variable _n0 is equal to 0 so what's the problem? _var2 select 0 has to be there yeah?
EDIT : YES _VAR2 SELECT 0 WAS THERE, THE PROBLEM WAS THAT _N0 WENT ABOVE _IDCOUNT AND THAT IS WHAT WAS NOT PRESENT
LOOK AT MY NEXT POST FOR THE FIX.