Hello Gruntage and Aldo15, first of all I would like to thank you again for your replies.
About my script, here is what I wanted to achieve: player unit is NATO and enemy units are resistance. When player is in certain area, which is covered with "detected by resistance" trigger, player can be detected from any resistance unit and, when it happens, a cutscene must run; since I want a camera that frames the player first and then quietly frames from the player to the resistance unit who detected him, I need a script that returns the name of that resistance unit as argument in order to make use of camSetTarget command properly.
Solution offered from Gruntage seems to be good because "behaviour" is a good parameter to determine who detected player, among all enemies, by changing his behaviour from "safe" to "aware"; solution offered from Aldo15 seems to be interesting too but it means I have to initialize every enemy units to make the script work and it will result that script can be ran more than once if more than one enemy unit detects the player at the same time thus making a conflict among all those enemy units who really detected player.
At the end, before reading your solutions (which I found both of them reasonable) and after some racking of my brains, I came up with my comfortable solution and I used nearestObject command to determine the enemy unit who is closer to the player and, for this reason, who is very likely the one who detects player; that unit, then, is the one that gets framed from the camera with camSetTarget command.