GetDistanceBetween

The   NWScript command returns the distance (in meters) between two provided objects. This will return 0.0 if the distance cannot be determined for some reason, such as when the objects are in different areas, one of the objects is invalid, or one of the objects does not have a location (e.g. an area). (This default return value is different than those for the other  commands.)

The distance takes into account differences in the z-coordinate.