They teleport into their home when it's night or raining and you are far enough away from both the home and the NPC. If they have that house assigned to them, of course.
yes, the dryad is assigned to her home, and i've moved several screens away while it is night and she refuses to teleport.
If they have that house assigned to them, of course.