where can i learn how to do this?
Well, first you need the NPC to find and follow the player by pathfinding. Then when the NPC touches the player, make the player take damage.