Transfer player on top of event that player can move

The game I'm currently working on takes a lot of inspiration from common farming sims like Stardew Valley. Once the in-game time reaches 2am, the screen fades to black, the player gets transported first to their farm plot to let the crop events move to their next stage, then to their bed inside their home. Typically, this would be easy enough and I would just transport the player to the coordinates of their bed, but I'm using Visustella's Furniture System that allows the player to place and move furniture items in their home as they please including their bed. Here is a link to the plugin here: http://www.yanfly.moe/wiki/Furniture_System_VisuStella_MZ

That plugin essentially uses their Events & Movement Core to spawn events based on templates saved on a template map. The player will start out the game with a default bed in the default location, but I don't want to lock the player into being stuck having their bed in a predetermined spot in their home. I feel like that takes away the player's ability to really design their home how they want to so I want to allow the player to move their bed around their home to wherever they want. The challenge I'm facing is not knowing how to adjust that player transfer to wherever that event is located at the time. So if the bed starts out in every player's game at the 10, 10 coordinate on the map, but the player decides to move their bed to the 15, 15 coordinate on the home map, I want the transfer to move to that new bed coordinate of 15, 15.
Hmmm, since they seem to be spawned events, I guess you can use 'Events and Movement Core' script $gameMap.lastSpawnedEventID().

EDIT: So, I think it's [this needs to be modified if you already start with the furniture placed, so check ATT_Turan's solution below]:

<JS On Place Furniture>
if ($gameVariables.value(68) === 0) {
$gameVariables.setValue(69, $gameMap.lastSpawnedEventID());
$gameVariables.setValue(68, 1);
}
$gameVariables.setValue(70, $gameMap.event($gameVariables.value(69)).x);
$gameVariables.setValue(71, $gameMap.event($gameVariables.value(69)).y);
</JS On Place Furniture>

Then you transport the player to variables 70,71
Well i see 3 options:

>Actually find the bed spawned id, and move the player to it as you're thinking now.

>Fade to black and spawn the player in the center of the room (the non-perfectionist abstract option as to keep on devving and not waste more than enough time on a single detail).

>Cutscene the bed events to have the "player" lie in it while the real player is invisible and hidden then go to suggestion 2 bonus points if you add a wake up animation or something.
I think you'd have to use some code to look for the bed event.

Try this. Give the template event you're spawning the bed from the notetag <Bed>

Then, in your 2 A.M. event, you would do
Fade Out
Transfer Player (with no fading) to some neutral position in their house, the doorway or something
Turn on a switch of your choice (let's say 42)

Then, in the house, you'd make an event with a blank first page. The second page has a condition of switch 42 and is Autorun
Script:
Code:
for (let i = 0; i < $gameMap.events().length; i++)
{
    if ($gameMap.events[i].event().meta.Bed)
    {
        $gameVariables.setValue(69, $gameMap.events[i].x);
        $gameVariables.setValue(70, $gameMap.events[i].y);
        break;
    }
}

Then you'd Transfer Player to variable coordinates 69, 70, Fade In, and turn switch 42 off. Change the numbers for 69 and 70 to any two variables you like.

I was typing this up as @rpgLord69 was making his post, so his method might be superior.
Nah, your method is superior. What I wrote (supposing there's no mistakes) would have to be modified, since the player already starts with the bed (doesn't place it first time around), LOL.
Beautiful! Thank you guys so much!

Original thread: https://forums.rpgmakerweb.com/threads/transfer-player-on-top-of-event-that-player-can-move.166946/