• 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] Making an attack that set up weathers?

  • 16
    Posts
    4
    Years
    • Seen Aug 1, 2023
    I'm trying to make an attack that sets up a thunderstorm (electric terrain and rain). However, the moves acts like a "Status" moves instead of an attack. So no damage was inflicted, only the weather was set up.
    How do I make it hurt my opponent then set up a weather? Similar how to Max Flare sets up sunny day.
    Here's the move.txt:
    XXX,MONSOON,Monsoon,301,100,ELECTRIC,Special,95,5,0,00,0,bef,"The user summoned a storm of thunders at the foe. Causing a thunderstorm for 5 turns."

    Here's the MoveEffects script:
    Code:
    ################################################################################
    # Starts thunderstorm weather. (Monsoon)
    ################################################################################
    class PokeBattle_Move_301 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        case @battle.weather
        when PBWeather::HEAVYRAIN
          @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
          return -1
        when PBWeather::HARSHSUN
          @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
          return -1
        when PBWeather::STRONGWINDS
          @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        @battle.field.effects[PBEffects::GrassyTerrain]=0
        @battle.field.effects[PBEffects::MistyTerrain]=0
        @battle.field.effects[PBEffects::ElectricTerrain]=5
        @battle.field.effects[PBEffects::ElectricTerrain]=8 if attacker.hasWorkingItem(:DAMPROCK)
        @battle.weather=PBWeather::RAINDANCE
        @battle.weatherduration=5
        @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
        @battle.pbCommonAnimation("Rain",nil,nil)
        @battle.pbDisplay(_INTL("A thunderstrom brewed in!"))
        return 0
      end
    end

    Thanks in advance.
     
    Last edited:
  • 311
    Posts
    4
    Years
    change the line,
    Code:
    def pbEffect(attacker,opponent,hitnum=0,alltarget=nil,showanimation=true)
    into
    Code:
    def pbAdditionalEffect(attacker,opponent)
     
  • 16
    Posts
    4
    Years
    • Seen Aug 1, 2023
    [SOLVED] OK. I figured it out. Here's the script to anyone who's curious.

    Code:
    class PokeBattle_Move_301 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        case @battle.weather
        when PBWeather::HEAVYRAIN
          @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
          return -1
        when PBWeather::HARSHSUN
          @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
          return -1
        when PBWeather::STRONGWINDS
          @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        @battle.field.effects[PBEffects::GrassyTerrain]=0
        @battle.field.effects[PBEffects::MistyTerrain]=0
        @battle.field.effects[PBEffects::ElectricTerrain]=5
        @battle.field.effects[PBEffects::ElectricTerrain]=8 if attacker.hasWorkingItem(:DAMPROCK)
        @battle.weather=PBWeather::RAINDANCE
        @battle.weatherduration=5
        @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
        @battle.pbCommonAnimation("Rain",nil,nil)
        @battle.pbDisplay(_INTL("A thunderstrom brewed in!"))
        return 0
      end
    end
     

    WolfPP

    Spriter/ Pixel Artist
  • 1,309
    Posts
    5
    Years
    Just a P.S:
    If your move triggers after hit (like Plasma Fist) you don't need the phrases if it failed. You can just change it to:

    Code:
        if @battle.weather==PBWeather::HEAVYRAIN ||
            @battle.weather==PBWeather::HARSHSUN ||
            @battle.weather==PBWeather::STRONGWINDS
                return -1
        end

    Also, Electric Terrain (and the others terrains) changes their turns to 8 if the user holding Terrain Extender instead Dramp Rock. :)

    Cya!
     
    Last edited:
    Back
    Top