Item/Skill that teleports the user to the last inn they slept in?

I wanted to create a skill/item that would allow the player to warp back to the last inn they slept in, but I have no idea how to event that in at all. Any help?
At every inn, store its position into three variable when they choose rest (x, y, map ID).
Then let the skill call a common event with a transfer based on those variables.
Thank you so much for the help! I got it to work.😂

Original thread: https://forums.rpgmakerweb.com/threads/item-skill-that-teleports-the-user-to-the-last-inn-they-slept-in.94408/