Creating a copy of a map?

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,349
Reaction score
4,631
First Language
English
Probably not as easy as I'd like, but I'd like to be able to just create a copy of an existing map. This came about today as a likely problem with my random dungeon runner script as it is - it'll randomly choose a map from the available ones, but what if it chooses the same one twice? Same layout with same stuff is not a problem to me... however, same room is. The copied map would be discarded when the dungeon is exited.


Even some documentation to study would be helpful. I'm developing some tileset burnout, and a change of direction would be good, I think!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Not sure I understand the question.  Are you talking about copying it in the editor, or loading it twice during gameplay?  Can't you just flag a map when it's chosen, so it can't be chosen a second time?  Create an array that's cleared on entry to the dungeon, then as each map is loaded, add its id into the array, then when you load a new map, exclude any that are in the array.  Or, slightly easier, create an array that contains ALL the available maps, then choose randomly which one to load, and remove it from the array so it can't be loaded again.


Would probably need to know more about your dungeon runner script to get the context.  You're asking how to copy a map, then saying having the same map twice is a bad thing, which kind of sounds like you DON'T want to copy it at all.
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,349
Reaction score
4,631
First Language
English
Not sure I understand the question.  Are you talking about copying it in the editor, or loading it twice during gameplay?  Can't you just flag a map when it's chosen, so it can't be chosen a second time?  Create an array that's cleared on entry to the dungeon, then as each map is loaded, add its id into the array, then when you load a new map, exclude any that are in the array.  Or, slightly easier, create an array that contains ALL the available maps, then choose randomly which one to load, and remove it from the array so it can't be loaded again.


Would probably need to know more about your dungeon runner script to get the context.  You're asking how to copy a map, then saying having the same map twice is a bad thing, which kind of sounds like you DON'T want to copy it at all.


I'd like to be able to basically have a "reference" map, and have the dungeon load a copy of that map, instead of just loading the original. The issue I have with just having an array of maps and never using the same one twice is covering cases of having fewer maps than required. What if I need 3 4-way crossroads and I only made 2 like that? I'm betting crash.


I'm thinking I would need a base map for data to be copied into, which would probably ultimately be more flexible than having duplicate map files around just in case I need more than I think I would (all my dungeon maps are the same width/height). I need to learn a lot more about maps...


Anyway, my dungeon runner chooses a random room from a list of "start" rooms and recursively builds out a map based on a number of conditions and (should, barring bugs) assigns appropriate maps based on the number of exits for the room. So, if I have a map that is used twice, and it has treasure, you would come across the room again and the treasure would already be gone.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
818
First Language
English
Primarily Uses
I'm working on a plugin that assigns events to randomly selected tiles in a region. I've gotten that done, I just need to add in more options.


If I'm understanding you correctly, it also does what you seem to be asking about. It creates a copy of the current map and then edits it, and then transfers the player to the new map. The new map is stored into a variable and can be loaded from a save file.


The most relevant functions you can look at are DXMapRandomElements.prototype.createDataMap and the DataManager functions, but you may need to look at more to fully understand. After you look at it, I can answer any questions you have.


https://github.com/DreamXRMMV/Rpg-Maker-MV/blob/master/DreamX_RandomMapEvents.js


If you want to automatically make a copy when you load from a "base map," you are going to alias DataManager.loadMapData and then edit the $dataMap it edits from the data file.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

I miss working in rpgmaker but I can only do one thing at a time. Maybe after drawing lessons I can come back.
Ever have a day like... you play minesweeper and your very first click is always a mine?
Today's patch of Eternal Dreamers is for all the gamblers out there! https://bit.ly/327mu83
i deleted anime only family guy from now on
I've discovered Stardew Valley and now I'm an addict. To think that one person designed this...

Forum statistics

Threads
94,337
Messages
920,054
Members
124,096
Latest member
skittenmaake
Top