{"name":"nearEntities","operator":null,"title":"nearEntities","type":"command","url":"https://community.bistudio.com/wiki/nearEntities","revid":377403,"updated":"2026-01-02T06:44:59Z","groups":["Object Detection"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Finds entities inside a sphere with the given radius. If the alternative syntax is used, only entities of given types or subtypes are listed.\nEntities returned are not sorted by distance.\n\nThe main syntax does not return dead entities or entities inside vehicles. If you need to return those, use the alternative syntax (with *includeCrew* set to true) or the entities command.\n\n> [!NOTE]\n> This command is much faster than nearestObjects for on-foot soldier and vehicle detection.","syntaxes":[{"syntax":"position nearEntities radius","since":null,"effect":null,"exec":null,"params":[{"name":"position","type":"Object or PositionAGL or Position2D","optional":false,"default":null,"description":"search centre","types":["Object","PositionAGL","Position2D"],"since":null,"text":"position: Object or PositionAGL or Position2D - search centre"},{"name":"radius","type":"Number","optional":false,"default":null,"description":"radius of the sphere","types":["Number"],"since":null,"text":"radius: Number - radius of the sphere"}],"returns":{"type":"Array of Objects","types":["Array","Object"],"description":"not sorted","text":"Array of Objects - not sorted"},"form":"binary","operator":null,"left":{"text":"position","types":["Object","PositionAGL","Position2D"]},"right":{"text":"radius","types":["Number"]}},{"syntax":"position nearEntities [type, radius]","since":null,"effect":null,"exec":null,"params":[{"name":"position","type":"Object or PositionAGL or Position2D","optional":false,"default":null,"description":"search centre","types":["Object","PositionAGL","Position2D"],"since":null,"text":"position: Object or PositionAGL or Position2D - search centre"},{"name":"type","type":"String or Array of Strings","optional":false,"default":null,"description":"type(s) to search for. See isKindOf","types":["String","Array"],"since":null,"text":"type: String or Array of Strings - type(s) to search for. See isKindOf"},{"name":"radius","type":"Number","optional":false,"default":null,"description":"radius of the sphere","types":["Number"],"since":null,"text":"radius: Number - radius of the sphere"}],"returns":{"type":"Array of Objects","types":["Array","Object"],"description":"not sorted","text":"Array of Objects - not sorted"},"form":"binary","operator":null,"left":{"text":"position","types":["Object","PositionAGL","Position2D"]},"right":{"text":"[type, radius]","types":["Array"]}},{"syntax":"area nearEntities [types, matchExactType, aliveOnly, includeCrew]","since":"arma3 2.18","effect":null,"exec":null,"params":[{"name":"area","type":"String, Object or Array:","optional":false,"default":null,"description":"String, Object or Array:\n- String - marker name\n- Object - trigger\n- Array - format [center, a, b, angle, isRectangular, c] or Arma 3 v2.22 [center, a, b, angle, isRectangular, c, usePosWorld] (see inArea)","types":["String","Object","Array"],"since":null,"text":"area: String, Object or Array:\n- String - marker name\n- Object - trigger\n- Array - format [center, a, b, angle, isRectangular, c] or Arma 3 v2.22 [center, a, b, angle, isRectangular, c, usePosWorld] (see inArea)"},{"name":"types","type":"Array of Strings","optional":false,"default":null,"description":"type(s) to search for or [] empty array to return every type","types":["Array","String"],"since":null,"text":"types: Array of Strings - type(s) to search for or [] empty array to return every type"},{"name":"matchExactType","type":"Boolean","optional":true,"default":"false","description":"true for an exact type match, false for an isKindOf match","types":["Boolean"],"since":null,"text":"matchExactType: Boolean - (Optional, default false) true for an exact type match, false for an isKindOf match"},{"name":"aliveOnly","type":"Boolean","optional":true,"default":"true","description":"true to ignore dead entities, false to include them","types":["Boolean"],"since":null,"text":"aliveOnly: Boolean - (Optional, default true) true to ignore dead entities, false to include them"},{"name":"includeCrew","type":"Boolean","optional":true,"default":"false","description":"true to include crew of vehicles in search","types":["Boolean"],"since":null,"text":"includeCrew: Boolean - (Optional, default false) true to include crew of vehicles in search"}],"returns":{"type":"Array of Objects","types":["Array","Object"],"description":"not sorted","text":"Array of Objects - not sorted"},"form":"binary","operator":null,"left":{"text":"area","types":["String","Object","Array"]},"right":{"text":"[types, matchExactType, aliveOnly, includeCrew]","types":["Array"]}}],"examples":[{"text":"```sqf\n_list = player nearEntities 20;\n_list = ASLToAGL getPosASL player nearEntities 50;\n_list = player nearEntities [\"Man\", 1000];\n_list = ASLToAGL getPosASL player nearEntities [\"LaserTarget\", 3000];\n_list = player nearEntities [[\"Car\", \"Motorcycle\", \"Tank\"], 50];\n_list = ASLToAGL getPosASL player nearEntities [[\"Man\", \"Air\", \"Car\", \"Motorcycle\", \"Tank\"], 200];\n```","code":["_list = player nearEntities 20;\n_list = ASLToAGL getPosASL player nearEntities 50;\n_list = player nearEntities [\"Man\", 1000];\n_list = ASLToAGL getPosASL player nearEntities [\"LaserTarget\", 3000];\n_list = player nearEntities [[\"Car\", \"Motorcycle\", \"Tank\"], 50];\n_list = ASLToAGL getPosASL player nearEntities [[\"Man\", \"Air\", \"Car\", \"Motorcycle\", \"Tank\"], 200];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["entities","findNearestEnemy","nearestBuilding","nearestObject","nearestObjects","nearObjects","nearestLocation","nearTargets","nearSupplies","nearestLocationWithDubbing","nearObjectsReady","nearRoads","nearestMines"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Detection","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}