dinofun: as for deciding on distances, you could use the system function that calculates distance (if you haven't already!) and then check if there's a collision between the object and the wall. One way of doing that would be to use an invisible sprite (like a straight line-of-sight line) and see if that invisible line "hits" any objects in between. If there is a collision in line-of-sight, change the angle and check it again until it finds a free route.
That could be done without using plugins, I believe.