Jump to content
beako

How to use "CARGO" in createUnit function

Recommended Posts

HI All,

 

Based on createUnit using syntax type createUnit [position, group, init, skill, rank]

it states ""CARGO" - The unit will be created in cargo of the group's vehicle, regardless of the passed position. If group has no vehicle or there is no cargo space available, the unit will be placed according to "NONE"." Yet, I cannot create units inside a vehicle unless I use moveIn as below.

_posLand = screenToWorld [0.5,0.5];
_veh = "O_T_LSV_02_armed_F" createVehicle [0,0,100];					
_grp = createGroup EAST;			
_veh setVehiclePosition [_posLand, [], 0];		
_grp addVehicle _veh;
_unit = _grp createUnit ["O_V_Soldier_ghex_F", [0,0,0], [], 0, "CARGO"];
_unit moveInAny _veh; 

 

Is there a way to create units directly inside a vehicle with designating a position or moving them in?

Share this post


Link to post
Share on other sites

I guess it doesn't work because the vehicle doesn't have any crew? (So it doesn't belong to any group, at least not at start)

 

Share this post


Link to post
Share on other sites

I thought so also at first so I used BIS_fnc_spawnVehicle, then tried to add a unit in the spawned vehicle with:

 

_vehArray = [[0,0,100], getDir player, _x, _AIside] call BIS_fnc_spawnVehicle;
_veh = _vehArray select 0;
_vehCrew = _vehArray select 1;
_grp = _vehArray select 2;

_veh setVehiclePosition [_posLand, [], 0];		
_grp addVehicle _veh;
_unit = _grp createUnit ["O_V_Soldier_ghex_F", [0,0,0], [], 0, "CARGO"];
_unit moveInAny _veh; 

But this too does not create the unit in the "CARGO" of the vehicle.

Share this post


Link to post
Share on other sites

@beako,
Do you need this?

I remember having trouble if my unit wasn't assigned as cargo.

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

×