Pulsating fog
Posted: Tue May 13, 2003 12:01 am
I just tested a piece of script I did to change the color and distance of the fogplane during the game... I found it rather cool. And because I'm such a nice guy, I'll share it with you guys:
The example fog pulsates between purple and "poison yellow", and rolls wildly back and forth... play with the variables at the start to calibrate it into someting that you can actually use 
Just put it in your script and put the line:
...in your main method to kick it into action...
Code: Select all
pulsating_fog:
// Color settings
local.farplane_color = "0.3 0.3 "
local.blueshift = 0
local.blueshift_max = 1
local.blueshift_min = 0
local.blueshift_step = 0.01
// Depth settings
local.fogplane = 5000
local.fogplane_step = 40
// Other stuff
local.pulsate_speed = 0.1
local.acending = 1
// Actual code
while ( 1 ) //for ever
{
// Switch pulse direction at max and min
if ( local.blueshift < local.blueshift_min || local.blueshift > local.blueshift_max )
{
local.acending = ! local.acending
}
wait local.pulsate_speed
if ( local.acending )
{
local.blueshift = local.blueshift + local.blueshift_step
local.fogplane = local.fogplane + local.fogplane_step
}
else
{
local.blueshift = local.blueshift - local.blueshift_step
local.fogplane = local.fogplane - local.fogplane_step
}
// Set the variables in $world
$world farplane_color ( local.farplane_color + string local.blueshift )
$world farplane local.fogplane
}
endJust put it in your script and put the line:
Code: Select all
thread pulsating_fog