Jump to content

Recommended Posts

HI All,

 

I cannot get the AI to move to the top level waypoints of a tower.

 

The AI seems to stay on the ground level.

 

How can I get the AI to move to each building position on the top floor? for example:

 

player addAction ["<t color='#f44298' size='1' > BUILDING SEARCH</t>", {

	_posTestGrp = screenToWorld [0.5,0.5];	
	_building = "Land_Cargo_Tower_V1_No1_F" createVehicle _posTestGrp;
	sleep 1;
	
	_testgrp = createGroup WEST;
	_soldier = "B_Soldier_F";		
	_newUnit = _testgrp createUnit [_soldier, _posTestGrp   , [], 0, "NONE"]; 

	_buildingPositionsArray = [_building] call BIS_fnc_buildingPositions;	
	_buildingPositionsCount = count _buildingPositionsArray;
	
	for "_i" from 10 to _buildingPositionsCount - 1 do {	
		_wp = _testgrp addWaypoint [AGLToASL (_building buildingPos _i), 0];
		//_wp waypointAttachObject _building;
		_wp setWaypointHousePosition _i;
		_testgrp setCurrentWaypoint _wp; 
		//_wp setWaypointType "MOVE";
		_arrow = createSimpleObject ["Sign_Arrow_F", AGLToASL (_building buildingPos _i)];
		hint format ["moving to %1", getPosATL _arrow];
		waitUntil {
			sleep 1;
			hint format ["%1m to %2", round (AGLToASL getPos _newUnit distance AGLToASL (_building buildingPos _i)), AGLToASL(_building buildingPos _i)];
			((AGLToASL getPos _newUnit distance AGLToASL(_building buildingPos _i)) < 2)
		};	
		sleep 3;
		deleteVehicle _arrow; 
	};		
},"",2];

I also tried without waypoints and used ATL

 

player addAction ["<t color='#f44298' size='1' > BUILDING SEARCH</t>", {

	_posTestGrp = screenToWorld [0.5,0.5];
	
	_building = "Land_Cargo_Tower_V1_No1_F" createVehicle _posTestGrp; // Land_Cargo_HQ_V1_F  
	sleep 1;
	
	_testgrp = createGroup WEST;
	_soldier = "B_Soldier_F";		
	_newUnit = _testgrp createUnit [_soldier, _posTestGrp   , [], 0, "NONE"]; 

	_buildingPositionsArray = [_building] call BIS_fnc_buildingPositions; 
	_buildingPositionsCount = count _buildingPositionsArray;

	
	for "_i" from 0 to _buildingPositionsCount - 1 do {
		_buildingPos = [(_building buildingPos _i) select 0, (_building buildingPos _i) select 1,((_building buildingPos _i) select 2) + 5] ;
		_arrow = "VR_3DSelector_01_default_F" createVehicle _buildingPos; 
		_arrow setPosASL _buildingPos; 
		sleep 0.1;	
		/*
		_wp = _testgrp addWaypoint [[(getPosATL _arrow) select 0,(getPosATL _arrow) select 1, ((getPosATL _arrow) select 2) + 5], 0];
		_wp waypointAttachObject _building;
		_wp setWaypointHousePosition _i;
		_testgrp setCurrentWaypoint _wp; 
		_wp setWaypointType "MOVE";
		*/
		_newUnit move getPosATL _arrow;
		
		waitUntil {
			sleep 1;
			hint format ["%1m to %2", round (_newUnit distance getPosATL _arrow), getPosATL _arrow];
			(( _newUnit distance getPosATL _arrow) < 3)
		};	
		sleep 3;
		hint format ["I am here at %1", getPosATL _arrow];
		deleteVehicle _arrow; 
	};
},"",2];

But soldier does not climb up the stairs to get the first building waypoint!

Share this post


Link to post
Share on other sites

Have you tried removing the AGLToASL in your code? I think addwaypoint likes ATL positions more

 

Share this post


Link to post
Share on other sites

I tried without the AGLToASL, but still not working?

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

×