Jump to content
Sign in to follow this  
Chaos

All units dismounting vehicle?

Recommended Posts

I have a problem. I will, that only the troop in cargo of the apc dismounts the vehicle but after i launch my script, all guys in the vehicle dismounts it - inclusive driver, gunner and commander.

_veh = vehicle player;

_troop1 = crew _veh - [gunner _veh] - [driver _veh] - [commander _veh];

~random 2
hintc format ["%1",_troop1];
{unassignvehicle _x} forEach _troop1; {_x leavevehicle _veh} forEach _troop1;

The hint format will list correctly only the infantry troop members without the apc crew.

:confused:

Share this post


Link to post
Share on other sites

I use the follwing statement and it works (I hope) :

_u = _this select 0;

{

_x action ["eject", vehicle _x];

sleep 0.2;

} forEach units group _u;

exit;

Share this post


Link to post
Share on other sites

Yes, i think its good idea, but i will know why its not works in my script.

Share this post


Link to post
Share on other sites
_veh = vehicle player;

_troop1 = crew _veh - gunner _veh - driver _veh - commander _veh;

~random 2

hintc format ["%1",_troop1];

{_x leavevehicle _veh} forEach _troop1;

exit;

Try this, not sure...

You don't need to unassign, cause, the command leaveVehicle do it.

From another side, leavevehicle seems to work with a group, not with an array. Try to split your group as follow : crew members, cargo members and get a try.

Edited by tom_48_97

Share this post


Link to post
Share on other sites

The commands "leavevehicle" without "unassignvehicle", makes no difference. Still will all units in vehicle dismount the apc. All members of infantry troop and all of the crew.

_veh = vehicle player;
_troop1 = crew _veh - [gunner _veh] - [driver _veh] - [commander _veh];
~random 2
hintc format ["%1",_troop1];
{_x leavevehicle _veh} forEach _troop1;

Share this post


Link to post
Share on other sites

{if(assignedVehicleRole _X == "CARGO")then{doGetOut _X}} forEach crew _veh;

Oddly, the comref says assignedVehicleRole returns an array (and doesn't mention what it contains), but that can't be right can it? Can someone clarify that for me?

Share this post


Link to post
Share on other sites

I think, the whole problem, is a new bug since patch 1.03

Edited by Chaos

Share this post


Link to post
Share on other sites
I think, it is a new bug since patch 1.03

Surely this isn't the case. Such a bug would be rather game-breaking... and quickly noticed.

Share this post


Link to post
Share on other sites

I can´t still find the bug.

Share this post


Link to post
Share on other sites

Ok, this is definitively an engine bug.

Infantry group, which is not in the same group as the apc crew members, dismounting the vehicle following by the vehicle crew.

_veh = apc1;
_troop1 = infantry1;

~random 2
{_x leavevehicle _veh} forEach units _troop1;

Makes no difference. So it must be a bug in 1.03.

Share this post


Link to post
Share on other sites
Ok, this is definitively an engine bug.

Infantry group, which is not in the same group as the apc crew members, dismounting the vehicle following by the vehicle crew.

_veh = apc1;
_troop1 = infantry1;

~random 2
{_x leavevehicle _veh} forEach units _troop1;

Makes no difference. So it must be a bug in 1.03.

Same happens to me. But can't you just use unassignvehicle instead of leavevehicle? Seems to me that if you use unassignvehicle, they get out and you won't need any more commands.

{if(assignedVehicleRole _X == "CARGO")then{doGetOut _X}} forEach crew _veh;

Oddly, the comref says assignedVehicleRole returns an array (and doesn't mention what it contains), but that can't be right can it? Can someone clarify that for me?

I've never used the comref, so I don't know about that but on the wiki it says this.

Don't forget that it returns an array, so first you got to select the part of the array that you want to compare. I've no idea whether it's somehow possible to compare arrays.

This should work. Keep in mind that with the dogetout command they get back into the vehicle after disembarking.

{if((assignedVehicleRole _X select 0) == "CARGO")then{doGetOut _X}} forEach crew apc1;

You probably might want to add another if in there that checks whether the array actually contains anything before you are trying to select something from it.

By the way, thanks for bringing this up. I was looking for such a command but couldn't find it!

Edited by BlackAlpha

Share this post


Link to post
Share on other sites

No bug. Merely not a too precise comref maybe ? ;)

This is how I do it and it still does fine since OF:

For dis/embarking I use

ArrayOfUnits [b]ordergetin[/b] false; // true;

disembarking this way always works great but isnt enough as they instantly GetIn back into their assigned vehicle as soon as a move command follows.

Therefore the vehicle must be unassigned, I always do it this way:

{[b]unassignvehicle [/b]_x}foreach ArrayOfUnits;

Naturally, before getting them back into a vehicle each unit must be reassigned to a specific role, f.e.:

(ArrayOfUnits select 0) assignasdriver vehicle1;
{_x assignascargo vehicle1}foreach (ArrayOfUnits -[ArrayOfUnits select 0]);

So back to the OP, using both commands (ordergetin, unassignvehicle) this way by substracting the driver, commander and gunner from the vehicle crew should indeed ALWAYS do the trick.

BUT be prepared for a new challenge in Arma2 though, lol:

The BMP3 has two additional gunners but these afaik are not assigned as gunners nor can i find a way to assign them as gunners.

Edited by Wiper

Share this post


Link to post
Share on other sites

Yes, it is a bug. I haven´t this problem with the same script with 1.02 version or in ARMA1. Hundret precently an engine bug.

Edited by Chaos

Share this post


Link to post
Share on other sites
Yes, it is a bug. I haven´t this problem with the same script with 1.02 version or in ARMA1. Hundret precently an engine bug.

works flawless, see <link removed> micro test mission, unless you use a BMP3 instead whose additional gunners seem to be undefined (glitch).

Edited by Wiper

Share this post


Link to post
Share on other sites

Syntax:
   group leaveVehicle vehicle 
Parameters:
   group: Object or Group

Example 1:
   soldierOne leaveVehicle jeepOne
Example 2:
   groupOne leaveVehicle jeepOne

Working with units AND with groups. I tested older, ARMA1 made, scripts and these are all working correctly. So it must be a bug.

Edited by Chaos

Share this post


Link to post
Share on other sites

correct, works with groups AND units.

at least for me AND in Arma2 v1.03 ;)

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  

×