• 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] "Supereffective" Sandstorm and Hail

40
Posts
8
Years
  • So I want to make it so that sandstorm and hail take into account the types of the Pokémon taking damage. Sort of like how stealth rock does more damage to Fire types and less to Ground types for example. Basically I want it so that Hail would do 1/16 HP damage if an Ice type attack would do regular damage to that pokémon, 1/8 HP to a Pokémon that's x2 weak to Ice, 1/4 to a Pokémon that's x4 weak to Ice (like Flying/Dragon types for example), 1/32 HP damage to Pokémon that are x2 resistant Ice, and 1/64 HP damage to Pokémon that are x4 resistant to ice. And the same sort of thing for sandstorm, obviously. And I still want Ice types to be immune to damage from hail, and Ground, Rock, and Steel types to be immune to Sandstorm. I'm not very good at scripting, though, so any help would be appreciated!
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    So I guess there's two things to do: a) find where Stealth Rock damage happens so that you can see how to make the damage based on the effectiveness of rock, b) find where Hail/Sandstorm damage happens and modify it so that once it's decided the Pokémon is not immune to damage that the damage is multiplied by the effectiveness of Ice/Rock.

    You can use Ctrl-Shift-F to search in all files, I'd recommend searching for StealthRock, HAIL and SANDSTORM.
     
    Last edited:

    hirokimura

    Miltank's Fanboy Number One
    150
    Posts
    6
    Years
  • Hello,
    I'm interested, so I gave it a try and it works. Maybe I should post it as a resource too ^^

    EDIT : posted it as a resource with screenshots : https://www.pokecommunity.com/showthread.php?p=10100092#post10100092

    In pokebattle_battle, locate this
    Code:
    pbCommonAnimation("Rain",nil,nil)
    #        pbDisplay(_INTL("Rain continues to fall."))
          end

    Select the code starting from :
    Code:
    "when PBWeather::SANDSTORM"
    until :
    Code:
    "when PBWeather::HEAVYRAIN"
    excluded. Your selection should end with lot of end.

    Paste this:

    Code:
        when PBWeather::SANDSTORM
          @weatherduration=@weatherduration-1 if @weatherduration>0
          if @weatherduration==0
            pbDisplay(_INTL("The sandstorm subsided."))
            @weather=0
            PBDebug.log("[End of effect] Sandstorm weather ended")
          else
            pbCommonAnimation("Sandstorm",nil,nil)
    #        pbDisplay(_INTL("The sandstorm rages."))
            if pbWeather==PBWeather::SANDSTORM
              PBDebug.log("[Lingering effect triggered] Sandstorm weather damage")
              for i in priority
                next if i.fainted?
                if !i.pbHasType?(:GROUND) && !i.pbHasType?(:ROCK) && !i.pbHasType?(:STEEL) &&
                   !i.hasWorkingAbility(:SANDVEIL) &&
                   !i.hasWorkingAbility(:SANDRUSH) &&
                   !i.hasWorkingAbility(:SANDFORCE) &&
                   !i.hasWorkingAbility(:MAGICGUARD) &&
                   !i.hasWorkingAbility(:OVERCOAT) &&
                   !i.hasWorkingItem(:SAFETYGOGGLES) &&
                   ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
                  atype=getConst(PBTypes,:GROUND) || 0
                   eff=PBTypes.getCombinedEffectiveness(atype,i.type1,i.type2,i.effects[PBEffects::Type3])
                   @scene.pbDamageAnimation(i,0)
                  i.pbReduceHP(((i.totalhp*eff)/64).floor)
                  pbDisplay(_INTL("{1} is buffeted by the sandstorm!",i.pbThis))
                  if i.fainted?
                    return if !i.pbFaint
                  end
                end
              end
            end
          end
        when PBWeather::HAIL
          @weatherduration=@weatherduration-1 if @weatherduration>0
          if @weatherduration==0
            pbDisplay(_INTL("The hail stopped."))
            @weather=0
            PBDebug.log("[End of effect] Hail weather ended")
          else
            pbCommonAnimation("Hail",nil,nil)
    #        pbDisplay(_INTL("Hail continues to fall."))
            if pbWeather==PBWeather::HAIL
              PBDebug.log("[Lingering effect triggered] Hail weather damage")
              for i in priority
                next if i.fainted?
                if !i.pbHasType?(:ICE) &&
                   !i.hasWorkingAbility(:ICEBODY) &&
                   !i.hasWorkingAbility(:SNOWCLOAK) &&
                   !i.hasWorkingAbility(:MAGICGUARD) &&
                   !i.hasWorkingAbility(:OVERCOAT) &&
                   !i.hasWorkingItem(:SAFETYGOGGLES) &&
                   ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
                   atype=getConst(PBTypes,:ICE) || 0
                   eff=PBTypes.getCombinedEffectiveness(atype,i.type1,i.type2,i.effects[PBEffects::Type3])
                   @scene.pbDamageAnimation(i,0)
                  i.pbReduceHP(((i.totalhp*eff)/64).floor)
                  pbDisplay(_INTL("{1} is buffeted by the hail!",i.pbThis))
                  if i.fainted?
                    return if !i.pbFaint
                  end
                end
              end
            end
          end


    And enjoy
     
    Last edited:
    Back
    Top