ok maybe this will help you :
first of all put a boolean variable in your NPC
and events will be like this :
event1:
condition : NPC boolean = false
action : set postion = self.x , self.y
event2:
condition : NPC boolean = true
action : set postion = player.x , player.y-20
event3:
condition:system compare 2 values : distance(player.x,player.y,NPC.x,NPC.y) < 40
action: NPC set boolean to true