• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!
Resource icon

Resource [20.1+] Weather System 1.4.0

I don't know why they conflict either. And looking at the last line that was run (29 in StartGame), it seems to be something about $PokemonSystem.screensize, which my plugin doesn't touch at all (don't know if the other one does).

The only thing I can think of that may solve the problem is making sure all the plugins are compiled and running. Aside from that, I'm afraid I can't help since I don't know what the problem even is. Maybe you will have more luck starting a thread in the forum or asking in the discord.
 
This is very strange. I noticed your plugin doesn't use those variables. I thought it might be the compilation order, but that wasn't the problem either.
The "Customizable Battle UI" plugin adds an additional variable to PoemonSystem, but I still don't understand the error.
I'll ask Toxillian about this error then!
Thanks!


LOL, you really solved it in august 2023 XDDD
 
Last edited:
I ran into a problem with this plugin a few months ago that made the whole game crash. I didn't fully understand it at the time and going back to look at the plugin again as of today, I'm still a little confused. The zones for the weather have 9 different weather settings, but only 8 numbers on the top line, 2 under that and one under that one. Trying to post a pic of what I'm talking about, but can't figure that out. Thanks in advance!

Here's the code in raw form.

# Probability of weather in summer.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SUMMER = [
[50, 20, 3, 0, 0, 0, 5, 30],
[40, 50],
[60]
]
 
Without knowing anything about the crash, I can't help much.

As for the seasonal weathers, the numbers are the probability of each weather (following the order stated above them) to be selected for that zone. Any weather type without a number will be treated as if it had a 0 probability but you'll have to put a 0 on any weather type you don't want on that zone if there is a weather type you do want that comes behind in the order.

For example:
[50, 20, 3, 0, 0, 0, 5, 30] means that 50 out of 108 times there will be no weather, 20 out of 108 there will be rain, 3 out of 108 there will be a storm, 0 out of 108 there will be snow, and so on. The 0 are needed to block weathers from apearing since there are others behind that have a probability to apear.

[40, 50] means that 40 out of 90 times there will be no weather, 50 out of 90 times there will be rain and the rest of the weathers will never apear. No 0 is needed here since there is no weather that comes later that is wanted.

[60] means that 60 out of 60 times there will be no weather and the rest of the weathers will never apear. Every zone needs to have custom probabilities for weather for the game not to crash so you'll use something like this to make that zone have no weather (or add a bunch of 0 before it to only have one weather in it).
 
Without knowing anything about the crash, I can't help much.

As for the seasonal weathers, the numbers are the probability of each weather (following the order stated above them) to be selected for that zone. Any weather type without a number will be treated as if it had a 0 probability but you'll have to put a 0 on any weather type you don't want on that zone if there is a weather type you do want that comes behind in the order.

For example:
[50, 20, 3, 0, 0, 0, 5, 30] means that 50 out of 108 times there will be no weather, 20 out of 108 there will be rain, 3 out of 108 there will be a storm, 0 out of 108 there will be snow, and so on. The 0 are needed to block weathers from apearing since there are others behind that have a probability to apear.

[40, 50] means that 40 out of 90 times there will be no weather, 50 out of 90 times there will be rain and the rest of the weathers will never apear. No 0 is needed here since there is no weather that comes later that is wanted.

[60] means that 60 out of 60 times there will be no weather and the rest of the weathers will never apear. Every zone needs to have custom probabilities for weather for the game not to crash so you'll use something like this to make that zone have no weather (or add a bunch of 0 before it to only have one weather in it).

Thank you for your response! It's starting to make a little sense, but I do need to clarify something. I don't plan on having (outdoor) areas without weather, so if I removed [60], it will still work?
 
I got some maps set in the configuration (gonna add the rest after I make sure it works properly) and received this error.

[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.9]

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

Backtrace:
[Lin's Weather System] 01 - Main.rb:131:in `block in pbInitializeWeather'
[Lin's Weather System] 01 - Main.rb:127:in `each'
[Lin's Weather System] 01 - Main.rb:127:in `pbInitializeWeather'
[Lin's Weather System] 03 - Handler.rb:10: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'
043:Game_MapFactory:147:in `setMapChanged'
043:Game_MapFactory:26:in `setup'


You have an earlier post regarding someone else having the same issue, but the images do not appear.

Quote:
Ok, with one more test, I got the same error only when there are less zones defined for the seasonal weathers than in the zone maps. As an example, if you have this configuration in the zone maps
1700931310146.png


the configuration for the seasonal weather has to have as many zones (3 in this case). It has to look something like this:
1700931514607.png


Change the numbers to whatever you want and add as many weather probabilities as you want, but you need the zones for both to match.

Quote end


I put it in vanilla Essentials and it worked and upon removing all of my plugins in my project except for the Hotfixes, I still get the same error.
 
Last edited:
The error isn't because of compatibility, but because you have zones defined without weather probabilities. The numbers in the default configuration are sort of examples of posibles configurations for the weather probabilities, so unless you deleted zones in the ZONE_MAPS array, you should not be deleting zones in the ZONE_WEATHER_season arrays.

In the configuration, there is a ZONE_MAPS, that is an array of arrays. Each array inside the main one (the one directly after the "=") is a "zone", and there you define which maps (defined by their ID) are part of this zone and, as such, will have the same weather at the same moment (with exeptions on certain weathers that you can define somewhere else).

As a consecuence of the plugin revolving arround this idea of "zones", other things you configure have to have the same number of zones that this ZONE_MAP: WEATHER_SUBSTITUTE, MAPS_POSITIONS and the multiple ZONE_WEATHER.
Like I said here, you need to have the same [ ] structure in ZONE_MAPS, WEATHER_SUBSTITUTE, MAPS_POSITIONS and the multiple ZONE_WEATHER for the plugin to properly work. Otherwise, the plugin will detect that there is information missing for some weather's and will be unable to properly work.

For clarity, this is how they work:
Ruby:
Expand Collapse Copy
ZONE_MAPS = [  # To put maps in the zones
    [2, 5],        # This is zone 0 and contains the maps with ID 2 and 5
    [7],            # This is zone 1 and contains the map with ID 7
    [21]           # This is zone 2 and contains the map with ID 21
]

# The weather before the => is changed for the one after if the map fulfills the conditions on MAPS_SUBSTITUTE
WEATHER_SUBSTITUTE = [
    {:None => :None, :Rain => :Rain, etc. },                                        # This is for zone 0
    {:Snow => :Rain, :Blizzard => :Storm, :Sandstorm => :None},      # This is for zone 1
    {:Snow => :Rain, :Blizzard => :HeavyRain}                                    # This is for zone 2
]

# You have to give to each map in each zone the name you used in the map_metadata in the PBS folder
MAPS_POSITIONS = [
    #{"Map Name" => Map ID},
    {"Lappet Town" => 2, "Route 1" => 5},  # This is for the maps on zone 0
    {"Cedolan City" => 7},                            # This is for the maps on zone 1
    {"Route 2" => 21}                                   # This is for the maps on zone 2
]

# All the ZONE_WEATHER work the same, so I'll only explain with one
ZONE_WEATHER_SUMMER = [
    [50, 20, 3, 0, 0, 0, 5, 30],             # Those are the weather probabilities for zone 0
    [40, 50],                                     # Those are the weather probabilities for zone 1
    [60]                                            # Those are the weather probabilities for zone 2
]
As you can see, all those configurations require to have the same structure than the ZONE_MAPS so if you add zones there, you have to add zones on those too or you'll get the error you are getting now.
 
That's what I did. Here's my code (split the season part off to make it easier to read):

ZONE_MAPS = [
[22, 32, 33, 48, 76, 77, 78, 43, 133, 134],
[83, 84, 3, 36, 41, 4, 38, 6, 2, 26, 35],
[37, 70, 27, 24, 23, 112, 113, 119],
[123, 122, 121, 120, 39, 34]
]
#===============================================================================
# * 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},
{"Pallet Town" => 22, "Route 1" => 32, "Viridian City" => 33, "Viridian Forest" => 48, "Route 2" => 76, "Pewter City" => 77, "Route 3" => 78, "Route 22" => 43, "Route 23" => 133, "Route 26" => 134},
{"Route 4" => 83, "Cerulean City" => 84, "Route 9" => 3, "Route 10" => 36, "Route 10 Powerplant" => 41, "Route 24" => 4, "Route 25" => 38, "Route 25 Bill's Cottage" => 6, "Route 5" => 2, "Saffron City" => 26, "Route 8" => 35},
{"Lavender Town" => 37, "Route 12" => 70, "Route 11" => 27, "Vermillion City" => 24, "Route 6" => 23, "Route 13" => 112, "Route 14" => 113, "Route 15" => 119},
{"Fuschia City" => 123, "Route 18" => 122, "Route 17" => 121, "Route 16" => 120, "Celadon City" => 39, "Route 7" => 34}


Season

# Probability of weather in summer.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SUMMER = [
[5, 10, 1, 0, 0, 0, 85, 10],
[40, 50],
[60]
]
# Probability of weather in autumn.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_AUTUMN = [
[5, 40, 10, 0, 0, 0, 45, 5],
[40, 50],
[60]
]
# Probability of weather in winter.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_WINTER = [
[5, 30, 20, 30, 0, 0, 30, 0],
[40, 50],
[60]
]
# Probability of weather in spring.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SPRING = [
[5, 40, 5, 0, 0, 0, 65, 0],
[40, 50],
[60]
]
end

I think I might be a little confused about the season part due to it's layout. I (believe) I understand the map zone part though.
 
Last edited:
The map display isn't what is causing the error. If you had anything wrong with that part, you would only get an error of it when opening the map. The error says that there is a problem when initializing the weather, so there has to be a problem with the other configuration I explained and you haven't shared.

Check WEAHTER_SUBSTITUTE and all four of the ZONE_WEATHER and make sure they have the same number of zones that ZONE_MAPS, as I explained in my last post.
 
The map display isn't what is causing the error. If you had anything wrong with that part, you would only get an error of it when opening the map. The error says that there is a problem when initializing the weather, so there has to be a problem with the other configuration I explained and you haven't shared.

Check WEAHTER_SUBSTITUTE and all four of the ZONE_WEATHER and make sure they have the same number of zones that ZONE_MAPS, as I explained in my last post.
Here's the weather subs I set up. I wanted everything to be excluded for those weathers. Still crashing.

MAPS_SUBSTITUTE = {
:Snow => ["exclude", 22, 32, 33, 48, 76, 77, 78, 43, 133, 134, 83, 84, 3, 36, 41, 4, 38, 6, 2, 26, 35, 37, 70, 27, 24, 23, 112, 113, 119, 123, 122, 121, 120, 39, 34],
:Blizzard => ["exclude", 22, 32, 33, 48, 76, 77, 78, 43, 133, 134, 83, 84, 3, 36, 41, 4, 38, 6, 2, 26, 35, 37, 70, 27, 24, 23, 112, 113, 119, 123, 122, 121, 120, 39, 34],
:Sandstorm => ["exclude", 22, 32, 33, 48, 76, 77, 78, 43, 133, 134, 83, 84, 3, 36, 41, 4, 38, 6, 2, 26, 35, 37, 70, 27, 24, 23, 112, 113, 119, 123, 122, 121, 120, 39, 34]
}
# The ID of the weathers that will substitute the main when appropiate (conditions defined in MAPS_SUBSTITUTE).
# 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}
]


I think this part is confusing me due to the wording:
# Any maps of a zone not added on the "exclude" list will use the main weather.
# Use "include" to define a list of maps that will use that weather when it's the main one.
# Any maps of a zone not added on the "include" list will use the secondary weather.
 
You have 4 zones in ZONE_MAPS, but only defined 3 on the WEATHER_SUBSTITUTE and the ZONE_WEATHERs. You NEED all those configurations to have the same number of zones, as I already explained. And if you don't want to use the Weather substitute, is as easy as setting all the zones with {:None => :None} and setting the probability for unwanted weathers as 0.

In your case, it needs to look something like this:
Ruby:
Expand Collapse Copy
# The ID of the weathers that will substitute the main when appropiate (conditions defined in MAPS_SUBSTITUTE).
# 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},
  {:None => :None},
  {:None => :None},
  {:None => :None}
]

# Probability of weather in summer.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SUMMER = [
  [5, 10, 1, 0, 0, 0, 85, 10],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in autumn.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_AUTUMN = [
  [5, 40, 10, 0, 0, 0, 45, 5],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in winter.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_WINTER = [
  [5, 30, 20, 30, 0, 0, 30, 0],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in spring.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SPRING = [
  [5, 40, 5, 0, 0, 0, 65, 0],
  [40, 50],
  [60],
  [60]
Configure the numbres in ZONE_WEATHERs to whatever fits your game, but if you add a line in ZONE_MAPS, you HAVE to add a line in ZONE_WEATHERs, WEATHER_SUBSTITUTE and MAP_POSITIONS or the plugin will detect that there is information missing and cause an error to tell you as much.

Note that in all the ZONE_WEATHERs, no zone has probability for snow (4th number in the line), blizzard (5th number), sandstorm (6th number) or fog (9th number) so they will never appear in any map. So defining all maps to exclude weathers that will never be selected is useless.

The Weather substitute configuration was made to have certain maps within the zones have certain weathers be different as the rest of the zone.
Ex: you have a desert map in a zone, but there are other, non-desert maps in that zone too. So you define a probability for sandstorm for that zone and you set in the MAPS_SUBSTITUTE that the desert map on that zone will be the only one with the sandstorm (using include) and in WEATHER_SUBSTITUTE you define in which weather turn the sandstorm for all the other maps of that zone.
Using exclude would be the oposite case, where you define a probability for a weather (ex: snow) and define the maps where that weather will be changed to something else (ex: a beach in warmer places, where snow happens very rarelly if at all).
 
You have 4 zones in ZONE_MAPS, but only defined 3 on the WEATHER_SUBSTITUTE and the ZONE_WEATHERs. You NEED all those configurations to have the same number of zones, as I already explained. And if you don't want to use the Weather substitute, is as easy as setting all the zones with {:None => :None} and setting the probability for unwanted weathers as 0.

In your case, it needs to look something like this:
Ruby:
Expand Collapse Copy
# The ID of the weathers that will substitute the main when appropiate (conditions defined in MAPS_SUBSTITUTE).
# 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},
  {:None => :None},
  {:None => :None},
  {:None => :None}
]

# Probability of weather in summer.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SUMMER = [
  [5, 10, 1, 0, 0, 0, 85, 10],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in autumn.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_AUTUMN = [
  [5, 40, 10, 0, 0, 0, 45, 5],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in winter.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_WINTER = [
  [5, 30, 20, 30, 0, 0, 30, 0],
  [40, 50],
  [60],
  [60]
]
# Probability of weather in spring.
# Order: None, Rain, Storm, Snow, Blizzard, Sandstorm, HeavyRain, Sun/Sunny, Fog
ZONE_WEATHER_SPRING = [
  [5, 40, 5, 0, 0, 0, 65, 0],
  [40, 50],
  [60],
  [60]
Configure the numbres in ZONE_WEATHERs to whatever fits your game, but if you add a line in ZONE_MAPS, you HAVE to add a line in ZONE_WEATHERs, WEATHER_SUBSTITUTE and MAP_POSITIONS or the plugin will detect that there is information missing and cause an error to tell you as much.

Note that in all the ZONE_WEATHERs, no zone has probability for snow (4th number in the line), blizzard (5th number), sandstorm (6th number) or fog (9th number) so they will never appear in any map. So defining all maps to exclude weathers that will never be selected is useless.

The Weather substitute configuration was made to have certain maps within the zones have certain weathers be different as the rest of the zone.
Ex: you have a desert map in a zone, but there are other, non-desert maps in that zone too. So you define a probability for sandstorm for that zone and you set in the MAPS_SUBSTITUTE that the desert map on that zone will be the only one with the sandstorm (using include) and in WEATHER_SUBSTITUTE you define in which weather turn the sandstorm for all the other maps of that zone.
Using exclude would be the oposite case, where you define a probability for a weather (ex: snow) and define the maps where that weather will be changed to something else (ex: a beach in warmer places, where snow happens very rarelly if at all).

Got it working! Thank you! That had me feeling dumb for a while lol. Time for me to have a mini celebration! <3
 
Back
Top