Jump to content
ditrapanij

AI Spawn floating when using buildingPos or BIS_fnc_buildingPositions

Recommended Posts

Hi All,

 

Having issues when spawning AI via a function. When I attempt to spawn an enemy using the below set of code:

_buildings = nearestObjects [(getMarkerPos _marker), ["house"], 400];
_building = selectRandom _buildings;
_buildingPositions = [_building] call BIS_fnc_buildingPositions;

_group = createGroup [EAST, true];
_unit = _group createUnit[(selectRandom EnemyUnits), (selectRandom _buildingPositions), [], 0, "NONE"];

Enemies will sometimes spawn floating inside the building, on windows, on crates or outside the building.

 

Is there a more specific function like unit building position that will stop AI spawning on these less than ideal positions?

 

I imagine this is because of the z field in the buildingPos but would like to see if anyone else has experienced this issue and how they've overcome it?

Share this post


Link to post
Share on other sites

Change "NONE" to "CAN_COLLIDE"; will make the code execute 100x faster (Not an exaggeration) and it should help stop them floating. If you want them to stay in that position and not try to chase people out or go prone, also have the unit execute these:
_unit disableAI"PATH";_unit setUnitPos "Up";

  • Like 1

Share this post


Link to post
Share on other sites

It's also a good idea to use setPosATL on the unit after creating it, to make sure unit is in right position

 

 

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

×