When the monster stopped somewhere and you go to a place that has similar coordinates but its not on the same level (upper/lower floor), make it so that it cannot chase you through the wall.