Jump to content
Sign in to follow this  
M1ke_SK

Kick/eject all units from vehicle

Recommended Posts

Hi, I am struggling with ejecting all units from vehicle.
 
This is what I got:
_cargo = assignedCargo _vehicle;
_commander = assignedCommander _vehicle;
_driver = assignedDriver _vehicle;
_gunner = assignedGunner _vehicle;

_crew = _cargo + _commander + _driver + _gunner;

{
    _x action ["EJECT", _vehicle]; // _x action ["GETOUT", _vehicle];
} forEach _crew;

Also problem is, when there is no gunner, it gives me empty object to add to _crew array. I want to have units in _crew array to kick them out.

Share this post


Link to post
Share on other sites

try this script

_vehicle = _this param [0,objNull,[objNull]];
if (isNull _vehicle) exitWith {}; // does nothing

_crew = crew _vehicle;
if (count _crew <= 0) exitWith {}; // does nothing

{moveOut _x} forEach _crew;

call using this:

_nul = [someVehicle] execVM "ejectCrew.sqf"
  • Like 1

Share this post


Link to post
Share on other sites

Could try using the crew command?

_crew = crew _vehicle;

{
    _x action ["EJECT", _vehicle]; // _x action ["GETOUT", _vehicle];
} forEach _crew;

unassignVehicle prevents units from getting back into vehicle. Might helping if you're working with ai commanders.

 

 

- Ninja'd

Share this post


Link to post
Share on other sites
{
	unassignVehicle (_x);
	(_x) action ["EJECT", vehicle _x];
	sleep 0.4;
} foreach units (group name);

you have to unassign vehicle.  just add your group name of the units you want to jump at the end where i have "group name".

Share this post


Link to post
Share on other sites

 

Hi, I am struggling with ejecting all units from vehicle.
 
This is what I got:
_cargo = assignedCargo _vehicle;
_commander = assignedCommander _vehicle;
_driver = assignedDriver _vehicle;
_gunner = assignedGunner _vehicle;

_crew = _cargo + _commander + _driver + _gunner;

{
    _x action ["EJECT", _vehicle]; // _x action ["GETOUT", _vehicle];
} forEach _crew;

Also problem is, when there is no gunner, it gives me empty object to add to _crew array. I want to have units in _crew array to kick them out.

 

 

 

 

try this script

_vehicle = _this param [0,objNull,[objNull]];
if (isNull _vehicle) exitWith {}; // does nothing

_crew = crew _vehicle;
if (count _crew <= 0) exitWith {}; // does nothing

{moveOut _x} forEach _crew;

call using this:

_nul = [someVehicle] execVM "ejectCrew.sqf"

 

 

Could try using the crew command?

_crew = crew _vehicle;

{
    _x action ["EJECT", _vehicle]; // _x action ["GETOUT", _vehicle];
} forEach _crew;

unassignVehicle prevents units from getting back into vehicle. Might helping if you're working with ai commanders.

 

 

- Ninja'd

 

 

{
	unassignVehicle (_x);
	(_x) action ["EJECT", vehicle _x];
	sleep 0.4;
} foreach units (group name);

you have to unassign vehicle.  just add your group name of the units you want to jump at the end where i have "group name".

 

 

 

All that, can be condensed to: (just as bull_a has mentioned in his script)

{ moveOut _x } forEach crew _vehicle;

Share this post


Link to post
Share on other sites

 

All that, can be condensed to: (just as bull_a has mentioned in his script)

{ moveOut _x } forEach crew _vehicle;

 

yes but then the crew get back  in immediately.

 

Here is how i handle with:

_grp addVehicle _veh;
{_x moveInAny _veh} forEach units _grp;

------------------------


{ unassignVehicle _x } forEach crew _veh;

or

_grp leaveVehicle _veh;

Share this post


Link to post
Share on other sites

I'm having some headache related to this post with getting an AI in and out of a vehicle. Not sure if its a bug or what I'm doing wrong. 

 

Situation is the following: I have a hostage that is a member of players group and I order him (in game) into a vehicle and drive to a certain point and order him off. Then we walk into a trigger and the AI should leave my group, get assigned to another empty vehicle and get in as driver. So I try this in the trigger:

[soldier] join grpNull;
unassignVehicle soldier; //not sure if needed

soldier assignAsDriver truck;
[soldier] orderGetIn true;

What happens is soldier will leave my group but then he will just stand still and wont get into the truck. What would prevent him from getting in?

Worth noting is that if soldier wasn't  previously in a vehicle he will enter the truck without problems when we enter the trigger area.   

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×