Respawn at Custom Position

In this tutorial we will transfer the Player out of the randomized area, but when he re-enters the Map, he will spawn at the exact position where he originally left the Map. For example, you can have a tent or a house on the randomized Map that the Player can enter and search through.

You should use a seedable PRNG here.

Save Player’s Position

Let’s make a Common Event that stores the Player’s Position on command. We use the methods that RPG Maker already provides.

Go to the Decoration Map, and let’s make an Event that transfers the Player to the tent, house, or secret room. Feel free to put multiple transfer events to get more variety.

Put a simple Transfer Event here. We call our Common Event to save the Player’s Position just before the transfer happens.

Respawn at Memorized Position

You need to copy-paste your (Common) Event that generates the Dungeon, and you will see the reason soon.

MZ only: Plugin Command

MV & MZ: JavaScript Call

Open your already-existing JS snippet and change it to something this:

const x = $gameVariables.value(VARIABLE_ID_X);
const y = $gameVariables.value(VARIABLE_ID_Y);

$dungeonGenerator.template(...)
.withExit(...)
...
.spawnPlayerAt(x, y)
.finalize();

Replace VARIABLE_ID_? with the respective Ids of the Variables that store the X and Y coordinates.