Hey guys,

I wondered if you might know what the cause of random loading errors
could be.

for instance when i change my level, like going inside a house everything
works just fine. But after a few times i got loading errors that some of my models, which are placed on the other map, could not be loaded or that the sprites I'm using on that map got a bad file format.

I hope you can come up with a solution whats wrong with my level change code or with my maps. I compiled everything and for the code it looks like this:

Code:
function lvl_change()
{
	var telx = 0;
	var tely = 0;
	var telz = 0;
	var charpan = 0;
	var place = 0;
	var telmap = 0;
	
	if(event_type == EVENT_IMPACT)
	{
		game_state = freeze;
	
		telx = my.x_pos;
		tely = my.y_pos;
		telz = my.z_pos;
		charpan = my.char_pan;
		place = my.environment;
		telmap = my.next_map;
		get_map(telmap);
	
		if(current_map == farm){save_field();}
			
		my.emask |= ~ENABLE_IMPACT;
		me = NULL;
		
                // fading the screen
		while(black.alpha < 100){black.alpha += 30 * time_step; wait(1);}
		
		// cleans up variables
		cleanup();
	
		level_load(loadmap);
		
		if(character != NULL)
		{
			character = ent_create("jadenbones.mdl",vector(telx,tely,telz),player_act);
			character.pan = charpan;	
		}
		
		current_map = telmap;		
		
		if(place == outdoor){game_state = outdoor;}else if(place == indoor){game_state = indoor;}
                
                // load related settings and calculate ingame time
		map_settings();
		game_time();
		
                // fade in
		while(black.alpha > 0){black.alpha -= 30 * time_step; wait(1);}
	}
}

action lvl_changer()
{

	set(my, INVISIBLE);
	my.emask |= ENABLE_IMPACT;
	my.event = lvl_change;
}



hope you can help me!

thanks in advance as always

Cheers
Roxas