Maybe some fancy nearestObject rune would do the trick?
Maybe the weapon could be detected with that, but then it would still probably pick the weapon on the units back as it's closer
I think this is with the 'get units stance' is one the features BIS have forgotten to release for public use...