[EoD]Junglist Posted December 1, 2009 Report Share Posted December 1, 2009 (edited) WORK IN PROGRESS - FILES NOT ADDED YET - MORE INFO NEEDS ADDING This tutorial is to explain how to bring weather effects into your Battlefield 2 map. In this tutorial we will cover adding lightning effects & thunder claps to your map as well as adding rain & snow to a map. You should have all ready covered these two tutorials before using this one... 1) Creating A Map For Begginers 2) Creating A Map For Intermediate Users Getting Started Before you start make sure you download my pack of ambient effects & sounds! Download Here Step 1 - Lightning Ok, so here all that is basically needed is a couple of tweaks to the init.con & the ambientobjects.con files. What we want to do is to add a lightning effect to the map allond with a delayed clap of thunder. Firstly open up your maps init.con file. Now this is what you are basically going to see: rem *** Generated by BF2Editor *** if v_arg1 == BF2Editor run Heightdata.con LevelSettings.InitWorld run Terrain.con BF2Editor run StaticObjects.con BF2Editor run Sounds.con run Sky.con BF2Editor run Editor/GamePlayObjects.con host UndergrowthEditable.create Undergrowth.load Levels\YOUR_MAP_NAME\ run Overgrowth/Overgrowth.con Overgrowth.editorEnable 1 run AmbientObjects.con BF2Editor run Water.con else run Heightdata.con run Terrain.con v_arg2 run Sky.con v_arg2 run CompiledRoads.con run Sounds.con run tmp.con v_arg1 Undergrowth.load Levels\YOUR_MAP_NAME\ run Overgrowth/Overgrowth.con run Overgrowth/OvergrowthCollision.con run AmbientObjects.con run Water.con endIf rem ------------------------------- LevelSettings ------------------------------- rem ----------------------------------------------------------------------------- gameLogic.setTeamName 1 "MEC" gameLogic.setTeamName 2 "US" gameLogic.setTeamLanguage 1 "Mec" gameLogic.setTeamLanguage 2 "English" gameLogic.setTeamFlag 0 "flag_neutral" gameLogic.setTeamFlag 1 "flag_mec" gameLogic.setTeamFlag 2 "flag_us" gameLogic.setKit 1 0 "MEC_Specops" "mec_light_soldier" gameLogic.setKit 2 0 "US_Specops" "us_light_soldier" gameLogic.setKit 1 1 "MEC_Sniper" "mec_light_soldier" gameLogic.setKit 2 1 "US_Sniper" "us_light_soldier" gameLogic.setKit 1 2 "MEC_Assault" "mec_heavy_soldier" gameLogic.setKit 2 2 "US_Assault" "us_heavy_soldier" gameLogic.setKit 1 3 "MEC_Support" "mec_heavy_soldier" gameLogic.setKit 2 3 "US_Support" "us_heavy_soldier" gameLogic.setKit 1 4 "MEC_Engineer" "mec_light_soldier" gameLogic.setKit 2 4 "US_Engineer" "us_light_soldier" gameLogic.setKit 1 5 "MEC_Medic" "mec_light_soldier" gameLogic.setKit 2 5 "US_Medic" "us_light_soldier" gameLogic.setKit 1 6 "MEC_AT" "mec_heavy_soldier" gameLogic.setKit 2 6 "US_AT" "us_heavy_soldier" rem ----------------------------------------------------------------------------- gameLogic.setBeforeSpawnCamera -203/157/-27 -28/-12/0 if v_arg1 == BF2Editor LevelSettings.CustomTextureSuffix "" else texturemanager.customTextureSuffix "" endIf rem ----------------------------------------------------------------------------- GameLogic.MaximumLevelViewDistance 140 rem ----------------------------------------------------------------------------- gameLogic.setDefaultNumberOfTicketsEx 16 1 100 gameLogic.setDefaultNumberOfTicketsEx 16 2 110 gameLogic.setDefaultNumberOfTicketsEx 32 1 200 gameLogic.setDefaultNumberOfTicketsEx 32 2 220 gameLogic.setDefaultNumberOfTicketsEx 64 1 300 gameLogic.setDefaultNumberOfTicketsEx 64 2 330 gameLogic.setDefaultNumberOfTicketsEx 128 1 150 gameLogic.setDefaultNumberOfTicketsEx 128 2 250 gameLogic.setDefaultTimeToNextAIWave 0 gameLogic.setTicketLossAtEndPerMin 200 gameLogic.setTicketLossPerMin 1 12 gameLogic.setTicketLossPerMin 2 6 rem ----------------------------------------------------------------------------- rem ----------------------------------------------------------------------------- renderer.globalStaticMeshLodDistanceScale 1 renderer.globalBundleMeshLodDistanceScale 1 renderer.globalSkinnedMeshLodDistanceScale 1 gameLogic.setTeamDropVehicle 1 "jep_vodnik" gameLogic.setTeamDropVehicle 2 "usjep_hmmwv" Now what we want to do, is to add to this a few lines of code. So under the line of code that says: "gameLogic.setTicketLossPerMin" You will notice something like this: rem ----------------------------------------------------------------------------- rem ----------------------------------------------------------------------------- Now, inbetween these lines we can post some code to help with the lightning. I've explained the ones you really need to play with to suit your need. weatherManager.stormEnabled 1 weatherManager.lightningMaxInterval 20 - Maximim interval before strike - low value for testing replace 20 with 300 weatherManager.lightningMinInterval 10 - Minimum interval before strike - low value for testing replace 10 with 240 weatherManager.lightningDuration 0.2 - How long lightning effect will appear to the eye weatherManager.lightningScale 25/1250 - Length & width of effect weatherManager.lightningColor 0.85/0.95/1/1 - Lightning colour weatherManager.lightningMinPos -650/0/650 - Affects where the lightning will occure in the sky weatherManager.lightningMaxPos -400/0/400 - Affects where the lightning will occure in the sky weatherManager.lightningBlendOutTIme 0.5 weatherManager.lightningPertubation 20 weatherManager.lightningSegments 25 weatherManager.inFadeSegments 5 weatherManager.lightningGroundPenetration 60 weatherManager.doubleStrikeProbability 0.6 - Chance of a double strike happening weatherManager.doubleStrikeMinDelay 0.3 - Minimum delay between next strike in a doublestrike weatherManager.doubleStrikeMaxDelay 0.75 - Maximum delay between next strike in a doublestrike SkyDome.lightingColor 0.7/0.75/0.8 rem -------------- Sound ----- weatherManager.lightningSFXDelay 0.8 - Delay after effect until thunder sounds weatherManager.lightningSFXName S_Thunder - Effect name that links to your ambientobjects.con file So, now you know what the important (For now) parts mean, add the following code... weatherManager.stormEnabled 1 weatherManager.lightningMaxInterval 300 weatherManager.lightningMinInterval 240 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.6 weatherManager.doubleStrikeMinDelay 0.3 weatherManager.doubleStrikeMaxDelay 0.75 SkyDome.lightingColor 0.7/0.75/0.8 rem -------------- Sound ----- weatherManager.lightningSFXDelay 0.8 weatherManager.lightningSFXName S_Thunder So now you should have a init.con that resembles this one: rem *** Generated by BF2Editor *** if v_arg1 == BF2Editor run Heightdata.con LevelSettings.InitWorld run Terrain.con BF2Editor run StaticObjects.con BF2Editor run Sounds.con run Sky.con BF2Editor run Editor/GamePlayObjects.con host UndergrowthEditable.create Undergrowth.load Levels\YOUR_MAP_NAME\ run Overgrowth/Overgrowth.con Overgrowth.editorEnable 1 run AmbientObjects.con BF2Editor run Water.con else run Heightdata.con run Terrain.con v_arg2 run Sky.con v_arg2 run CompiledRoads.con run Sounds.con run tmp.con v_arg1 Undergrowth.load Levels\YOUR_MAP_NAME\ run Overgrowth/Overgrowth.con run Overgrowth/OvergrowthCollision.con run AmbientObjects.con run Water.con endIf rem ------------------------------- LevelSettings ------------------------------- rem ----------------------------------------------------------------------------- gameLogic.setTeamName 1 "MEC" gameLogic.setTeamName 2 "US" gameLogic.setTeamLanguage 1 "Mec" gameLogic.setTeamLanguage 2 "English" gameLogic.setTeamFlag 0 "flag_neutral" gameLogic.setTeamFlag 1 "flag_mec" gameLogic.setTeamFlag 2 "flag_us" gameLogic.setKit 1 0 "MEC_Specops" "mec_light_soldier" gameLogic.setKit 2 0 "US_Specops" "us_light_soldier" gameLogic.setKit 1 1 "MEC_Sniper" "mec_light_soldier" gameLogic.setKit 2 1 "US_Sniper" "us_light_soldier" gameLogic.setKit 1 2 "MEC_Assault" "mec_heavy_soldier" gameLogic.setKit 2 2 "US_Assault" "us_heavy_soldier" gameLogic.setKit 1 3 "MEC_Support" "mec_heavy_soldier" gameLogic.setKit 2 3 "US_Support" "us_heavy_soldier" gameLogic.setKit 1 4 "MEC_Engineer" "mec_light_soldier" gameLogic.setKit 2 4 "US_Engineer" "us_light_soldier" gameLogic.setKit 1 5 "MEC_Medic" "mec_light_soldier" gameLogic.setKit 2 5 "US_Medic" "us_light_soldier" gameLogic.setKit 1 6 "MEC_AT" "mec_heavy_soldier" gameLogic.setKit 2 6 "US_AT" "us_heavy_soldier" rem ----------------------------------------------------------------------------- gameLogic.setBeforeSpawnCamera -203/157/-27 -28/-12/0 if v_arg1 == BF2Editor LevelSettings.CustomTextureSuffix "" else texturemanager.customTextureSuffix "" endIf rem ----------------------------------------------------------------------------- GameLogic.MaximumLevelViewDistance 140 rem ----------------------------------------------------------------------------- gameLogic.setDefaultNumberOfTicketsEx 16 1 100 gameLogic.setDefaultNumberOfTicketsEx 16 2 110 gameLogic.setDefaultNumberOfTicketsEx 32 1 200 gameLogic.setDefaultNumberOfTicketsEx 32 2 220 gameLogic.setDefaultNumberOfTicketsEx 64 1 300 gameLogic.setDefaultNumberOfTicketsEx 64 2 330 gameLogic.setDefaultNumberOfTicketsEx 128 1 150 gameLogic.setDefaultNumberOfTicketsEx 128 2 250 gameLogic.setDefaultTimeToNextAIWave 0 gameLogic.setTicketLossAtEndPerMin 200 gameLogic.setTicketLossPerMin 1 12 gameLogic.setTicketLossPerMin 2 6 rem ----------------------------------------------------------------------------- weatherManager.stormEnabled 1 weatherManager.lightningMaxInterval 20 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.6 weatherManager.doubleStrikeMinDelay 0.3 weatherManager.doubleStrikeMaxDelay 0.75 SkyDome.lightingColor 0.7/0.75/0.8 rem -------------- Sound ----- weatherManager.lightningSFXDelay 0.8 weatherManager.lightningSFXName S_Thunder rem ----------------------------------------------------------------------------- renderer.globalStaticMeshLodDistanceScale 1 renderer.globalBundleMeshLodDistanceScale 1 renderer.globalSkinnedMeshLodDistanceScale 1 gameLogic.setTeamDropVehicle 1 "jep_vodnik" gameLogic.setTeamDropVehicle 2 "usjep_hmmwv" Save that for now. Step 2 - Sound Open up your maps ambientobjects.con file. Look for the header like this: rem ************ AmbientSounds ************ Now, we need to add a section under that header like this: rem [SoundObjectTemplate: S_Thunder] ObjectTemplate.create Sound S_Thunder ObjectTemplate.activeSafe Sound S_Thunder ObjectTemplate.modifiedByUser "jung" ObjectTemplate.lowSamples 2147483647 ObjectTemplate.mediumSamples 2147483647 ObjectTemplate.soundFilename "levels/YOUR_MAP_NAME/common/sound/levelambients/thunder_1.ogg" ObjectTemplate.loopCount 0 ObjectTemplate.is3dSound 0 ObjectTemplate.stopType 0 ObjectTemplate.volume 1 ObjectTemplate.pitch 1 ObjectTemplate.pan 0.5 ObjectTemplate.reverbLevel 0 ObjectTemplate.minDistance 300000 Sound.addTrigger S_Thunder Now look a bit further down the ambientobject.con file and find this line: if v_arg1 == BF2Editor Under that, add this: Object.create S_Thunder Object.absolutePosition 0.00/200/0.00 Object.rotation 0.000/0.000/0.000 Object.layer 1 Ok, now save! So, now we need to make a new folder directly in the folder YOUR_MAP_NAME Add this folder: common Inside common add: sound Inside sound add: levelambients And inside there place the file "thunder_1.ogg" from my download pack (Available at the top of this page). Step 3 - Sky Ok, so this would be enough for our map to see some lightning action, but if we want the sky to light up with the lightning we need to look at the sky you are using. Skies in BF2 can be saved as DXT 5 .dds file. These files have alpha channels, so the white area is the area that will light up with the lightning effect. If it's all black, nothing in the sky will light up except the lightning effect. So if we look at this sky normally: And at the Alpha Channel: You can see where the sky will light when the lightning effect happens. You'll need to understand photoshop and save the sky as 2048 x 512 DXT 5 .dds file. I'm not the best one to do a tut on how to make an alpha channel like that I'm affraid. We can use the sky from Operation Harvest located in OperationHarvest/client/common/textures/sky/harvest_sky.dds if you can't make your own. NOTES The init.con will remove your weather info if you load the map in the editor so remember to re-add it before you play, or do it at the end of making your map once you pack it all up. You can get round this by using the tmp.con and weather.con but I'll explain this later on. So that's pretty much it for the lightning! Edited December 2, 2009 by [EoD]Junglist Quote Link to comment Share on other sites More sharing options...
[EoD]Junglist Posted December 1, 2009 Author Report Share Posted December 1, 2009 Reserved Quote Link to comment Share on other sites More sharing options...
[EoD]Junglist Posted December 1, 2009 Author Report Share Posted December 1, 2009 Reserved Quote Link to comment Share on other sites More sharing options...
mccae Posted December 1, 2009 Report Share Posted December 1, 2009 Thank you for this really clear tutorial! I must confess that, I did not knew that there is a built in lightning function since now... Quote Link to comment Share on other sites More sharing options...
mschoeldgen[Xww2] Posted December 2, 2009 Report Share Posted December 2, 2009 (edited) There's even code preperation for rain - unfortunately this only does work with the debugger . Harry pioneered in this field: http://bfeditor.org/forums/index.php?showtopic=5951 Note also that BF2 supports wind . I found those in the debugger: windManager.globalWindSpeed 10 gives you Change the direction with windManager.globalWindDirection X/Y/Z The question remains why some sprites are affected and some are not, though I also didn't test yet with the retail EXE. Edit: windManager does work with the retail EXE ( 1.5 ) , at least in a local game Now we only need to find out if the rainManager made it into 1.5 ... Edit2: No, unfortunately the rainManager doesn't work in 1.5 - too bad Edited December 2, 2009 by mschoeldgen[Xww2] Quote Link to comment Share on other sites More sharing options...
Amok@ndy Posted December 2, 2009 Report Share Posted December 2, 2009 seems like inspired junglist to a new tutorial awesome i could really need sth like this 2 weeks ago thx Junglist Quote Link to comment Share on other sites More sharing options...
[EoD]Junglist Posted December 2, 2009 Author Report Share Posted December 2, 2009 (edited) msch, wind kinda works in game, when there's an explosion on say the ambstatic fire it blows all over the place. Doesnt seem to work on justsmoke though. But yeah proper wind would be nice in game Edited December 2, 2009 by [EoD]Junglist Quote Link to comment Share on other sites More sharing options...
Amok@ndy Posted December 2, 2009 Report Share Posted December 2, 2009 it works on smoke grenades on FH2 maybe a secret line in the animation of the smoke ? Quote Link to comment Share on other sites More sharing options...
mschoeldgen[Xww2] Posted December 3, 2009 Report Share Posted December 3, 2009 (edited) It depends on the 'windAffectionFactor NN' coding in the effect. But despite that all sprites in the above effect have the factor set to similar values not all sprites are affected. To have global wind in your map , add those lines to your tmp.con: windManager.globalWindSpeed 10 ( where 10 is the speed in meters/second ) and optionally windManager.globalWindDirection X/Y/Z where X, Y and Z are the usual 3D coordinates . e.g. 0/-1/0 would make your wind blow right down to the ground . When running the debugger you can interactively set direction and speed and then take those settings into your tmp.con Edited December 3, 2009 by mschoeldgen[Xww2] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.