I am trying to make a npc, but which detection method should I use?

I suggest you have a look at this. I think it will help.