Jump to content
JR Nova

Get AI to move to upper level of building

Recommended Posts

Hello I'm trying to get an AI group to spawn and move to the upper level of a building but once they spawn they are just standing there. (The building in question is one of the multi-story office buildings in Kavala - im trying to get them to the room at the top level with the ladder in it.)

 

_spawnPos = [_object, [80,130]] call SHK_pos;
_movePos = (nearestBuilding _object) buildingPos 27;
_dataGuard = [_spawnPos, resistance, 3 + (random 3)] call bis_fnc_spawngroup; 
_wp = _dataGuard addWaypoint [_movePos, 0];
_wp setWaypointType "MOVE";

I tried getting the player pos or object pos and it sort of works, but they just stay on the 1st floor instead of moving up through the building.

Share this post


Link to post
Share on other sites

That fails for 3 reasons:

 

  • nearestBuilding is a rotten command not returning this building. Use nearestTerrainObject with "house" (add "tourism" if you want to reach a Tanoan hotel)...
  • The path LOD is broken in this building between positions #20 and #21, so, you have to split the track
  • always use ASL position and radius -1 inside a house, if not, here #20 is not perfectly OK and the next waypoint is not reached. Probably a unit readiness... who knows?

 

So, I suggest you:
 

_spawnPos = [_object, [80,130]] call SHK_pos;
_building = (nearestTerrainObjects [getpos _object,["house"],150]) select 0;
_dataGuard = [_spawnPos, resistance, 3 + (random 3)] call bis_fnc_spawngroup;
{
  _movePos = _building buildingPos _x;
  _wp = _dataGuard addWaypoint [AGLToASL _movePos, -1];
  _wp setWaypointType "MOVE"
} forEach [20,27];

 

Note:

You need to wait a couple of seconds because the path calculation is not immediate.

It's weird to ask a whole group to climb into a building. Usually, the subordinates take a formation... at ground level. :hang:

 

  • Thanks 2

Share this post


Link to post
Share on other sites

Thanks for the reply, that worked out perfectly! (Other than the fact that like you said the subordinates just stayed outside the whole time while the group leader ran upstairs lol😥)

 

I got around that by changing it to just spawn a few 1-2 man groups instead of just one and this works as planned for me!

dataGroups = 0;
randomLimit = 5 + (random 4);

spawn_dataGuard = { 
	private ["_spawnPos", "_building", "_dataGuard", "_movePos", "_wp"];
	dataGroups = dataGroups + 1;
	_spawnPos = [_object, [80,130]] call SHK_pos;
	_building = (nearestTerrainObjects [getpos _object,["house"],50]) select 0;
	_dataGuard = [_spawnPos, resistance, 1 + (random 1)] call bis_fnc_spawngroup;
	{
	  _movePos = _building buildingPos _x;
	  _wp = _dataGuard addWaypoint [AGLToASL _movePos, -1];
	  _wp setWaypointType "MOVE"
	} forEach [20,27];	
};

while {dataGroups <= randomLimit} do {
    call spawn_dataGuard;
    sleep 0.1;
};

 

 

  • Like 1

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

×