here,
;Artificial Intelligence Script
;Header
desc=PlaySoundwhenEntityisSeen
;Triggers
:state=0,inview=1:etimerstart,state=1
:state=1:sound=$0,state=2
:state=2,etimergreater=3000:state=0
;End of Script
however, this is just a script wherein if an entity is seen, it will play a sound, you can change the etimergreater=3000 to the length of your sound, for example you have a 10-second sound, then do etimergreater=10000
now about the AI, if you set mainscript of the AI to the script above, the AI will not move, AT ALL.....sorry, I hope someone else can help you. (not a scripting whiz myself
)
I do hope the my script gave an idea to you.