• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Error] Why is my Weather code causing crashes upon the use of some random moves when weather is up?

  • 428
    Posts
    5
    Years
    If a weather condition like Sun or Hail is active, all moves have a small chance to cause crashes inconsistently. The error messages claim * is undefined. Sometimes moves work and, if weather effects are active, sometimes they crash. If it was a specific move I'd know what move to look at, but I think my Weather code is the problem.

    Code:
        # Weather
        case @battle.pbWeather
        when :Sun, :HarshSun
          if type == :FIRE
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
          elsif type == :GRASS
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
          elsif type == :WATER
            multipliers[:final_damage_multiplier] /= 2 if !target.hasUtilityUmbrella?
          end
                if target.pbHasType?(:FIRE)
            multipliers[:defense_multiplier] *= 2
            multipliers[:special_defense_multiplier] *= 2
          end
                      if target.pbHasType?(:GRASS)
            multipliers[:defense_multiplier] *= 2
            multipliers[:special_defense_multiplier] *= 2
            end
              when :Hail
          if type == :FIRE
            multipliers[:final_damage_multiplier] /= 2 if !target.hasUtilityUmbrella?
          elsif type == :ICE
            multipliers[:final_damage_multiplier] *= 2.5 if !target.hasUtilityUmbrella?
          end
                if target.pbHasType?(:ICE)
            multipliers[:defense_multiplier] *= 2.5
            multipliers[:special_defense_multiplier] *= 2.5
    end
        when :Rain, :HeavyRain
          if type == :FIRE
            multipliers[:final_damage_multiplier] /= 2 if !target.hasUtilityUmbrella?
                  elsif type == :ELECTRIC
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
                  elsif type == :GRASS
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
          elsif type == :WATER
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
          end
                            if target.pbHasType?(:WATER)
            multipliers[:defense_multiplier] *= 2
            multipliers[:special_defense_multiplier] *= 2
          end
                            if target.pbHasType?(:ELECTRIC)
            multipliers[:defense_multiplier] *= 2
            multipliers[:special_defense_multiplier] *= 2
          end
                            if target.pbHasType?(:GRASS)
            multipliers[:defense_multiplier] *= 2
            multipliers[:special_defense_multiplier] *= 2
            end
        when :Sandstorm
               if type == :GROUND
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
                  elsif type == :ROCK
            multipliers[:final_damage_multiplier] *= 2 if !target.hasUtilityUmbrella?
                  elsif type == :STEEL
            multipliers[:final_damage_multiplier] *= 1.5 if !target.hasUtilityUmbrella?
            end
          if target.pbHasType?(:ROCK)
            multipliers[:defense_multiplier] *= 2
          if target.pbHasType?(:GROUND)
            multipliers[:defense_multiplier] *= 2
                  if target.pbHasType?(:STEEL)
            multipliers[:defense_multiplier] *= 1.5
          end
          end
        end
      end
     
    Back
    Top