Jump to content
Sign in to follow this  
1para{god-father}

BIS_fnc_spawnVehicle and Groups

Recommended Posts

Sorry a little confused trying to spawn a truck , then fill it with troops then spawn SUV and add a Civilian call;ed VIP2 into the car then move them both to the Way point.

It spawns find but no men in cargo , and the VIP will not get into the SUV.

Then only the Truck moves to the Waypoint not both ?

Can anyone point me in the correct direction

Thanks


_side = EAST;
_pos = _RandomTownPosition1;
_grptank = creategroup EAST;
_tankSpawn = [[(_pos) select 0, (_pos select 1)-30,0], 180, "V3S_Open_TK_EP1", _grptank] call BIS_fnc_spawnVehicle;


_cargoNum =  _tankSpawn emptyPositions "cargo";
if (_cargoNum > 0) then {
_fillSlots = round (random _cargoNum);
_locGr =  _pos findEmptyPosition [10, 100];
sleep .2;
if (_locGr select 0 > 0)then {
_cargo = [_locGr, _side , _cargoNum,[],[],[],[],[_fillSlots,.5], _dir] call BIS_fnc_spawnGroup;
sleep .2;
{_x moveInCargo _tankSpawn;} forEach units _cargo;
};
};


_suvvip = [[(_pos) select 0, (_pos select 1)- 20, 0], 180, "SUV_TK_EP1", _grptank] call BIS_fnc_spawnVehicle;
sleep.2;

////move Civilian into Car he is pre placed called vip2
vip2 moveInCargo _suvvip;

////add waypoints to group
_wp1 = _grptank addWaypoint [_RandomTownPosition2, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";

Share this post


Link to post
Share on other sites

I believe you have to move the soldiers and VIP into the vehicle, which you could do like this:

_tankVeh = _tankSpawn select 0; //0: created vehicle (Object)

_cargoNum = _tankVeh emptyPositions "cargo";

...

{_x moveInCargo _tankVeh;} forEach units _cargo;

_suvVeh = _suvvip select 0; //0: created vehicle (Object)

...

vip2 moveInCargo _suvVeh;

Edited by panther42

Share this post


Link to post
Share on other sites

Use assignAsCargo before you use moveInCargo.....

So...

{_x assigAsCargo _tankspawn; _x moveInCargo _tankSpawn} forEach units _cargo;

and...

vip2 assignAsCargo _suvvip;
vip2 moveInCargo _suvvip;

Share this post


Link to post
Share on other sites

@ psvialli

_tankSpawn is an array not the vehicle created:

http://community.bistudio.com/wiki/BIS_fnc_spawnVehicle

Syntax:

[position,direction,type,side or group] call BIS_fnc_spawnVehicle

Parameters:

position - desired position (Array)

direction - desired azimuth/direction (Number)

type - type of the vehicle (String)

side or group - side or existing group (Side or Group)

Return Value:

Array - 0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group)

which is why you need to do something like this (what panther says above):

_veh1 = _tankSpawn select 0;
{_x moveInCargo _veh1;} forEach units _cargo;

Edited by PELHAM

Share this post


Link to post
Share on other sites

@Pelham... I missed that! :)

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  

×