• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

[Scripting Question] Custom Function Code help

10
Posts
6
Years
    • Seen Feb 28, 2018
    I don't mean to impose, but would anyone be able to help with a function code for a move I have?

    Squall
    Flying-type move
    Effect: Damages target and randomly causes rain or hail.
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    This should work. 10% for hail and 10% for rain (dance). Don't forget to change the function code itself.
    Code:
    class PokeBattle_Move_B01 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,turneffects)
        int = rand(10)
        if int == 0
          @battle.weather=PBWeather::HAIL
          @battle.weatherduration=5
          @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
          @battle.pbCommonAnimation("Hail",nil,nil)
          @battle.pbDisplay(_INTL("It started to hail!"))
        elsif int == 1
          @battle.weather=PBWeather::RAINDANCE
          @battle.weatherduration=5
          @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
          @battle.pbCommonAnimation("Rain",nil,nil)
          @battle.pbDisplay(_INTL("It started to rain!"))
        end
      end
    end
     
    Back
    Top