• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • 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.8

Capparh

Rookie
Member
Joined
Nov 10, 2020
Posts
4
You're right, it works! It just gets "dark" before it is actually "night" time, Thanks again, great plugin! :D
 

ardicoozer

Cooltrainer
Member
Joined
Sep 29, 2020
Posts
171
Hello Lin,
It's possible to set a weather based on month?
Like if in June - August, weather change to rain..
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Do you mean forcing a specific weather on a specific month? If so, it may be possible.

I just made this up, so it may not work or have mistakes.

For the configuration, add this anywhere between module WeatherConfig (at the start of the Configuration file) and the end at the very end of the Configuration file. Just make sure you don't put it in the middle of another setting or it'll cause problems for you.
Ruby:
Expand Collapse Copy
  # Array to force specific weather on specific months. Format: weather ID, month number, probability.
  # 100 or more will cause the weather always to appear.
  # Turn the month or probability to 0 to not use this feature.
  MONTH_WEATHER = [
    [:Snow, 1, 50],
    [:Rain, 4, 100]
  ]
I put some examples of how it should look like.

Now, on 01 - Main Code/03 - Handler, add those lines bellow the duration = 0 on line 23:
Ruby:
Expand Collapse Copy
  WeatherConfig::MONTH_WEATHER.length.times do |i|
    if WeatherConfig::MONTH_WEATHER[i][1] == pbGetTimeNow.mon
      chance = rand(100)
      weather = WeatherConfig::MONTH_WEATHER[i][0] if chance <= WeatherConfig::MONTH_WEATHER[i][2] && WeatherConfig::MONTH_WEATHER[i][2] != 0
      break if chance <= WeatherConfig::MONTH_WEATHER[i][2]
    end
 end
If you notice, the way the code is made allows multiple weathers to be forced on the same month. If one weather isn't selected to be forced, it will try to force the next one if there is a next one.

As a note, if you are using the Unreal Time System, you must change the pbGetTimeNow.mon to the command that the plugin uses to get the month.

Please, report if this causes any error since I haven't tested it at all. If it works, I would also appreciate if you inform if it also works so I can add it with an update.
 

ardicoozer

Cooltrainer
Member
Joined
Sep 29, 2020
Posts
171
this is for a weather on specifics maps or all of maps?
in PBS metadata_map.txt must have add a weather config?
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
It's for all maps though with some more additions I should be able to make it work only for certain zones. Zones can be as big as the entire game or as small as a single map. You define how many zones and what maps form them in the Configuration file, in the ZONE_MAPS array.

This plugin overwrites the weather set in the map's metadata if I'm not wrong. In any case, you will not need to add any weather there if you install this plugin, since you can define how many weathers a zone has and how frequent each of them are. You can even have different weather or weather probability depending on what season is in the game. For example, you can define snow and blizzards to only happen in winter.

What you asked (different weather for a specific month) is a step further since seasons are all 3 months and they will share weather probabilities regardless of which month it is.
 

Fil

Novice
Member
Joined
Jul 11, 2024
Posts
12
Hi everyone 🦄
I am trying to do some test with the plugins i like before starting mapping ecc., and i have some difficulties to make this work.
I dunno if has something to do with Unreal Time, i know they should be compatible. I use 21.1 version of Essentials.
My config are: no season, no showing time on map (i don't have planning to add PokèGear in my game)...
I change the probability for the first map (Lappet Town) to check if the plugin works (so i raised Rain probablity and Fog), making change check for the weather at 1/1 hours, and i put proportions in Unreal to 180 second to 1.
As soon as i get out from Red house, i get this:

Ruby:
Expand Collapse Copy
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.9]

Exception: NoMethodError
Message: undefined method `-' for nil:NilClass

Backtrace:
RubyUtilities:376:in `rand'
RubyUtilities:367:in `rand'
[Lin's Weather System] 01 - Main.rb:104:in `pbGetEndTime'
[Lin's Weather System] 01 - Main.rb:173:in `pbUpdateWeather'
[Lin's Weather System] 03 - Handler.rb:17:in `block in <main>'
Event_Handlers:89:in `block in trigger'
Event_Handlers:89:in `each_value'
Event_Handlers:89:in `trigger'
Event_HandlerCollections:63:in `trigger'
Game_MapFactory:147:in `setMapChanged'

For more clarity, i also include my actual config:


Ruby:
Expand Collapse Copy
#===============================================================================
# * Weather System Configuration
#===============================================================================

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

  # Set to true to show the weather on the Town Map.
  SHOW_WEATHER_ON_MAP = false    # 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 = 1        # Default: 1
  CHANGE_TIME_MAX = 1        # Default: 4

  # Set to true to if you want to force the weather to change when interacting with certain events.
  # Use pbForceUpdateWeather in an event to update all zone weathers.
  # Use pbForceUpdateZoneWeather(zone) in an event to update the weather of a zone.
  FORCE_UPDATE = false        # Default: false

  # Set to true to have the outdoor maps change with seasons.
  # The map's appearance will update when leaving an indoor map.
  SEASON_CHANGE = false        # Default: false

  # Set to true if your game starts outdoors and want to show the season splash when going somewhere indoors.
  # Set to false if your game starts indoors and want to show the season splash when going somewhere outdoors.
  OUTDOOR = false        # Default: false

  # Array with the ID of outside tilesets that will change with seasons.
  OUTDOOR_TILESETS = [1, 2]

  # The difference between the ID of the tileset defined for an outdoor map and it's season version.
  # The difference has to be the same for any tileset defined in OUTDOOR_TILESETS.
  # Use the same season tileset as the default outdoor map tileset and define the diference for that season as 0.
  SUMMER_TILESET = 0
  AUTUMN_TILESET = 0
  WINTER_TILESET = 0
  SPRING_TILESET = 0

#===============================================================================
# * Weather Substitute
#===============================================================================
  # A hash with the ID of the maps that will have or not have certain weathers.
  MAPS_SUBSTITUTE = {
    :Snow => ["exclude", 1, 4],
    :Blizzard => ["exclude", 1, 4],
    :Sandstorm => ["include", 5]
  }

  # The ID of the weathers that will substitute the main when in one of the summer or sandstorm maps.
  # There has to be a hash (defined between {}) for each defined zone with weather to substitute.
  # Any weather not defined in the hash for a zone will use the main weather instead.
  WEATHER_SUBSTITUTE = [
    {:None => :None, :Rain => :Rain, :Storm => :Storm, :Snow => :Rain, :Blizzard => :Storm, :Sandstorm => :None, :HeavyRain => :HeavyRain, :Sun => :Sun, :Fog => :Fog},
    {:Snow => :Rain, :Blizzard => :Storm, :Sandstorm => :None},
    {:Snow => :Rain, :Blizzard => :HeavyRain}
  ]

#===============================================================================
# * Weather Names
#===============================================================================
  # A hash that contains the ID of weather and the name to display for each one.
  # Using .downcase will make them lowercase.
  WEATHER_NAMES = {
    :None        => _INTL("None"),
    :Rain        => _INTL("Rain"),
    :Storm        => _INTL("Storm"),
    :Snow        => _INTL("Snow"),
    :Blizzard    => _INTL("Blizzard"),
    :Sandstorm    => _INTL("Sandstorm"),
    :HeavyRain    => _INTL("Heavy rain"),
    :Sun        => _INTL("Sun"),
    :Fog        => _INTL("Fog")
  }

#===============================================================================
# * Zones Configuration
#===============================================================================
  # Arrays of id of the maps of each zone. Each array within the main array is a zone.
  # The maps within each zone will have the same weather at the same time.
  # Each zone may have a different weather than the others.
  ZONE_MAPS = [
    [2, 5],
    [7],
    [21]
  ]
#===============================================================================
# * Map Display
#===============================================================================
  # Array of hashes to get each map's position in the Town Map. Each hash corresponds to a zone in ZONE_MAPS.
  # In "Map Name" you have to put the name the Town Map displays for that point.
  # In Map ID you have to put the ID of the map the name corresponds to, like in ZONE_MAPS.
  MAPS_POSITIONS = [
    #{"Map Name" => Map ID},
    {"Lappet Town" => 2, "Route 1" => 5},
    {"Cedolan City" => 7},
    {"Route 2" => 21}
  ]

  # A hash for the plugin to display the proper weather image on the map.
  # They have to be on Graphics/Pictures/Weather (in 20+) or Graphics/UI/Weather (in 21+).
  WEATHER_IMAGE = {
    :Rain => "mapRain",
    :Storm => "mapStorm",
    :Snow => "mapSnow",
    :Blizzard => "mapBlizzard",
    :Sandstorm => "mapSand",
    :HeavyRain => "mapRain",
    :Sun => "mapSun",
    :Fog => "mapFog"
  }
#===============================================================================
# * Season Probability Configuration
#===============================================================================
  # Arrays of probability of weather for each zone in the different seasons.
  # Each array within the main array corresponds to a zone in ZONE_MAPS.
  # Put 0 to weather you don't want if you define a probability after it.
  # If your game doesn't use seasons, edit the probabilities of one season and copy it to the others.

  # Probability of weather in summer.
  # Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
  ZONE_WEATHER_SUMMER = [
    [10, 80, 0, 0, 0, 0, 0, 0, 10],
    [40, 50],
    [60]
  ]

  # Probability of weather in autumn.
  # Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
  ZONE_WEATHER_AUTUMN = [
    [10, 80, 0, 0, 0, 0, 0, 0, 10],
    [40, 50],
    [60]
  ]

  # Probability of weather in winter.
  # Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
  ZONE_WEATHER_WINTER = [
    [10, 80, 0, 0, 0, 0, 0, 0, 10],
    [40, 50],
    [60]
  ]

  # Probability of weather in spring.
  # Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
  ZONE_WEATHER_SPRING = [
    [10, 80, 0, 0, 0, 0, 0, 0, 10],
    [40, 50],
    [60]
  ]
end

Anyone can help me? 😓 Ty
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
The error seems to be with the range of hours for the weather change. It appears that I didn't check if setting both values as the same number would work. I'll update the fix shortly.
 
  • Like
Reactions: Fil

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
LinKazamine updated [20.1+] Weather System with a new update entry:

1.3.5

  • Changed the code so the WeatherSystem variable is added to existing save files.
  • Fixed an error when the minimum and maximum change time for weather is set the same.
The only changes are in 01 - Main Code/01 - Main so there is no need to overwrite the configuration file.

If the plugin doesn't work on existing save files, report it. I'll change it back to require a new game until I figure out what the problem is.

Read the rest of this update entry...
 
  • Like
Reactions: Fil

Fil

Novice
Member
Joined
Jul 11, 2024
Posts
12
I really appreciate your fast answer and the time you dedicate to fix the problem, but now something else seems going on...
no crashing error to show this time, but if i mantain the proprtion of 180 in Unreal Time and the same config as i have before, now it's Sunny. Always Sunny. Even if i have set the probability for Sunny to 0. Even at Night...
so i think: maybe it's not really sunny. Maybe it's the moving picture of rain that try to appear so many times and so close togheter that seems like flashing stuff, with 1s=180s (6m) and 1h of checking for changing time, it has "only" 10 second to appear and then probably is refreshed for the high probability (80% rain, for testing).
So i lowered the proportion in Unreal Time, putting that to 1s=20s, that should be like it should be in the final game... and now it's always normal time. Like there is no change at all. I try to wait a lot, maybe i am just unlucky, but it's not that. I also try to put the probability of "None" Wheater to 0%, but when i go out the standard Red's house, it's still normal time, even with 100% of probability of rain and 0% to "None".
I try to start a New Game, to be sure. Nothing is changing.
I remove Arcky's Utilities and other Arcky's plugin, rename the project, start new game again. This time is still Sunny even to 1s=20s, everytime.

So, for counter/cross/check, i try to change to the precedent version of your Main file, changin this time the checking rate to 1min and 2max, and everything works like magic 🦄
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Ok, after some testing, it seems that the change I made to allow for existing save files to load this plugin caused that problem. But only if there was an existing save file that was saved when the configuration file had different probabilities for the weather. At least, it started with sunny weather on both a saved file and a new game even though there was 0% of sunny weather.

That issue would solve itself after 2 weather changes (or after only 1), though, since the weather probabilities aren't stored anywhere except in the configuration file. That means that the new ones would have been used instead the next time the weather had to be picked.

As a note, the weather is only updated when changing maps (both the weather stored and the one displayed on screen) so waiting without changing maps will keep the same weather for an indefinite amount of time. Maybe that's the reason why the sunny weather didn't go away on your tries.
 
  • Like
Reactions: Fil

Fil

Novice
Member
Joined
Jul 11, 2024
Posts
12
Yea, i don’t go around a lot in my testing, that’s sure is.
Thank you sincerely for your help and this amazing script 🙏🏻
 

BlueZulfish

Casual Water-type Enjoyer & Cry Composer
Member
Joined
Sep 4, 2023
Posts
9
I'm curious, is it possible to have battle themes for specific seasons? like one wild battle theme for summer, one wild battle theme for winter, etc.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Not with the plugin, but you can overwrite the music for the next battle (wild or trainer). This page explains how at the end of the "Music" section:

So, you could have events that only activate during certain seasons and overwrite the music for the wild battles. And have conditionals on the trainers' events to change their music depending on the season.
 

GoodEnding

Novice
Member
Joined
Jun 24, 2022
Posts
17
I've been getting this error

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `length' for nil:NilClass

Backtrace:
[Lin's Weather System] 01 - Main.rb:121:in `block in pbInitializeWeather'
[Lin's Weather System] 01 - Main.rb:117:in `each'
[Lin's Weather System] 01 - Main.rb:117:in `pbInitializeWeather'
[Lin's Weather System] 03 - Handler.rb:8: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'
044:Game_MapFactory:26:in `setup'
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
I don't seem to be able to replicate this error. Could you share some more information about when this error happens? When starting a new game? When continuing an existing saved game? Another situation (if so, what where you doing)?
 

gamemonkei

Novice
Member
Joined
Dec 31, 2022
Posts
11
Hello! So I recently just came into a problem with this resource. The Seasons changing works perfectly! However today, randomly it started raining in the Winter. I then went to the config file and turned it to 0. However, I reloaded the game and it still continued to rain. It does this in every season. I've tried redownloading the plugin but it is still happening. I do not know what I am doing wrong. It even does this when I turn seasons off.
 

PattyOChairs

Novice
Member
Joined
Aug 2, 2024
Posts
23
I can't seem to get the weather from this plugin working. I've got my zones made and the probabilities set, but I see no weather at all in any of the maps. Here are the relevant bits from Configuration.rb - sorry I'm not sure how to format or send the entire file

NO_WEATHER = false

ZONE_MAPS = [
[84],
[89,81]
]

ZONE_WEATHER_SUMMER = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_AUTUMN = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_WINTER = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_SPRING = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Hello! So I recently just came into a problem with this resource. The Seasons changing works perfectly! However today, randomly it started raining in the Winter. I then went to the config file and turned it to 0. However, I reloaded the game and it still continued to rain. It does this in every season. I've tried redownloading the plugin but it is still happening. I do not know what I am doing wrong. It even does this when I turn seasons off.
Are those problems on an already existing save file? You will need to change maps (as in, move the character from one map to another) for the weather to update (it will only show it updated if you go to a map with a different weather or if it's time to change the weather of that zone). Be aware that this plugin stores 2 weathers simultaneously for each zone, so if it stored rain for the weather of the moment and the next one before you made the change, you will have to wait for 2 weather changes to see your new probabilities in effect.

As a note, turning seasons off on the configuration file doesn't affect the weather. That configuration is only there to allow the tileset change (so the maps look different every season). It says so right above it.

I can't seem to get the weather from this plugin working. I've got my zones made and the probabilities set, but I see no weather at all in any of the maps. Here are the relevant bits from Configuration.rb - sorry I'm not sure how to format or send the entire file

NO_WEATHER = false

ZONE_MAPS = [
[84],
[89,81]
]

ZONE_WEATHER_SUMMER = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_AUTUMN = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_WINTER = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]

ZONE_WEATHER_SPRING = [
[20,30,15,0,0,0,20,0,0], #Route 2
[0,0,15,0,0,0,0,0,100] #Dark Forests
]
What you shared seems to be fine and should work. I imagine that you have also tried to see if there was any weather on the Dark Forest maps (which seems to be the easiest map where to see if the plugin was working on your game).

The only thing I can think of that will cause this is that you haven't defined those 3 maps as outdoors. Please, do so if that's the case because the plugin will not display weather on a map unless it detects that it is marked as outdoors. I did it like that so you could add indoor maps to zones without weather displaying on them (so you could modify the example forecast that comes with the plugin and have it check in which zone the player is even when indoors and display a text message with the weather of that zone).

If you don't plan to add indoors maps on the zones (and marking those 3 maps as outdoors solved the issue), you can go to 01 - Main Code/03 - Handler and delete lines 9 and 11 (they have $game_map.metadata&.outdoor_map on it, in case they are not on lines 9 and 11 for some reason). This will make the weather display in any map added to the zones in the configuration file without having to mark them as outdoors.
 

PattyOChairs

Novice
Member
Joined
Aug 2, 2024
Posts
23
Are those problems on an already existing save file? You will need to change maps (as in, move the character from one map to another) for the weather to update (it will only show it updated if you go to a map with a different weather or if it's time to change the weather of that zone). Be aware that this plugin stores 2 weathers simultaneously for each zone, so if it stored rain for the weather of the moment and the next one before you made the change, you will have to wait for 2 weather changes to see your new probabilities in effect.

As a note, turning seasons off on the configuration file doesn't affect the weather. That configuration is only there to allow the tileset change (so the maps look different every season). It says so right above it.


What you shared seems to be fine and should work. I imagine that you have also tried to see if there was any weather on the Dark Forest maps (which seems to be the easiest map where to see if the plugin was working on your game).

The only thing I can think of that will cause this is that you haven't defined those 3 maps as outdoors. Please, do so if that's the case because the plugin will not display weather on a map unless it detects that it is marked as outdoors. I did it like that so you could add indoor maps to zones without weather displaying on them (so you could modify the example forecast that comes with the plugin and have it check in which zone the player is even when indoors and display a text message with the weather of that zone).

If you don't plan to add indoors maps on the zones (and marking those 3 maps as outdoors solved the issue), you can go to 01 - Main Code/03 - Handler and delete lines 9 and 11 (they have $game_map.metadata&.outdoor_map on it, in case they are not on lines 9 and 11 for some reason). This will make the weather display in any map added to the zones in the configuration file without having to mark them as outdoors.
I do have them marked as outdoors in the metadata. I believe that is working cause I can see the day/night lighting on those maps. I would like to keep the indoor maps weather-free, so I don't want to delete those lines you mentioned.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Deleting those lines will only display weather in the indoor maps if you add those maps into zones. Any maps that aren't added in the ZONE_MAPS array in the configuration will be ignored by the plugin and will not display any weather (unless it's defined in their metadata).

In any case, if you did mark them as outdoors that doesn't seem to be the problem here and I honestly can't think of why seeing your configuration. Could you use the command for the example forecast and see what weather the plugin is picking for the zones? The command is pbWeatherForecast(zone) with "zone" being either 0 (for the route map) or 1 (for the forest maps).
 
Back
Top