• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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
    5
    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:
    change the line,
    Code:
    def pbEffect(attacker,opponent,hitnum=0,alltarget=nil,showanimation=true)
    into
    Code:
    def pbAdditionalEffect(attacker,opponent)
     
    [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
     
    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