bangabob 41 Posted September 2, 2013 I am writing a script which will spawn a vehicle and automatically spawn the driver,gunner and commander. However if the vehicle has no gunner position or commander position the unit will be spawned outside the vehicle. _unitType=_pool select (floor(random(count _pool))); _s1 = _grp createUnit [_unitType, _pos, [], 0, "FORM"]; _s1 moveindriver _veh; _s2 = _grp createUnit [_unitType, _pos, [], 0, "FORM"]; _unitType=_pool select (floor(random(count _pool))); _s2 moveingunner _veh; _unitType=_pool select (floor(random(count _pool))); _s3 = _grp createUnit [_unitType, _pos, [], 0, "FORM"]; _s3 moveincommander _veh; So what i need is a condition which will detect whether the commander position/gunner position exists. Thanks for reading Share this post Link to post Share on other sites
Foxy 1 Posted September 2, 2013 emptyPositions generally does the job http://community.bistudio.com/wiki/emptyPositions Share this post Link to post Share on other sites
5133p39 12 Posted September 2, 2013 Cant you just use createVehicleCrew ? Share this post Link to post Share on other sites
das attorney 857 Posted September 2, 2013 createVehicleCrew will spawn gunners in turret positions as well. (Really complex to work out turret positions by hand). Share this post Link to post Share on other sites
Foxy 1 Posted September 2, 2013 Nice one 5133p39. Not seen that command before. Certainly seems to do the job and is much simpler than counting the available positions. :) Share this post Link to post Share on other sites
bangabob 41 Posted September 2, 2013 emptyPositions generally does the jobhttp://community.bistudio.com/wiki/emptyPositions Thanks that was exactly what i was looking for. ---------- Post added at 15:01 ---------- Previous post was at 15:00 ---------- createVehicleCrew will spawn gunners in turret positions as well. (Really complex to work out turret positions by hand). Yes i didnt know that command. It may well be useful for another script Share this post Link to post Share on other sites
spunfin 34 Posted September 14, 2013 BIS_fnc_vehicleRoles returns array of roles & indexes, like: [["Driver",[]],["Turret",[0,1]],["Cargo",[0]]] Share this post Link to post Share on other sites
kylania 567 Posted September 14, 2013 Just use BIS_fnc_spawnVehicle Share this post Link to post Share on other sites