nearObjects: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|PARAMETER3= |p24=" to "|PARAMETER23= |p24=") |
Lou Montana (talk | contribs) |
||
Line 1: | Line 1: | ||
{{Command|Comments= | {{Command|Comments= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 14: | Line 10: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| position | | position [[nearObjects]] radius |SYNTAX= | ||
|p1= position: [[Position]], [[Position2D]] or [[Object]] |PARAMETER1= | |p1= position: [[Position]], [[Position2D]] or [[Object]] |PARAMETER1= | ||
|p2= radius: [[Number]] |PARAMETER2= | |p2= radius: [[Number]] |PARAMETER2= | ||
|s2= position | | [[Array]] |RETURNVALUE= | ||
|s2= position [[nearObjects]] [typeName, radius] |SYNTAX2= | |||
|p21= position: [[PositionAGL]], [[Position2D]] or [[Object]] |PARAMETER21= | |p21= position: [[PositionAGL]], [[Position2D]] or [[Object]] |PARAMETER21= | ||
|p22= [typeName, radius]: [[Array]] |PARAMETER22= | |p22= [typeName, radius]: [[Array]] |PARAMETER22= | ||
|p23= typeName: [[String]] |PARAMETER23= | |p23= typeName: [[String]] |PARAMETER23= | ||
|p24= radius: [[Number]] |PARAMETER4= | |p24= radius: [[Number]] |PARAMETER4= | ||
|r2= [[Array]] | | |r2= [[Array]] |RETURNVALUE2= | ||
__________________________________________________________________________________________ | __________________________________________________________________________________________ | ||
Line 39: | Line 39: | ||
| [[findNearestEnemy]], [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearestLocation]], [[nearEntities]], [[nearTargets]], [[nearSupplies]], [[nearestLocationWithDubbing]], [[nearObjectsReady]], [[nearRoads]] |SEEALSO= | | [[findNearestEnemy]], [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearestLocation]], [[nearEntities]], [[nearTargets]], [[nearSupplies]], [[nearestLocationWithDubbing]], [[nearObjectsReady]], [[nearRoads]] |SEEALSO= | ||
}} | }} | ||
Line 48: | Line 45: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on June 30, 2007 - 08:21 | <dd class="notedate">Posted on June 30, 2007 - 08:21 | ||
<dt class="note"> | <dt class="note">[[User:Kronzky|Kronzky]] | ||
<dd class="note"> | |||
Units in vehicles are not detected via this command. | Units in vehicles are not detected via this command. | ||
<dd class="notedate">Posted on December 15, 2011 - 23:17 | <dd class="notedate">Posted on December 15, 2011 - 23:17 | ||
<dt class="note"> | <dt class="note">[[User:Tankbuster|Tankbuster]] | ||
<dd class="note"> | |||
In the second example, 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 example, 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) | ||
<dd class="notedate">Posted on January 3, 2013 - 19:59 | <dd class="notedate">Posted on January 3, 2013 - 19:59 | ||
<dt class="note"> | <dt class="note">[[User:Tankbuster|Tankbuster]] | ||
<dd class="note"> | |||
If you use the first example, 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. | If you use the first example, 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 Section END --> | <!-- Note Section END --> | ||
Line 60: | Line 62: | ||
<h3 style="display:none">Bottom Section</h3> | <h3 style="display:none">Bottom Section</h3> | ||
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]] | |||
<!-- CONTINUE Notes --> | <!-- CONTINUE Notes --> |
Revision as of 12:15, 3 September 2019
Description
- Description:
- Find 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:
- Uncategorised
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: PositionAGL, Position2D or Object
- [typeName, radius]: Array
- typeName: String
- radius: Number
- Return Value:
- Array
Examples
- Example 1:
_list = position player nearObjects 50;
- Example 2:
_list = [_xpos,_ypos] nearObjects ["House", 20];
- Example 3:
_list = player nearObjects 20;
Additional Information
- See also:
- findNearestEnemynearestBuildingnearestObjectnearestObjectsnearestLocationnearEntitiesnearTargetsnearSuppliesnearestLocationWithDubbingnearObjectsReadynearRoads
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
Notes
- Posted on June 30, 2007 - 08:21
- Kronzky
- Units in vehicles are not detected via this command.
- Posted on December 15, 2011 - 23:17
- Tankbuster
- In the second example, 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 January 3, 2013 - 19:59
- Tankbuster
- If you use the first example, 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.
Bottom Section
- Posted on August 8, 2017 - 16:08 (UTC)
- Cheitan
- The example 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.