Search the Community
Showing results for tags 'nearentities'.
Found 1 result
-
I'm having a brain-fart with finding all nearest Blufor units around the player within a radius, INCLUDING units INSIDE vehicles. (Whether it be driver, gunner, passenger, etc.) I'm searching for nearby units like this: BLU=["B_Soldier_base_F","MRAP_01_base_F","Truck_01_base_F","MBT_01_base_F","LSV_01_base_F","B_APC_Wheeled_01_base_F","B_APC_Tracked_01_base_F","Heli_Light_01_base_F","Heli_Transport_01_base_F","Heli_Transport_03_base_F","Plane_CAS_01_base_F","Parachute_02_base_F","B_Boat_Transport_01_F","B_Boat_Armed_01_minigun_F","B_SDV_01_F"]; _n=nearestObjects[player,BLU,8192];_c=[]; {if((isAbleToBreathe _x)&&{(alive _x)&&(_x!=player)})then{_c set[(count _c),_x];};}forEach _n; The above code, even if "B_Soldier_base_F" is the only object being searched for, will not return units inside vehicles. It's possible that once a unit enters a vehicle, he is no longer "B_Soldier_base_F" until he dismounts, but I could definitely be wrong and overlooking something... [EDIT] Figured out a possible work around: BLU=["B_Soldier_base_F","MRAP_01_base_F","Truck_01_base_F","MBT_01_base_F","LSV_01_base_F","B_APC_Wheeled_01_base_F","B_APC_Tracked_01_base_F","Heli_Light_01_base_F","Heli_Transport_01_base_F","Heli_Transport_03_base_F","Plane_CAS_01_base_F","Parachute_02_base_F","B_Boat_Transport_01_F","B_Boat_Armed_01_minigun_F","B_SDV_01_F"]; _n=nearestObjects[player,BLU,WS];_c=[];_v=[]; {if((isAbleToBreathe _x)&&{(alive _x)&&(_x!=player)})then{_c set[(count _c),_x];};}forEach _n; {if((count(crew _x)>1)&&{(alive _x)&&(_x!=player)})then{_v set[(count _v),_x];};}forEach _n; _c=_c+_v; _c select 0; I think this should work. Still need to test it more.