assuming your unit is West and enemy is East,
create a trigger with a large enough radius to cover all East units, press F2 and group it to your soldier, select "Any Group Member"/"Repeatedly"/"Detected by East". in the condition type " this and (unit'sName hasWeapon "weaponName") "
and in activation type " unit'sName setCaptive False "
this will work as long as you expect your captive units to obtain a specific type of weapon, otherwise use " this and (someAmmo unit'sName) ", assuming that your captive units begin with no weapons or grenades...
alternatively, place a trigger with large radius and set "Anybody"/"Repeatedly"/"Detected by East" and in activation put "detectedList = thislist". now run a script to check if the captives have weapons and are in the detectedList.
_captives = [soldier1,soldier2.....]
_count = (count _captives)-1
_captive = _captives select _count
? (_captive in detectedList) and (someAmmo _captive) : _captive setCaptive False ; _captives = _captives - [_captive]
_count = _count - 1
? _count > - 1 : goto "loop"