OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bedges on 12 Jun 2005, 16:48:55

Title: zero divisor...
Post by: bedges on 12 Jun 2005, 16:48:55
m'kay, i have put together a paradrop script. here it is...

Code: [Select]
_grplead = _this select 0
_chopper = _this select 1
_grp = group _grplead
_grpnum = count units _grp
_i = 0

#loop

_who = units _grp select _i
_who action ["eject",_chopper]
~1

_i = _i + 1
?_i>_grpnum:goto "all_out"

goto "loop"

#all_out

{unassignvehicle _x} foreach units _grp

exit

sometimes, (and only sometimes) the following error appears -

Quote
_who = units _grp select _i - error zero divisor

i have 4 other choppers which call this script, but as all the variables are local, that shouldn't be the problem, should it?
Title: Re:zero divisor...
Post by: THobson on 12 Jun 2005, 17:01:48
Correct, using this script multiple times will not cause a problem.

It looks like _grp is empty.  Could there be a case where
_this select 0 is not valid.  That  might happen if you have mistyped the name of the unit when the script is called.
Title: Re:zero divisor...
Post by: bedges on 12 Jun 2005, 17:13:21
hmmm... sometimes the lead loon is killed on exiting the chopper... i shall investigate further...

cheers

edit - yep, that's the problem - the new question is why the lead loon gets killed...