Get list of all maps

Hi fellow Makers, i am trying to teleport the player to a random map based on a list of maps.
I am pretty sure that i must set a control variable that will store the chosen map ID, then teleport the pplayer based on the control variable, but how can i parse a min and max index of map ID to feed the control variable?
that has more problems than you think, and in practical cases won't work.
and there is no need for it to work anyway.

you cannot create maps dynamically, so you will always have the full list of maps in the editor - and then you can count and check their IDs there, and place them directly with the corresponding control variable command.

additionally, you cannot just use the map id - you need all three coordinates for a transfer, map ID and xy where on the map to transfer to. And that xy has to be a passable place, so you can't just set a random number, you need to be able to check the map to specify different xy depending on the map to make sure the player doesn't end up in a wall or in mountains, unable to move after the transfer.

so you'll end up with (most likely) a common event that uses control variable to get a random number, followed with conditional branches checking which number you got and then placing three control variables for three different but predetewrmined numbers for map id, map x and map y as to where the player has a valid coordinate on that specific map to teleport to.

and since it always needs a valid grouping of three specific fitting numbers, the randomize is better not on a map number but on a percentage or weight for each map you list as a possible target.
It's possible Yes. But with everything you want to do there is work involved.
ss2.png

a Common Event Or just an Event placed on the Map that will change a Variable randomly and giving it a little bit or waiting time before changing it gives room for a bit of performance. IF it is a common event you need to activate a Switch to make it run the way it is told to do.

ss1.png

Now if the Variable were 12, the player is being sent to the Map you wish them to be teleported to.

ss3.png

this is all the Teleport on the Map needs as the Common Event will do the checking for you.
In what format is your list of maps? It would probably be much simpler to pick a random map from that list and get its id.
I agree with @Mac15001900, if you already have

based on a list of maps.
it seems like the easiest thing to do would be to use that.

If that's not actually something you have, there's no need to mess about with all of the stuff with parsing map IDs from a variable and all that.

Just use the Control Variable event command to assign a variable a random number - let's say from 1-5.

Then you use Conditional Branches to check the value and transfer to a specific, corresponding map.

Condtional Branch -> variable == 1
- transfer to map 69
Conditional Branch -> variable == 2
- transfer to map 42
etc.

I don't really understand what @B3N4ZC4L's approach is doing, why there's a parallel event constantly generating random values.
Ehy people, first of all thank you for your precious feedback.
I managed to avoid problems changing some little mechanic in order to accomodate the engine:
1) maps go in tiers, ID 1 to 10 is first level difficulty, ID 11 to 20 is second level and so on.
2) a map of tier 1 can only call a map of tier 2.
3) from this i will further specify Tier difficulties meaby inserting id 1 to 5 and 6 to 10 to make slight changes in the difficulties.

How i did it:
i simply choose " teleport with variables " and registered theanchor point for each and every map that is always the same coordinate.
The map Id is based on a random integer and the event is stored inside doors.
Every door is binded to a level, so the door can call only the next tier of maps from the random integer min e max.




1698150909005.png
I agree with @Mac15001900, if you already have


it seems like the easiest thing to do would be to use that.

If that's not actually something you have, there's no need to mess about with all of the stuff with parsing map IDs from a variable and all that.

Just use the Control Variable event command to assign a variable a random number - let's say from 1-5.

Then you use Conditional Branches to check the value and transfer to a specific, corresponding map.

Condtional Branch -> variable == 1
- transfer to map 69
Conditional Branch -> variable == 2
- transfer to map 42
etc.

I don't really understand what @B3N4ZC4L's approach is doing, why there's a parallel event constantly generating random values.
Yeah boss, i used your method in the end, with little variations, i didn't know that i could transfer with variables. Still n00b but i am slowly entering in the engine mind. 😀
My approach was to have a variable change into a random number from 0 - 12 in each 0.3 seconds, But I just noticed that the random number can be generated within the teleport marker as well before the actual teleport is being triggered.
I kind of make it work first and then minimize the resources needed for that action.

Original thread: https://forums.rpgmakerweb.com/threads/get-list-of-all-maps.162340/