nearestObject: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(Described ArmA behaviour.)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Nearest object of given type to given position. For nearestObject pos, pos may be [x, y ,z, "type"] or [object, "type"] or even [x, y, z]. |= Description
| Nearest object of given type to given position. For nearestObject pos, pos may be [x, y ,z, "type"] or [object, "type"] or even [x, y, z]. Before ArmA the funcion matched only objects with exactly the type given. Since ArmA, any object derived from the type is found as well.|= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 18: Line 18:
   
   
|x1= <code>_nObject <nowiki>=</nowiki> nearestObject  <nowiki>[</nowiki>[[player]], "StreetLamp"] </code> |= Example 1
|x1= <code>_nObject <nowiki>=</nowiki> nearestObject  <nowiki>[</nowiki>[[player]], "StreetLamp"] </code> |= Example 1
|x2= <code>_nObject <nowiki>=</nowiki> nearestObject  <nowiki>[</nowiki>[[player]], "Tank"] </code>  |= Example 2 (ArmA)
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 08:57, 13 September 2006

Hover & click on the images for description

Description

Description:
Nearest object of given type to given position. For nearestObject pos, pos may be [x, y ,z, "type"] or [object, "type"] or even [x, y, z]. Before ArmA the funcion matched only objects with exactly the type given. Since ArmA, any object derived from the type is found as well.
Groups:
Uncategorised

Syntax

Syntax:
nearestObject pos
Parameters:
pos: Array
Return Value:
Object

Examples

Example 1:
_nObject = nearestObject [player, "StreetLamp"]
Example 2:
_nObject = nearestObject [player, "Tank"]

Additional Information

See also:
See also needed

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

This command can only find objects up to 50 meters away.

Bottom Section