Random Weather Generator
Current Version: 3.0
Introduction
This is my Random Weather Generator that I built for Leknaat's Rhapsodia Village. The script is used to create random weather effects that fade in and out like real weather. In other words, after a few minutes, it may begin to rain. Then after an other minute, it may hail. And then it may grow into a thunder storm. Then the weather will slowly die down into soft rain, and eventually clear weather.
Features
Not many, yet. More planned for later.
Future Feature//Regionalized Weather//Types
EDIT: This feature will work by placing [r] in Event 001 on any map, where r is the region type on that map.
Screenshots
No point. This system doesn't have any means of displaying other than weather you have all probably already seen...
Demo
I will post a demo when I have more scripts to put into it.
Script
Instructions
Easy as pie. All you have to do is paste the script above Main. Here is how to use Memorize and Restore:
FAQ
Q: What does Random mean?
A: ... ... ...
Q: Which Weather Effects does this have?
A: Every one of Ccoa's Weather Script weather effects!
Q: How do I...?
A: How do you what?
Compatibility
I know it works with f0tz!baerchen's AntiLag script, but that's all I have tested it with. You MUST have Ccoa's Weather Script to make this work!
RandWeather only alters Scene_Map's initialize and update methods, and gives it new methods. It also changes Game_Screen's initialize and adds the method power?.
Credits and Thanks
Credit me, Ccoa, and if you so feel the need, SephirothSpawn, who I indirectly got my Event Checking code snipets from!
Author's Notes
Next Release: Already Out!
New Features: Above if I mentioned them!
I am taking requests for add ons, clean ups, whatever! But be polite and patient. I may not accept to do any if I so wish.
Future/Planned Features:
1. Screen Tinting based on weather (clear weather = normal, sunny = bright, rainy = dark, etc.)
2. possible use of fogs (overlapping Map Fogs if possible!)
3. Easily add new Random Weather Effects (Blood Rain, anyone?)
4. Regionalized Weather ('Forest' = RAIN, 'Desert' = Sand Storm, etc.) COMPLETE
5. Weather Fade into other weather at command call. For example, Rain can turn to now by using Scene_Map.fade_to('Rain', 'Snow'). Something along these lines.
Peace!
Current Version: 3.0
Introduction
This is my Random Weather Generator that I built for Leknaat's Rhapsodia Village. The script is used to create random weather effects that fade in and out like real weather. In other words, after a few minutes, it may begin to rain. Then after an other minute, it may hail. And then it may grow into a thunder storm. Then the weather will slowly die down into soft rain, and eventually clear weather.
Features
Not many, yet. More planned for later.
- Random Effects
- Memorize and Restore Weather
- Turn RandWeather ON or OFF with a simple Call Script
Future Feature//Regionalized Weather//Types
EDIT: This feature will work by placing [r] in Event 001 on any map, where r is the region type on that map.
- ALL -- Every Effect!
- PLAIN -- Rain, Hail, Storm, and Rain w/Th&Li
- FOREST -- Rain, Hail, Storm, Rain w/Th&Li, and All of the Leef Effects (except Sakura...)
- DESERT -- Falling Ash (sorry, but it is all I can do with what I have right now!)
- ARCTIC -- Snow and Blowing Snow
- OCEAN -- See PLAINS. I didn't realize this until now, but PLAINS and OCEAN are the same!
Screenshots
No point. This system doesn't have any means of displaying other than weather you have all probably already seen...
Demo
I will post a demo when I have more scripts to put into it.
Script
Code:
# Random Weather Generator
# Broken Wire
# Version: 3.0
# Date: 1/28/07
module BSR
# Constructer Event ID
CONSTRUCT_ID = 1
# Region IDs ####Please do not edit, though you may add to the list!
ALL = 'All'
PLAINS = 'Plains'
FOREST = 'Forest'
DESERT = 'Desert'
ARCTIC = 'Arctic'
OCEAN = 'Ocean'
# Weather Hash
WEATHER = {
ALL => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19],
PLAINS => [1, 2, 4, 5], FOREST => [1, 2, 4, 5, 6, 7, 8, 9],
DESERT => [18], ARCTIC => [3, 16], OCEAN => [1, 2, 4, 5]
}
end
class Scene_Map
#Aliases
alias brkn_init initialize
alias brkn_updt update
#Init
def initialize
@weather_on = true
@weather = [0, 0] #Current weather [type, power]
@memorized = [0, 0] #Memorized weather data [type, power]
@fade_active = false
@rage_actice = false
@count = 0 #Count value for update method
end
# Memorize Weather
def memorize_weather
if !memorized?
@memorized[0] = @weather[0]
@memorized[1] = @weather[1]
@weather[0] = 0
@weather[1] = 0
$game_screen.weather(@weather[0], @weather[1], 0)
end
end
# Memorized?
def memorized?
if @memorized[0] != nil
return true
end
return false
end
# Restore Weather
def restore_weather
if memorized?
@weather[0] = @memorized[0]
@weather[1] = @memorized[1]
@memorized[0] = 0
@memorized[1] = 0
$game_screen.weather(@weather[0], @weather[1], 0)
end
end
# Enragen the Weather
def rage_weather
power = @weather[1] + rand(10)
$game_screen.weather(@weather[0], power, rand(19) + 1)
if rand(5) > 3
@rage_active = true
else
@rage_active = false
end
update
end
# Fade the Weather
def fade_weather
power = @weather[1] - rand(10)
$game_screen.weather(@weather[0], power, rand(19) + 1)
if rand(5) > 3
@fade_active = true
else
@fade_active = false
end
update
end
# Update
def update
# Update regularly
brkn_updt
if @weather_on == true
if memorized?
restore_weather
end
types = []
# Fade Weather
if @fade_active == true
fade_weather
# Rage Weather
elsif @rage_active == true
rage_weather
end
event = $game_map.events[CONSTRUCT_ID]
unless event.erased
unless event.list.nil?
event.list.each do |event_command|
if event_command.code == 108 && event_command.code == 408
line0 = event_command.parameters[0]
#Weather Update
if line0.include?(BSR::ALL)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
$game_screen.weather(rand(BRW::WEATHER.keys.size - 1) + 1, rand(10), rand(9) + 1)
end
elsif line0.include?(BSR::PLAINS)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
plains = BSR::WEATHER[BSR::PLAINS].values
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
n_weather = plains[rand(plains.size - 1)]
$game_screen.weather(n_weather, rand(10), rand(9) + 1)
end
elsif line0.include?(BSR::FOREST)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
forest = BSR::WEATHER[BSR::FOREST].values
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
n_weather = forest[rand(forest.size - 1)]
$game_screen.weather(n_weather, rand(10), rand(9) + 1)
end
elsif line0.include?(BSR::DESERT)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
desert = BSR::WEATHER[BSR::DESERT].values
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
n_weather = desert[rand(desert.size - 1)]
$game_screen.weather(n_weather, rand(10), rand(9) + 1)
end
elsif line0.include?(BSR::ARCTIC)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
arctic = BSR::WEATHER[BSR::ARCTIC].values
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
n_weather = arctic[rand(arctic.size - 1)]
$game_screen.weather(n_weather, rand(10), rand(9) + 1)
end
elsif line0.include?(BSR::OCEAN)
@count = (@count + 1) % 1400
if @count == (rand(99) + 1) + 100 and @fade_active == false and @rage_active == false
ocean = BSR::WEATHER[BSR::OCEAN].values
#use special Fade or Rage features here if weather_type != 0
if $game_screen.weather_type != 0
if $game_screen.power? > 25
@fade_active = true #Make the weather fade out a little.
update
elsif $game_screen.power? <= 25
@rage_active = true #Make the weather get heavier/harsher
update
end
end
#Otherwise, create a random weather effect at low power!
n_weather = ocean[rand(ocean.size - 1)]
$game_screen.weather(n_weather, rand(10), rand(9) + 1)
end
end
end
end
end
elsif @weather_on == false
memorize_weather
end
end
end
class Game_Screen
alias brkn_init initialize
def initialize
@power = 0
brkn_init
end
def weather(type, power, duration)
@weather_type_target = type
if @weather_type_target != 0
@weather_type = @weather_type_target
@power = power
end
if @weather_type_target == 0
@weather_max_target = 0.0
else
@weather_max_target = (power + 1) * 4.0
end
@weather_duration = duration
if @weather_duration == 0
@weather_type = @weather_type_target
@weather_max = @weather_max_target
end
end
def power?
return @power
end
end
Instructions
Easy as pie. All you have to do is paste the script above Main. Here is how to use Memorize and Restore:
To effectively use Memorize, go into an event that transports the player to an inside map. After adding Prepare for Transition, add Call Script: Scene_Map.memorize_weather.Then transport the player and use Execute Transition. (WILL ONLY WORK IF YOU HAVE NOTHING MEMORIZED YET!)
To effectively use Restore, go into an event that transports the player to an outside map. After adding Prepare for Transition, add Call Script: Scene_Map.restore_weather.Then transport the player and use Execute Transition. (WILL ONLY WORK IF YOU HAVE USED MEMORIZE!)
FAQ
Q: What does Random mean?
A: ... ... ...
Q: Which Weather Effects does this have?
A: Every one of Ccoa's Weather Script weather effects!
Q: How do I...?
A: How do you what?
Compatibility
I know it works with f0tz!baerchen's AntiLag script, but that's all I have tested it with. You MUST have Ccoa's Weather Script to make this work!
RandWeather only alters Scene_Map's initialize and update methods, and gives it new methods. It also changes Game_Screen's initialize and adds the method power?.
Credits and Thanks
Credit me, Ccoa, and if you so feel the need, SephirothSpawn, who I indirectly got my Event Checking code snipets from!
Author's Notes
Next Release: Already Out!
New Features: Above if I mentioned them!
I am taking requests for add ons, clean ups, whatever! But be polite and patient. I may not accept to do any if I so wish.
Future/Planned Features:
1. Screen Tinting based on weather (clear weather = normal, sunny = bright, rainy = dark, etc.)
2. possible use of fogs (overlapping Map Fogs if possible!)
3. Easily add new Random Weather Effects (Blood Rain, anyone?)
4. Regionalized Weather ('Forest' = RAIN, 'Desert' = Sand Storm, etc.) COMPLETE
5. Weather Fade into other weather at command call. For example, Rain can turn to now by using Scene_Map.fade_to('Rain', 'Snow'). Something along these lines.
Peace!