Page 1 of 1

Dynamic Lighting!!!!

Posted: Mon Jul 15, 2002 7:39 am
by NathanielPT
Hey guys ever want dynamic light? Flickering lights like when there is bad power? Lights that come on at the flick of a switch? Here's how! I found this out by reading through the "spotlight.scr"

Code: Select all

local.light = spawn script_model
local.light.targetname = "thelight"  // Whatever you want
local.light model "fx/dummy.tik"
local.light light (1.0 1.0 1.0) // Color and intensity of light -- 1.0 is full
local.light lightRadius 300
local.light lightOn // lightOff turns it off
local.light notsolid
local.light.origin = (0 0 0)

//Flickering light
local.i = .1
for (local.x = 0; local.x <50; local.x++)
{
  local.i = randomint(10)
  wait (local.i * .05)
  local.light lightOff

  local.i = randomint(10)
  wait (local.i * .1)
  local.light lightOn
}

//Ramping light intensity
local.light lightOn
for (local.x = 0; local.x <1; local.x=local.x+.05)
{
  local.light light (local.x, local.x, local.x)
}


//Moves between two "info_waypoints"
for (local.x = 0; local.x <10; local.x++)
{
     // "thelight" is the targetname we gave the light back at the top
  $thelight moveto $aspot1
  $thelight waitmove

  $thelight moveto $aspot2
  $thelight waitmove
}
Have fun!

light

Posted: Wed Jul 17, 2002 2:04 am
by tltrude
The only thing I can get it to do is make lights that are already near it get brighter. I must not be holding my mouth right.



Image

Image

Posted: Wed Jul 17, 2002 7:14 am
by NathanielPT
I need to see your script. When I was playing around with it I got the light to move all over and do cool stuff. Its the same thing that the "spotlight.scr" uses. So let me see your script and maybe I can help you out. I might post a tutorial about "Dynamic Lights" in a day or two.

Posted: Wed Jul 17, 2002 8:06 am
by Surgeon
Nice one !

Posted: Thu Jul 18, 2002 1:26 am
by tltrude
You can have the whole thing--map included. I hope you will use it for your tutorial. It has a nice wall switch and compiles real fast. The wall light panels were to see if I could get the light to go out when shot.

No need to post anything about it here, I'll just get it from your tutorial.

http://www.intplsrv.net/tltrude/Temp/light_switch.zip

Posted: Thu Jul 18, 2002 4:33 pm
by NathanielPT
Dynamic lights are wierd. Brushes don't effect them. That means if you have a light on the inside of a room near the wall, and if the radius of the light extends beyond the wall the light will light both sides. In other words, brushes don't block the light. That's the quirck, and probably why they aren't used more in the game. Hope this helps.

The tutorial is coming, eventually.

map

Posted: Thu Jul 18, 2002 8:48 pm
by tltrude
Did you download my map, bsp, and script?

http://www.intplsrv.net/tltrude/Temp/light_switch.zip

There is a "light" clipping texture and I have it applied to the inside surfaces of the central column. I tried to move a light inside there with waypoints to block it, but that failed because I never got the light to show up.

I guess we could teleport a player to an identical room that is dark, ha ha. Even if we can only use the dynamic light in an underground tunnel, it would be worth it. Flickering lights in a sewer would be cool too.

Posted: Fri Jul 19, 2002 9:43 am
by NathanielPT
Yeah I download your map, and played around with it, thats where I found out that the brushes don't block the light, however, I didn't look at the ".map" file, I just played with the ".scr" file. I will play around with blocking textures, like light clip or maybe sunblock. I'll just try a bunch of things.