Pulsating fog

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply

This is:

A waste of space...
0
No votes
Funny, but useless...
0
No votes
Wicked cool...
0
No votes
The final proof that Bjarne should be locked up...
1
11%
Probably written by 1000 monkeys on 1000 terminals...
2
22%
Just what I need to impress girls...
5
56%
Not against the law... but it SHOULD be...
1
11%
 
Total votes: 9

Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Pulsating fog

Post by Bjarne BZR »

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:

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
	}
end
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 :roll:

Just put it in your script and put the line:

Code: Select all

thread pulsating_fog
...in your main method to kick it into action...
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

8)
Image
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Post by Parts »

I (sure I'm not alone) thought it would be great if you could randomise the light on a map. I had a quick look but it appeared settings like the amibent light, sun colour, direction, etc could not be changed in game. I presume these are set at compile time to improve performance.

Is this correct or does someone know better?
[VS-UK]Capt.Parts[BnHQ]
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Yep, you are correct... the light settigs are compiled into the map... as it often takes several minutes up to a few hours to do the light compile, it would not be a good thing to demand a recompile every frame :? :D
Admin .MAP Forums
Image
Head above heels.
_Snake_
Sergeant
Posts: 52
Joined: Mon Mar 03, 2003 12:22 pm
Location: Canada
Contact:

Post by _Snake_ »

Just what I need to impress girls... :roll: 3 other people voted, I thought this would happen :)


But really, I am going to try this now. Sounds pretty cool :P
:D
Post Reply