Jump to content
Sign in to follow this  
alleycat

Filter "man" out of AllUnits?

Recommended Posts

I would like to filter all living soldier units out of AllUnits (removing all non human units). How would I do that?

IsKindOf "Man" can be used but I am not sure about syntax.

Share this post


Link to post
Share on other sites

{
deleteVehicle _x;
} foreach vehicles;

... would remove all vehicles. Crew & passengers are not affected - except probably kinda surprised.

Share this post


Link to post
Share on other sites

Try this:

_vehicles_arr = [];

{
    if (not _x isKindOf "Man") then
    {
         _vehicles_arr set [count _vehicles_arr, _x];
    };
} forEach allUnits;

Share this post


Link to post
Share on other sites

DOes that script add every unit that is not Man to the new array?

Share this post


Link to post
Share on other sites

Yes, you can filter additional classes out as well if you need to by adding in more checks.

For example - (All units that aren't men or aircraft):

_vehicles_arr = []; 

{ 
    if (not _x isKindOf "Man" and not _x isKindOf "Air") then 
    { 
         _vehicles_arr set [count _vehicles_arr, _x]; 
    }; 
} forEach allUnits;

Is that what you meant?

Share this post


Link to post
Share on other sites

I would use "CAmanBase" instead of "Man", since "man" kind includes animals as well... BIS logic. True in some sense. :)

I'm not sure if allUnits would include animals though...

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
Sign in to follow this  

×