jigalypuff, you can have as many lights as you want in the level , if you are using the 2 lights shader , then you can only have 2 lights active at one time , i.e. , 2 lights have their lightrange > 0, if you are using the one light shader , then you can only have 1 light on at a time , but in the level , you can place as many as you want. The whole idea of having a 2 light shader with 1 pass and a 1 light shader is for speed. The only reason I modified the shader was that other shaders with only had 1 light only used the sun as dynamic light , which to me makes them completely useless. Here is a very simple code you can use to place as many lights as you want in the level and the 2 closest lights to the player will be the ones activated.
Code:
action dynamicLight		//	Attach to entity or entities that are going to be your ligth sources
{
	my.invisible = on;
	my.passable = on;
	my.light = on;
	my.cast = on;		// Cast shadows
	my.red = 255;		// Light red color
	my.green = 255;		// Light green color
	my.blue = 255;		// Light blue color
	my.lightrange = 0;		// Light brightness
	while(!player){wait(1);}
	while(me!=null)
	{
		if(vec_dist(my.x,player.x) < 200)  //// How close the light should be to the player before it activates.
		{
			my.lightrange = 200;  //// Light brightness
		}
		else
		{
			my.lightrange = 0;
		}
		wait(1);
	}
}


The code I posted above will handle the lights on it's own , just position the lights in a way that let's the level flow with them. This code is not good for 2 story buildings , because of how vec_dist works , but modifying it to work with 2 or more story buildings should be pretty easy.
The script will work with the 1 or 2 light shader.

edit: The script is not perfect , and doesn't really calculate the closes to the player , rather than just activates itself if it is close enough to the player , then the engine will use the 2 lights it sees first and ignore extra ones if more than 2 lights are in range at once. However , by cleverly placing the lights , i.e. not putting 5 lights next to each other , but rather in places you want lit , like 1 in a room , another in a hall , another in the next room , ect... , this script should handle the lights pretty good.
I will prolly make a more precise script later on to really handle lights properly, activating only the ones closest to the player , and handling 2 or more story levels , but that will prolly be later on when I get more into the game , I'm still in testing stage of things.

Last edited by Why_Do_I_Die; 12/07/08 03:06.