GetDistanceToObject

The   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.