- Joined
- Feb 8, 2014
- Messages
- 518
- Reaction score
- 223
- First Language
- English
- Primarily Uses
- RMVXA
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:
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.
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
