This is the script i made to let me change levels in my game and i thought i would share it, maybe you can use it in your game too. Ive only been using 3DGS for a few weeks so please be gentle when reviewing my code
.
All the other level changing scripts ive managed to find have been where you have to use 2 different files and create a new file for every level you want to load/change to. So heres how i do it, the newb way hehe.
Create the appropriate level strings at the top of your game script like:
string level_str = <level1.WMB>;
string level_str2 = <level2.WMB>; ..etc etc
Code:
var levell=1;
function nextlevel
{while(vec_dist(my.x,player.x)>10){wait(1);}my.passable=on;remove(my);levell+=1;{
if(levell==2){level_load(level_str2);}
if(levell==3){level_load(level_str3);}
if(levell==4){level_load(level_str4);}
if(levell==5){level_load(level_str5);};wait(1);
}
}
action level_exit
{my.passable=on;nextlevel();
}
then i just put an entity in my level for my exit and assigned the level_exit action to it and when my player touches that it loads the next level. maybe theres an easier way to do it i dont know but im a beginner and proud of myself for making that hehe.
hope it helps someone