Completely off from what I was making back then. Pressing the Green Flag will display a demo of the lightning generator doing stuff. It uses an overcomplicated script to accomplish this. The code relies on pen, but if you know how, you can substitute that for a "particle" instead, for sprite-based lightning, at the price of extra memory usage. Feel free to take the script and do whatever you want with it. Just keep in mind that it's quite inefficient, and fancy sine wave randomization shouldn't have to happen for this to be made.
In a nutshell, everything here is done by me. The limitations of the Scratch canvas is hindering, but it's the only drawing thing I can understand due to its simplicity. :( There may be some bugs here and there, but so far I haven't run into any significant ones.