GetNearestObjectToLocation(int, location, int)
Returns the nearest object, which is of a specified type, to a given location.
- Object type to find, an OBJECT_TYPE_* constant. More than one can be included with bitwise OR |
- Location to find a nearby object from.
- The nNth thing to find (Default: 1)
Get the nNth object nearest to lLocation that is of the specified type. You can 'or' several OBJECT_TYPE_* constants together using the bitwise | (or) operator. See code sample below.
Return value on error: OBJECT_INVALID
It seems that this function returns OBJECT_INVALID if the location of the object is identical to the location passed to the function. In other words, if there is an object at the exact location that is fed into the function it will NOT be returned by the function. Simply put, the function does not consider an identical location to be the nearest location.
1.64 made sure this function is now consistent - it will return the nearest objects every time it is called from the same location.
author: Jason Simpson, editor: Jasperre, additional contributor(s): Lilac Soul, Heed, Jasperre