Okay I've solved all the issues so far.
Attached are two separate events that when triggered will randomly transition between maps while also preserving coordinate accuracy.
- The first attachment, marked Random Map Travel is common event script that can be called from any local event on a map. It determines
a) A random number
😎 Makes that random number equivalent to a map id. (for example, random number 12 is also map 12)
c) Then calls in the Coordinate Transfer System (a separate common event)
d) Then ends the event so it doesn't jump the player all over the place.
- The second attachment, marked Script Solution is another common event that determines, on an automatic level, where to position the player when they move to a new map. This way, I the game designer, don't have to constantly create designated arrival areas. The event is pretty intense, so let me give the run down and an explanation of a few key things.
a) The event loads information about the map the player is
about to enter.
😎 It takes the height and width information and dumps it into two variables so I can manipulate the information later.
c) I deduct 2 from each of the height and width variables. Why? Because, although a map may be 20x20, the useable area will only be 19x19 and I also want a 1 square space between the player and any borders (again so they don't end up teleporting all over the place)
d) Now the event loads all the information about the
current map. The map's dimensions and the player's coordinates are dumped into their own variables.
e) Again, I deduct 2 from the map's dimensions. This is in order to enable proper re-positioning when a player moves from either the far X (right) or far Y (down) on map 1 and wants to arrive in the correct spot on map 2.
f) Here are the conditions by which the new coordinates will be picked. They are all dependant on the player's current X and Y coordinates, and the Height and Width of the map they are about to arrive in.
g) I added the Jump To label function because once the coordinates have been picked, I don't want the event to run through them again and alter them twice. I'm not actually sure if I need that in there, but it's a remnant from lots of testing and it does no harm so I left it in.
h) The event jumps to the Transfer label
I) The player is transferred using the variables established by the random number generated (representing the Map ID), the new map X coordinates, and the new map y coordinates.
J) Now, when a player exits a map from the left they will appear on the new map on the right hand side. If they leave from the top part of the map they arrive in the bottom part of the next map. And it's all automated now.
That should cover my bases for now. The next step is creating a system so that the game remembers the order in which the random maps appeared, so that if I were to go back the way I came, I would encounter the maps in the right order. That's a task for a different day. It's 320am where I am right now and I am so pooped.
Thanks to everyone for your help. It means a lot. And for anyone else with similar problems, I'm more than happy to troubleshoot.
