A big thankyou to THobson
I used your way of writing scripts to make another one which involved one group being split into two vehicles, and them not being able to move until both cars are full. It worked nearly first time!! Nice one mate. I think the original issue was definitely something not being happy with me just using the
xxxx units alphathroughout my scripts. Giving the units alpha an assigned value like _group for example works far better. here's my other script
_i = 0
_j = 4
_group = units alpha
"_x lockwp true" foreach units alpha
#groupa
_unit = _group select _i
? _unit == leader alpha : goto "drivera"
_unit assignascargo jeep1
_i = _i + 1
?(_i == 4) : goto "groupb"
goto "groupa"
#drivera
_unit assignasdriver jeep1
_i = _i + 1
goto "groupa"
#groupb
_unit = _group select _j
?(_j == 4) : goto "driverb"
_unit assignascargo jeep2
_j = _j + 1
?(_j > 6) : goto "close"
goto "groupb"
#driverb
_unit assignasdriver jeep2
_j = _j + 1
goto "groupb"
#close
_count1 = "_x in jeep1" count units alpha
_count2 = "_x in jeep2" count units alpha
?(_count1 + _count2) == 7 : goto "end"
goto "close"
#end
"_x lockwp false" foreach units alpha
exit