After disable some freeline() function it seems I almost there.
When see player, the NPC will remember and chasing player till the end. Unless I go to a room, hit the switch to close the room with a dynamic wall and break vision with NPC. Strangely enough, the dynamic wall isn't count as a vision block and the NPC can walk through it if they still see me through the dynamic wall. But it's ok, I don't mind that minor detail.
I think there is one problem left:
When the player spawn with a wall between him/her and the NPC, the NPC can't see even if they are within the same screen. This is strange because it happen even without freeline(). Is it because the NPC have no target registered on spawn?
PS: Never mind! If NPC can't see player through wall, I can just script it so that they will go to some random entities like spawn, teleport and bot node. Hopefully while doing so they will encounter players. Thanks @ TrialAndError: ! edited 1×, last 22.01.20 01:52:43 am