Find Map ID of next room

I'm trying to event a custom door/transfer Common Event, using three variables: 'NextRoomID', 'NextRoomX', and 'NextRoomY'. The X and Y are easy to figure out, but when I try to set the next room's Map ID, I notice it only gives me an option to set it as the current room's ID. Is there a script call I can use to manually set the next room's ID?

The common event:
1655239063639.png


Setup for calling the common event:
1655239164341.png
Well, I don't think there's any way for the engine to get the ID for the next map because...how would the engine know what the next map is? You can just use a static number (i.e. "16" for map ID 16) and increase/decrease accordingly, but with how maps are numbered, it's unlikely that the numbering will match the order in the editor unless you're really careful with how you make them.

Can you maybe be more specific about what this common event does? So far it looks like it's a complicated way of doing a perfectly mundane transfer; there's nothing in the screenshots here that looks like it would do anything different from just using the transfer command, but I'm sure you want something more than that, so I thought I'd ask.
Right, I know that the engine wouldn't know what the 'next map' is, I meant more like, is there a way for me to pass a Map ID manually into the variable?

Like say that the player starts on a map with the ID of 001, and I want to transfer them to a map with an ID of 002. Is there a script call for referring to specific map IDs that I can pass into the variable via the 'Script' option under the Variable command?

The common event contains the animation for the door as well as the transfer itself, but it also contains the Graphics.freeze and Graphics.transition(x) scripts to allow for a crossfade between rooms. I could just copy and paste, but I decided to try and make a common event for it for testing purposes, as I'm unsure of whether I'd rather have the door animate, or just initiate the crossfade without any prior animation, and I'd rather be able to keep everything in a common event just so I don't have to go back and edit a bunch of doors later.
The engine never knows the ID of the next map - it is your job as a developer to tell the engine which map transfer leads where.
either by selecting the map on the transfer command, or giving the number to a variable to be used in the transfer command. But you are the one who decides what the next map from any position will be.

EDIT: and you use the control variable command for that
Ace doesn't need to know that it's a map ID. If you have a variable with an integer stored in it, it will automatically read that as the ID of your map if you put it into a transfer event.
Ace doesn't need to know that it's a map ID. If you have a variable with an integer stored in it, it will automatically read that as the ID of your map if you put it into a transfer event.
Oh wow that's simple. I'm embarrassed now, lol. That works, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/find-map-id-of-next-room.148547/