Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ForeverZer0 on March 31, 2010, 06:12:02 pm

Title: [XP] Advanced Weather
Post by: ForeverZer0 on March 31, 2010, 06:12:02 pm
Advanced Weather
Authors: ForeverZer0, Ccoa
Version: 1.1
Type: Complete Weather System
Key Term: Custom Environment System

Introduction

First off, let me state that this is a modification, albeit a heavy one, of Ccoa's Advanced Weather System. If you use Ccoa's script, and have other scripts that are dependent on it, this script can still replace it with only some very minor edits.

Although I love the original script (a great staple for any game), I found that there was room for many improvements in basic data handling, configurability, and the simple overview of it.  Then came the MAWS script by Agckuu Coceg. I loved the idea (it's what inspired this script), but it only further added to the number of redundancies that bugged me.I didn't see the point in caching 50+ different bitmaps, when there are essentially less than 30 types of weather, and the rest are just color variations. For example, Rain, Blood Rain, Acid Rain, Sepia Rain, Golden Rain, and Oil Rain all use the exact same image, just with different color, so why cache all of them separately?

So, here it is, with totally over-hauled coding. You no longer have to remember 60+ different numbers for weather types. If it is rain, the type will always be 1, but with an added number at the end of the script call, it can quickly become any color variation of rain (see instructions). It's easier than ever to add your own custom color schemes to the weather, I added some extra configurable values, and the coding has been improved immensely. To give you an idea of how many redundant lines of code there were, before I added some of my new custom weather effects, the code was over 1000 lines shorter than the MAWS script. Even now, if you include all the various color schemes, this script offers 95 different weather patterns, compared to the 54 offered by MAWS, and it is still shorter!


Features


Screenshots

Birds: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Zer0%20Advanced%20Weather%201.1/AdvWeather1.png)

Snow: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Zer0%20Advanced%20Weather%201.1/AdvWeather2.png)

Autumn Leaves: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Zer0%20Advanced%20Weather%201.1/AdvWeather3.png)


Demo

Demo Link (http://dl.dropbox.com/u/20787370/Scripts/Zer0%20Advanced%20Weather%201.1/Zer0%20Advanced%20Weather%201.1.zip)

If you would like to create custom weather patterns, check out the WeatherCreator (http://forum.chaos-project.com/index.php/topic,7731.0.html), it will help you create your own, and generate Advanced Weather 2.0 to use them with.

Script

https://pastebin.com/raw/rUPJtKEA (As dropbox links are outdated - thanks Sin86)

Script is too large for code box. View by following link.
Script Link (http://dl.dropbox.com/u/20787370/Scripts/Zer0%20Advanced%20Weather%201.1/Zer0%20Advanced%20Weather%201.1.htm)


Instructions

Place script anywhere below Spriteset_Map.
Click here for some quick instructions.
Spoiler: ShowHide

To alter the color/tone of the weather, add the corresponding number to the end of the normal script call:
$game_screen.weather(type, power, transition, style)
Here's an example:
# This will set the weather pattern to rain, but with the added 1 at the end,
# it will now be Blood Rain.
$game_screen.weather(1, 25, 40, 1) # 2 for the style would be Oil Rain, etc., etc.
The usual script call will still work just fine.
If the 'style' is left off, it will be assumed to be 0 and the default weather pattern will be used.
That means you can you can use either one of the following to make it snow normally:
$game_screen.weather(3, 25, 0)
...or...
$game_screen.weather(3, 25, 0, 0)
They both do the exact same thing, so this should help with compatibility in other scripts that make script
calls to alter the weather.

More instructions, if needed, are in the script and demo.


Compatibility

Should be compatible with everything.
I tried to keep most of the weather types set to the same value as they were in Ccoa's original script, but a few
of them have been combined with other ones under the new system (i.e. different leave colors, Blood Rain, etc.)

Credits and Thanks


Author's Notes

Hope you enjoy. Be sure to give some feedback and let me know how you like it.
I'm running out of ideas for weather effects, so if you have an idea for any weather effects you would like, let me know and I'll include them in future updates.
If any bugs are found, let me know and I'll be happy to try and fix them.
Title: Re: [XP] Advanced Weather
Post by: lilbrudder917 on April 01, 2010, 01:19:37 am
I like. I'll probably use this. -levels up-

Just one thing, the demo link you gave leads to your Advanced Title demo, not Weather.  :P Might want to fix that.
Title: Re: [XP] Advanced Weather
Post by: Jragyn on April 01, 2010, 01:29:49 am
You know, you've shown up on this forum seemingly outta no where, and your slamming script after script out, and I have to say I'm not only impressed, but appreciative, cuz their all useful!

Thumbs up to you, and thanks again for another addition to the collection of l33t scripts here on Chaos Project.


--JeR
Title: Re: [XP] Advanced Weather
Post by: Tyril132 on April 01, 2010, 02:14:31 am
Great script, great effort, and I'm sure I'll make good use of it.

Level up.  :haha:
Title: Re: [XP] Advanced Weather
Post by: Agckuu Coceg on April 02, 2010, 04:14:27 am
Good to see the superiority of leveled scripter like you. I just created a rough work on the code Ccoa, because I - just spriter, not scripter.

Glad I could inspire you to this remarkable work. I think it would be nice if I can use your work to improve my MAWS on your script base (or to make an addon on your base ...)

Level up, keep it up. Let them know that small communities can not be underestimated.

P.S. 5.04.2010. Actually, today I have already done. Look at your masterpiece in my cut. I hope you like it.
Title: Re: [XP] Advanced Weather
Post by: Caligatio on April 05, 2010, 07:14:06 am
I like this one better than the original script, thanks!
Title: Re: [XP] Advanced Weather
Post by: ForeverZer0 on April 07, 2010, 06:23:59 pm
Ok, I finally fixed the Demo link. Sorry about that :(

I've updated the script to Version 1.1. (Script only, not the demo)

The following changes have been added:
   - New weather effects (4)
       - Bats
       - Bees
       - Fish (good for an underwater scene)
       - Ravens
   - Butterfly flight pattern has been improved. They move about a little bit more randomly
     instead of just flying in a more or less straight line until they reach the end of the screen.
   - Updated credits (Forgot to credit Blizzard for Bitmap2Code)
   - Some minor coding improvements

If anybody has been experienced any lag when the weather variation is changed, let me know.
I thought about re-writing the make_bitmaps and disposal methods to only dispose and re-cache
the weather pattern that is being changed, and leaving the weather bitmaps that are not being
used alone. This will give the CPU a little less to do, especially since more and more elaborate
weather effects are being added.

I haven't personally experienced any lag, but I see the possibility of it because of how it works, so if you have,
tell me and I'll get to work on it and make an updated version.
Title: Re: [XP] Advanced Weather
Post by: ForeverZer0 on April 07, 2010, 06:28:42 pm
QuoteGlad I could inspire you to this remarkable work. I think it would be nice if I can use your work to improve my MAWS on your script base (or to make an addon on your base ...)


Yes, by all means use any of this code you like. I wouldn't have really undertook this if your modification wasn't released.

That goes with pretty much all of my scripts. Anybody can use or modify the coding as they seem fit.
I hope others can learn from my work same as I learn from theirs.
Title: Re: [XP] Advanced Weather
Post by: Agckuu Coceg on April 09, 2010, 12:00:30 am
It would be nice if you could make this and VX. I personally can not do this  :^_^':...
Title: Re: [XP] Advanced Weather
Post by: ForeverZer0 on May 15, 2011, 10:34:24 am
NECRO-BUMP!!!

Fixed the post and the dead links.
Added screenshots.
Title: Re: [XP] Advanced Weather
Post by: LiTTleDRAgo on May 23, 2011, 01:05:44 am
can I add a request to make weather effect by event graphics?

ex : aluxes / arshes raining from the sky
Title: Re: [XP] Advanced Weather
Post by: ForeverZer0 on May 23, 2011, 05:26:44 pm
You can use the "User Defined" (Type 15) weather type for custom graphics that you don't want to have defined via script.
You can set the names images to load in the $WEATHER_IMAGES array, and set the movement with the other variables.

#-------------------------------------------------------------------------------
$WEATHER_UPDATE = false   # the $WEATHER_IMAGES array has changed, please update
$WEATHER_IMAGES = []      # the array of picture names to use
$WEATHER_X = 0            # the number of pixels the image should move horizontally (positive = right, negative = left)
$WEATHER_Y = 0            # the number of pizels the image should move vertically (positive = down, negative = up)
$WEATHER_FADE = 0         # how much the image should fade each update (0 = no fade, 255 = fade instantly)
$WEATHER_ANIMATED = false # whether or not the image should cycle through all the images
#-------------------------------------------------------------------------------


This part could be improved, and I may sometime soon here when I get a chance.  It is a remnant of Ccoa's base script that never really got changed.
Title: Re: [XP] Advanced Weather
Post by: Lamsah on May 19, 2013, 02:27:01 pm
Hi! I was wondering how i can call or set the weather animation to off but keep the audio running? What im trying to do is when the actor goes indoor then set the weather to off but keep the audio running and i cant seem to do just that. I know how to turn the entire weather off including audio but thats not what im trying to accomplish in the project. It seems to  come prebuilt for your advance climate script but not this one. I dont want to use the other script but only this one so is there a script call for my request in turning off the weather but leave the audio sound of the weather on? Thanks in advance =)
Title: Re: [XP] Advanced Weather
Post by: Zexion on May 19, 2013, 02:39:03 pm
Why don't you just play the sound effect by event? You use an event to teleport the player right? Why not start the background sound then, or just set up the sound effect in the map settings?
Title: Re: [XP] Advanced Weather
Post by: Lamsah on May 19, 2013, 05:04:36 pm
Hi Zexion  :^_^':

That is indeed a good temporary solution but, what if it stopped raining outside because of the duration inside made the changed in weather. That would be kinda weird when the thunderstorm audio is still running inside and by the time u come outside, the rain stops... that would be weird?
Title: Re: [XP] Advanced Weather
Post by: KK20 on May 19, 2013, 08:32:42 pm
Then make it rain again with another script call. (?)

Or try this edit. You're only replacing the few lines in the script itself:

  def type=(type)
    return if @type == type
    @type = type
    case @type
    when 1, 5, 9, 100                            # Rain, Thunder, Real Thunder
      bitmap = @type == 100 ? nil : @rain_bitmap
      @thunder = true if @type == 5
      @realistic_thunder = true if @type == 9 || @type == 100

Use a type of 100 when calling the script.

By the way, FZer0 is practically dead. It's funny how you address to him as if he's still here.
Title: Re: [XP] Advanced Weather
Post by: Lamsah on May 19, 2013, 11:01:59 pm
Hi KK20!

I didn't know Zero wasnt here anymore. :'(

Well, i can see what your saying by recalling the script to rain again but, i have the rain set to random power every certain amount of frames by event on parallel process set to different power of type weather to certain times. So, if i make it where an exit event of the area calls the rain again at random like you said, then it would look funny if the actor reenters and re-exits the area consistently just to see how it would turn out; the rain would change rapidly just by exiting and would look unrealistic. It would look funny to see the weather change so fast in a second by repeatedly reentering the area and in that case, player would know that weather changes when zoning the area. Thats giving the player control to manipulate the weather. So to fix this, i just need script call code for a temporary halt or pause to the weather while actor is indoor and at this, ill just set weather audio by event to make it feel that the weather outside is on OR find a way to temporarily disable the weather animation in the meantime while audio is currently playing and set by the weather script; example: rainstorm audio is running inside the house but no raindrops on screen and at the same time the global weather is constantly running with the random event i had set it to. Isn't there a script call for this? Sorry, but i am not a scripter and im still figuring things out. :shy:
Title: Re: [XP] Advanced Weather
Post by: Gears on January 20, 2015, 01:38:13 pm
I seem to be having weird trouble getting the variations to work in the script. the script is included in KK20's Advance wars engine, but if i try to call it there trough the game with the $game_screen.weather(1, 25, 40, 1)  function, i get normal rain instead of the bloodrain that's supposed to fall. Any idea what might cause the lack of variation?
Title: Re: [XP] Advanced Weather
Post by: KK20 on January 21, 2015, 04:37:35 pm
Turns out I was a total noob at the time. I didn't alias Spriteset_Map#update. So just move this script below it and you should be good to go. I have it fixed in the later version, where I went back and cleaned up stupid copy-paste things I did.
Title: Re: [XP] Advanced Weather
Post by: Gears on January 26, 2015, 07:58:11 pm
I'm afraid i don't quite follow. I did move the weather script below the spriteset_Map script, but that did not seem to do anything.
Title: Re: [XP] Advanced Weather
Post by: KK20 on January 26, 2015, 10:41:54 pm
I have a second 'Spriteset_Map' located near the bottom of the script list. You have to move the weather script below that listing.

Right now your script list should be like
Quote
Scene_Debug
------------------
~*~NOTES~*~

##RANDOM EDITS##
...
FZer0 Weather Script
...
--------[ Engine ]----------------
Spriteset_Map
Game_Player
Game_Map

So move FZer0 Weather Script just below the Spriteset_Map listed above.
Quote
Scene_Debug
------------------
~*~NOTES~*~

##RANDOM EDITS##
...
--------[ Engine ]----------------
Spriteset_Map
FZer0 Weather Script
Game_Player
Game_Map
Title: Re: [XP] Advanced Weather
Post by: Gears on January 27, 2015, 05:51:28 pm
Got it. Now it works. Time to make bloodrain a thing.
Title: Re: [XP] Advanced Weather
Post by: Josey on February 04, 2015, 09:28:53 am
Hi! :D

I wanted to ask if you could also install a sandstorm? Perhaps as a variation, the irregular directions changed? Would that be hard?
I would appreciate an answer.

Josey~
Title: Re: [XP] Advanced Weather
Post by: KK20 on February 05, 2015, 04:32:00 pm
Why not create it yourself?
http://forum.chaos-project.com/index.php/topic,7731.0.html
Title: Re: [XP] Advanced Weather
Post by: Josey on February 06, 2015, 12:59:11 pm
Thank you very much! :D