Random map selection script which does not use the same map twice

● ARCHIVED · READ-ONLY
Started by prince of mars 8 posts View original ↗
  1. Post: #1

    (RPGMXP) Random map selection script which does not use the same map twice   

    hello everyone does anyone know of a way to have multiple maps picked at random when you use a door entity and then make sure you do not select a map which you have been on before I have been trying to program that all morning here is what i have so far 

    the idea is it randomly chooses a number which picks a map but if that maps has already been used it will call the random map common event which the exact same event as this one but saved in the common event that way it will pick another number and you will go to another map well in theory I used the common event because I could not figure out another way to reset the event apologize if there is a really easy way to do that I am very VERY new to this
  2. You need to store which maps are cleared and change the random selection based on that.

    Let me show you the principle of how you can get this to work:

    RandomRoomPicking.png

    Whenever you clear a room I would set the specific room switch while sharing the room cleared variabled adding in a common event.

    RandomRoomPickingCommonEvent.png

    Good luck setting it up. Have fun while doing it.

    *hugs*

     - Zeriab
  3. thank you so much for taking the time to respond unfortunately i have no idea what your saying is there any chance you can do a step by step explaining each part as if you were talking to a child  thanks again :)
  4. Do you WANT to use a script for this? It can be done with events.
  5. Try implementing exactly what I have created. The same event commands and all.

    Then play around with it. See how it works. Prod it here and there. How does it change. How does it work.

    And of course, try to have fun while doing it.

    @Shaz:

    Scripting this is easier and more natural when you can both event and script. Eventing it is however much more fun.

    *hugs*

     - Zeriab
  6. lol! In this case, I would use eventing, with numerous Script snippets thrown into the mix :)


    Gah! I suddenly had flashbacks to maps with sheep ... or pigs. You've ruined me, Zeriab!
  7. hmm I typed it in exactly but I am getting a syntax error is there any chance you could write the script part here so I can copy and paste it 
  8. I asked the same question on another forum and i got this responce

    This problem is actually two problems! The first one is visiting rooms in a certain order from a door, but never the same room twice. The second one is the actual randomizing.

    The first can be solved like this; Take a number of variables equal to the number of rooms you want to visit, say, Variable 2 to 5. The first time you use the door, it checks with a conditional branch if Variable 2 is bigger than 0. If so it teleports the player to the Map Id stored in stored in Variable 2 AND (here's the important part) sets Variable 2 to 0 so we know the player has been there before.

    The next time you try to open the door, it will check that Variable 2 is zero, and go to check Variable 3 next. If it is not 0, it will teleport the player to the Mapid stored in Variable 3 and set it to 0. And so on until you've worked through all of the possible maps.

    the second problem is randomizing which variables lead to which map ids. we can do that with the 'Script' event! Put this into the box that comes up when you click on "Script...";

    rooms = [12, 24, 78, 36] #map IDs

    rooms.sort_by { rand }

    $game_variables[2] = rooms[0]
    $game_variables[3] = rooms[1]
    $game_variables[4] = rooms[2]
    $game_variables[4] = rooms[3]

    ​do you think this idea will work? do I have to replace the map ids with the names of the maps? I apologize if I keep asking stupid questions but I am really am quite clueless