nearObjects: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<dl class="command_description"> <dd class="notedate">" to "<dl class="command_description"> <dt></dt> <dd class="notedate">") |
m (Fixed (and slightly clarified) notes) |
||
(32 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma1 | |game1= arma1 | ||
|version1= 1.00 | |||
|1.00 | |game2= arma2 | ||
|version2= 1.00 | |||
|game3= arma2oa | |||
|version3= 1.50 | |||
|game4= tkoh | |||
|version4= 1.00 | |||
|game5= arma3 | |||
|version5= 0.50 | |||
|gr1= Object Detection | |gr1= Object Detection | ||
| Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius. The first object in the returned array is ''not'' necessarily the closest one. If you need returned objects to be sorted by distance, use [[nearestObjects]]. If typeName is given, only objects of given type (or its subtype) are listed. | |descr= Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius. The first object in the returned array is ''not'' necessarily the closest one. If you need returned objects to be sorted by distance, use [[nearestObjects]]. If typeName is given, only objects of given type (or its subtype) are listed. | ||
| position [[nearObjects]] radius | |s1= position [[nearObjects]] radius | ||
|p1= position: [[Position]], [[Position2D]] or [[Object]] | |p1= position: [[Position]], [[Position#Introduction|Position2D]] or [[Object]] | ||
|p2= radius: [[Number]] | |p2= radius: [[Number]] | ||
| [[Array]] | |r1= [[Array]] | ||
|s2= position [[nearObjects]] [typeName, radius] | |s2= position [[nearObjects]] [typeName, radius] | ||
|p21= position: [[PositionAGL]], [[Position2D]] or [[Object]] | |p21= position: [[Array]] format [[Position#PositionAGL|PositionAGL]], [[Position#Introduction|Position2D]] or [[Object]] | ||
|p22= | |p22= typeName: [[String]] | ||
|p23= | |p23= radius: [[Number]] | ||
|r2= [[Array]] | |||
| | |x1= <sqf>_list = position player nearObjects 50;</sqf> | ||
| | |x2= <sqf>_list = [_xpos,_ypos] nearObjects ["House", 20];</sqf> | ||
| | |x3= <sqf>_list = player nearObjects 20;</sqf> | ||
| | |seealso= [[findNearestEnemy]] [[nearestBuilding]] [[nearestObject]] [[nearestObjects]] [[nearestLocation]] [[nearEntities]] [[nearTargets]] [[nearSupplies]] [[nearestLocationWithDubbing]] [[nearObjectsReady]] [[nearRoads]] [[nearestMines]] | ||
}} | |||
| | {{Note | ||
|user= Kronzky | |||
|timestamp= 20070630082100 | |||
|text= Units in vehicles are not detected via this command. | |||
}} | }} | ||
{{Note | |||
|user= Tankbuster | |||
|timestamp= 20111215231700 | |||
|text= In the second syntax, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59) | |||
}} | |||
In the second | |||
{{Note | |||
|user= Tankbuster | |||
|timestamp= 20130103195900 | |||
|text= If you use the first syntax, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames. | |||
}} | |||
{{Note | |||
|user= Cheitan | |||
|timestamp= 20170808160800 | |||
|text= The syntax 2 means that the command will include all types which inherit from the given type. As an example, when using "Helipad_Base_F", the command will detect all types of helipads (Land_HelipadSquare_F, Land_HelipadCircle_F, Land_HelipadEmpty_F, etc) in the given radius. | |||
}} | |||
The | |||
Latest revision as of 20:27, 8 September 2022
Description
- Description:
- Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius. The first object in the returned array is not necessarily the closest one. If you need returned objects to be sorted by distance, use nearestObjects. If typeName is given, only objects of given type (or its subtype) are listed.
- Groups:
- Object Detection
Syntax
- Syntax:
- position nearObjects radius
- Parameters:
- position: Position, Position2D or Object
- radius: Number
- Return Value:
- Array
Alternative Syntax
- Syntax:
- position nearObjects [typeName, radius]
- Parameters:
- position: Array format PositionAGL, Position2D or Object
- typeName: String
- radius: Number
- Return Value:
- Array
Examples
- Example 1:
- Example 2:
- Example 3:
Additional Information
- See also:
- findNearestEnemy nearestBuilding nearestObject nearestObjects nearestLocation nearEntities nearTargets nearSupplies nearestLocationWithDubbing nearObjectsReady nearRoads nearestMines
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Jun 30, 2007 - 08:21 (UTC)
- Units in vehicles are not detected via this command.
- Posted on Dec 15, 2011 - 23:17 (UTC)
- In the second syntax, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59)
- Posted on Jan 03, 2013 - 19:59 (UTC)
- If you use the first syntax, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames.
- Posted on Aug 08, 2017 - 16:08 (UTC)
- The syntax 2 means that the command will include all types which inherit from the given type. As an example, when using "Helipad_Base_F", the command will detect all types of helipads (Land_HelipadSquare_F, Land_HelipadCircle_F, Land_HelipadEmpty_F, etc) in the given radius.
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Object Detection