RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Rain Candy

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 60
Rain Candy
Version: 1.0
Author: Marc of Fall From Eden
Date: March 17, 2012

Version History


  • <Version 1.0> 2012.03.17 - Original Release

Description


This script creates a more aesthetically-pleasing rain effect than the one provided by RMVX. In other words, it's pure eye candy. ;)

Features

  • Use weather effects the same way you normally would (no script calls or fogs).
  • The opacity and speed of the rain will be affected by the "power" of the weather effect.
  • Many of the default aesthetics are easily user-modifiable.
  • It's eye candy! :V

Screenshots



Instructions

This script makes use of the default way RMVX handles weather. As such, all you need to do is set weather effects the way you normally would, and the intensity of the rain effect will adjust accordingly. If you want to change any of the default values used, simply modify their related constants in the Marc::Weather module of the script.

Script


This script requires an image to display for the rain effect. The image included in the demo is one we created for the effect, but this image created by ak47lol for their "realistic rain" tutorial works just as well (if not better). ;)

If you use ak47lol's rain image, please be sure to credit them!

Code: [Select]
# ============================================================================ #
# Rain Candy v1.0 by Marc (of Fall From Eden)                                  #
# This script is licensed under the Creative Commons BY-SA 3.0 license.        #
# ============================================================================ #
# DESCRIPTION                                                                  #
# ---------------------------------------------------------------------------- #
# This script creates a more aesthetically-pleasing rain effect than the one   #
# provided by RMVX. In other words, it's pure eye candy. ;)                    #
# ============================================================================ #
# USAGE INSTRUCTIONS                                                           #
# ---------------------------------------------------------------------------- #
# This script makes use of the default way RMVX handles weather. As such, all  #
# you need to do is set weather effects the way you normally would, and the    #
# intensity of the rain effect will adjust accordingly. If you want to change  #
# any of the default values used, simply modify their related constants in the #
# Marc::Weather module below.                                                  #
# ============================================================================ #

module Marc
  module Weather
    # Set RAIN_FILE to the picture you want to use for the rain effect.
    RAIN_FILE = "rain"
    # RAIN2_FILE is the file to display underneath RAIN_FILE; this creates a
    # more visually pleasing effect, as RAIN2_FILE subtracts from RAIN_FILE.
    RAIN2_FILE = RAIN_FILE
    # The tone you want rain to be. Set as Tone.new(red, green, blue, gray).
    RAIN_TONE = Tone.new(0, 0, 128, 75)
    # Determine the zoom levels of RAIN_FILE and RAIN2_FILE here. 1.0 is 100%,
    # 2.0 is 200%, and so on.
    RAIN_ZOOM = 1.0
    RAIN2_ZOOM = 1.5
  end
end # module Marc::Weather

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# !                      DO NOT EDIT BEYOND THIS POINT.                      ! #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #

# ============================================================================ #
# Spriteset_Weather                                                            #
# ---------------------------------------------------------------------------- #
# Aliased methods: initialize, update, dispose, type=                          #
# New methods: dispose_weather_planes                                          #
# ============================================================================ #
class Spriteset_Weather
  alias marc_rain_spriteset_weather_initialize initialize
  def initialize(viewport = nil)
    @type, @max, @ox, @oy = 0
    @rain_bitmap, @storm_bitmap = nil
    @weather_plane = Plane.new(viewport)
    @weather_plane2 = Plane.new(viewport)
    @weather_plane2.blend_type = 2
    @weather_plane.zoom_x = Marc::Weather::RAIN_ZOOM
    @weather_plane.zoom_y = Marc::Weather::RAIN_ZOOM
    @weather_plane2.zoom_x = Marc::Weather::RAIN2_ZOOM
    @weather_plane2.zoom_y = Marc::Weather::RAIN2_ZOOM
    marc_rain_spriteset_weather_initialize
  end # initialize
 
  alias marc_rain_spriteset_weather_update update
  def update
    return if @type == 0
    case @type
    when 1
      @weather_plane.opacity = (@max * 4)
      @weather_plane2.opacity = (@max * 3)
      @weather_plane.ox += (@max / 9).to_i
      @weather_plane.oy -= 8
      @weather_plane2.ox += (@max / 6).to_i
      @weather_plane2.oy -= 6
    when 2
      @weather_plane.opacity = (@max * 5)
      @weather_plane2.opacity = (@max * 4)
      @weather_plane.ox += (@max / 6).to_i
      @weather_plane.oy -= 16
      @weather_plane2.ox += (@max / 4).to_i
      @weather_plane2.oy -= 12
    else
      dispose_weather_planes
    end
    marc_rain_spriteset_weather_update
  end # update
 
  alias marc_rain_spriteset_weather_dispose dispose
  def dispose
    dispose_weather_planes
    marc_rain_spriteset_weather_dispose
  end # dispose
 
  def dispose_weather_planes
    unless @weather_plane.bitmap.nil? or @weather_plane2.bitmap.nil?
      @weather_plane.bitmap.dispose
      @weather_plane2.bitmap.dispose
    end
  end # dispose_weather_planes
 
  alias marc_rain_spriteset_weather_type type=
  def type=(type)
    return if @type == type
    if type == 1 or type == 2
      @type = type
      for sprite in @sprites
        sprite.bitmap = nil
      end
      @weather_plane.bitmap = Cache.picture(Marc::Weather::RAIN_FILE)
      @weather_plane2.bitmap = Cache.picture(Marc::Weather::RAIN2_FILE)
      @weather_plane.tone = Marc::Weather::RAIN_TONE
    else
      dispose_weather_planes
      marc_rain_spriteset_weather_type(type)
    end
  end # type=
end # class Spriteset_Weather

Credit


  • Marc of Fall From Eden
  • ak47lol (if you use their rain image)

Thanks


Support


You may receive support for this script in this topic or by sending us a personal message on these forums.

Known Compatibility Issues

This script only modifies Spriteset_Weather, so it should be compatible with just about anything except another script which affects how weather is drawn or handled.

Demo


Rain Candy Demo
There's nothing to demonstrate, but if you want to see the effect.... ;)

Author's Notes


This script was inspired by a topic we recently viewed about creating "realistic rain" on VX.net written by ak47lol. Marc then decided to script in a similar effect that makes use of RMVX's default weather effects (and how they are set) to keep things as simple as possible for the end-user. :)

(We might also be using this in our own game, but that's beside the point on this one.) :P

Restrictions

:ccbysa:
This script is licensed under a Creative Commons BY-SA 3.0 license. Essentially, you may use it for commercial games, but proper attribution is required; as well, you may modify the script any way you like as long as the modified version retains attribution to the original author and is released under an identical license.

*
A-pow 2015
Rep:
Level 81
2014 Best RPG Maker User - GraphicsFor frequently finding and reporting spam and spam bots2013 Most Unsung MemberSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.How can I help you? :Da^2 + b^2 = c^2Secret Santa 2012 ParticipantSilver - GIAW 10Silver - GIAW 9Bronze - GIAW HalloweenGold - Game In A Week VII
I thought this was a script for raining down candy from the sky. I am disappoint.  :mad:

But cool normal rain.

***
Rep:
Level 60
You know, you could always change the rain graphic to candy. :D