Jump to content
Official BF Editor Forums

Enabling weathereffects


Harry
 Share

Recommended Posts

Yeah, Battlefield finally has native support for lightning! and it's very easy to enable (tweakign requires a bit more work). Rain is also an option, but only for those with the debugger as the normal game doesnt support it (yet, I hope)(I'm talking about native support, not custom effects).

So far I only have a sound, some flashing in the sky and tweakable timings, no texture nor color effects (plain white). BF does require a lightning texture to be present but so far I havent seen it (maybe the flash hides the texture). Ill just give the commands I know that actually did something to get it to work.

First we need to setup a nice lightning sound. Grab your favorite lightningsound and make sure the game can read it (mine was 44kHz, 16 bit mono). The sound template could look like this:

ObjectTemplate.create Sound S_Lightning_strike
ObjectTemplate.modifiedByUser "Harry"
ObjectTemplate.lowSamples 2147483647
ObjectTemplate.mediumSamples 2147483647
ObjectTemplate.soundFilename "Common/Sound/Weather/lightning.wav"
ObjectTemplate.minDistance 1
ObjectTemplate.halfVolumeDistance 3

I think the game is only concerned with the filename and the halfVolumeDistance, which needs to be atleast 3. Anyway, having the sound ready, lets setup our lightning. I put my lightningcode in the Init.con file of my map. The code could look like this:

weatherManager.lightningSFXName S_Lightning_strike
weatherManager.lightningSFXDelay 0.5
weatherManager.lightningDuration 0.15
weatherManager.skyblendOutTime 0.5
weatherManager.lightningMinInterval 3
weatherManager.lightningMaxInterval 6
weatherManager.doubleStrikeProbability 0.75
weatherManager.doubleStrikeMinDelay 0.01
weatherManager.doubleStrikeMaxDelay 0.4
weatherManager.stormEnabled 1

lightningSFXName will tell the game what soundfile to use when the thunder has to be played.

lightningSFXDelay wil ltell the game how long to wait before the sound is played after a strike

lightningDuration will tell how long the full white flash will last in the sky

skyblendOutTime will tell the game how long it takes for the flash to blend out and disappear.

the total time youll see whitesky is the time of lightningDuration and skyblendOutTime combined

lightningMinInterval will tell the game the minimum time between 2 strikes

lightningMaxInterval will tell the game the maximum time between 2 strikes

doubleStrikeProbability will tell the game what chance of a double striek there is. A double strike actually means 3 flashes in total. All strikes will behave the same as one single strike, it just happens a bit more often

doubleStrikeMinDelay will give the minimum amount of time between the first and second, or second and third strike of a doublestrike

doubleStrikeMaxDelay will give the maximum amount of time between the first and second, or second and third strike of a doublestrike

stormEnabled will tell the game to show the lightning or not.

Except for SFXName (string) and stormEnabled (boolean) all values are floats.

Thats it, this will bring some lightning into your map/game/mod.

Screenies:

before (I know, operation clean sweep would have suited better I guess)

screen0025gx.th.jpg

after (already blending out)

screen0036ta.th.jpg

Notice the rain is debugger only. To enable rain in the debugger like mine, add this code to init.con:

rainManager.particleCount 5000
rainManager.particleColor 0/1/1/0.5
rainManager.particleVelocity -2/-40/0
rainManager.particleSpeed 20
rainManager.fadeOutRange 0.3
rainManager.setTexture Common/Textures/rain.dds
rainManager.enabled 1

5000 particles and no framedrop for me:) Thats the power of bf2 rain, but its unavailable:(

Edit: its in the skydome settings. Will try to look at it later. Knows commands for skyDome:

lightingBlend float

lightingColor Vec3

Edited by Harry
Link to comment
Share on other sites

  • Replies 91
  • Created
  • Last Reply

Top Posters In This Topic

snow and rain doesnt work here

my code in init.con

rainManager.particleCount 5000

rainManager.particleColor 0/1/1/0.5

rainManager.particleVelocity -2/-40/0

rainManager.particleSpeed 20

rainManager.fadeOutRange 0.3

rainManager.setTexture Common/Textures/snow.dds

rainManager.enabled 1

Link to comment
Share on other sites

The EoD rain is probably an emitter above the soldier/vehicle. The particles have a rain texture and are faced towards the camera. To ensure less lag, you cna put more raindrops per particle to reduce te amount of particles needed. You could also add a collisionmesh ot the particles so it wont rain inside, but that can cause extreme physicslag.

Link to comment
Share on other sites

There isn't a lightning texture, so to say. It is all held in the skydome's alpha channel. Check out Operation Harvest's skydome, and go to the alpha channel (harvest_sky.dds). Within the alpha is where "lightning" should be placed... however it is only capable of flashes, and not a full fledged storm (or so it appears so). White = flash, black = nothing.

Link to comment
Share on other sites

I would like to place some lightning into my map, I assume all maps have equal rights for it since its built into the editor, or will I(and those that recieve the map) need AF for it to work?

also I assume the code for the lightning sounds goes in the ambientObjects.con? Under ambient triggers, or ambient sounds?

also were in the init.con would it be best to place the code, anywhere? or before level setting, after?

edit: nevermind, sounddogs has a nice collection ;)

Edited by zuiquan1
Link to comment
Share on other sites

I figured that out a while ago with operation harvest.

If you want to lit up several areas in your skybox,

make a black alpha channel in the skybox texture and make the light areas white.

You can even add a "real" lightning. My edited operation harvest file:

weatherManager.stormEnabled 1
weatherManager.lightningMaxInterval 30
weatherManager.lightningMinInterval 10
weatherManager.lightningDuration 0.2
weatherManager.lightningScale 25/1250
weatherManager.lightningColor 0.85/0.95/1/1
weatherManager.lightningMinPos -650/0/650
weatherManager.lightningMaxPos -400/0/400
weatherManager.lightningBlendOutTIme 0.5
weatherManager.lightningPertubation 20
weatherManager.lightningSegments 25
weatherManager.inFadeSegments 5
weatherManager.lightningGroundPenetration 60

weatherManager.doubleStrikeProbability 0.5
weatherManager.doubleStrikeMinDelay 0.3
weatherManager.doubleStrikeMaxDelay 0.75

SkyDome.lightingColor 0.7/0.75/0.8

rem -------------- Sound -----
weatherManager.lightningSFXDelay 1
weatherManager.lightningSFXName S_Thunder_Sound

Didnt know rain was possible tho :huh:

But why, oh why, is it just available in the debugger :rolleyes:

Where did you find the rainmanager lines?

Link to comment
Share on other sites

alright Ive added a sound and I can get the effects working on my map :)

right know it just makes the entire sky flash white for a few seconds, doesnt look exactly like lightning, but most likely I can get the effect I want through some tweaking of everything

thanks for the help harry

Edited by zuiquan1
Link to comment
Share on other sites

edit: here are some screens of it-

before-

screen1420ow.th.png

during strike-

screen1433gk.th.jpg

edit again: wait I was wrong there is an actual lightning strike but you can barely see it :huh:

is there any way to make the flash smaller on it so I can actually see it.

well I got the sound to work, but my lightning still doesnt look right, is there anyway to change the color of the strike aswell?

Edited by zuiquan1
Link to comment
Share on other sites

I figured that out a while ago with operation harvest.

If you want to lit up several areas in your skybox,

make a black alpha channel in the skybox texture and make the light areas white.

You can even add a "real" lightning. My edited operation harvest file:

what do you mean by a "Black alpha channel", how would I go about doing this, and how could I add real lightning to my map.

could any of these effects be done without the operation harvest sky files?

Link to comment
Share on other sites

what do you mean by a "Black alpha channel", how would I go about doing this, and how could I add real lightning to my map.

could any of these effects be done without the operation harvest sky files?

I think what he is saying is that you have to save your skies texture as a DTX5 interpolated alpha and the alpha chan will be all black except where you want the lightening texture to show up. I'm pretty sure that the skies are saved as DTX1 (no alpha.) so you would have to create a new sky with an alpha chan.

Its too bad you couldnt do something like the framed effects where you could have several lightening strikes in say 9 frames and it would randomly select one of the frames to "light up" a certain lightening strike.

Edited by Shipwreck
Link to comment
Share on other sites

I think what he is saying is that you have to save your skies texture as a DTX5 interpolated alpha and the alpha chan will be all black except where you want the lightening texture to show up. I'm pretty sure that the skies are saved as DTX1 (no alpha.) so you would have to create a new sky with an alpha chan.

edit:Ive painted the alpha channel on my sky black(dont know if I should have but heh) than Ive saved as DTX5, havent tested anything yet but we will see.

Ive also found the texture for the lightning, I assume ive I put my own texture in it will show up ingame.....I hope

edit: well Ive tested it ingame and nothing has changed <_<

will keep fooling with things.....

Edited by zuiquan1
Link to comment
Share on other sites

Take operation harvest for example.

Thats what the sky looks like:

harvest_sky_normal.png

And thats the alpha channel of the file:

harvest_sky_alpha.png

Only the white area is going to be lit up by the lightning.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

Announcements




×
×
  • Create New...