I think i got it running.
I had some problems like ome6a1717 said, adressing the units.
Since the unit is in the family, it seems to detect the distance to itself. So here is what i did
For each Unit
distance(Unit.X, Unit.Y, Family.X, Family.Y) < 20
Unit.UID not= Family.UID
I got a lot of work on the movement of units, so its really smooth and logical, but i think i got the main idea.
Thanks