weather

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
Grondel
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

weather

Post by Grondel »

is there any way to have certain weather on a certain turn to prevent spawning air-waves from crashing at spawn?
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

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
Grondel
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

Re: weather

Post by Grondel »

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
function bel_tempo()
world.weather.key = Clear
end


try this
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

Grondel wrote: Tue Mar 30, 2021 10:43 am function bel_tempo()
world.weather.key = Clear
end
try this
not working neither! ... i touhgt i had to use quotes on Clear, but NO ..... still need help.

did u solve the problem for yourself? i want summer turns to be clear, but i cant set them as i want
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: weather

Post by asuser »

Hello Grondel and cicciopastic and the other hard working friends of LUA testing! :wink:


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... :wink:
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

asuser wrote: Wed Mar 31, 2021 9:02 am Hello Grondel and cicciopastic and the other hard working friends of LUA testing! :wink:

hi mate!

thanks for your answer .... i've tryed something like u suggesting, but is not working :cry: , i will try it tonight again, maybe i missspelled something (?)

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 .... :shock:

i dont' know how that was possible! :roll: : if i will get that again i will ask for a bug "investigation"

ciao Pietro
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

cicciopastic 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 .... :shock:
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 0

let see .... tks again!
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: weather

Post by asuser »

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.
Grondel
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

Re: weather

Post by Grondel »

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
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: weather

Post by asuser »

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.
Grondel
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

Re: weather

Post by Grondel »

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.
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: weather

Post by asuser »

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
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

Grondel wrote: Wed Mar 31, 2021 4:53 pm 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.
so it wasn't me!!! :lol: :lol: :lol: :lol: :lol:

Grondel did u post this problem as a bug?
Grondel
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

Re: weather

Post by Grondel »

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

Re: weather

Post by cicciopastic »

Grondel wrote: Wed Mar 31, 2021 6:44 pm i´m not sure yet if this is a bug or i´m incompetent ;) need more research
:lol: :lol: :lol: :lol: :lol:

don't worry yesterday i lost 30-40 minutes because i insisted to write else if instead of elseif :lol: :lol: :lol: :lol: ... 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
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

i asked this to be checked here

viewtopic.php?f=464&t=97527&p=918671#p918671
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: weather

Post by asuser »

Fine, I made an add on to the "air force still flying" problem.
jeannot le lapin
1st Lieutenant - 15 cm sFH 18
1st Lieutenant - 15 cm sFH 18
Posts: 828
Joined: Sun Dec 10, 2017 3:29 pm

Re: weather

Post by jeannot le lapin »

cicciopastic wrote: Wed Mar 31, 2021 8:30 pm
Grondel wrote: Wed Mar 31, 2021 6:44 pm i´m not sure yet if this is a bug or i´m incompetent ;) need more research
:lol: :lol: :lol: :lol: :lol:

don't worry yesterday i lost 30-40 minutes because i insisted to write else if instead of elseif :lol: :lol: :lol: :lol: ... 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
You should use Notepad++(Freeware):

Capture d’écran (740).jpg
Capture d’écran (740).jpg (52.41 KiB) Viewed 4684 times

Capture d’écran (739).jpg
Capture d’écran (739).jpg (33.84 KiB) Viewed 4684 times
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: weather

Post by cicciopastic »

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,
Post Reply

Return to “Panzer Corps 2 Scenario Design”