ID:1205138
 
Code:
mob
Player
Login()
src.loc=locate(11,3,1)
SwapMaps_SaveChunk("intro[src]",locate(1,1,1),locate(50,50,1))
var/swapmap/M=SwapMaps_Load("intro[src]")
if(!M)
usr << "Map intro not found."
return
src.loc=locate(M.x1+11,M.y1+3,M.z1)
src<<"Your loc = [x] [y] [z]"


and

mob
Player
Login()
src.loc=locate(11,3,1)
SwapMaps_SaveChunk("intro",locate(1,1,1),locate(50,50,1))
var/swapmap/M=SwapMaps_CreateFromTemplate("intro")
if(!M)
usr << "Map intro not found."
return
src.loc=locate(M.x1+11,M.y1+3,M.z1)
src<<"Your loc = [x] [y] [z]"


Problem description:

I want the first part of my game to be single-player, to get the storyline going and to get players used to the controls. I do not want other players helping/hindering/molesting them.

I'm trying to use Swapmaps. As I only use z=1 of my map for this first 'chapter' I've avoided using SwapMaps_Save(id) and have elected to use SwapMaps_SaveChunk(id,turf/corner1,turf/corner2) instead. This is the first thing I suspect I might have done needlessly/incorrectly.

My problem is that when I use SwapMaps_Load() it does indeed make a 'new' map at z=11 rather than z=1, but only once: any new players get put on this same z=11 map, rather than a brand new one each, as I had hoped.

When I use SwapMaps_CreateFromTemplate() instead is makes a 'new' map for each player, which is great, but it only loads a small percentage of the NPC mobs. Furthermore, the mobs it load seem to be randomly chosen each time. Sometimes it loads none, sometimes it loads all six.

SwapMaps_Load() also sometimes behaves like this, but not as often.

Any help would be greatly appreciated. Testing this is a major issue, as I can only afford one membership, which means I have to sit through an ad every time I log on with my second account, and it takes forever!
You could generate the NPCs after loading the map, if that's what is giving you problems.

PD: And use the old pager to not get the delay while its in testing, o.o.
Saving as a chunk is definitely not right, so that's part of it. It's not so much that you can't save a chunk, but that you're expected to load the chunk into an existing map. Trying to use a chunk with Load or CreateFromTemplate is problematic.

If you want to save a specific map portion as a nonchunk, just use code exactly like what's in SaveChunk but leave out the ischunk=1 line. That may help.

The Load routine only creating the map once is intended behavior, because Load believes you're loading a uniquely named map, not something intended to be copied ad infinitum. CreateFromTemplate is the correct choice.

There isn't any reason in the library that NPCs should fail to load or load randomly. The only special thing done with mobs is that any mobs already in the space being loaded to are removed. What you should probably look for is if any of the mobs you're loading have a key var set (I don't know why they would, but it'd be a bad idea) or a tag. Also, you should make sure none of the mobs have the wrong layer set; if anything has a custom layer, you could be looking at an issue where the way it's loaded has an impact on what's visible.