Jump to content
Sign in to follow this  
rambler

Spawned Group Not Disembarking from Spawned Vehicle

Recommended Posts

I've been racking my brain out over this for days, and decided to post here for some help. I've tried several solutions I found by searching for similar problems, but none worked. The short of it is I have a trigger that fires once a town has been sufficiently cleared of enemies. When it fires, it calls a script that spawns a T-80 (I'm using RHS), a BMP-1 and a group of soldiers that are cargoed in the BMP for a counterattack. This all seems to work fine. The problem I have is that when the BMP reaches the specified waypoint to unload the troops, the troops refuse to get out no matter what I try. Below is the code I've been using (I removed the T-80 for brevity since that works):

if (!isServer) exitWith {};

_rucrew2 = creategroup EAST;
_bmp1 = [getmarkerpos "russpawn1", 003, "rhs_bmp1d_msv", _rucrew2] call bis_fnc_spawnvehicle;

_wp1a = _rucrew2 addwaypoint [(getmarkerpos "ruswp1"), 0];
_wp1a setwaypointtype "MOVE";
_wp1a setwaypointspeed "NORMAL";
_wp1a setwaypointbehaviour "SAFE";

_wp2a = _rucrew2 addwaypoint [(getmarkerpos "ruswp2"), 0];
_wp2a setwaypointtype "MOVE";
_wp2a setwaypointspeed "NORMAL";
_wp2a setwaypointbehaviour "AWARE";
_wp2a setwaypointstatements ["true", "0 = [] spawn {{unassignVehicle _x ; _x action ["Eject",  _bmp1]; sleep 1;} forEach (assignedCargo _bmp1);}"];

_wp3a = _rucrew2 addwaypoint [(getmarkerpos "ruswp4"), 0];
_wp3a setwaypointtype "SAD";
_wp3a setwaypointspeed "NORMAL";
_wp3a setwaypointcompletionradius 75;
_wp3a setwaypointbehaviour "COMBAT";

_rusquad1 = [getmarkerpos "russpawn1", EAST, ["rhs_msv_sergeant","rhs_msv_machinegunner","rhs_msv_rifleman","rhs_msv_grenadier","rhs_msv_medic","rhs_msv_LAT","rhs_msv_machinegunner_assistant",],[],[],[.7],[],[],003] call bis_fnc_spawngroup;

_wp1b = _rusquad1 addwaypoint [(getmarkerpos "ruswp4"), 0];
_wp1b setwaypointtype "SAD";
_wp1b setwaypointcompletionradius 100;
_wp1b setwaypointbehaviour "COMBAT";

sleep .5;
{_x assignascargo _bmp1; _x moveincargo _bmp1;} foreach units _rusquad1;

I've also tried this to no avail:

if (!isServer) exitWith {};

_rucrew2 = creategroup EAST;
_bmp1 = [getmarkerpos "russpawn1", 003, "rhs_bmp1d_msv", _rucrew2] call bis_fnc_spawnvehicle;

_wp1a = _rucrew2 addwaypoint [getmarkerpos "ruswp1", 0];
[_rucrew2,0] setwaypointtype "MOVE";
[_rucrew2,0] setwaypointspeed "NORMAL";
[_rucrew2,0] setwaypointbehaviour "SAFE";

_wp2a = _rucrew2 addwaypoint [getmarkerpos "ruswp2", 1];
[_rucrew2,1] setwaypointtype "TR UNLOAD";
[_rucrew2,1] setwaypointspeed "NORMAL";
[_rucrew2,1] setwaypointbehaviour "AWARE";

_wp3a = _rucrew2 addwaypoint [getmarkerpos "ruswp4", 2];
[_rucrew2,2] setwaypointtype "SAD";
[_rucrew2,2] setwaypointspeed "NORMAL";
[_rucrew2,2] setwaypointbehaviour "COMBAT";

_rusquad1 = [getmarkerpos "russpawn1", EAST, ["rhs_msv_sergeant","rhs_msv_machinegunner","rhs_msv_rifleman","rhs_msv_grenadier","rhs_msv_medic","rhs_msv_LAT","rhs_msv_machinegunner_assistant",],[],[],[.7],[],[],003] call bis_fnc_spawngroup;

_wp1b = _rusquad1 addwaypoint [getmarkerpos "rusgo", 0];
[_rusquad1,0] setwaypointtype "GETOUT";
[_rusquad1,0] setwaypointbehaviour "AWARE";
[_rucrew2,1] synchronizewaypoint [[_rusquad1,0]];

_wp2b = _rusquad1 addwaypoint [getmarkerpos "ruswp4", 1];
[_rusquad1,1] setwaypointtype "SAD";
[_rusquad1,1] setwaypointbehaviour "COMBAT";

sleep .5;
{_x moveincargo _bmp1;} foreach units _rusquad1;

Any help would be appreciated. Thanks.

Share this post


Link to post
Share on other sites

I had to change the type of units as I didn't have the ones your using.

You may want to enable showscripting errors in launcher or read this http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter!

if (!isServer) exitWith {};

_rucrew2 = creategroup EAST;
_bmp1grp = [getmarkerpos "russpawn1", 003, "O_Truck_02_transport_F", _rucrew2] call bis_fnc_spawnvehicle;
_bmp1 = _bmp1grp select 0;// extract vehicle from the _bmp1grp array.

_wp1a = _rucrew2 addwaypoint [(getmarkerpos "ruswp1"), 20];
_wp1a setwaypointtype "MOVE";
_wp1a setwaypointspeed "NORMAL";
_wp1a setwaypointbehaviour "SAFE";

_wp2a = _rucrew2 addwaypoint [(getmarkerpos "ruswp2"), 20];
_wp2a setwaypointtype "MOVE";
_wp2a setwaypointspeed "NORMAL";
_wp2a setwaypointbehaviour "AWARE";
_wp2a setwaypointstatements ["true", "0 = vehicle this spawn {{unassignVehicle _x ; _x action ['Eject', vehicle _this]; sleep 1;} forEach (assignedCargo _this);}"];// you can't use local variables
_wp3a = _rucrew2 addwaypoint [(getmarkerpos "ruswp4"), 20];
_wp3a setwaypointtype "SAD";
_wp3a setwaypointspeed "NORMAL";
_wp3a setwaypointcompletionradius 75;
_wp3a setwaypointbehaviour "COMBAT";

_rusquad1 = [getmarkerpos "russpawn1", EAST, ["O_Soldier_AR_F","O_Soldier_AR_F","O_Soldier_AR_F","O_Soldier_AR_F","O_Soldier_AR_F","O_Soldier_AR_F","O_Soldier_AR_F"],[],[],[],[],[],0.1] call bis_fnc_spawngroup;// yours gave an error

_wp1b = _rusquad1 addwaypoint [(getmarkerpos "ruswp4"), 10];
_wp1b setwaypointtype "SAD";
_wp1b setwaypointcompletionradius 100;
_wp1b setwaypointbehaviour "COMBAT";

sleep .5;
{_x assignascargo _bmp1; _x moveincargo  _bmp1;} foreach units _rusquad1;

Share this post


Link to post
Share on other sites

Thanks F2k Sel! Your fixed script worked perfectly. The comments were helpful in understanding where I went wrong too. I'll also add that showscripting errors parameter as it should make life a little easier when hunting down these problems. Thanks again.

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  

×