Well, that's a lil bit too much what you've done here.
Why do you put those guys each into it's seperate array?
Also, _aliveunit1 = [_aliveunit1] + [_unit1]
is some kind'a mismatch, as you say:
variable = [variable] + [unit]
Result would look like:
_aliveunit1 = [_aliveunit1,_unit1]
And that doesn't make sense
Then again it wouldn't work, as you cannot add anything to
something what you didn't have pre-defined.
_aliveunit1 = _unit1
would work, as it would be pre-defining (initialising) of the
variable: _aliveunit1
But: _aliveunit1 = [something] + [something_else] wouldn't
work, as _aliveunit1 is not assigned to be anything. Therefore
you cannot add something to another thing which doesn't
exist.
_aliveunit1 = []
would pre-define _aliveunit1 to be an empty array
Followed by: _aliveunit1 = [something] + [something_else]
would then work.
look:
[man1,man2,man3,man4,man5,man6] exec "scriptname.sqs"
already features an array.
Therefore in your script you could say:
_units_default = _this
would be equal to:
_units_default = [man1,man2,man3,man4,man5,man6]
The whole part where you are checking wether a unit
is alive or not could be shorten up to a one-liner:
For that you would also need to initialise another array, where
to put all the living guys into:
_units_array = []
"if (alive _x) then {_units_array = _units_array + [_x]}" foreach _units_default
Now the array: _units_array would consist of only the guys
who are alive.
Now have a look onto the next part, where you check wether
the guys are inside a vehicle, or if not, go back to the start
of the loop until all are inside:
This could aswell be done with only one single line:
@"vehicle _x == _x" count _units_array == 0
This line would sit and wait there, until the count result of the
alive guys not inside a vehicle returns 0.
And now it's time for the next line of your script:
convoyloaded = 1
Finished
:edit - and the whole script would then look like that:
_units_default = _this
_units_array = []
"if (alive _x) then {_units_array = _units_array + [_x]}" foreach _units_default
@"vehicle _x == _x" count _units_array == 0
convoyloaded = 1
exit
hope this helps
~S~ CD