It is possible, I implemented this in my game quite successfully, however, I did not use a code or script, but instead use mapping functions and a dozen of conditional branches for it. So say, you have a NPC, record its Map X and Map Y in two variables, do the same for the other event (Pikachu)...