GetDistanceToObject() NWScript command returns the distance (in meters) from the caller (OBJECT_SELF) to the provided object. This will return -1.0 if the distance cannot be determined for some reason, such as when the object is in a different area than the caller, the object is invalid, or either the object or the caller does not have a location (e.g. an area).
The distance takes into account differences in the z-coordinate.
float GetDistanceToObject (object oObject
- The object whose distance from the caller will be determined.
See also Edit
GetDistanceBetween()— for getting the distance between arbitrary objects.