[XP] Advanced Weather

Started by ForeverZer0, March 31, 2010, 06:12:02 pm

Previous topic - Next topic

ForeverZer0

March 31, 2010, 06:12:02 pm Last Edit: October 16, 2020, 11:21:55 pm by KK20
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

  • New weather effects include, butterflies, birds, falling rocks, and arrows.
  • Including color variations, offers 95 different weather patterns.
  • Easy to quickly add more or alter existing weather patterns.
  • Configurable switch that will be ON during bad weather (Good for event conditions)
  • Configurable in-game variable that will be equal to the weather type.
  • Realistic thunder with random volume and pitch.
  • Easily configure how constant the over-all thunder/lightning is.
  • Fixed an error from the original script with the snow bitmap. It looks better now.
  • More RAM friendly and over-all much cleaner code

Screenshots

Birds: ShowHide

Snow: ShowHide

Autumn Leaves: ShowHide


Demo

Demo Link

If you would like to create custom weather patterns, check out the WeatherCreator, 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


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

  • ForeverZer0, for the script
  • Ccoa, for the original base script
  • Agckuu Coceg, for some additional weather colors, and the inspiration to write this script.

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

lilbrudder917

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.

Jragyn

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
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Tyril132

Great script, great effort, and I'm sure I'll make good use of it.

Level up.  :haha:
Lv. 7 Writer | Lv. 7 Composer | Lv. 7 Mapper | Lv. 4 Eventer | Lv. 0 Scripter | Lv. 1 Spriter
DSC Project Soundtrack
Personality Index:: ShowHide

Agckuu Coceg

April 02, 2010, 04:14:27 am #4 Last Edit: April 05, 2010, 04:30:21 am by Agckuu Coceg
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.
I'm not retarded, but I'm busy. Sorry for patience.


Caligatio

I like this one better than the original script, thanks!

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Agckuu Coceg

It would be nice if you could make this and VX. I personally can not do this  :^_^':...
I'm not retarded, but I'm busy. Sorry for patience.


ForeverZer0

NECRO-BUMP!!!

Fixed the post and the dead links.
Added screenshots.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

LiTTleDRAgo

can I add a request to make weather effect by event graphics?

ex : aluxes / arshes raining from the sky

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Lamsah

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 =)

Zexion

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?

Lamsah

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?

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Lamsah

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:

Gears

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?

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Gears

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.