Distance to object

Explanation
This function is used to get the distance from the current object to the object specified. While useful, it is just a modified version of. If multiple instances with the same object id exist, the function will choose the object whose id is the least.