While it is nice to occasionally have rain in order to spice up the tactical situation things a bit, there could be more types of weather than just that. Additionally it is odd that if it rains, it rains in the entire country.
So I've upgraded the weather system. Weather can now be local, meaning that at the same time, different sectors can have different weather. When and where weather happens is not controlled by the ini and SectorNames.xml, where you can enter specific weather chances for several weather types:
...
<rainchance>
chance that, if it rains, it will also happen in this sector
<sandstormchance>
chance that, if a sandstorm happens, it will also happen in this sector
<snowchance>
chance that, if it snows, it will also happen in this sector
-->
<SECTOR_NAMES>
<SECTOR>
<SectorGrid>A1</SectorGrid>
<szUnexploredName>Tropical</szUnexploredName>
<szDetailedUnexploredName>Tropical</szDetailedUnexploredName>
<szExploredName>Tropical</szExploredName>
<szDetailedExploredName>Tropical</szDetailedExploredName>
<sWaterType>2</sWaterType>
<usNaturalDirt>300</usNaturalDirt>
<usCivilianPopulation>2</usCivilianPopulation>
<rainchance>80</rainchance>
<sandstormchance>0</sandstormchance>
<snowchance>0</snowchance>
</SECTOR>
...
...
[Tactical Weather Settings]
;******************************************************************************************************************************
; In this section you can enable Rain and other weather effects. Rain reduces visibility, lightning reveals enemy
; positions.
;******************************************************************************************************************************
;------------------------------------------------------------------------------------------------------------------------------
; Rain settings
;
; (For slow CPUs, you may want to disable this)
;------------------------------------------------------------------------------------------------------------------------------
; Enable/Disable weather appearing in the game.
ALLOW_RAIN = TRUE
; Possible number of weather events happening per day
RAIN_EVENTS_PER_DAY = 5
; Chance of weather being triggered, evaluated for each of RAIN_EVENTS_PER_DAY.
RAIN_CHANCE_PER_DAY = 70
; Minimum/Maximum length of waether.
RAIN_MIN_LENGTH_IN_MINUTES = 60
RAIN_MAX_LENGTH_IN_MINUTES = 240
; Number of raindrops per given time. Note that this multiplied according to the screen resolution and weather type
; For slow CPUs decrease the MAX_RAIN_DROPS.
; This is the base setting for each weather
MAX_RAIN_DROPS = 100
;------------------------------------------------------------------------------------------------------------------------------
; Lightning settings
;
; (ALLOW_RAIN must be set to TRUE for this to work.)
;------------------------------------------------------------------------------------------------------------------------------
; Enable/Disable lightning occuring during rain.
ALLOW_LIGHTNING = TRUE
; Minimum/Maximum intervals between lightning in real time mode.
MIN_INTERVAL_BETWEEN_LIGHTNINGS_IN_REAL_TIME_SECONDS = 2
MAX_INTERVAL_BETWEEN_LIGHTNINGS_IN_REAL_TIME_SECONDS = 15
; Minimum/Maximum intervals between lightning and thunder (this has no effect on gameplay)
MIN_INTERVAL_BETWEEN_LIGHTNING_AND_THUNDERCLAPS_IN_SECONDS = 1
MAX_INTERVAL_BETWEEN_LIGHTNING_AND_THUNDERCLAPS_IN_SECONDS = 5
; If an enemy is spotted when lightning strikes, this causes a delay of X seconds to let you get a good look.
DELAY_IN_SECONDS_IF_SEEN_SOMEONE_DURING_LIGHTNING_IN_TURNBASED = 5
; In Turn-Based mode, lightning only occurs between turns. This is the chance of it occuring (out of 100).
CHANCE_TO_DO_LIGHTNING_BETWEEN_TURNS = 35
;------------------------------------------------------------------------------------------------------------------------------
; Sandstorm settings
;
; (For slow CPUs, you may want to disable this)
;------------------------------------------------------------------------------------------------------------------------------
; Enable/Disable this weather appearing in the game.
ALLOW_SANDSTORM = TRUE
; Possible number of weather events happening per day
SANDSTORM_EVENTS_PER_DAY = 3
; Chance of weather being triggered, evaluated for each of SANDSTORM_EVENTS_PER_DAY.
SANDSTORM_CHANCE_PER_DAY = 70
; Minimum/Maximum length of weather.
SANDSTORM_MIN_LENGTH_IN_MINUTES = 120
SANDSTORM_MAX_LENGTH_IN_MINUTES = 240
;------------------------------------------------------------------------------------------------------------------------------
; Snow settings
;
; (For slow CPUs, you may want to disable this)
;------------------------------------------------------------------------------------------------------------------------------
; Enable/Disable this weather appearing in the game.
ALLOW_SNOW = TRUE
; Possible number of weather events happening per day
SNOW_EVENTS_PER_DAY = 1
; Chance of weather being triggered, evaluated for each of SNOW_EVENTS_PER_DAY.
SNOW_CHANCE_PER_DAY = 70
; Minimum/Maximum length of weather.
SNOW_MIN_LENGTH_IN_MINUTES = 120
SNOW_MAX_LENGTH_IN_MINUTES = 360
;------------------------------------------------------------------------------------------------------------------------------
; Various environment modifiers during weather
;------------------------------------------------------------------------------------------------------------------------------
; Reduction of weapon reliability, causing weapons to deteriorate faster and possibly jam more often. Values from 0 to 10.
WEAPON_RELIABILITY_REDUCTION_RAIN = 0
WEAPON_RELIABILITY_REDUCTION_THUNDERSTORM = 1
WEAPON_RELIABILITY_REDUCTION_SANDSTORM = 4
WEAPON_RELIABILITY_REDUCTION_SNOW = 2
; Reduction of the speed of regaining your breath (stamina). Values from 0.0 to 1.0.
BREATH_GAIN_REDUCTION_RAIN = 0.05
BREATH_GAIN_REDUCTION_THUNDERSTORM = 0.4
BREATH_GAIN_REDUCTION_SANDSTORM = 0.7
BREATH_GAIN_REDUCTION_SNOW = 0.2
; Sightrange reduction, range 0.0-1.0
; 0.0 = Weather doesn't decrease sightrange.
; 1.0 = Can't see anything at all.
VISUAL_DISTANCE_DECREASE_RAIN = 0.05
VISUAL_DISTANCE_DECREASE_THUNDERSTORM = 0.15
VISUAL_DISTANCE_DECREASE_SANDSTORM = 0.4
VISUAL_DISTANCE_DECREASE_SNOW = 0.3
; Hearing reduction, range 0.0-1.0
; 0.0 = No reduction
; 1.0 = Can't hear anything at all.
HEARING_REDUCTION_RAIN = 0.3
HEARING_REDUCTION_THUNDERSTORM = 0.8
HEARING_REDUCTION_SANDSTORM = 0.6
HEARING_REDUCTION_SNOW = 0.1
As the above excerpt from JA2_Options.ini tells you, the current weather types are:
Normal weather. When no particular interesting stuff is falling from the sky, besides the odd mortar shell or so.
Rain - water falling from the sky. Classic stuff
Thunderstorms - every rain shower has a chance to be upgraded to a thunderstorm, which is like a more boss version of rain. With lightning, louder sounds, higher penalties and everything.
Sandstorms - likely to happen in the desert, a severe sandstorms can be devastating. Visual range is drastically lowered, your mercs can hear almost nothing over the noise, and even breathing gets harder...
Snow. While this might seem odd in Arulco, this is a worthy addition (and might be used more widely in mods with a less tropical climate). I've added it to the mountains so we don't forget it exists.
While I also planned to add fog to swamps, I don't see how we could reasonably add the effect, so I didn't.
As you can see in the above video, there is now a new map display that shows you what weather currently happens where.
This is fully savegame compatible.
This has been added in r8253 & GameDir r2325. Using the new exe without the new GameDir data will cause BLOOD TO RAIN FROM THE SKY, AND NOT IN A FUN KIND OF WAY.
[Updated on: Sat, 18 June 2016 23:41]
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.
To add Swamp Fog effects, you might try looking at modifying the tile lighting values globally for the sector via the same method that Lightning/Thunderstorms use. Altering RGB values and luminosity may give the desired ambiance.
Hello!
There is no local weather events in Urban Chaos Mod (ja2.exe version 8692).
I tried to check the function "DetermineLocalizedWeatherGivenHelperArray" (file "environment.cpp").
It looks like the variable "totalweatherpoints" with a global chance to launch weather changes in the game is equal zero.
Looking in the file "SectorNames.xml" I see correct (at least plausible) values of <rainchance>, but all "helperstruct[sector].chance" are always 0.
Does anything else affect the values of "helperstruct[sector].chance" which contribute to "totalweatherpoints"?
Thank you in advance.
A quick look at the code tells me that function ForecastDayEvents() decides if there are any weather events for the day. If we want to have weather events we have to enable them in JA2_Options.ini and give them a certain chance and length. For each weather type the chance in the helperstruct is determined from sector data. Once we have this, function DetermineLocalizedWeatherGivenHelperArray() can determine if we will have a weather event in certain sectors or not.
You should monitor function ForecastDayEvents() to see what value each parameter has.
Yeah, you are right.
The weather events are enabled in ja2_options.ini, the sector data in files Ja2\Data-UC113\TableData\Map\SectorNames.xml, Ja2\Data-UC113\Data-UC113NewMaps\TableData\Map\SectorNames.xml and Ja2\Data-UC113\Data-UC113OldMaps\TableData\Map\SectorNames.xml are non zero as well. Cant understand why in my code the rainchance in the helperstruct is always equal zero