Resource icon

v21.1 [20.1+] Weather System 1.3.4

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
The plugin has been tested to work in both v20.1 and v21.1 of Pokémon Essentials. It has also been tested to work with Unreal Time System plugin.

I made this plugin after Zaldar asked for some help with some trouble adding weather to his game. My weather system, unlike what I understood theirs does, works with time.
The weather will update automatically when changing maps (only on outside maps) if a certain amount of time has passed since the last time it updated. You can have that certain amount of time be a random number of hours or once midnight has passed.
My plugin also works with zones, that can be as big or as small as one wants. Each zone will have the same weather at the same time, meaning that changing between maps of the same zone will not change the weather unless it's updated.
You can also have the weather be different in each season.

Plugin Configuration
Most of the plugin can be configured in the configuration file that comes with it, but I will explain some important things.

You can deactivate the weather system anytime during the game with WeatherConfig::NO_WEATHER = true.
If you want to activate it again, use WeatherConfig::NO_WEATHER = false instead.
This will only work if you have Unreal Time System installed.
Use WeatherConfig::USE_REAL_TIME = false for the weather system to use the Unreal Time System to define the starting and end time for the weather.
Use WeatherConfig::USE_REAL_TIME = true for the weather system to use the PC's time to define the starting and end time for the weather.
Set the variable "CHANGE_MIDNIGHT" to true to have weather change after midnight has passed. Set it to false to have weather change after a random number of hours have passed instead.
"CHANGE_TIME_MIN" and "CHANGE_TIME_MAX" set the range of hours the plugin randomly chooses to define the time the weather will change.
There is a section in the configuration file (called Zones Configuration), where you define how many zones there are in your game and which maps conform to each zone.
This is the example that comes defined by default:

You have to put the number of the map on one of the arrays for that map to be defined in that zone. Be aware that only maps that aren't marked as interior maps will show weather. Zones don't need to have a set number of maps. You can define a zone to be an entire region, a single map or your whole game. It's up to you.
To define a zone, add an array inside the array for ZONE_MAPS.
You can change the maps that form a zone at any time during the game by using this: $WeatherSystem.zoneMaps[zone] = array_of_maps.
Zone has to be a number corresponding to the zone you want to edit (0 for the first zone defined, 1 for the second and so on).
Array_of_maps has to be an array of the maps that will define that zone.
Under the Zones Configuration, there's a section called Season Probability Configuration. Here you define the probability for each season and zone. The sum of probabilities for a zone doesn't have to add up to 100. The plugin will handle the probability on its own. It also should be able to work with any custom weather you added to your game.
This is one of the examples that comes defined by default:

There are 4 weather probabilities for each season and all look like that.
There are some simple rules to make this work:
  • The order of the weather corresponds to their ID numbers. You have the default order for the ones in vanilla essentials defined as a help.
  • You can give a probability to any weather you want while having others not appear at all.
  • If you don't want weather to appear but you want weather that comes after that, you have to define the probability as 0. If you don't add 0 for the weather you don't want, the probability you define will go to those.
  • If there is no weather you want behind them, you can leave their probability blank.
Like with the zone maps, you can change the probabilities anytime with this:
WeatherConfig::ZONE_WEATHER_SEASON[zone] = array_of_probabilities.
You have to change SEASON for the name of the season you want to edit probabilities for.
Zone has to be a number corresponding to the zone you want to edit (0 for the first zone defined, 1 for the second and so on).
Array_of_probabilities has to be an array of the new weather probabilities.
In addition, you can have all seasons have the same weather by making the autumn, winter and spring probabilities equal to ZONE_WEATHER_SUMMER.
While you can define maps to be in a different zone than the maps next to it, you may want them to have the same weather as them with some exceptions. That is where Weather Substitute comes into play. By default, there are 3 weathers defined:

Add in the snow and blizzard arrays all the maps you don't want to ever display snow or blizzard weather. This is to keep maps that display beaches to have cold weather since it's not that common for there to snow, let alone have a blizzard, especially the closer they are to Ecuador.
Add in the sandstorm array the maps you want the sandstorm in. Usually, this is to keep sandstorms to the deserts while having the neighbouring areas still have the same weather the rest of the time.
Important: be sure the keep either "exclude" or "include" in the first position of the array or this feature will not work.
Like with the zone maps and probabilities, you can change them mid-game with WeatherConfig::MAPS_SUBSTITUTE[Weather] = array. Weather has to be in the same form as in the maps substitutes, with ":" before the weather's name.
This takes the form of an array of hashes, which I think will make it easier to configure. For those that don't know, an array is contained between "[ ]" and a hash is contained between "{ }".
This is the example that comes defined by default:

As you can see, each hash corresponds to a zone, so you can have the same weather be substituted by a different one on each zone.
Configuring it is even easier than the probabilities. All you have to do is define this inside the hash: main weather ID => secondary weather ID.
The main weather ID is the name (in the format you see in the example) that defines the weather.
The secondary weather ID is the name (again, in the format you see in the example) that defines the weather.
The plugin will check this and see if the weather it has chosen (the main weather ID) is defined to be changed for another one (the secondary weather ID).
To change which weather is changed in each zone during the game, you can use this code: WeatherConfig::WEATHER_SUBSTITUTE[zone] = hash.
Zone is the number of the zone (0 for the first, 1 for the second, and so on).
Hash is the hash with the weather's conversions defined. Look at the example ones to see how to do them.
To add maps that will use different weather when a certain one should be active, you have to add in the MAPS_SUBSTITUTE hash. It follows this format: key => array.
The key is the ID of the weather that will change when the conditions are met.
The array consists of two things:
  • The first element has to be either "include" or "exclude". If you put "include", only the maps in the array will show the weather in the key. If you put "exclude", any of the maps in the array will not show the weather in the key.
  • The rest of the array has to be a list of maps.
The code comes with an example of a forecast to be used with the TV. The code is in the "02 - Main_Extra" file to edit the text to what you prefer.
The code to call it is pbWeatherForecast(zone). Zone is the number of the zone you want the forecast to be about.
You can define the names the weather forecast will use for each weather in "WEATHER_NAMES" in the configuration file. It follows this format: weather ID => name of the weather. Follow the already defined examples to add names for any custom weather you added. The plugin will automatically transform the names to lowercase for the example forecast that comes with the plugin.
The game automatically updates the weather anytime the player changes maps to an outdoor one if it detects that the time for the actual weather to end has passed.
If you want the weather to change before the weather is set to end, you can do so by using: pbForceUpdateWeather or pbForceUpdateWeather(zone).
pbForceUpdateWeather will update the weather of all zones you have defined.
pbForceUpdateWeather(zone) will update the weather of the zone you tell it to update.
Adds a small box on the top left of the map with an image of the weather. The images are stored in "Graphics/Pictures/Weather" or "Graphics/UI/Weather". The download comes in black and white or in color pictures.
This function is compatible with my Pokegear Themes plugin. The weather display on Arcky's Town Map will be added in the future in this plugin or in Arcky's.
In the configuration file, there's a section called Map Display near the end of it. There are two things you have to do here.
  • Add the maps in MAPS_POSITIONS. You'll see that follows the same structure as ZONE_MAPS. Inside each hash (defined with {} that has to correspond to each zone in ZONE_MAPS), you have to add the info for the maps in the following format: "Map Name" => Map ID. Check the examples that come in the configuration file to see how it's done. Important: be sure that the maps are in the same zone you defined them in ZONE_MAPS.
  • Change the name of the weather pictures (stored in the folder Weather within Pictures or UI) to match the ones in that folder. You can add pictures for other weathers as well as long as they follow the same structure.
It seemed obvious that, with changing weather, wild pokémon encounters would change as well. And, since it seems that the only (maybe?) plugin that adds weather-based encounters is causing conflicts, I made this little extra that adds 144 new encounters.

The basic structure for the new encounters is "TypeWeather". Type can be Land, Water, Cave, OldRod, GoodRod, SuperRod, RockSmash, HeadbuttLow and HeadbuttHigh.

For the encounter types that can be time-dependent (land, surf and cave), they can also follow this structure: TypeTimeWeather. Just change Time for the appropriate moment of the day (Day, Night, Morning, Afternoon, Evening) and Weather for the appropriate weather.
Important: due to how the plugin is made, the encounters for LandNightSun will never happen since the Sun weather is never used during the night.
You can disable this feature by turning SEASON_CHANGE in the configuration to false.
Added the optional feature for maps to change their tileset to match the season. You have to define the tilesets used for the outdoor maps (the ones you will make the map with) in OUTDOOR_TILESETS and define how many tilesets the plugin has to skip to get the proper season's tileset.

For example: if you make a map with tileset 1 and the summer tileset is 20, you have to define SUMMER_TILESET as 19. You can't define a different number for each tileset in OUTDOOR_TILESETS so try to keep the same difference for them all.
The plugin now also adds the option to change the battle's background (including the bases and message background) to match the season. Like with the encounters, the image follows this name order: BattleBack_Season_Time_ImageType
BattleBack: the name defined on the map's metadata or by the TerrainTag.
Season: "summer", "autumn", "winter" or "spring".
Time: either "eve" or "night". No other time is defined for those images.
ImageType: "base0" for the player's base, "base1" for the wild pokemon or trainer's base, "bg" for the battle background and "message" for the message background.

The plugin will first search if you have an image that matches BattleBack_Season_Time_ImageType. If it's not found, it'll search for BattleBack_Season_ImageType or BattleBack_Time_ImageType. If it still doesn't find a matching one, it'll resort to BattleBack_ImageType.
Added 8 new Environments and 8 new TerrainTags. They are for both grass and tall grass, so you can have the battle bases match the season. You can use the default grass and tall grass terrain tags for any season.
The default ID numbers for the new terrain tags go from 21 to 28. Change them in 04 - Overworld Season/03 - TerrainTag to any unused ones you have.
Added the season splash from the gen 5 games. Like the change of tileset, they won't appear if you have seasons disabled.

The code keeps track of the season and what the last season splash it showed was so they only appear once until the season changes. It also won't show up if the player leaves the game for months and returns to the game in a month with the same season they last played with.

There are only two things to be done for this to work properly:
  • Set the OUTDOOR variable in configuration to true (if you want the first season splash showing when going indoors) or false (if you want the first season splash showing when going outdoors).
  • Use $WeatherSystem.seasonSplash = true in an event in your game before the first season splash. It can be at the end of the intro event, on an automatic event at the player's house, or anywhere you want. Setting $WeatherSystem.seasonSplash = false will deactivate the season splash until you activate it again.
The path to the four images with the season's names can be changed when translating the game. You can only change the path, not the name so you'll have to keep the translated image name to "Summer", "Autumn", "Winter" and "Spring".
As for the image size, I suggest keeping it to the word size so the plugin can properly centre it. With the splash images comes a .txt file with the details of the font used for the season's name in photoshop, so you can keep the same style in translated images if you don't want to change the original one.
  • LinKazamine
  • Zaldar for the idea
  • Swdfm for some of the code used
First release
Last update
5.00 star(s) 3 ratings

More resources from LinKazamine

Latest updates

  1. 1.3.4

    Registered weather encounters for surfing, fishing, headbutt and rock smash. Added code to make...
  2. Fix for v1.3.3

    Fixed a slight oversight with the random number generator that is compared to the weather...
  3. 1.3.3

    Fixed a flaw in the code that selected the weather. Now it should compare the probability to a...

Latest reviews

Excellent Plugin! It would be great if it were compatible with Arcky's Region Map!
That's something in progress, don't you worry. We're in contact and we will talk about how to add it when the time comes.
Love this plugin, looking forward to see this one grow more
Fantastic! Really brings life to your fan game with more diverse weather across the map, and I really love the addition of weather dependant encounters, giving you lots of possibilities to mix up your spawn pool!