Page 1 of 1

Script Lighting Trouble?

Posted: Mon May 21, 2007 2:47 pm
by Ophisâ„¢
Ok, i have a trigger_use with a targetname "theswitch" and a light entity and corona with a targetname "thelight" then i have the following in my .scr;

Code: Select all

level waittill spawn

//--------------------------L I G H T S-----------------------
 

$thelight hide
end

showlight:
$thelight show
$theswitch remove
end


//-------------------------------------------------------------------------------------------------------
That doesnt work.... anything i have missed out or am i on the wrong lines of going about this?

(p.s. hi everyone not posted in a long while)

Posted: Mon May 21, 2007 5:51 pm
by ViPER
you need to remove the light entity and script your light so it can be turned on and off. switchable light will only work in compiled darkness.

Posted: Tue May 22, 2007 12:43 am
by lizardkid
clarification: the light entity's light is compiled into the map; so you can't change it. Use a script_object and assign it a 'light' 'r g b' key/value and THEN apply your script to it.

Posted: Tue May 22, 2007 6:48 am
by wacko
Had some trouble with this, too. Most of my threads about this topic can be found with keyword "flickering" and there are loads of others...
Here's one that should be helpful for u

Posted: Tue May 22, 2007 5:16 pm
by Ophisâ„¢
Thanks for all the help, I'll try these out and post back if i have any trouble! :)

Posted: Tue May 22, 2007 9:15 pm
by Green Beret
Shouldn't the light and corona have different targetnames?

Posted: Tue May 22, 2007 9:17 pm
by ViPER
depends how you script it - but could work either way :D

Posted: Thu May 24, 2007 12:08 am
by ViPER
Thanks Wacko - never saw that. Ive been wanting to do something like this but never thought of a good way. Here is Wacko's torch combined with modified JV's script to create a flickering torch LIGHT effect. I wonder how many of these you can use till it starts to slow things down?

flicker_torch_light

Posted: Thu May 24, 2007 5:44 am
by wacko
Viper wrote:...I wonder how many of these you can use till it starts to slow things down?
Coool, especially the added sound makes it way better. I would adjust the settings a tiny bit, but that's just my taste.

Code: Select all

flicker:
	self light 0.5 0.4 0.2 200
	while(1)
	{
		wait (randomfloat 0.09)
		self lightRadius (randomfloat 50 + 150)
		wait 0.01//waitframe // don't change the light within one frame
	}
end
Thanks!

Dunno whether u read about it or even have made the experience: These dynamic lights are visible from the the backside of walls they're attached to. So u won't be able to use them there. And yes, they don't improve fps :P but - like most things - too many of these torches won't make a map better anyway.

edit:: After a deeper look into it, I found my old (and bad) torch shader. It will probably never die :roll: I did a new pk3 and map of Viper's test including the better torch and additionally a demonstration of the light-through-wall effect. Here it is

Posted: Thu May 24, 2007 11:07 am
by bdbodger
You want a demo of dynamic lights try my traffic light demo . It simulates a working traffic light and pedestrian sign . The pk3 has the .map file in it .

bdb_traffic_light.pk3

Posted: Thu May 24, 2007 11:19 am
by Ophisâ„¢
bdbodger wrote:You want a demo of dynamic lights try my traffic light demo . It simulates a working traffic light and pedestrian sign . The pk3 has the .map file in it .

bdb_traffic_light.pk3
i think i tryed this last year, it doesnt show how to make it triggered on and off tho does it? or is it quite stright forward by just adding a setthread on a trigger?

Posted: Thu May 24, 2007 11:37 am
by bdbodger
No it does not have any triggers the lights are scripted to turn on and off in sequence like a real traffic light . A triggered light with setthread will run some scripting like the scripting I did with this light .

turn the north/south red lights on

Code: Select all

$n_s_red[1] light 1 0 0 25
$n_s_red[1] lighton
$n_s_red[2] light 1 0 0 25
$n_s_red[2] lighton
wait 10 seconds turn the north/south red lights off

Code: Select all

$n_s_red[1] lightoff
$n_s_red[2] lightoff
wait 10 second and do it all again same for all the lights except the blinking pedestrian lights . The thing with this map is the red yellow green textures and the size of the dynamic lights and how they light up the textures making it look like the red , yellow or green lights are lighting up when in fact it is a texture that does not light up at all it is just the small dynamic lights place close to the textures that have a small radius just big enough and the right color to light up the right part of the red yellow green light texture and not the other textures. Dynamic lights need a texture to light up or a model maybe if not you probably won't even see the light at all and a lot also depends on the radius of the light too big and it will light up the wrong side of a wall for example .

Image