Ok,
after you not understand what he write, I begin at the origin!
This script must placed in a triggerzone which is there where no light is.
;Header
desc = Reads if in area
;Triggers
:state=0:dimvar=stealth,setvar=stealth 0,state=1
:state=1,plrwithinzone=1:setvar=stealth 1
:state=1,plrwithinzone=0:setvar=stealth 0
;End of Script
After you do this you must place this command in every line in the main script of your npc(back up before) in which the player gets detected.
"vargreater=stealth 0,"
For example:
":state=0,vargreater=stealth 0,plrdistwithin=50:rotatetoplr,state=2"
Hope this help you