Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Weather: Thunderstorm

Weather: Thunderstorm Version: 1.00
By: Glitchfinder


Introduction

This script is easily one of my oldest scripts. In fact, the very first version of this was evented, and the issues that led to caused me to begin to learn scripting. My very first posted script (the multiple timers one) was a direct result of this script needing more than one timer. I've rewritten this script from scratch so many times that I've lost count of it, as well. Anyway, this script is intended to create a fully featured, automated thunderstorm for use within a game. While originally intended for use in a much larger, mostly scrapped group of systems, this one was near enough to being finished that I was able to fine tune it for release.

Features

  • Create a fully automated thunderstorm!
  • Works on any map!
  • Override and create instant lightning strikes and thunderclaps!
  • Easy event access!

Video

http://www.youtube.com/watch?v=uoP9nUd5M9c

Script

Due to the nature of this script, it can only be found in the demo below.

Demo

You can download the XP demo of this script here.

Instructions

Place this script above Main, and below the default scripts. (I realize this is obvious to most, but some people don't get it.)

This script requires no configuration. To see how to use it, look at the method list below.

The methods listed under the Thunderstorm Module are intended for scripted access, and can be accessed with Weather::Thunderstom.method_name

The methods listed under the Evented Access are intended to be called from the evented call script function, and can be accessed with no prefixes.

Method List (Thunderstorm Module)

set_power(power, duration)

Changes the intensity of the thunderstorm over the period specified by duration. (in frames) It is recommended that power be set to an integer from 0 to 9, where 0 is off and 9 is the most intense. Values below 0 function in the same way as 0, while values above 9 shorten the time between lightning strikes.

update

Updates the thunderstorm module. Intended for internal use, but can also be used to update the thunderstorm in scenes other than Scene_Map.

flash_lightning

Creates a flash for a lightning strike. Intended for internal use, but can also be used to create a fully automated lightning strike at will.

manual_lightning(distance)

Creates a flash of lightning for a lightning strike, where distance is distance from the player where it hits, in miles. This method will automatically result in a thunderclap being played, where the delay is based upon the distance.

override_lightning(color, flash_time, delay, audio, volume, pitch)

Creates a custom lightning flash. Color is a Color object created with Color.new; flash_time is the duration of the flash, in frames; delay is the delay between the strike and the resulting thunder, in frames; audio is the path to the thunder audio file; volume is the volume of the thunderclap, from 0 to 100; pitch is the pitch of the thunderclap, from 0 to 100, where 50 is normal. This method will automatically result in a thunderclap being played using the override_thunderclap method.

play_thunderclap

Plays a random thunderclap from the audio file array at the top of the script. This method is intended for internal use only, but it can also be used to play a fully automated thunderclap at will.

manual_thunderclap(distance, thunderclap_number)

Manually forces playback of a thunderclap. Distance is the distance from the player where the lightning struck, and indirectly affects volume and pitch. Thunderclap_number is the index of the thunderclap audio file in the array at the top of the script, starting at 0.

override_thunderclap

Forces playback of a fully overridden thunderclap. This method is intended for internal use only, and does nothing unless the override_lightning has been called. This method will also be ignored if the override_lightning method has already called this method.

Method List (Evented Access)

set_thunderstorm(power, duration)

Changes the intensity of the thunderstorm over the period specified by duration. (in frames) It is recommended that power be set to an integer from 0 to 9, where 0 is off and 9 is the most intense. Values below 0 function in the same way as 0, while values above 9 shorten the time between lightning strikes.

flash_lightning(distance)

Creates a flash of lightning for a lightning strike, where distance is distance from the player where it hits, in miles. This method will automatically result in a thunderclap being played, where the delay is based upon the distance.

override_lightning(color, flash_time, delay, audio, volume, pitch)

Creates a custom lightning flash. Color is a Color object created with Color.new; flash_time is the duration of the flash, in frames; delay is the delay between the strike and the resulting thunder, in frames; audio is the path to the thunder audio file; volume is the volume of the thunderclap, from 0 to 100; pitch is the pitch of the thunderclap, from 0 to 100, where 50 is normal. This method will automatically result in a thunderclap being played using the override_thunderclap method.

play_thunderclap(distance, thunderclap_number)

Manually forces playback of a thunderclap. Distance is the distance from the player where the lightning struck, and indirectly affects volume and pitch. Thunderclap_number is the index of the thunderclap audio file in the array at the top of the script, starting at 0.

Terms and Conditions

  • This script is free to use in any noncommercial project. If you wish to use this script in a commercial (paid) project, please contact Glitchfinder at his website.
  • This script may only be hosted at the following domains:
    http://www.glitchkey.com
    http://www.hbgames.org
  • If you wish to host this script elsewhere, please contact Glitchfinder.
  • If you wish to translate this script, please contact Glitchfinder. He will need the web address that you plan to host the script at, as well as the language this script is being translated to.
  • The script header must remain intact at all times.
  • Glitchfinder remains the sole owner of this code. He may modify or revoke this license at any time, for any reason.
  • Any code derived from code within this script is owned by Glitchfinder, and you must have his permission to publish, host, or distribute his code.
  • This license applies to all code derived from the code within this script.
  • If you use this script within your project, you must include visible credit to Glitchfinder, within reason.
 

regi

Sponsor

Cool stuff! I've always enjoyed these kinds of weather effects. I like how you included quite a few script snippets to ease the process and add variation, even if it's still easily done via common events. Nice work.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top