Dynamic Lighting!!!!
Posted: Mon Jul 15, 2002 7:39 am
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"
Have fun!
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
}

