• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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 Sandstorm Weather Variant Not Damaging

  • 4
    Posts
    4
    Years
    • Seen Nov 26, 2020
    Hello. I'm making an exclusive ability for Flygon which would put into the field a version of Sandstorm that doesn't end until it is overriden or Flygon leaves the field. However, I'm encountering a problem:
    Code:
    case curWeather
          when PBWeather::Sandstorm || PBWeather::HuntingSands # This is what was added
            next if !b.takesSandstormDamage?
            pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis))
            @scene.pbDamageAnimation(b)
            b.pbReduceHP(b.totalhp/16,false)
            b.pbItemHPHealCheck
            b.pbFaint if b.fainted?
    Despite adding this line to the code (with HuntingSands being the weather) - it won't deal damage.

    I'll leave in this spoiler every single other modification I made to insert HuntingSands - except the ones regarding the text it produces (which it produces just fine, including start - end - end of round "rages on", except, of course, for the buffered by sandstorm message, since that doesn't happen) and the ones regarding the fact that it acts the same as sandstorm for sandstorm abilities.
    Thank you very much in advance :)
    Spoiler:
     
    I think I can help you.
    Rather than combining them, separate them like in these two codes here:
    Code:
    def takesHuntingSandsDamage?
        return false if !takesIndirectDamage?
        return false if isSpecies?(:FLYGON)
        return false if inTwoTurnAttack?("0CA","0CB")   # Dig, Dive
        return false if hasActiveAbility?([:OVERCOAT,:SANDFORCE,:SANDRUSH,:SANDVEIL])
        return false if hasActiveItem?(:SAFETYGOGGLES)
        return true
      end

    Code:
    when PBWeather::HuntingSands
            next if !b.takesHuntingSandsDamage?
            pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis))
            @scene.pbDamageAnimation(b)
            b.pbReduceHP(b.totalhp/8,false)
            b.pbItemHPHealCheck
            b.pbFaint if b.fainted?
     
    I think I can help you.
    Rather than combining them, separate them like in these two codes here:
    Code:
    def takesHuntingSandsDamage?
        return false if !takesIndirectDamage?
        return false if isSpecies?(:FLYGON)
        return false if inTwoTurnAttack?("0CA","0CB")   # Dig, Dive
        return false if hasActiveAbility?([:OVERCOAT,:SANDFORCE,:SANDRUSH,:SANDVEIL])
        return false if hasActiveItem?(:SAFETYGOGGLES)
        return true
      end

    Code:
    when PBWeather::HuntingSands
            next if !b.takesHuntingSandsDamage?
            pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis))
            @scene.pbDamageAnimation(b)
            b.pbReduceHP(b.totalhp/8,false)
            b.pbItemHPHealCheck
            b.pbFaint if b.fainted?
    Oh! That works perfectly. I wonder why grouping them together didn't...? Well, hooray for order, I guess. Thank you very much!
     
    Back
    Top