Jump to content
FireWalker

Delete spawned AI from near a marker

Recommended Posts

I'm trying to delete a group of AI units that are spawned by a script. A marker spawns on their location.

 

I've tried:

{ deleteVehicle _x; } forEach nearestObjects [getMarkerPos "_marker",["O_recon_medic_F","O_Soldier_lite_F","O_Soldier_GL_F","O_Soldier_A_F","O_Soldier_lite_F"],50];

 

and:

{ deleteVehicle _x; } forEach side [getMarkerPos "_marker",[east],50];

 

and quite a few variations of each. Also tried    "  nearEntities  "   and    "  deleteGroup  "    I just don't think I'm getting all the parts right.

 

 

... I have the radius set at 50 to make sure the area is covered.

 

 

Thank you for any help,

Fire

 

Share this post


Link to post
Share on other sites

1. Select all groups where side = WEST and distance to marker < 100m

private _groups = allGroups select {side _x == WEST and {leader _x distance getMarkerPos "_marker" < 100}};

2. Delete units and groups:

{{deleteVehicle _x} forEach units _x; deleteGroup _x} forEach _groups;

3. All together:

{{deleteVehicle _x} forEach units _x; deleteGroup _x} forEach
	(allGroups select {side _x == WEST and {leader _x distance getMarkerPos "_marker" < 100}});

* code fixed

* test mission: link

  • Like 1

Share this post


Link to post
Share on other sites

@serena

 

Winner, winner  Chicken dinner.   Worked perfect first time!!   

 

Thank you very much,

Fire

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

×