Scripts:Thunder and Lightning

Jump to navigation Jump to search

Just a quick little script I thought I'd share. This will create a flash of lightning at random intervals, and optionally, play a random thunder sound as well.


plotscript, mapthunder, begin

  variable (thundersfx) 
  if (read timer (0) == 0)then, begin
    set timer (0, random (1,8), 18) #happens every 1-8 seconds
    thundersfx := random (0, 3) #replace these numbers with the range of sounds you want to use
    play sound (thundersfx,false,true) 
    tweak palette(40,40,40) #change these higher or lower for brighter or dimmer flashes
    update palette
    reset palette
    fade screen in


Use this script as the Each-Step script for every map you want thunder/lightning.

If you're only using one sound, delete all references to 'thundersfx' and just play the sound directly. This can easily be modified to call individual bolts of lightning instead of map-wide.