Script Lighting Trouble?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Script Lighting Trouble?

Post 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)
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post 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.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post 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
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

Thanks for all the help, I'll try these out and post back if i have any trouble! :)
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

Shouldn't the light and corona have different targetnames?
Image
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

depends how you script it - but could work either way :D
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post 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
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post 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
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post 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?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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
Image
Post Reply