Jump to content

Sign in to follow this  
roguetrooper

Helicopter & crew created by script do not "unload"

Recommended Posts

This is one of those things that drive me insane and where I have not the faintest clue what kind of stupid bug this again is.

When I place a helicopter (not emtpy) in the editor on the map and place also a group of soldiers who are not grouped with the heli-crew, the "unload"-waypoint works fine. The copter flies to the waypoint, unloads the cargo-groups and flies away to its next wayoint. Everything works fine and as expected.

But when I use EXACTLY THE SAME waypoint-script for a helicopter and a transported crew (not grouped with pilots) that are created by script, the unload-waypoint suddenly does not work. The copter flies to the unload-waypoint but does NOT unload the cargo but moves to the next waypoint. That crap drives me crazy! :mad:

Share this post


Link to post
Share on other sites

Nothing works. None of unassign and all that related stuff. The copter does and does not land/hover and makes the combat group disembark. He just takes the unload-waypoint as a move-waypoint (which it is flying to) and moves on to waypoint two afterwards (yes, the cargo-group is created and placed in the cargo-space correctly).

The only variable in my attempts is a) everything placed on map b) everything created by script while the mission is running.

Both the copter placed on the map and the one created by script are waypointed by the script:

_grp addWaypoint [_landPos, 0];
_grp addWaypoint [_exitpos, 0];

[_grp,1] setWaypointType "TR UNLOAD"; (or UNLOAD)
[_grp,2] setWaypointType "MOVE";

Is there any known bug concerning waypoints and script-created units?

Btw, when I set the first waypoint to "getout", it works without problems... but that's not what I want. I want the copter to hover/land, release the cargo group and fly away.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites

Have you tried using copyWaypoints instead? I don't know for sure that will work, but it's worth a shot. Alternatively, have the chopper flyInHeight 0 at one waypoint so it lands, then have some condition like this, for example:

waituntil {sleep 0.1; (getPosATL chopperName select 2) < 1};

Then run a script to eject the crew, such as

{
unassignvehicle _x;
_x action ["EJECT", chopperName];
sleep 0.5;
} foreach units passengerGroup;

Share this post


Link to post
Share on other sites

This seems to work:

_start = getMarkerPos "mrk_start";
_end = getMarkerPos "mrk_end";
_land = getMarkerPos "mrk_land";
_transportGroup = ["BAF_Soldier_TL_W", "BAF_Soldier_MG_W", "BAF_Soldier_AMG_W", "BAF_Soldier_W"]; 

_grpP = createGroup west; 
grpT = createGroup west;
pilot = _grpP createUnit ["BAF_Pilot_W", [1,1,1], [], 100, "FORM"]; 
helo = createVehicle ["AW159_Lynx_BAF", _start, [], 10, "FLY"];
pilot assignAsDriver helo;
pilot moveInDriver helo;

sleep 1;
{_y = grpT createUnit[_x, position player, [], 10, "FORM"]; _y assignAsCargo helo; _y moveInCargo helo;} forEach _transportGroup;

_grpP addWaypoint [_land, 0];
_grpP addWaypoint [_land, 0];
_grpP addWaypoint [_end, 0];

[_grpP, 1] setWaypointType "MOVE";
[_grpP, 1] setWaypointStatements ["true", "helo land 'GET OUT'; {unassignVehicle _x} forEach units grpT; commandGetOut units grpT"];
[_grpP, 2] setWaypointType "TR UNLOAD";
[_grpP, 3] setWaypointType "MOVE";

grpT addWaypoint [_land, 0];
grpT addWaypoint [position player, 0];

[grpT, 1] setWaypointType "GETOUT";
[grpT, 2] setWaypointType "MOVE";

Share this post


Link to post
Share on other sites

Sorry to annoy everybody here and thanks for your replies so far. Even with Kylania's script there is not the faintest chance to make the chopper land/hover and to have the combatgroup disembark. I don't use any mods or something, just vanilla 1.6.

Everything works and is created properly: chopper, crew and cargo-group. Chopper moves to first waypoint but immediately to the second, even with

[_grpP, 1] setWaypointType "MOVE";
[color=#b22222][_grpP, 1] setWaypointStatements ["true", "helo land 'GET OUT'; {unassignVehicle _x} forEach units grpT; commandGetOut units grpT"];[/color]
[_grpP, 2] setWaypointType "TR UNLOAD";
[_grpP, 3] setWaypointType "MOVE";

and many other combinations with stuff related to waypoint-ing.

I don't know what's going on. I've been wasting several hours now just to make a script-created helo make its cargo-group disembark :(

Share this post


Link to post
Share on other sites

Try this function, i'm using it in my Advance & Secure coop mission:

 
BTC_type_pilots           = "Ins_Soldier_Pilot";
BTC_type_para  = ["Ins_Soldier_1","Ins_Soldier_2","Ins_Soldier_GL","Ins_Soldier_MG","Ins_Soldier_Medic","Ins_Soldier_AT","Ins_Soldier_Sab","Ins_Soldier_AR"];
BTC_type_heli_transport   = ["Mi24_P","Mi17_Ins"];
BTC_spawn_rinf_para = 
{
_side        = _this select 0;
_spawn_zones = _this select 1;//array
_veh_type    = _this select 2;
_land        = _this select 3;	
_dest        = _this select 4;
_zone_array  = _spawn_zones select (round (random ((count _spawn_zones) - 1)));
_zone = _zone_array;
switch (typeName _zone_array) do
{
	case "ARRAY" :{_zone = _zone_array;};
	case "STRING":{_zone = getMarkerPos _zone_array;};
	case "OBJECT":{_zone = position _zone_array;};
};
_group_p = createGroup _side;
_group_t = createGroup _side;
if (_veh_type == "") then {_veh_type = BTC_type_heli_transport select (round (random ((count BTC_type_heli_transport) - 1)));};
_heli = createVehicle [_veh_type, _zone, [], 0, "FLY"];
_gunner    = _heli emptyPositions "gunner";
_commander = _heli emptyPositions "commander";
_cargo     = (_heli emptyPositions "cargo") - 1;
BTC_type_pilots createUnit [_zone, _group_p, "this moveinDriver _heli;this assignAsDriver _heli;this flyInHeight 100;"];
if (_gunner > 0) then {BTC_type_pilots createUnit [_zone, _group_p, "this moveinGunner _heli;this assignAsGunner _heli;"];};
if (_commander > 0) then {BTC_type_pilots createUnit [_zone, _group_p, "this moveinCommander _heli;this assignAsCommander _heli;"];};
for "_i" from 0 to _cargo do
{
	_unit_type = BTC_type_para select (round (random ((count BTC_type_para) - 1)));
	_unit_type createUnit [_zone, _group_t, "this moveinCargo _heli;this assignAsCargo _heli;"];
};
if !(isClass(configFile >> "cfgPatches" >> "asr_ai_main")) then {{_x setSkill ["aimingAccuracy", BTC_AI_skill];} foreach units _group_t;};
if (_land == "RANDOM") then {_land_random = ["","LAND"] select (round (random ((count ["","LAND"]) - 1)));_land = _land_random;};
if (_land == "LAND") then
{
	_wp_land_1 = _group_p addWaypoint [_dest, 60];
	_wp_land_1 setWaypointType "MOVE";
	WaitUntil {isNull driver _heli || !Alive _heli || _heli distance _dest < 200};
	_heli land "GET OUT";
	WaitUntil {isNull driver _heli || !Alive _heli || getPos _heli select 2 < 4};
	{unassignVehicle _x} forEach units _group_t;commandGetOut units _group_t;
	_wp_land_3 = _group_p addWaypoint [_zone, 60];
	_wp_land_3 setWaypointType "MOVE";

	_wp_land = _group_t addWaypoint [_dest, 60];
	_wp_land setWaypointType "SAD";
	_wp_land setWaypointCombatMode "RED";
	_wp_land setWaypointBehaviour "SAFE";
	_wp_land setWaypointSpeed "FULL";
	_wp_land setWaypointFormation "WEDGE";
	WaitUntil {_heli distance _dest < 500};
}
else
{
	_wp = _group_p addWaypoint [_dest, 60];
	_wp setWaypointType "MOVE";
	_wp setWaypointCombatMode "RED";
	_wp = _group_p addWaypoint [_zone, 60];
	_wp setWaypointType "MOVE";
	_heli flyInHeight 100;
	WaitUntil {_heli distance _dest < 200};
	{
		if !(_x isKindOf BTC_type_pilots) then 
		{
			unassignvehicle _x;
			_x action ["EJECT", _heli];
			sleep 1;
		};
	} foreach units _group_t;
	_wp_land = _group_t addWaypoint [_dest, 60];
	_wp_land setWaypointType "SAD";
	_wp_land setWaypointCombatMode "RED";
	_wp_land setWaypointBehaviour "SAFE";
	_wp_land setWaypointSpeed "FULL";
	_wp_land setWaypointFormation "WEDGE";
};
WaitUntil {sleep 1; _heli distance _zone < 400 || !Alive _heli || isNull driver _heli};
{deleteVehicle _x;} foreach units _group_p;
deleteVehicle _heli;
};

Share this post


Link to post
Share on other sites

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

new_wp setWaypointStatements ["true", "hint 'hello'; hint 'goodbye'"];  // there is both on act and on de act fields seperated by a ;

this should work, have used it in my PR scripted waypoints.

[_grpP, 1] setWaypointStatements ["true", "helo land 'GET OUT'; {unassignVehicle _x; dogetout _x} forEach units grpT;" ""];

the original code ran from PR script:

  Reveal hidden contents

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  

×