lawman_actual 24 Posted July 26, 2015 I have a group moving to a waypoint, at which point they leave the vehicle and are assigned a move command to their next objective. I had to write a script to re-define the handle for the vehicle and units because it is part of a procedural script where these handles are reused for multiple deployments. w_unload = hemttcrew addWaypoint [_startdeploy, 1]; w_unload setWaypointType "MOVE"; hemttcrew setCurrentWaypoint w_unload; if (chosenside == 0) then { potentialunits = potentialunits + units _newgroup; } else {}; w_unload setWaypointStatements ["true", " _myvehicle = (vehicle this); _myvehicle lock false; _incargo = +units(group (assignedGunner _myvehicle)); alphagroup = group (assignedDriver _myvehicle); player sideChat (format['%1',_incargo]); _aunit = +_incargo call BIS_fnc_selectRandom; { doGetOut _x} foreach _incargo; {_x leaveVehicle _myvehicle} foreach _incargo; _endof = count assignmentus; for '_a' from 0 to _endof do { _ismine = (assignmentop select _a) find _aunit; if (_ismine > -1) then {_number = _a; objnumb = +_number;_a = _endof;} else {}; }; _thisobj = markerlist select objnumb; objpos = getMarkerPos _thisobj; if (player in _incargo) then {_thisobj setMarkerAlpha 1;} else {}; alphaobj = alphagroup addWaypoint [objpos, 25]; alphaobj setWaypointType 'SAD'; alphaobj setWaypointCombatMode 'RED'; alphagroup setCurrentWaypoint alphaobj;"]; The script works fine, the units reach their objective, leave the vehicle and go to the correct objective. But I keep getting a little message flash up saying there is an error with the BIS_fnc_selectRandom because the array has no values. I got the player to sideChat the value for _incargo to ensure it was properly determining who was 'in cargo' (which in this case is anyone in the vehicle, as everyone needs to get out). It worked fine, calling out 4 units. But oddly, it then called out an empty array as well. The script seems to be called twice, and the second time the array for _incargo is empty, which would explain why the BIS_fnc_selectRandom was playing up. After some tests, it seems that using _myvehicle to determine who's _incargo works fine as long as the unit is still in the vehicle. After the units leave the vehicle _myvehicle changes to the actual vehicle, which could be messing things up. It's almost as if the way point is being completed twice, one time when the units are still in the vehicle and once when they exit. I was hoping someone could shed a little more light on this. Share this post Link to post Share on other sites