Weather change event?

Post » Mon Nov 19, 2012 12:00 am

Hello there :)
Is there a way to handle the event when the weather changes? For example from pleasant to cloudy?

Thank you.
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Sun Nov 18, 2012 9:45 pm

Not sure, but your best bet is to poke around here for stuff: http://www.creationkit.com/Weather_Script
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Sun Nov 18, 2012 8:19 pm

Yes, I know about Weather Script but I cannot check if weather is changing.


Anyway: Thank you
User avatar
Spooky Angel
 
Posts: 3500
Joined: Thu Aug 10, 2006 5:41 pm

Post » Sun Nov 18, 2012 11:37 pm

http://www.creationkit.com/GetCurrentWeather_-_Weather

That ^^^^ and a FormList (hopefully) is probably all you need.

So ... create a formlist
Create a script with an OnUpdate Event (or similar) to get the Current-Weather
The first time this is run (FormList is empty) add the result to the FormList
The next time the script is run get the OLD VALUE, from the FormList and compare it to the new value

Rinse and repeat via the OnUpdate Event


Should be OK ...?
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Mon Nov 19, 2012 2:33 am

Thanks! I never used formlists yet. But the event OnUpdate() is called with a weather chage too?
User avatar
Rachael
 
Posts: 3412
Joined: Sat Feb 17, 2007 2:10 pm

Post » Sun Nov 18, 2012 8:48 pm

Thanks! I never used formlists yet. But the event OnUpdate() is called with a weather chage too?
No. (OnUpdate is always called, depending on the time interval you set for it to fire)

You run an OnUpdate check continuously, comparing the old value to the current value. When the two values are not equal that means you have a weather transition. Depending on what you are doing you also need to determine if it is still in transition using GetCurrentWeatherTransition which returns the fraction complete the transition is. Then you can set the old weather using GetOutgoingWeather() or just set oldWeather = curWeather before setting the curWeather to the new weather.

More generally, weather is changing if GetCurrentWeather is < 1.0 or > 0. But that is two comparisons and it may be quicker just to check that the current weather is not the same as the previous weather.

Edit: Also, GetOutgoingWeather != None should tell you in one step if a transition is occurring. It returns None if there is no transition currently happening.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Mon Nov 19, 2012 8:32 am

Ok :) I'll try this way. Thank you.
User avatar
Jay Baby
 
Posts: 3369
Joined: Sat Sep 15, 2007 12:43 pm


Return to V - Skyrim