If you plan to use gs-paths for pathfinding you may be interrested in this function:
Feel free to contact me if you're in need of such function (sell/share). It calculates the shortest distance from an entity to any position using the assigned (and complex) path: