This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [QUESTION] Can this be done to the Weather?  (Read 2454 times)

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
[QUESTION] Can this be done to the Weather?
« 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #1 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #2 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;
}
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [QUESTION] Can this be done to the Weather?
« Reply #3 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;
    }
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #4 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #5 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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #6 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #7 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #8 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?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Milly

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 503
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #9 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [QUESTION] Can this be done to the Weather?
« Reply #10 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

Magnus

  • Moderators
  • Wiki Incarnate
  • *****
  • Posts: 147
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #11 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

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;
   }
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #12 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Magnus

  • Moderators
  • Wiki Incarnate
  • *****
  • Posts: 147
    • View Profile
Re: [QUESTION] Can this be done to the Weather?
« Reply #13 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »