Troubleshooting ForeverZero's Advanced Weather Script

Hello world!

I'm trying to use ForeverZero's weather script, based on Ccoa's weather script and with additional edits by Agckuu Coceg. I have it pasted above Main (since it can go anywhere below Spriteset_Map) but when I try to call the script, I get the error:

ForeverZero Weather Script Error.png

Script 'Zer0 Advanced Weather' line 754: NameError occurred. uninitialized constant RPG::Weather::SCREEN_RESOLUTION."

I remember enough of my very basic programming class long ago to understand the gist of what that means, but I'm not sure how to fix it. I've attached a screencap of the lines around 754, but the full text of the script is on PasteBin in the Chaos Project thread. (Unfortunately the demo link is dead, or I'd just reference that.)

The bit of this that I'm really looking for is the sparkle rains in various colors. I did try Agckuu Coceg's version, and that one didn't give me any errors--but it only had one sparkle rain option, so it's not ideal for my purpose. If there's a different weather script that allows for five or so different colors of sparkle rains, that would work too!

Thanks for your help!

Ah, oops--I just realized this was supposed to go in the Script forum, not the general XP support forum. Sorry, mods!
Ah yeah, that would be from my XPA Tilemap script. The user who provided the pastebin was using XPA at the time and I guess made some personal edits to the script. If you're using base resolution, you can replace SCREEN_RESOLUTION[0] with 640 and [1] with 480.

I'll be sure to fix that.
Brilliant, thank you so much! No more errors.

If you have another minute, I do have another question. The sparkles sometimes almost have the appearance of blinking in and out of existence, rather than drifting down--they'll be very opaque and bright, then fade down to low opacity, then disappear (or fade to such a low opacity that they almost don't show up) near the bottom, then suddenly show up again near the top, very opaque.
Where should I look for the numbers to tweak to adjust that? Either by reducing the opacity when they first show up, or raising the opacity when they fade off the screen, so that the difference isn't so sharp.
That's going to mostly be defined in the same area of the code:
Code:
      x = sprite.x - @ox
      y = sprite.y - @oy
      if sprite.opacity < 64 || x < -50 || x > 640 + 150 || 
        y < -300 || y > 480 + 32
        sprite.x = rand(640 + 160) - 50 + @ox
        sprite.y = rand(480 + 320) - 200 + @oy
        sprite.opacity = 255
      end
This is ensuring that if any of the weather particles has low opacity or is far enough off the screen, it will reposition it and reset its opacity value. Keep in mind this is applied to all the weather effects. If you want to get more specific for each type, then you'll need to introduce if @type == X to it.

How the particles are updated is seen here
Code:
      if @type == 14 # Sparkles
        if @countarray[i] == 0
          @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
          sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
        end
        @countarray[i] = (@countarray[i] + 1) % 15
        sprite.y += 1
        sprite.opacity -= 1
      end
So it's constantly moving down 1 pixel and lowering opacity by 1 each frame.
Ohhh, I see! I overcomplicated your directions to replace the SCREEN_RESOLUTION constants with 640 and 480, respectively. I thought that the +150, +32, etc, were related to the XP Ace adjustments. Putting them back in smoothed it all right out.

Interesting that that segment affects all the weather types--I thought it was under the if type == bombs section. Apparently I still get cross-eyed looking at code, haha. It never was my strong suit.

Final question--to adjust the color (for example, orange sparkles instead of pink), I would go to the Sparkle Bitmap section around Line 1367, and adjust the RGB values accordingly?

Thank you so much for your help!
Yes, that is the area. You could also just add onto the list rather than replacing one of the existing ones, thereby giving you additional variants:
Code:
    case $game_screen.weather_variation
    when 1 # Lavender
      sparkle_color1 = Color.new(197, 181, 255)
      sparkle_color2 = Color.new(171, 126, 234)
      sparkle_color3 = Color.new(187 , 77, 234)
      sparkle_color4 = Color.new(255, 255, 255)
    when 2 # Pink
      sparkle_color1 = Color.new(255, 181, 234)
      sparkle_color2 = Color.new(232, 125, 178)
      sparkle_color3 = Color.new(232, 76, 110)
      sparkle_color4 = Color.new(255, 255, 255)
    when 3 # Green
      sparkle_color1 = Color.new(222, 255, 181)
      sparkle_color2 = Color.new(157, 226, 122)
      sparkle_color3 = Color.new(85, 226, 74)
      sparkle_color4 = Color.new(255, 255, 255)
    when 4 # White
      sparkle_color1 = Color.new(236, 236, 236)
      sparkle_color2 = Color.new(218, 218, 218)
      sparkle_color3 = Color.new(210, 210, 210)
      sparkle_color4 = Color.new(255, 255, 255)
    when 5 # Orange
      # the four colors here
    else # Blue
      sparkle_color1 = Color.new(181, 244, 255)
      sparkle_color2 = Color.new(126, 197, 235)
      sparkle_color3 = Color.new(77, 136, 225)
      sparkle_color4 = Color.new(255, 255, 255)
    end
Hey Tei, next time if you end up posting somewhere wrong, just report the post and a moderator will move it to the correct section.
Not necessary now, since I'm here 🙂

I've moved this to Script Support.

KK20--Fantastic! Thank you so much! I was considering trying adding a variant if I was feeling bold, having the confirmation that that's how's it's done gives me that extra boost of confidence.

Thanks for all your help!

Slim--Brilliant, thank you! I'll remember that! I was dreading that "please post in the correct forum" message, haha.

Original thread: https://forums.rpgmakerweb.com/threads/troubleshooting-foreverzeros-advanced-weather-script.128705/