Beerkan 71 Posted February 20, 2017 Hey guys, hope you can help. I'm trying to select just the passengers in a vehicle. _passengers = assignedcargo _heli; Unfortunately for some vehicles, this is not picking up all units assignedcargo. V44X I'm looking at you!! Therefore to get round this I've tried this. _crew = crew _heli; _passengers = []; {If (_x in _heli && alive _x) then {_passengers pushback _x};} foreach allunits;// This gets everyone incuding pilot/copilot gunner etc. _passengers = _passengers - _crew;//Now remove just the crew. Unfortunately however, in the above example the _passengers array ends up empty. It's the same if I were to use _crew = fullcrew _heli. It seems both crew and fullcrew select all occupants ie. crew passengers. Anyway, I'm sure there is a better way. For example I'm sure I can change the IF condition to select passengers but de-select the crew without trying to remove them from afterwards _passengers. Has anyone got any ideas for a better solution to get just the _passengers of a _heli? Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 20, 2017 fullCrew with cargo filter perhaps? Share this post Link to post Share on other sites
gc8 970 Posted February 20, 2017 4 minutes ago, killzone_kid said: allCrew with cargo filter perhaps? you mean fullCrew? cant find allCrew from the wiki Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 20, 2017 Already corrected, yes. Share this post Link to post Share on other sites
Beerkan 71 Posted February 20, 2017 See my original post. I have tried fullcrew, it selects the same units as crew, just with more info. In my testing I had use hints to show the content of _passengers _crew etc. I can't use cargo because this leaves some units behind. For example try assigning an infantry group as cargo to a VX44 and then eject them 3 units get left behind. i.e. _passengers = assignedcargo _heli; { unassignvehicle _x; moveout _x; } forEach _passengers; If _heli is a V44X units get left behind. In order for my script to be generic, I need to be able to select a random i.e. unknown number of units/groups within ANY vehicle but not also include the crew in the array. Any help appreciated. Share this post Link to post Share on other sites
gc8 970 Posted February 20, 2017 45 minutes ago, Beerkan said: See my original post. I have tried fullcrew, it selects the same units as crew, just with more info. In my testing I had use hints to show the content of _passengers _crew etc. I can't use cargo because this leaves some units behind. For example try assigning an infantry group as cargo to a VX44 and then eject them 3 units get left behind. i.e. _passengers = assignedcargo _heli; { unassignvehicle _x; moveout _x; } forEach _passengers; If _heli is a V44X units get left behind. In order for my script to be generic, I need to be able to select a random i.e. unknown number of units/groups within ANY vehicle but not also include the crew in the array. Any help appreciated. how did you place the units in cargo? with moveInCargo & assignAsCargo commands? Share this post Link to post Share on other sites
gc8 970 Posted February 20, 2017 This should work: _crew = crew vx; { _role = assignedVehicleRole _x; if(count _role > 0) then { if((_role select 0) == "Cargo") then { player sidechat format["Ejecting: %1", _x]; // debug... unassignvehicle _x; moveout _x; }; }; } foreach _crew; Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 20, 2017 1 hour ago, Beerkan said: See my original post. I have tried fullcrew, it selects the same units as crew, just with more info have you tried to use filter? It is not clear from your answer _passengers = fullCrew [_veh, "cargo"]; Share this post Link to post Share on other sites
Beerkan 71 Posted February 20, 2017 23 minutes ago, gc8 said: how did you place the units in cargo? with moveInCargo & assignAsCargo commands? Yes, I used assignAsCargo then moveInCargo. 10 minutes ago, gc8 said: This should work: _crew = crew vx; { _role = assignedVehicleRole _x; if(count _role > 0) then { if((_role select 0) == "Cargo") then { player sidechat format["Ejecting: %1", _x]; // debug... unassignvehicle _x; moveout _x; }; }; } foreach _crew; Will give it a shot. 2 minutes ago, killzone_kid said: have you tried to use filter? It is not clear from your answer _passengers = fullCrew [_veh, "cargo"]; Didn't try just "cargo", however I actually tried _passengers = fullCrew [_veh, ""] - fullCrew [_veh, "driver"] - fullCrew [_veh, "turret"] blah blah gunner, commander, etc etc ; Which didn't work. I'll give both your suggestions a shot. Share this post Link to post Share on other sites
gc8 970 Posted February 20, 2017 Did some testing and found at that the fullCrew with cargo filter doesnt work for the V44-X because the passenger seats are considered "turrets" (atleast some of them, my guess is the ones near the ramp). this is how I tested: _clist = fullCrew _helo; diag_log format["%1",_clist]; V44-X: prints: [[vxD,""driver"",-1,[],false], [testguy3,""cargo"",2,[],false], [B Alpha 1-2:2,""Turret"",-1,[0],false], [B Alpha 1-2:3,""Turret"",-1,[1],false], [B Alpha 1-2:4,""Turret"",-1,[2],false], [testguy1,""Turret"",0,[3],true], [testguy2,""Turret"",1,[4],true]]" CH67 (huron): prints: [hrD,""driver"",-1,[],false], [testguy1,""cargo"",0,[],false], [testguy2,""cargo"",1,[],false], [testguy3,""cargo"",2,[],false], [B Alpha 1-3:2,""Turret"",-1,[0],false]]" (testguys are all supposed to be in cargo) Edit: However the boolean value tells if the turret is a "personTurret" Share this post Link to post Share on other sites