Map Instancing |
|
An easy way to create multiple instances of a map. Each instance is put on its own z level. [More] |
To download this library for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Forum_account.MapInstancing##version=5 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Forum_account.MapInstancing##version=5 |
The library provides you with ways to easily make and manage copies of maps. Here's all you need to do to use it:
// make a copy of the second z level Calling maps.copy() makes a copy of a z level and returns a /Map object you can use to manage the map. When you make a copy of a map, the library creates a "blueprint" of the original map. The blueprint is all you need to make a new copy, you can delete the original: // make the blueprint for the dungeon Calling maps.clear() tells the library that you're done using a z level and it can use it the next time you ask it to copy a map. Because you've created the blueprint it doesn't matter if the original map is deleted. You can also save and load these blueprints: // saving You save the blueprint of the map, not an actual instance of the map. This lets you create copies of map that aren't compiled into the game's .dmb file. You create a copy of the saved map just like you create a copy of an existing z level, using the maps.copy() proc. The difference is that you pass it the filename. Version HistoryVersion 5 (posted 03-03-2012)
|
Forum_account: (Jan 8 2012, 11:39 am)
The saving and loading was added as an afterthought because it was easy to add. If there are more features that could be added to help you with this problem that you think could belong as part of the library, let me know =)
KetchupKid: (Jan 8 2012, 11:37 am)
I think you may be right on #1. I'll look into it. Its setup this way so that it will save the maps when I have them all included and load the saved maps when I don't have them included. But I think its just saving every time.
Forum_account: (Jan 8 2012, 11:33 am)
I'm not sure how that New() proc is being called, but I'm guessing the problem is somewhere in there.
When you're calling it, if the if statement is true it doesn't make an instance of a map, it just creates a base and saves it. It only makes a copy of the if statement is false. If it's not working, I'd guess that either: 1. The else clause in the New() proc is never being executed. 2. The map isn't being saved or loaded properly. To troubleshoot #1 you just need to change your code. To troubleshoot #2 you'd have to edit the library's code. There's not much code to it. You'd just need to add some output statements to the MapBase object's constructor to make sure it's getting created and getting created properly, and add some output statements to its make() proc to see what is happening when an instance is being made. KetchupKid: (Jan 8 2012, 8:52 am)
When loading a saved map, it loads a black blank map. I can't figure out what I'm doing wrong.
//Saving and Loading in the New() proc of my mapDatum. [Edit] It also doesn't display a z level when calling world << map.z, its just a blank output line. |
Copyright © 2024 BYOND Software.
All rights reserved.
Right now I'm reading through the library again. But I still don't know whats going wrong. If I can't figure it out soon, I'll probably go back to regular maps. I just liked the idea of having all my maps at 1kb.