nearObjects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (see also)
(split up different syntax -> increase readability)
Line 16: Line 16:
____________________________________________________________________________________________
____________________________________________________________________________________________


| position '''nearObjects''' radius ''or'' [typeName, radius]
| position '''nearObjects''' radius |= Syntax


|p1= position: [[Array]] - format [[Position]] |= Parameter 1
|p1= position: [[Array]] - format [[Position]] |= Parameter 1
|p2= [typeName, radius]: [[Array]] |= Parameter 2
|p2= radius: [[Number]] |= Parameter 2
|p3= typeName: [[String]] |= Parameter 3
| [[Array]] |= RETURNVALUE
|p4= radius: [[Number]] |= Parameter 4


| [[Array]] |= Return value
|s2= position '''nearObjects''' [typeName, radius]  |= Syntax
|p21= position: [[Array]] - format [[Position]]  |= PARAMETER1
|p22= [typeName, radius]: [[Array]] |= PARAMETER2
|p23= typeName: [[String]] |= PARAMETER3
|p24= radius: [[Number]] |= PARAMETER4
 
|r2= [[Array]] |= Return value
__________________________________________________________________________________________
__________________________________________________________________________________________
   
   

Revision as of 16:40, 27 April 2015


-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Find objects in the circle with given radius.
If typeName is given, only objects of given type (or its subtype) are listed.
The first object in the returned array is not necessarily the closest one (like it is in nearestObjects for example).
Groups:
Uncategorised

Syntax

Syntax:
position nearObjects radius
Parameters:
position: Array - format Position
radius: Number
Return Value:
Array

Alternative Syntax

Syntax:
position nearObjects [typeName, radius]
Parameters:
position: Array - format Position
[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]

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