How can I teleport my Player to a random Map?

Status
Not open for further replies.

Tiregs

Villager
Member
Joined
Jan 19, 2020
Messages
24
Reaction score
2
First Language
german
Primarily Uses
RMVXA
Hello,

I want to make a game where you have to fight yourself through random dungeons while simultaniously your oxygen runs out and you have to hurry, fighting yourself from room to room to find more oxygen tanks or loot and stuff. For this, I already installed an ABS and almost everything I need. For this project, I dont even need a random map generator, I am trying to make the rooms myself with different Puzzles and Enemies and Stuff. I still want to have control over the design of the rooms and dont wanna trust a random generator. But for this I am searching for something, that teleports the player randomly into one of the rooms I created. So basicly, I just need a script, that choses the map ID at random and then ports me to this room. The rooms are all identical in Size and Form, only with different Loot, Puzzles maybe and enemies. Does someone know how I can arrange that?

I added a screenshot to show how these maps will look. They will be bigger and look different, but this is an example of how it will principly look.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,221
Reaction score
6,766
First Language
German
Primarily Uses
RMMV
yes, you can - although it might require you to change some of the maps.

If you check out the event commands, you'll find that the transfer player command can receive its coordinates from variables instead of using a fixed target. Usually this is used for some kind of "return" teleport scroll, but you can also use it for random teleport.

the first thing to keep in mind is that this requires you an unbroken line of map IDs as the target maps.
If for example your first ten maps are town maps and the dungeons are the maps #11 to #99, then you can do a control variable giving a random number between 11 and 99 and then use that as the map ID of the transfer command.
If you have your town maps scattered between the dungeon maps, that is obviously a problem as you would have to detect and remove those IDs before the transfer.

The second part is that you'll need two X Y coordinates for the dungeon maps that are passable.
That is no problem if every map has a big center room at the same place, but if the maps are different then you need to find a spot where every map is passable (or a more complex event structure that gives different coordinates depending on map ID) because otherwise the player would be stuck on an impassible tile after the transfer.
 

CrowStorm

Storm crow descending, Winter unending.
Veteran
Joined
Sep 7, 2018
Messages
249
Reaction score
229
First Language
English
Primarily Uses
RMMV
the first thing to keep in mind is that this requires you an unbroken line of map IDs as the target maps.
If for example your first ten maps are town maps and the dungeons are the maps #11 to #99, then you can do a control variable giving a random number between 11 and 99 and then use that as the map ID of the transfer command.
If you have your town maps scattered between the dungeon maps, that is obviously a problem as you would have to detect and remove those IDs before the transfer.
Alternatively, if at least some of the intended teleport locations are numerically continuous, he could get fancy with the "Set Variable - Rand": let's say for example maps 11-17, 29-32, 48-71, and 95-101 are all target ranges, you could first use "Set Variable - Rand" to "roll a d4" to choose one of those ranges at random, then use "Set Variable - Rand" to set the Map ID to teleport to to one in those ranges. If the MAP IDs alternate constantly between dungeon and town or whatever this wouldn't work but...well, I've never set up MY maps that way for a project and I can't imagine why anyone would.

Anyway it sounds like the OP's game is all dungeon so that might not be an issue.
 

Tiregs

Villager
Member
Joined
Jan 19, 2020
Messages
24
Reaction score
2
First Language
german
Primarily Uses
RMVXA
Thank you so much Andar and Crowstorm! With your help I did it, I just made a parallel process that set a few variables and then I was able to make it work with that.

Now I decided, that I just wanted 2 doors, one left and one right. So either you can go right to a new, random room or back to the last. I tried to use "map ID" as variable for going left. But it just ports me back to the same room I am in. Do you maybe know how I can change that, so I can go back to the last map I was on?

Anyway, you have already been a great help, thank you!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,221
Reaction score
6,766
First Language
German
Primarily Uses
RMMV
then we need a screenshot of your event.

you did something wrong with the variable, and to see what went wrong we need to see what you did, we can't read your mind;-)
 

Tiregs

Villager
Member
Joined
Jan 19, 2020
Messages
24
Reaction score
2
First Language
german
Primarily Uses
RMVXA
Okay so this is the default room. To the right I enter a new random room, to the left I go back.

bandicam 2020-01-20 19-48-59-023.jpg

Here is my left event:

bandicam 2020-01-20 19-49-18-475.jpg

bandicam 2020-01-20 19-49-25-924.jpg

This is my parallel process running to set the variables:

bandicam 2020-01-20 19-49-43-589.jpg

And this is the variable that should teleport me back.

bandicam 2020-01-20 19-49-52-656.jpg

I read in a forum about someone, who also wanted help on how to teleport back to the previous map. The solution was given, that it can be done with "Map ID" in the variables. I tried, but I don't know how let the system take the last map ID I was on and not the current.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,221
Reaction score
6,766
First Language
German
Primarily Uses
RMMV
1) you should NOT have used a parallal process, the control variables should have been directly before the transfer command

2) Map ID from the game data is always the current map ID, there is nothing random about that.
to actually get a random number you need to use the random setting, not fixed data.

EDIT:
3) to keep the last ID in memory you need a different variable, and it needs to be set to map ID in the last room before the transfer. Again parallel process is wrong for that because that would constantly update the variable with current values
 

Tiregs

Villager
Member
Joined
Jan 19, 2020
Messages
24
Reaction score
2
First Language
german
Primarily Uses
RMVXA
Thank you very much! Now I have everything running perfectly :)

Have a good day!
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,222
Reaction score
3,590
First Language
English
Primarily Uses
RMMV
@Tiregs Are all your questions related to your thread answered?
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,222
Reaction score
3,590
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Updated my state Stacker Script on itch.io, github is down for some reason (probs just me).
Wife watching Locke and Key. This show is so bad!! You can't just acclimate to discovering magic or magical worlds in less than 60 seconds.
I think I still prefer RPG Maker over Dreams. Been playing around with it, and the controls are really the biggest flaw for me.
Watching Dragon Quest: Your Story on Netflix and already like 5 mins in we've passed over like 3 hours of gameplay.

Forum statistics

Threads
94,329
Messages
919,956
Members
124,078
Latest member
Enkidu
Top