There is lots on this forum about hostage situations, have a good hunt using the forum search function.
There are several ways of achieving what you want, depending on the precise circumstances. Probably the easiest way, if you want him shot by the guards, is to make him on the opposite side and write
this setCaptive true
in his init field. Then, in your detection trigger (and assuming you have named him loon1) have this
On Activation: loon1 setCaptive false
As long as the guards can see him they will shoot him.
Dofire is usually best preceded by a dotarget command: however, coded commands like this only work on AI controlled units, not human controlled ones.