weather
Moderator: Panzer Corps 2 Moderators
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
Did u have any reply? i am tryng this,but is not working. i am sure about the condition (it was on lua manual examples), so it must be wrong the following function.
-- condition
function estate()
return world.round >= 1 and world.round <= 5
end
-- function
function bel_tempo()
world.weather = Clear
end
-- condition
function estate()
return world.round >= 1 and world.round <= 5
end
-- function
function bel_tempo()
world.weather = Clear
end
Re: weather
function bel_tempo()cicciopastic wrote: ↑Mon Mar 29, 2021 10:26 pm Did u have any reply? i am tryng this,but is not working. i am sure about the condition (it was on lua manual examples), so it must be wrong the following function.
function bel_tempo()
world.weather = Clear
end
world.weather.key = Clear
end
try this
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
Hello Grondel and cicciopastic and the other hard working friends of LUA testing!
I found a way for that theme and it works really for my needs. With that you can have rainy weather with round 2,
although "dry" is set in the scenario parameters.
In theory, it could also be used for other applications:
function W1() -- Editor: Trigger Round
return world.round == 2
end
function Z1() -- Weather definition
world.weather.key = Rain
end
The trigger definition for the editor looks like this:
Name: Z1
Count:1
Function: W1
StartTurnAction
Don't forget your umbrellas...
After some playtesting you need also built in a separate command for the "Humidity".
Otherwise the ground keeps dry...
I found a way for that theme and it works really for my needs. With that you can have rainy weather with round 2,
although "dry" is set in the scenario parameters.
In theory, it could also be used for other applications:
function W1() -- Editor: Trigger Round
return world.round == 2
end
function Z1() -- Weather definition
world.weather.key = Rain
end
The trigger definition for the editor looks like this:
Name: Z1
Count:1
Function: W1
StartTurnAction
Don't forget your umbrellas...
After some playtesting you need also built in a separate command for the "Humidity".
Otherwise the ground keeps dry...
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
hi mate!
thanks for your answer .... i've tryed something like u suggesting, but is not working
in return i got some very strange effects as (i had to have clear weather on a 100% rain scenario): i got clear on the top screen bar, but rain on the screen ....
i dont' know how that was possible!
ciao Pietro
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
reading a bit furthermore yuor post it come to my mind that i could have missinterpreted mud as rain??? i will check tonight and i will follow your suggestion changhing humidity to 0cicciopastic wrote: ↑Wed Mar 31, 2021 10:59 am
in return i got some very strange effects as (i had to have clear weather on a 100% rain scenario): i got clear on the top screen bar, but rain on the screen ....![]()
let see .... tks again!
Re: weather
Strange to hear that ... thats why here come a more comfortable script for you.
Scenario parameter is "Summer", "No Clouds", and ground "dry".
With that, rain comes after round 2 and goes after round 5 (nearly), after that the weather keeps clear.
I had also add the humidity command, because the standard value for that keeps otherwise dry.
Rain -> Muddy ground!
Finally you get with that a nice weather report to your attention:
function W1() -- Editor: Trigger Round
return world.round >= 2 and world.round <= 5
end
function Z1() -- Weather definition
world.weather.key = Rain
world.humidity = 50
MessageBox("Weather Report!", "Rain is coming!")
end
function W2() -- Editor: Trigger Round
return world.round == 7
end
function Z2() -- Weather definition
world.weather.key = Clear
world.humidity = 0
MessageBox("Weather Report!", "Nice weather is coming!")
end
Name: Z1
Count:1
Function: W1
StartTurnAction
Name: Z2
Count:1
Function: W2
StartTurnAction
Hopefully it works for you... in my scenario it works perfect.
Scenario parameter is "Summer", "No Clouds", and ground "dry".
With that, rain comes after round 2 and goes after round 5 (nearly), after that the weather keeps clear.
I had also add the humidity command, because the standard value for that keeps otherwise dry.
Rain -> Muddy ground!
Finally you get with that a nice weather report to your attention:
function W1() -- Editor: Trigger Round
return world.round >= 2 and world.round <= 5
end
function Z1() -- Weather definition
world.weather.key = Rain
world.humidity = 50
MessageBox("Weather Report!", "Rain is coming!")
end
function W2() -- Editor: Trigger Round
return world.round == 7
end
function Z2() -- Weather definition
world.weather.key = Clear
world.humidity = 0
MessageBox("Weather Report!", "Nice weather is coming!")
end
Name: Z1
Count:1
Function: W1
StartTurnAction
Name: Z2
Count:1
Function: W2
StartTurnAction
Hopefully it works for you... in my scenario it works perfect.
Re: weather
triggerin rain works fine, but triggering sun to prevent planes from crashing does not sadly.
current work around is make planes fly despite of rain, but looks weird
current work around is make planes fly despite of rain, but looks weird
Re: weather
Thanks for the feedback Grondel!
This could mean that all aircraft need an additional "landing command" with the first rain function to simulate the correct behavior in rain. The reason for this,... I would think..., is, that the scenario parameters basically say "no rain" and we presumably only overwrite the weather but not the game mechanics of the aircraft. Now you have to find a meaningful LUA combination for:
-All planes!
-Aggressiveness goes to 0?
-Armament goes to 0?
-Move back to airfield?
-...?
... something like that.
Maybe, the secret is connected with the weather.csv:
With rain, the air_operations value is false (not possible) and other values have also other effects.
This could mean that all aircraft need an additional "landing command" with the first rain function to simulate the correct behavior in rain. The reason for this,... I would think..., is, that the scenario parameters basically say "no rain" and we presumably only overwrite the weather but not the game mechanics of the aircraft. Now you have to find a meaningful LUA combination for:
-All planes!
-Aggressiveness goes to 0?
-Armament goes to 0?
-Move back to airfield?
-...?
... something like that.
Maybe, the secret is connected with the weather.csv:
With rain, the air_operations value is false (not possible) and other values have also other effects.
Re: weather
u can set air_operations to true and planes will fly, u can set weather.key to Clear and the symbol in the ui will change BUT it will still be raining. the grafic is not influenced by the lua.
Re: weather
Yes, I tested again and sadly the own and the oppostite air force can fly and attacks despite bad weather. Now we have looking for the right additional commands...
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
i´m not sure yet if this is a bug or i´m incompetent
need more research
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
don't worry yesterday i lost 30-40 minutes because i insisted to write else if instead of elseif
i think they should do a much more complete lua manual for pzc2 with plenty of examples .... anyhow since i downloaded notepad++ everything is much easier
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
Fine, I made an add on to the "air force still flying" problem.
-
jeannot le lapin
- 1st Lieutenant - 15 cm sFH 18

- Posts: 828
- Joined: Sun Dec 10, 2017 3:29 pm
Re: weather
You should use Notepad++(Freeware):cicciopastic wrote: ↑Wed Mar 31, 2021 8:30 pm![]()
![]()
![]()
![]()
![]()
don't worry yesterday i lost 30-40 minutes because i insisted to write else if instead of elseif![]()
![]()
![]()
... and some days before i lost half an hour beacause i was missing and end !
i think they should do a much more complete lua manual for pzc2 with plenty of examples .... anyhow since i downloaded notepad++ everything is much easier
-
cicciopastic
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 173
- Joined: Mon Oct 26, 2015 9:01 pm
Re: weather
yes m8, as i wrote i just started to use it! tks anyway for your suggestion .... as i told its not easy to start from zero and indeed notepad++ hepls a lot!
tks again,
tks again,

