I have a big ol' Barbarossa multiplayer map just sitting idle because I don't know how to change the weather properly. ...it needs seasons or else it will be kinda silly.
changing weathe via LUA script
Moderator: Panzer Corps 2 Moderators
changing weathe via LUA script
Is there any example scenario/lua of changing the weather based on a turn check, or changing the weather within a range of turns?
I have a big ol' Barbarossa multiplayer map just sitting idle because I don't know how to change the weather properly. ...it needs seasons or else it will be kinda silly.
I have a big ol' Barbarossa multiplayer map just sitting idle because I don't know how to change the weather properly. ...it needs seasons or else it will be kinda silly.
-
jeannot le lapin
- 1st Lieutenant - 15 cm sFH 18

- Posts: 827
- Joined: Sun Dec 10, 2017 3:29 pm
Re: changing weathe via LUA script
Lua Scripting Manual...there is an example with weather.
Be more precise in your request.
Be more precise in your request.
Re: changing weathe via LUA script
I have seen the example in the manual. It doesn't help me much.jeannot le lapin wrote: ↑Sun Nov 22, 2020 6:30 am Lua Scripting Manual...there is an example with weather.
Be more precise in your request.
Anyways, to be more specific than my op is...
I want to change the weather from summer, to fall, to winter - all within one scenario (Barbarossa AGC/AGN Multiplayer map).
I see this going one of two ways:
a) manually set all weather parameters for every turn, or a range of turns (ie a season)
-or-
b) adjust the percentage chances of clouds, rain ect to simulate season changes (this would obviously include changing to sub-zero temp in winter)
I understand all the weather options in the editor and there effects. I just don't know how to go about lua scripting the first method. I am not sure if the second method is even possible via lua.
-
jeannot le lapin
- 1st Lieutenant - 15 cm sFH 18

- Posts: 827
- Joined: Sun Dec 10, 2017 3:29 pm
Re: changing weathe via LUA script
Have you figured out Lua scripting or nothing at all?
I did not find an example in the scenarios
I did not find an example in the scenarios
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: changing weathe via LUA script
hi netscape,NETSCAPE wrote: ↑Tue Nov 24, 2020 4:04 am
I want to change the weather from summer, to fall, to winter - all within one scenario (Barbarossa AGC/AGN Multiplayer map).
I see this going one of two ways:
a) manually set all weather parameters for every turn, or a range of turns (ie a season)
-or-
b) adjust the percentage chances of clouds, rain ect to simulate season changes (this would obviously include changing to sub-zero temp in winter)
I understand all the weather options in the editor and there effects. I just don't know how to go about lua scripting the first method. I am not sure if the second method is even possible via lua.
did u solve the wheather problem via LUA? i've got the same problem
Re: changing weathe via LUA script
As currently implemented, you'd have to go with option a. The relevant fields are:NETSCAPE wrote: ↑Tue Nov 24, 2020 4:04 am I want to change the weather from summer, to fall, to winter - all within one scenario (Barbarossa AGC/AGN Multiplayer map).
I see this going one of two ways:
a) manually set all weather parameters for every turn, or a range of turns (ie a season)
-or-
b) adjust the percentage chances of clouds, rain ect to simulate season changes (this would obviously include changing to sub-zero temp in winter)
I understand all the weather options in the editor and there effects. I just don't know how to go about lua scripting the first method. I am not sure if the second method is even possible via lua.
Code: Select all
world.weather
world.ground_state
world.humidity
world.weather_forecast
world.cold_winter
At the risk of creating a redundant update problem (between the scenario definition in the editor and the corresponding scenario script), you could implement a StartTurnAction effect function during round 0 to set the Time & Date and Weather parameters as properties on a Lua variable in your scenario script, then use/update it in one or more NewRoundAction condition/effect functions as desired.
Re: changing weathe via LUA script
That is probably not enough.
We tested this with the weather settings in a LUA file and it didn't work (completely). Rain comes, but aircraft could still be used, despite the instruction/special command:
"air_operations = false" ...
... as a definition from the weather file.
This command could be added to your list.
My assumption is that if "dry" is set in the scenario parameters in the editor - "dry" has a higher priority and blocks the "no-fly" option. Was reported in the bug area some days ago.
We tested this with the weather settings in a LUA file and it didn't work (completely). Rain comes, but aircraft could still be used, despite the instruction/special command:
"air_operations = false" ...
... as a definition from the weather file.
This command could be added to your list.
My assumption is that if "dry" is set in the scenario parameters in the editor - "dry" has a higher priority and blocks the "no-fly" option. Was reported in the bug area some days ago.
Re: changing weathe via LUA script
Can someone please show me what the lua script would look like if you want to change the weather in the scenario?
Thanks!
Thanks!



