[VX Ace] TypeError in Weather Script

Hello! I was looking for a way to modify the default weather in Ace, and I found this little snippet from @Shaz . The formatting was ruined, so I reformatted it as this:

Code:
class Game_Map
 
def weather_modifier
 @weather_modifier = 3
 if !@weather_modifier
 @weather_modifier
end

def weather_modifier=(value)
  @weather_modifier = value
end
end
end

class Game_Interpreter
 
def modify_weather(value)
  $game_map.weather_modifier = value
end
end

class Spriteset_Weather

alias shaz_weather_modifier_update_sprite update_sprite
def update_sprite(sprite)
  old = sprite.x
  shaz_weather_modifier_update_sprite(sprite)
  sprite.x += $game_map.weather_modifier    #<---------- Line 28
end
end

However, when running this, I get a TypeError on line 28: in '+': nil can't be coerced into Fixnum. Any idea what is causing this, and how to fix it? I'm not very familiar with TypeErrors.
I think this method should be this:
Code:
def weather_modifier
 @weather_modifier = 3 if !@weather_modifier
 @weather_modifier
end
Oh, that actually seems to have fixed the problem already. Too easy, right? Thanks!
Spoiler: Shaz weather Snippett
Code:
class Game_Map
  def weather_modifier
    @weather_modifier = 0 if !@weather_modifier
    @weather_modifier
  end

  def weather_modifier=(value)
    @weather_modifier = value
  end
end

class Game_Interpreter
  def modify_weather(value)
    $game_map.weather_modifier = value
  end
end

class Spriteset_Weather
  alias shaz_weather_modifier_update_sprite update_sprite
  def update_sprite(sprite)
    old = sprite.x
    shaz_weather_modifier_update_sprite(sprite)
    sprite.x += $game_map.weather_modifier
  end
end
Not sure how to use this, but no errors when playing weather.

Ninja'd by A-MoonLess-Night
Now I just need to figure out how to make the rain fall straight up and down; wish me luck!

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-typeerror-in-weather-script.105171/