Basic principles of using weather in scenes
We have different things to change the overall weather situation in a scene:
- set_fog_distance
- set_rain
- scene_set_day_time
- set_global_cloud_amount
(set_rain,<rain-type>,<rain-strenght>),
set_rain needs to be always called before a mission gets started and cant be changed during a mission.
Rain type will determine wether its snow or rain (2 for snow, 1 for rain)
Rain strenght will determine how "much" it rains...
A simple example how to use it in a generic trigger would be this:
(scene_set_day_time,<time of day>),
This is a indirect command, basicly the time of day will determine what type of skybox will be used. We cant choose a specific skybox, the game is hardcoded to choose from the existing ones randomly if they fit specific settings.
scene_set_day_time is pretty straigthforward to use, note that it also needs to be set before the mission starts and cant be changed during a mission:
Now that we could choose between a night/dawn/day skybox, how can we further specify if its cloudy or not? Here comes the command (set_global_cloud_amount,<strenght>) into play.
The higher the strenght the more likely it is that the game will choose a cloudy version of the skybox. (i am not sure about exact values, this would need extensive testings as its hardcoded and cant be looked at easy)
Lastly we have set_fog_distance.
(set_fog_distance,<distance>,<color in hex code>),
This is the only command we can dynamical change during a mission.
The distance is distance in meters. Note that anything below 20 is way too foggy imo, something like 550-800 is good for a little bit haze at sunny days, anything over 1500 seems to have nearly no fog/haze at all (its there but barely visible).
The color needs to be coded in the following way:
0xAARRGGBB --> A is alpha value, not used for fog and should be set to FF
--> R,G and B are Red, Green and Blue values of the color.
for example: 0xFF0000FF would be totally blue fog.
One last example to show this all together: we want a cloudy scene at dawn, with mid-range fog and slightly raining:
most script examples are made-up as i wrote this, to script your own weather setup this should give you the basics.
We have different things to change the overall weather situation in a scene:
- set_fog_distance
- set_rain
- scene_set_day_time
- set_global_cloud_amount
(set_rain,<rain-type>,<rain-strenght>),
set_rain needs to be always called before a mission gets started and cant be changed during a mission.
Rain type will determine wether its snow or rain (2 for snow, 1 for rain)
Rain strenght will determine how "much" it rains...
A simple example how to use it in a generic trigger would be this:
abhuva_rain = (ti_before_mission_start,0,0,[],[
(store_random_in_range,":rain_yesno",1,101), ## this will output a random number between 1 and 100
(try_begin),
(ge, ":rain_yesno",50), ## we have a 50% change that it will be raining or not
(party_get_current_terrain, ":terrain_type", "p_main_party"),
(store_random_in_range,":rain_strength",1,101), ## this will output a random number between 1 and 100
(try_begin),
(eq, ":terrain_type", rt_snow),
(set_rain,2,":rain_strength"),
(else_try),
(set_rain,1,":rain_strength"),
(try_end),
(try_end),
])
(store_random_in_range,":rain_yesno",1,101), ## this will output a random number between 1 and 100
(try_begin),
(ge, ":rain_yesno",50), ## we have a 50% change that it will be raining or not
(party_get_current_terrain, ":terrain_type", "p_main_party"),
(store_random_in_range,":rain_strength",1,101), ## this will output a random number between 1 and 100
(try_begin),
(eq, ":terrain_type", rt_snow),
(set_rain,2,":rain_strength"),
(else_try),
(set_rain,1,":rain_strength"),
(try_end),
(try_end),
])
(scene_set_day_time,<time of day>),
This is a indirect command, basicly the time of day will determine what type of skybox will be used. We cant choose a specific skybox, the game is hardcoded to choose from the existing ones randomly if they fit specific settings.
scene_set_day_time is pretty straigthforward to use, note that it also needs to be set before the mission starts and cant be changed during a mission:
(ti_before_mission_start, 0, 0, [],
[
(scene_set_day_time, 13), ## sets time of day to 1 pm
]),
[
(scene_set_day_time, 13), ## sets time of day to 1 pm
]),
Now that we could choose between a night/dawn/day skybox, how can we further specify if its cloudy or not? Here comes the command (set_global_cloud_amount,<strenght>) into play.
The higher the strenght the more likely it is that the game will choose a cloudy version of the skybox. (i am not sure about exact values, this would need extensive testings as its hardcoded and cant be looked at easy)
(ti_before_mission_start, 0, 0, [],
[
(set_global_cloud_amount, 100), ## sets cloud amount to very very cloudy
]),
[
(set_global_cloud_amount, 100), ## sets cloud amount to very very cloudy
]),
Lastly we have set_fog_distance.
(set_fog_distance,<distance>,<color in hex code>),
This is the only command we can dynamical change during a mission.
The distance is distance in meters. Note that anything below 20 is way too foggy imo, something like 550-800 is good for a little bit haze at sunny days, anything over 1500 seems to have nearly no fog/haze at all (its there but barely visible).
The color needs to be coded in the following way:
0xAARRGGBB --> A is alpha value, not used for fog and should be set to FF
--> R,G and B are Red, Green and Blue values of the color.
for example: 0xFF0000FF would be totally blue fog.
abhu_fog = (0,0,ti_once, [],
[
(set_fog_distance,50,0xFFB3B3AC),
]
[
(set_fog_distance,50,0xFFB3B3AC),
]
One last example to show this all together: we want a cloudy scene at dawn, with mid-range fog and slightly raining:
(ti_before_mission_start, 0, 0, [],
[
(scene_set_day_time, 6),
(set_global_cloud_amount, 100),
(set_rain,1,30),
]),
(0,0,ti_once, [],
[
(set_fog_distance,250,0xFFB3B3AC),
]
[
(scene_set_day_time, 6),
(set_global_cloud_amount, 100),
(set_rain,1,30),
]),
(0,0,ti_once, [],
[
(set_fog_distance,250,0xFFB3B3AC),
]
most script examples are made-up as i wrote this, to script your own weather setup this should give you the basics.