Support of multiple worldmaps is not something that is currently inherent in the game. I'm actually a bit surprised to hear that two are working. Ideally, someone would sit down and put the necessary coding together to make multiple worlds work easily, but until that happens you'll probably need to brute force it using scripting and state variables. The best thing would be to put together some squirrel code in a .nut file, but if you don't know how to make that work (or don't want to) you can also probably make it work in the worldmap initialization script. Because I use a sort of "non-traditional" file hierarchy in my own levels, this is what I had to do to make it work in my own levels (it didn't automatically even for two maps for me). I'm only using two worldmaps at the moment but intend to have at least three, so the trick I developed should work well enough for you (I haven't tried yet myself and can't for a few weeks so this is a bit of an assumption).
Anyway I'm sure you're ultimately interested in the necessary code, so I'll try to cover it as best I can. First you will need to establish some state variable(s) to denote which worldmap you want loaded when the player returns. State variables are saved after exiting and contain information such as level stats (located in your profile folder). I've been using a boolean (true/false) for each worlmap to denote which is active, but that's probably not the most efficient for a large number of worlmaps. You could experiment with a single integer or string in a case structure if you wish, but until I can play around with better ways I'll stick with what I already know works. Start with something like:
- {l Code}: {l Select All Code}
if(! ("map1" in state)){state.map1<- true;}
if(! ("map2" in state)){state.map2<- false;}
if(! ("map3" in state)){state.map3<- false;}
Using my method, you need to have a line for every worldmap you are using- this initializes the state variable if it does not yet exist (note at first only map1 should be true). Next you will need a little code to handle the change to go to the correct worldmap. I've been using something like this:
- {l Code}: {l Select All Code}
if(!state.map1){ exit_screen();
if(state.map2){ load_worldmap(\"levels/<world name>/world2/worldmap.stwm\");}
if(state.map3){ load_worldmap(\"levels/<world name>/world3/worldmap.stwm\");}
} else {<any normal map initialization code if used>}
The code up to this point should only need to be on the first worldmap and executed during initialization (maybe the second, with some tweaks, if it actually loads automatically already). Anyway what it does is first checks to see if you are on the right map, if not it closes it (otherwise it runs the optional code in the else statement). Then it looks to find which map you are suppose to be on and loads it instead. You will obviously have to use the correct path to your worldmaps and include lines for all your worlds. SuperTux automatically remembers the coordinates where you left off, so you do not have to worry about spawnpoints or anything like that.
Finally, you are going to need to set up some way to set the state variables in-game so that it all actually works. I use a special tile that is immediately after a spawnpoint of a map to set the correct variable, for example in world 3 you would use the script:
- {l Code}: {l Select All Code}
state.map3<- true;
state.map2<- false;
I do not worry about map1 because I have no way to get from world 1 to world 3 (thus it should already be set correctly); however, any map that links to world 3 should also be set to false in this script as well (for example world 4 would be a logical choice to also include assuming you can go backward).
That should be enough to get it to work. I realize this is not the best or most efficient way to do this, but it should work and is conceptually pretty simple. If you want more elaboration, just let me know. I'd put together a demo, but I don't have access to SuperTux for a couple of weeks.
Hope that helps.