- 465
- Posts
- 8
- Years
- Seen Jun 17, 2024
Version 2!
Made this script ages ago for my game and its the most standalone of all mine, so felt i'd share.
I've now updated it to be entirely one script (Excluding weather encounters) with no map events or checks.
Both weather their encounters work seperate and best together.
We have the weather system overhaul, creating a system.
I'm yet to make checks for some things or getting what it currently is from the script.
Weather system script
If you are updating be sure to delete the old script aswell as the events used in the script, as they will clash.
create a new section above main, call it "Weather"
So first off, Foggy, Ash, Drought, Windy, Drought, Tornado, Moon, Eclipse are custom field weathers of mine, i've kept them in but
make sure you remove them.
This system works using conditions, either neutral, warm, cold, freezing or abnormal. these span the entire region and will change every
24 hours (default) this will need to be a multiple of the weather change time or issue will occur.
Each condition has a set of weathers it can be and cant be, and with what chance. e.g. cold can only be rain or storm (by default)
weather is set out of these for each map, so one can be rainy, one can be sunny etc. if the condition allows it. they change every
4 hours (Default) this will need to multiply into the condition change time or issues will occur.
now the weather maps are were weather will change, e.g. every open city, route lake etc. any map not included (interiors or maps you
don't want weather on) will be set to clear weather.
The Weather changes on transfer not instantly if the time runs out. to reset the weather leave the map and return.
Next for the weather encounters, these aren't updated and can easily be simplified into a encounter method.
this script still works with the other, and should work.
Weather encounters
This should be entirely plug and play.
the script mostly says it all, there are no events needed or extra coding.
make sure you put it above "Main" and call it "Weather Encounters"
The script should explain it all, feel free to ask me if thats not the case.
They should both work, do leave a reply if thats not the case, or you have issues in general.
if you do have improvements or something your unsure how to do for edits, i might know so its worth a try.
Made this script ages ago for my game and its the most standalone of all mine, so felt i'd share.
I've now updated it to be entirely one script (Excluding weather encounters) with no map events or checks.
Both weather their encounters work seperate and best together.
We have the weather system overhaul, creating a system.
I'm yet to make checks for some things or getting what it currently is from the script.
Weather system script
Spoiler:
If you are updating be sure to delete the old script aswell as the events used in the script, as they will clash.
create a new section above main, call it "Weather"
Spoiler:
Code:
################################################################################
# Weather Overhaul by ArchyArc [v17] v1-
# This is an overhaul of a weather system not overhauling how the weathers look
# or act ingame.
#
# CONDITIONCHANGETIME is how long a condition will last before shifting in a
# region.
#
# WEATHERCHANGETIME is how long a weather will last before changing within the
# same condition for each map.
#
# CONDITIONS are the weather conditions that will change every 24 hours and
# determine what weathers can and can't appear.
#
# (Condition)WEATHER is what weathers can appear in that condition, and the
# chance out of 100 that they will appear.
#
# WEATHERMAPS are the maps affected by weather, any maps not included will set
# their weather to none essentially turning it off. you should do seperate ones
# for other regions, maybe have WEATHERKANTOMAP and WEATHERKALOSMAP for example.
################################################################################
CONDITIONCHANGETIME = 24 # Default 24 hours
WEATHERCHANGETIME = 6 # Default 6 hours
CONDITIONS = [
["Warm"],
["Neutral"],
["Cold"],
["Freezing"],
["Abnormal"]
]
WARMWEATHER = [
[PBFieldWeather::Sun,1], #50%
[PBFieldWeather::None,51], #40%
[PBFieldWeather::Ash,91], #8%
[PBFieldWeather::Drought,99] #2%
]
NEUTRALWEATHER = [
[PBFieldWeather::None,1], #40%
[PBFieldWeather::Cloudy,41], #40%
[PBFieldWeather::Sun,81], #10%
[PBFieldWeather::Windy,91] #10%
]
COLDWEATHER = [
[PBFieldWeather::Rain,1], #45%
[PBFieldWeather::Moon,46], #30%
[PBFieldWeather::Storm,76], #10%
[PBFieldWeather::Windy,86], #10%
[PBFieldWeather::Foggy,96], #5%
]
FREEZINGWEATHER = [
[PBFieldWeather::Snow,1], #40%
[PBFieldWeather::Windy,41], #38%
[PBFieldWeather::Blizzard,79], #14%
[PBFieldWeather::Storm,93] #8%
]
ABNORMALWEATHER = [
[PBFieldWeather::Ash,1], #20%
[PBFieldWeather::Foggy,21], #20%
[PBFieldWeather::Sandstorm,41], #20%
[PBFieldWeather::Drought,61], #20%
[PBFieldWeather::Eclipse,81], #10%
[PBFieldWeather::Tornado,91] #10%
]
WEATHERMAPS =
[38,230,6,11,12,13,14,15,18,19,25,20,26,27,29,30,31,34,46,48,54,56,111,68,
72,243,89,342,3,73,58]#58 is test map
################################################################################
class PokemonGlobalMetadata
attr_accessor :conditionTimer
attr_accessor :currentCondition
attr_accessor :weatherArray
attr_accessor :weatherTimer
end
def pbGenerateCondition
$PokemonGlobal.currentCondition = "none" if $PokemonGlobal.currentCondition==nil
#checks what season it is.
if pbIsSeason(0,0) #Spring
conditionRand = rand(9)
if conditionRand==1
condition = "Abnormal"
elsif conditionRand>=8
condition = "Neutral"
elsif conditionRand>=6
condition = "Warm"
elsif conditionRand>=4
condition = "Cold"
elsif conditionRand>=2
condition = "Freezing"
end
elsif pbIsSeason(0,1) #Summer
conditionRand = rand(9)
if conditionRand==1
condition = "Cold"
elsif conditionRand>=6
condition = "Abnormal"
elsif conditionRand>=4
condition = "Neutral"
elsif conditionRand>=2
condition = "Warm"
end
elsif pbIsSeason(0,2) #Autumn
conditionRand = rand(9)
if conditionRand==1
condition = "Abnormal"
elsif conditionRand>=8
condition = "Neutral"
elsif conditionRand>=6
condition = "Warm"
elsif conditionRand>=4
condition = "Cold"
elsif conditionRand>=2
condition = "Freezing"
end
elsif pbIsSeason(0,3) #Winter
conditionRand = rand(8)
if conditionRand==7
condition = "Freezing"
elsif conditionRand>=5
condition = "Cold"
elsif conditionRand>=3
condition = "Neutral"
elsif conditionRand>=1
condition = "Abnormal"
end
end
$PokemonGlobal.currentCondition = condition
$PokemonGlobal.conditionTimer = pbGetTimeNow
#Kernel.pbMessage(_INTL("{1}",weatherArray))
#Kernel.pbMessage(_INTL("{1}",NEUTRALWEATHER[0][1]))
end
def pbGenerateWeather
$PokemonGlobal.weatherArray = []
mapId = pbMapTree
for i in 0...mapId.length #goes through every map
next if !WEATHERMAPS.include?(i) #checks if the map is in the array
condition=$PokemonGlobal.currentCondition
currentWeather = pbWeatherPicker(condition)
$PokemonGlobal.weatherArray.push([[i],[currentWeather]])
end
$PokemonGlobal.weatherTimer = pbGetTimeNow
end
def pbWeatherPicker(condition=Neutral)
weatherRand=rand(100)
if condition=="Warm"
for i in 0...WARMWEATHER.length
if weatherRand>=NEUTRALWEATHER[i][1]
return NEUTRALWEATHER[i][0]
end
end
elsif condition=="Neutral"
for i in 0...NEUTRALWEATHER.length
if weatherRand>=NEUTRALWEATHER[i][1]
return NEUTRALWEATHER[i][0]
end
end
elsif condition=="Cold"
for i in 0...COLDWEATHER.length
if weatherRand>=COLDWEATHER[i][1]
return COLDWEATHER[i][0]
end
end
elsif condition=="Freezing"
for i in 0...FREEZINGWEATHER.length
if weatherRand>=FREEZINGWEATHER[i][1]
return FREEZINGWEATHER[i][0]
end
end
elsif condition=="Abnormal"
for i in 0...ABNORMALWEATHER.length
if weatherRand>=ABNORMALWEATHER[i][1]
return ABNORMALWEATHER[i][0]
end
end
end
end
def pbWeatherMap(i=0)
if $PokemonGlobal.weatherArray[i][1]==[0]
return PBFieldWeather::None
elsif $PokemonGlobal.weatherArray[i][1]==[1]
return PBFieldWeather::Rain
elsif $PokemonGlobal.weatherArray[i][1]==[2]
return PBFieldWeather::Storm
elsif $PokemonGlobal.weatherArray[i][1]==[3]
return PBFieldWeather::Snow
elsif $PokemonGlobal.weatherArray[i][1]==[4]
return PBFieldWeather::Blizzard
elsif $PokemonGlobal.weatherArray[i][1]==[5]
return PBFieldWeather::Sandstorm
elsif $PokemonGlobal.weatherArray[i][1]==[7]
if PBDayNight.isDay?
return PBFieldWeather::Sun
elsif $PokemonGlobal.currentCondition=="Neutral"
return PBFieldWeather::Moon
else
return PBFieldWeather::None
end
elsif $PokemonGlobal.weatherArray[i][1]==[8]
return PBFieldWeather::Ash
elsif $PokemonGlobal.weatherArray[i][1]==[9]
return PBFieldWeather::Foggy
elsif $PokemonGlobal.weatherArray[i][1]==[10]
if PBDayNight.isNight?
return PBFieldWeather::Moon
elsif $PokemonGlobal.currentCondition=="Neutral"
return PBFieldWeather::Sun
else
return PBFieldWeather::None
end
elsif $PokemonGlobal.weatherArray[i][1]==[11]
return PBFieldWeather::Windy
elsif $PokemonGlobal.weatherArray[i][1]==[12]
return PBFieldWeather::Tornado
elsif $PokemonGlobal.weatherArray[i][1]==[13]
return PBFieldWeather::Eclipse
elsif $PokemonGlobal.weatherArray[i][1]==[14]
return PBFieldWeather::Drought
elsif $PokemonGlobal.weatherArray[i][1]==[15]
return PBFieldWeather::Cloudy
else
return PBFieldWeather::None
end
end
Events.onMapChange+=proc {|sender,e|
$PokemonGlobal.weatherArray = [] if $PokemonGlobal.weatherArray==nil
if $PokemonGlobal.weatherArray==[] ||
((pbGetTimeNow-$PokemonGlobal.conditionTimer)>CONDITIONCHANGETIME*60*60) #checking if the time is up
pbGenerateCondition
end
if $PokemonGlobal.weatherArray==[] ||
((pbGetTimeNow-$PokemonGlobal.weatherTimer)>WEATHERCHANGETIME*60*60) #checking if the time is up
pbGenerateWeather
end
for i in 0...$PokemonGlobal.weatherArray.length
next if !WEATHERMAPS.include?($game_map.map_id)
if $PokemonGlobal.weatherArray[i][0]==[$game_map.map_id]
weather=pbWeatherMap(i)
$game_screen.weather(weather,9.0,20)
end
end
if !WEATHERMAPS.include?($game_map.map_id)
$game_screen.weather(PBFieldWeather::None,9.0,20)
end
}
make sure you remove them.
This system works using conditions, either neutral, warm, cold, freezing or abnormal. these span the entire region and will change every
24 hours (default) this will need to be a multiple of the weather change time or issue will occur.
Each condition has a set of weathers it can be and cant be, and with what chance. e.g. cold can only be rain or storm (by default)
weather is set out of these for each map, so one can be rainy, one can be sunny etc. if the condition allows it. they change every
4 hours (Default) this will need to multiply into the condition change time or issues will occur.
now the weather maps are were weather will change, e.g. every open city, route lake etc. any map not included (interiors or maps you
don't want weather on) will be set to clear weather.
The Weather changes on transfer not instantly if the time runs out. to reset the weather leave the map and return.
Next for the weather encounters, these aren't updated and can easily be simplified into a encounter method.
this script still works with the other, and should work.
Weather encounters
Spoiler:
This should be entirely plug and play.
the script mostly says it all, there are no events needed or extra coding.
make sure you put it above "Main" and call it "Weather Encounters"
Code:
#===============================================================================
# Weather Encounters By ArchyArc [v16] v1-
# this is the second part to the weather revamp, but not needed for that to
# work, however this WILL need that to work, in a sense.
#
# I'll explain what each bit means after this or at when it appears in the
# script.
#
# some basics, the encounters dont work like the encotuner tables nor show up
# on the nest/habitat page. There is a way to make ones more likely/less likely
# and also depends on how many species you want.
#
# WEATHERCHANCE - The %age chance a weather encounter will appear over a
# regular one.
# _SPECIES - A weather is in the underscore in caps (e.g. RAINSPECIES) this is
# the area where encounters are defined.
# do define a sepcies it should be [:BULBASAUR], No level is provided but you
# could adjust the script for it. to increase the number that can appear just
# have multiple of the species name, say if you have 10 total and 4 are
# BULBASAUR, then a 40% chance a bulbasaur will appear.
#
# This script along with the base weather script can be expanded on with your
# own weathers.
#
# The level of the pokemon is based on your party level.
#===============================================================================
WEATHERCHANCE = 40 # Default 40%
RAINSPECIES =[
[:SHELLOS],
[:SHELLOS],
[:SHELLOS],
[:MAGIKARP],
[:MAGIKARP],
[:LOTAD],
[:LOTAD],
[:OSHAWOTT],
[:OSHAWOTT],
[:GOOMY],
[:GOOMY]
]
STORMSPECIES =[
[:FEEBAS],
[:FEEBAS],
[:FEEBAS],
[:FROAKIE],
[:FROAKIE],
[:BLITZLE],
[:BLITZLE],
[:HELIOPTILE],
[:HELIOPTILE],
[:GOOMY],
[:GOOMY],
[:STUNFISK],
[:STUNFISK]
]
SNOWSPECIES =[
[:SNOVER],
[:SNOVER],
[:SNOVER],
[:STANTLER],
[:STANTLER],
[:CUBCHOO],
[:CUBCHOO],
[:DELIBIRD],
[:DELIBIRD],
[:CRYOGONAL],
[:CRYOGONAL],
[:ABSOL],
[:ABSOL]
]
BLIZZARDSPECIES =[
[:SNOVER],
[:SNOVER],
[:SNOVER],
[:SKARMORY],
[:SKARMORY],
[:CUBCHOO],
[:CUBCHOO],
[:DELIBIRD],
[:DELIBIRD],
[:CRYOGONAL],
[:CRYOGONAL],
[:ABSOL],
[:ABSOL]
]
SANDSTORMSPECIES =[
[:DIGLET],
[:DIGLET],
[:DIGLET],
[:SANDSHREW],
[:SANDSHREW],
[:SANDILE],
[:SANDILE],
[:PHANPY],
[:PHANPY],
[:TRAPINCH],
[:TRAPINCH],
[:AXEW],
[:AXEW]
]
SUNNYSPECIES =[
[:SUNKERN],
[:SUNKERN],
[:SUNKERN],
[:BULBASAUR],
[:BULBASAUR],
[:HELIOPTILE],
[:HELIOPTILE],
[:GROWLITHE],
[:GROWLITHE],
[:TORCHIC],
[:TORCHIC],
[:LARVESTA],
[:LARVESTA]
]
#Start of actual code
EncounterModifier.register(proc {|encounter|
return encounter if !encounter
if $game_screen.weather_type==PBFieldWeather::Rain # Check for weather, change this for each weather
index=rand(RAINSPECIES.length) # the call for the species, make sure it matches to work
newenc=RAINSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
elsif $game_screen.weather_type==PBFieldWeather::Storm # Check for weather
index=rand(STORMSPECIES.length) # the call for the species
newenc=STORMSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
elsif $game_screen.weather_type==PBFieldWeather::Snow # Check for weather
index=rand(STORMSPECIES.length) # the call for the species
newenc=SNOWSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
elsif $game_screen.weather_type==PBFieldWeather::Blizzard # Check for weather
index=rand(BLIZZARDSPECIES.length) # the call for the species
newenc=BLIZZARDSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
elsif $game_screen.weather_type==PBFieldWeather::Sandstorm # Check for weather
index=rand(SANDSTORMSPECIES.length) # the call for the species
newenc=SANDSTORMSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
elsif $game_screen.weather_type==PBFieldWeather::Sunny # Check for weather
index=rand(SUNNYSPECIES.length) # the call for the species
newenc=SUNNYSPECIES[index]
if rand(100)<WEATHERCHANCE
level=pbBalancedLevel($Trainer.party) - 5 + rand(6) # For variety
return [getID(PBSpecies,newenc[0]),level]
end
end
return encounter
})
They should both work, do leave a reply if thats not the case, or you have issues in general.
if you do have improvements or something your unsure how to do for edits, i might know so its worth a try.
Last edited: