Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Miscellaneous => Topic started by: Valkryst on September 02, 2014, 06:28:59 am

Title: [QUESTION] Can this be done to the Weather?
Post by: Valkryst on September 02, 2014, 06:28:59 am
Hey,

After working all day with Milly I've finally managed to get a very nice looking night time for an area. Although I've nearly perfected the look, there is one terrible bug. Whenever a weather event begins where it starts raining, snowing, etc... the light, sky, and everything I've set changes from a nice night time look to a bright daytime look.

What I'm wondering is if there is a way to change the look of the weather, have the weather take the look of the light and all that which is already set, or somehow set the weather to only work during daytime.

Any information is appreciated, thanks.

--------------------------------------------------------------

This is being done on WotLK 3.3.5a, Trinity Core.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: schlumpf on September 02, 2014, 08:50:25 am
Weather.dbc has a light entry since some version. Not sure which one. There is also a spell effect with time-of-day or light override. Again, not sure since when.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Milly on September 02, 2014, 02:21:02 pm
No idea if the light setting can be fixed to work with the nights, but you can make it so weather only happens during day.

Quote from: "Magnus"
And may the following snippet helps somebody to prevent the problem with rain/snow/fog destroying the night effect. Just add it in the beginning of Weather::ReGenerate() in weather.cpp. So you will have sun weather in the night. (May adjust the time).

Code: [Select]
// night cycle if time between 21:00 and 6:00
    time_t curTime = time(NULL);
    tm localTm;
    ACE_OS::localtime_r(&curTime, &localTm);

if (localTm.tm_hour>=21 || localTm.tm_hour<=6)
{
TC_LOG_INFO("weather", "It's night time.");
m_type = WEATHER_TYPE_FINE;
m_grade = 0.0f;
return false;
}
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Valkryst on September 02, 2014, 03:43:45 pm
Quote from: "Milly"
No idea if the light setting can be fixed to work with the nights, but you can make it so weather only happens during day.

Quote from: "Magnus"
And may the following snippet helps somebody to prevent the problem with rain/snow/fog destroying the night effect. Just add it in the beginning of Weather::ReGenerate() in weather.cpp. So you will have sun weather in the night. (May adjust the time).

Code: [Select]
// night cycle if time between 21:00 and 6:00
    time_t curTime = time(NULL);
    tm localTm;
    ACE_OS::localtime_r(&curTime, &localTm);

if (localTm.tm_hour>=21 || localTm.tm_hour<=6)
{
TC_LOG_INFO("weather", "It's night time.");
m_type = WEATHER_TYPE_FINE;
m_grade = 0.0f;
return false;
}

Thanks Schlumpf and Milly. I've looked around the Weather.dbc file and I'll probably do some tests with it when I get a chance. For-now I'll use an edit to Weather.cpp.

Although the code you provided probably worked at some point, it wouldn't compile properly for me. After a minute or two I made the following changes to get it to compile and hopefully work in the same way.

Code: [Select]
 // night cycle if time between 21:00 and 6:00
    time_t t;
    short hour;
    t = time(NULL);
    hour = localtime(&t)->tm_hour;
   
    if (hour>=21 || hour<=6)
    {
      TC_LOG_INFO("weather", "It's night time.");
      m_type = WEATHER_TYPE_FINE;
      m_grade = 0.0f;
      return false;
    }
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: kojak488 on September 03, 2014, 04:20:03 pm
Please note that Milly didn't create that code.  Thanks goes to its original author (on this forum), Magnus.  Though I suspect he got the code from another forum anyway.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Milly on September 03, 2014, 10:09:33 pm
Quote from: "kojak488"
Please note that Milly didn't create that code.  Thanks goes to its original author (on this forum), Magnus.  Though I suspect he got the code from another forum anyway.
I already quoted Magnus in my post. Check it again :P
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: kojak488 on September 06, 2014, 02:32:36 am
Quote from: "Milly"
Quote from: "kojak488"
Please note that Milly didn't create that code.  Thanks goes to its original author (on this forum), Magnus.  Though I suspect he got the code from another forum anyway.
I already quoted Magnus in my post. Check it again :P

Why are you telling me?  I'm not the one that thanked you.  You should direct your post at the other guy.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Milly on September 06, 2014, 03:53:08 am
Quote from: "kojak488"
Quote from: "Milly"
Quote from: "kojak488"
Please note that Milly didn't create that code.  Thanks goes to its original author (on this forum), Magnus.  Though I suspect he got the code from another forum anyway.
I already quoted Magnus in my post. Check it again :P

Why are you telling me?  I'm not the one that thanked you.  You should direct your post at the other guy.
Um, perhaps it's because you're suggesting that I took the code as my own? And that's sorta a dick thing to do.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: kojak488 on September 07, 2014, 01:41:13 pm
Quote from: "Milly"
Um, perhaps it's because you're suggesting that I took the code as my own? And that's sorta a dick thing to do.

I suggested no such thing.  Valkryst was thanking you and made no mention of Magnus.  I pointed out to him that the thanks goes to Magnus rather than you.

Reading is hard, eh?
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Milly on September 07, 2014, 08:39:29 pm
Quote from: "kojak488"
Quote from: "Milly"
Um, perhaps it's because you're suggesting that I took the code as my own? And that's sorta a dick thing to do.

I suggested no such thing.  Valkryst was thanking you and made no mention of Magnus.  I pointed out to him that the thanks goes to Magnus rather than you.

Reading is hard, eh?
And in no way did Valkryst ever suggest that I made the code. He thanked me for sharing it.

Reading sure is hard kojak.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Valkryst on September 07, 2014, 08:41:21 pm
Quote from: "kojak488"
Quote from: "Milly"
Um, perhaps it's because you're suggesting that I took the code as my own? And that's sorta a dick thing to do.

I suggested no such thing.  Valkryst was thanking you and made no mention of Magnus.  I pointed out to him that the thanks goes to Magnus rather than you.

Reading is hard, eh?


Milly is the one who provided a solution to my problem and Magnus wrote the code. Magnus wasn't one who posted here in response to my questions and so I wont be thanking him here. Problem solved.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Magnus on October 05, 2014, 11:49:37 am
Such a strange conversation here  :D

The code I posted first indeed must be adjusted a litte bit because in the meantime Trinity changed the ACE lib to Boost (http://www.boost.org/)

F. ex. like this (or Valkryst example):
Code: [Select]

 // night cycle if time between 21:00 and 6:00
time_t curTime = time(NULL);
tm localTm;
localtime_r(&curTime, &localTm);

 if (localTm.tm_hour>=21 || localTm.tm_hour<=6)
   {
      TC_LOG_INFO("weather", "It's night time.");
      m_type = WEATHER_TYPE_FINE;
      m_grade = 0.0f;
      return false;
   }
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: kojak488 on October 11, 2014, 02:15:38 pm
Quote from: "Milly"
Quote from: "kojak488"
Quote from: "Milly"
Um, perhaps it's because you're suggesting that I took the code as my own? And that's sorta a dick thing to do.

I suggested no such thing.  Valkryst was thanking you and made no mention of Magnus.  I pointed out to him that the thanks goes to Magnus rather than you.

Reading is hard, eh?
And in no way did Valkryst ever suggest that I made the code. He thanked me for sharing it.

Reading sure is hard kojak.

Holy shit you're dumb.  I don't give two fucks what he thanked you for.  He didn't thank Magnus.  It doesn't matter who posted it here; the creator deserves the thanks.

RIP braincells.
Title: Re: [QUESTION] Can this be done to the Weather?
Post by: Magnus on October 11, 2014, 02:22:14 pm
Please stop that kind of discussion  :shock:

It's not worthy because of 10 lines of code.