Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Mik57

Lightning with Thunder

Recommended Posts

Does anyone know the ACS code for making a thunder sound file play whenever lightning strikes?

Share this post


Link to post

This is a flexible one I used for my weather demo:

script 1 open //lightning
{
// Lightning sector flicker
Light_ChangeToValue (1, 255);
delay(2);
Light_ChangeToValue (1, 128);
delay(2);
Light_ChangeToValue (1, 255);
delay(2);
Light_ChangeToValue (1, 128);

//Sounds
delay(random(70,210)); //Sound travels slower than light, wait 2-6 seconds)
ambientsound("Thunder", random(32, 127)); //Play the sound at a random audible volume
delay(random(175,2100)); //Wait 5-60 seconds until next strike
restart;
}
Hope that helps!

Share this post


Link to post

You may not be aware that this can be handled by MAPINFO. If you put the word "lightning" in your map definition, the game will automatically make thunder and lightning for you. No need to tag all your sectors etc to flash. The lightning temporarily flashes all sectors with a sky flat and any sectors with types such as "indoor lightning". It also plays the sound world/thunder (IIRC) which you have to define in sndinfo. In addition, if you have 2 sky graphics set up, eg 1 normal sky and one with forks of lightning drawn on it, the sky will briefly change to the second sky too. And all that happens just because of that keyword in mapinfo.

What's more, if you still want additional scripted things to happen every time the lightning flashes, there is also the "lightning" script type which runs a script every time the level activates lightning.


So, short version, no need to script unless you want to.

Share this post


Link to post

Alright, thanks guys. I already tried the script from your rain example, and It just kept flashing repeatedly and making 3 thunder noises happen at the same time. But at least I learned a bit from it.

I'm gonna try Enjay's way. I already knew about the lightning keyword in mapinfo, but I didn't know about the sound name in SND info.

Thanks again.

Share this post


Link to post

Should have mentioned this before. Got to this site

http://members.lycos.co.uk/enjay001/

And about half way down the page look for a file called redsky.zip (just search for it - I can't hotlink to files from that site). Download it and load it into Doom2. Then go outside in map01 and look at the sky. Eventually, you'll get a lightning flash, a thunder sound and a change of sky - all done with the MAPINFO thingy.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×