Okay, here is how I made a free-roaming section in a test game I've done:
1) Make your different "maps", set the start markers where you want them to be
2) Place down temporary entities (preferably an invisible decal) where you want the "entrances" in the map to be.
Here comes the tricky part:
3) For all your exits, place a triggerzone in front of them in such a way that when the player goes to exit they will HAVE to go through that triggerzone. Now script that triggerzone to set a variable (I named this variable "startspot") as well as which "map" it's supposed to go to next. This part helps greatly if you have a list of which maps are going to be which Level Number.
Now, when the player walks out of the map in any of the exits, it will take them to the map they are supposed to be going to.
Hope you can get this far because this is the hardest part:
You may have noticed that even though your player is going to the right maps, they ALWAYS go to the start marker, and you may not want that. You may want them to appear at different spots on the map based on which map they came from. Here goes:
4) Remember those invisible decals we placed on the floor for all the "entrances"? You do? Good! Remember that "startspot" variable we were setting? Great! I bet you have no idea what to put in that variable, huh? Well, here's where you find out:
- That variable basically determines which "entrance spot" your player will be coming out of. I suggest naming your invis decals names that are specific to this variable's value. (I.e. "Entr_1", "Entr_2", etc)
- Now that each of your decals has a number assigned to it (Don't start at 0) this will be the value that you want to put into your variable when you want the player to appear at that spot.
- So let's say you have a map with two entrances, one of them is the start marker and the other is the decal named "Entr_1". Let's say the player comes INTO this map with the "startspot" variable set to 1... Because it's set to 1, we know they are supposed to go to the decal starting position and not the start marker. How do we determine this? Simple:
- Place a triggerzone AROUND your start marker, and script like this:
:state=0:hudshow=black
:state=0,varequal=startspot 0:hudunshow=black,state=99
:state=0:state=%startspot
:state=1:settarget=Entr_1,activatetarget=1,state=99
This script will basically activate the decal which your player should be going to. Now give the following script to your decals:
:state=0,activated=1:state=1
:state=1:cameraposx=0 $EPX,cameraposz=0 $EPZ,hudunshow=black,state=10
This script will reposition your player to the position of your decal, except for the y position. Meaning this will work perfectly IF all your entrances are on the same layer as your start marker. If they aren't then you'll need to fiddle around with "cameraposy" to get them repositioning correctly.
You may be wondering what the HUD named "black" is all about. Well this is just a fullscreen black HUD. Whent he level starts you don't want your players seeing you teleporting across the level, right? This will keep them from doing just that.
There... hope that gave a little bit of insight into how a free-roaming game could be accomplished.
Have fun!
The one and only,
Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.