Making weather more dynamic (scripting)

Discussions on Modding of S.T.A.L.K.E.R. SoC & Clear Sky

Making weather more dynamic (scripting)

Postby ket on 12 Oct 2011 23:28

Me again :p First time I've considered playing with level_weather.script so perhaps somebody with better scripting knowledge can answer this. Is it possible to "combine" 2 weather ltx files? By which I mean could I open up level_weather.script and add extra weather files there for the game to switch between?

For example, change this;

function WeatherManager:reset()
--printf ("WeatherManager:WeatherManager():Reset()")

local ini = ini_file("game.ltx")
local weather = utils.cfg_get_string(ini, level.name(), "weathers", db.actor, false, "", "default")
local postprocess = utils.cfg_get_string(ini, level.name(), "postprocess", db.actor, false, "")
if postprocess ~= nil then
printf("LEVEL POSTPROCESS: level: [%s], postprocess: [%s]", level.name(), postprocess)
level.add_pp_effector(postprocess, 999, true)
else
printf("LEVEL POSTPROCESS: level: [%s], postprocess: [none]", level.name())
level.remove_pp_effector(999)
end

if weather == "p_surge_day" then

self.weather_list = xr_logic.parse_condlist(db.actor, level.name(), "weather", "default")
else
self.weather_list = xr_logic.parse_condlist(db.actor, level.name(), "weather", weather)
end
self:select_weather(w,true)
end


To this; (changes in RED)

function WeatherManager:reset()
--printf ("WeatherManager:WeatherManager():Reset()")

local ini = ini_file("game.ltx")
local weather = utils.cfg_get_string(ini, level.name(), "weathers", db.actor, false, "", "default", "rain")
local postprocess = utils.cfg_get_string(ini, level.name(), "postprocess", db.actor, false, "")
if postprocess ~= nil then
printf("LEVEL POSTPROCESS: level: [%s], postprocess: [%s]", level.name(), postprocess)
level.add_pp_effector(postprocess, 999, true)
else
printf("LEVEL POSTPROCESS: level: [%s], postprocess: [none]", level.name())
level.remove_pp_effector(999)
end

if weather == "p_surge_day" then

self.weather_list = xr_logic.parse_condlist(db.actor, level.name(), "weather", "default", "rain")
else
self.weather_list = xr_logic.parse_condlist(db.actor, level.name(), "weather", weather)
end
self:select_weather(w,true)
end


Any input is welcome :D
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Making weather more dynamic (scripting)

Postby Nightwatch on 13 Oct 2011 01:15

I don't think it would work in the way as you propose to do so. The parse_condlist in xr_logic is set in a specific way which is being checked in level_weathers file. definition is as: parse_condlist(npc, section, field, src)
I would myself try to be on the cautious side and would enter only one specific weather mode, so to say, like either rain or default.
xr_logic is full of abort orders, it's best to stay on the safe side. You may, however, as I would guess, try to add another line into the script like after the second line:

else
self.weather_list = xr_logic.parse_condlist(db.actor, level.name(), "weather", rain)

It may depend on if you've done any modifications on xr_logic and/or the rest of your level_weathers script goes.

(PS: you may have done it with a purpose, of course, but I though that nevertheless I should bring this part in your level_weathers script to your attention: self:select_weather(w,true) )
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2615
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Making weather more dynamic (scripting)

Postby ket on 13 Oct 2011 10:09

Thanks Nightwatch, useful info :D I'll probably have to pick your brain some more but for now I will try simply adding another line as you suggest. I have a rather nice weather system I spent some time on (even moonlight when the sky is clear, no moonlight when cloudy etc) and I need the rain.ltx file to be used as well to complete the "scorched earth" weather. BTW, where is everybody the last few days? I hope the zone hasn't taken them! :mozilla_surprised:
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system


Return to Modding Techniques

Who is online

Users browsing this forum: No registered users and 1 guest

cron