Maybe you can try something like this, i use it (currently in a very basic version) in my TD Game. I cant provide code at the moment sorry.

I have one scanning - entity that "knows" a list of ally forces nearby. I let it scan for enemys and i use event_detect to store their pointers in an array.
Currently i only look for the closest enemy and assign it as target to the allied forces. For the "communication" i use structs with entitypointerarrays.
This way i have more ways to assign targets to units.

Kind regards