Random idea that popped into my head
Use the
findNearestEnemy command to find the nearest enemy of the group leader (who should be aware of all the enemies of the group), then set that enemy to setCaptive true (which is the equivalent of changing their side to something not-enemy, I think). After that, run the findNearest enemy command again, set that enemy to captive etc. etc until findnearestenemy return null = no contacts.
Of course, that means there're bunches of enemies out there that are setcaptivated, but you could save them in an array and un-captivate them when necessary. Depending on what kind of situation it is you need this for? Also, using reveal + setcaptive true might be necessary, since it usually takes a while otherwise for AI commanders to grok that something's changed. This should lead to the AI commander saying "clear!" after a while. Note they won't return to safe mode automatically, so you might need to tell them that separately.
Might work, might not?
Wolfrug out.