Jump to content
Dani2033

[Fixed] Problem with multiple helicopter landing in a "small" area

Recommended Posts

*** Fixed ***

I changed this:  _wp1 = _heliGroup addWaypoint [_heliLz,0];

to this: _wp1 = _heliGroup addWaypoint [_heliLz,-1];

Totally missed it in the biki

***************

 

Hi, I'm new to scripting in Arma and I have been trying to create a script to spawn a helicopter, load it with other group and unload them in a position. The problem comes when their landing zones are close and they start to fight between each other for them, however I have tried to do it with the eden editor and if you attach each waypoint to each helipad they seem to respect it. I have tried to attach the waypoint to the helipad with waypointAttachObject but I don't get the same result. I have also read in the forum that the helicopter AI claims the lz when flying over them but even if I assign them routes without hovering other landing zones there is no change.

 

The code: (it's supposed to be executed in a dedicated server)

Spoiler

params [
	["_pSpawnPoint", 0], 
	["_pLzReinforcements", 0], 
	["_pHeli", "B_Heli_Transport_01_F"],
	["_grpPreset", "preset1"]
];

_heliReinforcement = {
	_groupSide = missionNamespace getVariable "EAG_AICONFIG_SIDE";
	_heliSpawn = getMarkerPos _pSpawnPoint vectorAdd [0,0,60];
	_heliLz = _pLzReinforcements;
	_curPreset = [_grpPreset] call eag_fnc_selectPreset;
	_group = [[0,0,0], _groupSide,_curPreset ,[],[],[],[],[],180] call BIS_fnc_spawnGroup;
	[_group] call eag_fnc_taskPlayer;
	_heli = [_heliSpawn, (random 360), _pHeli, _groupSide] call BIS_fnc_spawnVehicle;
	_heliVehicle = _heli#0;
	_heliGroup = _heli#2;
	_heliPilot = (units _heliGroup)#0;
	_totalCrewCount = [_pHeli, true] call BIS_fnc_crewCount;
	_crewCount = [_pHeli, false] call BIS_fnc_crewCount;
	_cargoCount = _totalCrewCount - _crewCount; 
	
	//Comportamineto del piloto
	_heliPilot setBehaviour "CARELESS";
	_heliPilot disableAI "AUTOCOMBAT";
	// _heliPilot disableAI "CHECKVISIBLE"; // Por comprobar si la IA sigue aterrizando sin ello
	_heliVehicle flyInHeight 20;
	
	{
		if (_forEachIndex < _cargoCount) then {
			_x assignAsCargo _heliVehicle;
			_x moveIncargo _heliVehicle;
		} else {
			deleteVehicle _x;
		}
	} forEach (units _group);

	_wp1 = _heliGroup addWaypoint [_heliLz,0];
	_wp1 setWaypointType "TR UNLOAD"; 
	_wp1 waypointAttachObject _heliLz;
	// _wp1 setWaypointType "TR UNLOAD";
	_wp2 = _heliGroup addWaypoint [_heliSpawn,25];
	_wp2 setWaypointType "MOVE";
	_wp2 setWaypointStatements ["true", "_vehicleToDelete = (vehicle this); {_vehicleToDelete deleteVehicleCrew _x} forEach crew _vehicleToDelete;
deleteVehicle _vehicleToDelete;"];
	
	True
};

//Comprobar si el HC está presente
HC1Present = if(isNil "HC4") then{False} else{True};

//Ejecutar spawn en HC si está presente
if(HC1Present && isMultiplayer) then{
	if(!isServer && !hasInterface) then{
		diag_log "HC: Creando IA en el HC";
		[] call _heliReinforcement;
	};
}

//Ejecutar en Servidor si no hay HC
else{
	if(isServer) then{
		diag_log "HC: Creando IA en el servidor";
		[] call _heliReinforcement;
	};
};

 


This is what happens when I execute the script:

5E8620776FAB1F5196F50FD86AED52B58CEFD06A

 

And here you can see how one of the helis didn't like his assigned lz

EE8E89BDA27D4BBFF9F1B530BA66A8F4A5429E2B

 

Here is the behaviour with the eden created waypoints:

3DDBE599AA150F3A2DFFC2F3A92636482BB976CA

 

FA627965786B8F03D1058DD2521E2869B095561B

 

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

×