OK, first you need a trigger to start the script when the right loon is in the right place. That I know you can do.
The script will look something like this. ? .... : .... is the if-then command.
;put a marker when the guy is
setPos marker (getPos loon1)
_counter=1
#loop
;is the loon in the same place as the marker
?getPos marker <> getPos loon1:goto "end"
~1
_counter=_counter+1
?_counter=30:camcreate bang bang bang
goto "loop"
#end
exit
In accordance with my usual practice I won't bother attempting the syntax, it's not my strong point. I'm not sure if or how you can check if two positions are the same, but assuming you can something along these lines should work. It might be better to use a gamelogic rather than a marker.
So if he stays in the same place for 30 seconds its BANG time .. but if he moves the script will end and he's ok.