How do I use mapId?

Hiya! I'm very new to with RPG maker and I'm currently experimenting with some JS (Java Script). I'm more of a visual learner when it comes to learning so I just need to know if what I'm thinking is correct.

Basically been using a google doc with example scripts but it's still a bit confusing. I currently have this at the moment

$gamePlayer.reserveTransfer(mapId, 3, 9, 4, 0);

I tried 2 different methods and looked for some tutorials but I wasn't able to find any so this is what I have

EXAMPLE 1:
$gamePlayer.reserveTransfer(006, 3, 9, 4, 0);

EXAMPLE 2:
$gamePlayer.reserveTransfer(Gallery_Room, 3, 9, 4, 0);

Right now I'm just guessing how it works. I would love any help possible

If it also helps, I'm using RPG Maker MZ if it makes any difference to how the code works
Heya!

For the first example you have, I believe the reason it might not be working is because you have the extra 0s in there. A general rule when referring to IDs from anywhere in the project, be it the map, events, database or otherwise, is to never include the 0s, as it does funky things with how the game interprets the data. So try with just '6' instead of '006' and see if that helps!

Edit: Assuming it was being used in practice, or if this was more of just a theoretical question, haha. But either way--yeah, always avoid including the 0s. Otherwise, the first example seems like it's formatted correctly.
Did you checked documentation here?
Map number should be written as @FrigidGaze said, should be "X" instead of "00X" like you see in the editor. In your example:

$gamePlayer.reserveTransfer(6, 3, 9, 4, 0);
It transfers the player to map ID = 6, X=3, Y=9, 4 is the direction of looking (4=left), 0 is fade type while transfering (0=black screen).
The above answers are correct (here's a link to the up-to-date front page of that spreadsheet), but since you say you're very new to RPG Maker: are you aware that your example can be done much more simply with the Transfer Player command? If you want variable coordinates, consider Transfer Player with Control Variables, e.g. like in this tutorial:
A lot of the basics in RPG Maker don't require any scripting at all, that's the engine's main advantage~
Hiya! I'm very new to with RPG maker and I'm currently experimenting with some JS (Java Script).

A lot of the basics in RPG Maker don't require any scripting at all, that's the engine's main advantage~
This. In fact, more than basics - there are are full-length, fully functional games that have been released which use no scripting, only eventing.

That's a bit of an extreme, but the point is: if you're brand new, learn how to use RPG Maker. Learn how to implement what you want without having to learn how to code, that's one of the points of MZ. Then, as you find things you can't figure out how to implement via events, you look at plugins or script calls.

Good luck with your project!
Heya!

For the first example you have, I believe the reason it might not be working is because you have the extra 0s in there. A general rule when referring to IDs from anywhere in the project, be it the map, events, database or otherwise, is to never include the 0s, as it does funky things with how the game interprets the data. So try with just '6' instead of '006' and see if that helps!

Edit: Assuming it was being used in practice, or if this was more of just a theoretical question, haha. But either way--yeah, always avoid including the 0s. Otherwise, the first example seems like it's formatted correctly.
I tried it but it seems to shut down my game
This. In fact, more than basics - there are are full-length, fully functional games that have been released which use no scripting, only eventing.

That's a bit of an extreme, but the point is: if you're brand new, learn how to use RPG Maker. Learn how to implement what you want without having to learn how to code, that's one of the points of MZ. Then, as you find things you can't figure out how to implement via events, you look at plugins or script calls.

Good luck with your project!

I'm aware, I do apologize if I didn't give a lot of info! I wanted to code in something from the title screen so it can transfer them to a certain map. I have a plug in currently that changes the title screen

1678220012064.png

1678220163998.png

1678220397877.png

1678220617921.png
You're trying to transfer the player to the map when there are no maps, nor a player. The actual game hasn't been loaded yet.

If you look at the default code for when you start a new game:
Code:
DataManager.setupNewGame = function() {
    this.createGameObjects();
    this.selectSavefileForNewGame();
    $gameParty.setupStartingMembers();
    $gamePlayer.reserveTransfer($dataSystem.startMapId,
        $dataSystem.startX, $dataSystem.startY);
    Graphics.frameCount = 0;
};

you can see it creates the game objects and initializes the party.

You could try adding those function calls in, but I think you'd have better luck using a plugin designed to do this, such as

Or a title menu plugin that turns it into a map - I know MV had HimeWorks' Pre-Title Events, I'm not sure if that works with MZ via Project FOSSIL or natively, or if an MZ equivalent has been written.
You're trying to transfer the player to the map when there are no maps, nor a player. The actual game hasn't been loaded yet.

If you look at the default code for when you start a new game:
Code:
DataManager.setupNewGame = function() {
    this.createGameObjects();
    this.selectSavefileForNewGame();
    $gameParty.setupStartingMembers();
    $gamePlayer.reserveTransfer($dataSystem.startMapId,
        $dataSystem.startX, $dataSystem.startY);
    Graphics.frameCount = 0;
};

you can see it creates the game objects and initializes the party.

You could try adding those function calls in, but I think you'd have better luck using a plugin designed to do this, such as

Or a title menu plugin that turns it into a map - I know MV had HimeWorks' Pre-Title Events, I'm not sure if that works with MZ via Project FOSSIL or natively, or if an MZ equivalent has been written.
I'm so sorry, I wanna make an interactive gallery room like in IB for example, where you can still move your character and interact with the gallery images,

That why I'm trying so hard to get this coding to work in the title screen, if there maybe a plug in for a New Game+ I think I can try to function it to become a gallery cause it's like a new map I hope?
I think it would be much easier to make it an in-game function. Make a key item with a common effect of transporting the player to the gallery map.

Or make an event on a map someplace that you interact with to go there.

New Game+ does not inherently have anything to do with what you're talking about, it's still starting the regular game processes. Did you try simply copying the other function calls that I showed you in my last post?

My fear is that you're trying to do this an advanced way when you don't seem to quite get what you're doing. I think it's better to do a simpler implementation and be confident about making it.

Good luck!
I think it would be much easier to make it an in-game function. Make a key item with a common effect of transporting the player to the gallery map.

Or make an event on a map someplace that you interact with to go there.

New Game+ does not inherently have anything to do with what you're talking about, it's still starting the regular game processes. Did you try simply copying the other function calls that I showed you in my last post?

My fear is that you're trying to do this an advanced way when you don't seem to quite get what you're doing. I think it's better to do a simpler implementation and be confident about making it.

Good luck!
Oh! Ok, I'll try the code again and see if I can make it work and if it doesn't, I'll try more of the in game function. Thank you! I'll post back here again if it still proceeds
Should be able to do this with the CGMZ plugin, though I'm not sure what the context is for the command calls. However, note that switches etc typically don't carry over from one playthrough to another, so you'd need something else to handle that.

For the "custom new game" command you could try this:
JavaScript:
// Memorise current starting position
const m = $dataSystem.startMapId,
const x = $dataSystem.startX,
const y = $dataSystem.startY
// Set new starting position
$dataSystem.startMapId = 6;
$dataSystem.startX = 3;
$dataSystem.startY = 9;
// Call current scene's new game method (should be Scene_Title)
SceneManager._scene.commandNewGame();
// Restore previous starting position
$dataSystem.startMapId = m;
$dataSystem.startX = x;
$dataSystem.startY = y;
I've used similar logic in one of my MZ plugins, Cae_TitleMenu.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-use-mapid.155599/