nearestObject: Difference between revisions

From Bohemia Interactive Community
mNo edit summary
mNo edit summary
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Nearest object of given type to given position.
| Returns the closes [[Object]]
*to a [[Position]], or
*of a given ClassType to a [[Position]], or
*of given Classtype  to another [[Object]] (player eg)


For nearestObject pos, pos may be [x, y ,z, "type"] or [object, "type"] or even [x, y, z].
ClassType's are defined as per [[CfgVehicles]]


*Before ArmA the funcion matched only objects with exactly the type given.
*Before ArmA the funcion matched only objects with exactly the type given.
Line 16: Line 19:
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''nearestObject''' pos |= Syntax
|  
*[[Object]] <nowiki>=</nowiki> ''' nearestObject''' [[Position]]
*[[Object]] <nowiki>=</nowiki> ''' nearestObject''' [ [[Position]], "ClassType"]
*[[Object]] <nowiki>=</nowiki> ''' nearestObject''' [ [[Object]], "ClassType"]


|p1= pos: [[Array]] |= Parameter 1
|p1= ClassType: [[String]]  


| [[Object]] |= Return value
| [[Object]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|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

Revision as of 09:34, 28 August 2007

Hover & click on the images for description

Description

Description:
Returns the closes Object ClassType's are defined as per CfgVehicles
  • 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:
Parameters:
ClassType: String
Return Value:
Object

Examples

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

Additional Information

See also:
nearestObject typenearestObjectsnearObjectsnearestObject id

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note

Notes

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

Bottom Section