• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Resource [20.1+] Weather System 1.3.4

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
It isn't right now if you mean showing the weather on the town map. But it's something that's on the to-do list.
 

Jedahjony

Novice
Member
Joined
Aug 27, 2023
Posts
40
Hi Lin! i have 2 version of this files
1697828160062.png

What are the good ones?
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
The 02 - Map_Display are the new ones. Although, as a good practice, you may want to delete the plugins you want to update before dropping the updated version.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
Thank you so much for integrating Weather Encounters into your plugin! Everything now works as I would have wished it to work! On a sidenote, my previous errorlog resulted from me not properly understanding what the "WEATHER_SUBSTITUTE" section does and how to properly define it, once I figured that out, everything works perfectly :)

I suppose you HAVE to start a new save file with this plugin whenever you change some of the Configurations, right? I tried yesterday with an old save and it resulted in some strange weather behaviours, like having a Blizzard in my desert map even though Blizzard should only occure in my mountain map. However, starting a new save sorted that out and - once again - everything now works perfectly! :)
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
Well, I don't have a save file on the pokemon essentials versions I use to test the plugin so I'm not sure if it's a requisite for all changes on the configuration file or just some of them. But if something weird happens in the game when you change the configuration, starting a new game should fix it, yes.

As for the explanation of how to configure each part of the plugin, I tried to do my best on it but even I can recognise that there are things that are hard to explain and understand. Unfortunately, I have simplified the configuration of those parts as much as I can right now. Suggestions on how to better explain things are welcome, though.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
A friend of mine produced the following error while betatesting my project:

Code:
[2023-10-25 19:34:08 +0200]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: ArgumentError
Message: argument out of range

Backtrace:
<internal:timev>:310:in `initialize'
[Lin's Weather System] 01 - Main.rb:105:in `new'
[Lin's Weather System] 01 - Main.rb:105:in `pbGetEndTime'
[Lin's Weather System] 01 - Main.rb:173:in `pbUpdateWeather'
[Lin's Weather System] 03 - Handler.rb:17:in `block in <main>'
035:Event_Handlers:89:in `block in trigger'
035:Event_Handlers:89:in `each_value'
035:Event_Handlers:89:in `trigger'
036:Event_HandlerCollections:63:in `trigger'
044:Game_MapFactory:147:in `setMapChanged'

I also use the Unreal Time System, giving the player the possibility to change time by going to sleep at their bed. According to him, he was doing exactly that and after he exited the house (and entered one of the maps that uses weather defined in this plugin), his game crashed. I was also able to reproduce the error, although it took me around 30 time skips (I always slept until 12pm on the following day, so doing 24 hour skips each time). I suppose it might have something to do with the time interval I set for the next weather change? And skipping time might result in jumping to a time that is outside of the range for the weather change to occure? For context, my Weather System Configuration looks like this:

Code:
module WeatherConfig
  # Set to false to use the Weather System.
  NO_WEATHER = false        # Default: false

  # Set to false to use the Weather System.
  SHOW_WEATHER_ON_MAP = true    # Default: true

  # Set to true to use the computer's time. Will not work without Unreal Time System.
  USE_REAL_TIME = false        # Default: true

  # Set to true to have the weather change at midnight.
  CHANGE_MIDNIGHT = false    # Default: true

  # Define the min and max amount of time (in hours) before the weather changes.
  # Set the same number to not randomize the amount of time before the weather changes.
  CHANGE_TIME_MIN = 8        # Default: 1
  CHANGE_TIME_MAX = 16        # Default: 4

Oh and don't worry about your explanations within the plugin, they are totally fine, the mistake was on me not properly reading and comprehending everything^^

Edit: I tried to replicate the error consistently, and found the following:

So, my ingame starting date is 1st March 1848. Whenever I skipped time to the 31st March and THEN left the house/ entered the map that uses the Weather System, the game crashes. HOWEVER, if I skip over 31st March all the way to 1st April before leaving the house, the game does not crash.
 
Last edited:

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
Mmm... I think I see what the problem is. The error is with the midnight code, which added a day to the starting time regardless of what day it was. Since the plugin calculates this date regardless if you use it or not, it's throwing you errors because of a non-existent date. I'll update the plugin again with the fix as soon as possible. Thank you for bringing up this oversight.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
Thanks for the super quick update :) There is just a tiny inconsistency in your new script section for pbGetEndTime in "01 - Main Code/01 - Main". Your new variables are called longMonth and shortMonth, but the script calls longMont and shortMont. I fixed that myself and this fixed the error I encountered previously! :)

Ruby:
def pbGetEndTime(startTime)
  # Midnight of the next day
  longMonth = [1,3,5,7,8,10,12]
  shortMonth = [4,6,9,11]
  leapYear = (startTime.year % 4 == 0) ? true : false
  if startTime.year % 100 == 0
    leapYear = (startTime.year % 400 == 0 && leapYear) ? true : false
  end
  if longMont.include?(startTime.month) && startTime.day == 31
    midnight = Time.new(startTime.year, startTime.month + 1, 1, 0, 0, 0)
  elsif shortMont.include?(startTime.month) && startTime.day == 30
    midnight = Time.new(startTime.year, startTime.month + 1, 1, 0, 0, 0)
  elsif startTime.month == 2 && leapYear && startTime.day == 29
    midnight = Time.new(startTime.year, startTime.month + 1, 1, 0, 0, 0)
  elsif startTime.month == 2 && !leapYear && startTime.day == 28
    midnight = Time.new(startTime.year, startTime.month + 1, 1, 0, 0, 0)
  else
    midnight = Time.new(startTime.year, startTime.month, startTime.day + 1, 0, 0, 0)
  end
  hours = rand(WeatherConfig::CHANGE_TIME_MIN...WeatherConfig::CHANGE_TIME_MAX)
  elapse = hours * 60 * 60
  endTime = startTime + elapse
  # Sets the end of the weather at the next midnight or a determined amount of hours in the future
  endTime = (WeatherConfig::CHANGE_MIDNIGHT) ? midnight : endTime
  return endTime
end
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
Ugh... I was so focused on how to get the leap years that I didn't even check that. I'll upload it again with the fix.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614

REALMUGEN

Trainer
Member
Joined
Jan 23, 2020
Posts
69
Thanks for sharing this script.

I would like to ask a question, is there any way to check what weather is happening outside while on an indoor map?
I'm trying to generate some effects and change some dialogs if certain weather is happening outside (for example, a storm).

But when doing it from an indoor map, I intuit that the game always considers that there is no active weather inside?
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
I guess you are using $game_screen.weather_type or some similar code for the checks. Those codes check the weather for the map you are in and my plugin is configured to only change weather on outdoor maps, so obviously it always returns as none on indoor maps. You have to go directly to where the weather for the moment is stored to see what weather is active outside.

You have an example of it on 01 - Main Code/02 - Forecast. But $WeatherSystem.actualWeather[zone].mainWeather and $WeatherSystem.actualWeather[zone].secondWeather are the codes you need. You have to change "zone" with the number of the zone the outdoor map belongs to.
Also, you have to be aware of two things:
  1. The outdoor map that the indoor map connects to can have any of the weathers you defined in MAPS_SUBSTITUTE with "exclude"?
  2. The outdoor map that the indoor map connects to can have any of the weathers you defined in MAPS_SUBSTITUTE with "include"?
If the answer for the first is yes or the answer for the second is no, you have to use $WeatherSystem.actualWeather[zone].secondWeather. You have to use the other one if it's not the case.
 

REALMUGEN

Trainer
Member
Joined
Jan 23, 2020
Posts
69
I guess you are using $game_screen.weather_type or some similar code for the checks. Those codes check the weather for the map you are in and my plugin is configured to only change weather on outdoor maps, so obviously it always returns as none on indoor maps. You have to go directly to where the weather for the moment is stored to see what weather is active outside.

You have an example of it on 01 - Main Code/02 - Forecast. But $WeatherSystem.actualWeather[zone].mainWeather and $WeatherSystem.actualWeather[zone].secondWeather are the codes you need. You have to change "zone" with the number of the zone the outdoor map belongs to.
Also, you have to be aware of two things:
  1. The outdoor map that the indoor map connects to can have any of the weathers you defined in MAPS_SUBSTITUTE with "exclude"?
  2. The outdoor map that the indoor map connects to can have any of the weathers you defined in MAPS_SUBSTITUTE with "include"?
If the answer for the first is yes or the answer for the second is no, you have to use $WeatherSystem.actualWeather[zone].secondWeather. You have to use the other one if it's not the case.
Thank you so much for all the explanation :)
 
Back
Top