Code:

action LevelChanger_act
{
  while(!player) { wait(1); }

  my.passable = on;

  while(me)
  {
    if(vec_dist(my.x,player.x) < 50)
    {
      level_load("level02.wmb");
    }
    wait(1);
  }
}


Other approach using a touch event:
Code:
function LevelChanger_event()
{
  if(event_type == event_entity || event_type == event_impact)
  {
    if(you == player)
    {
      level_load("level2.wmb");
    }
  }
}

action LevelChanger_act
{
  my.enable_entity = on;
  my.enable_impact = on;
  my.event = LevelChanger_event;
}


Of course you can alter it for using it with multiple levels.
Like, define a skill which works as id for the level that is loaded, have a string array (text object) holding all level name strings, and load it using the id as index:
Code:
text level_files
{
  string = "level1.wmb","level2.wmb"....
}
...
define level_id, skill2;
...
level_load(level_files.string[my.level_id]);
...


hope this helps you a bit