• 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] New Move Question

Rival Alioth

The Stargazer
  • 1
    Posts
    5
    Years
    • Seen Feb 19, 2025
    Hello. I'm somewhat new to this place, and a complete novice at coding. However, I'm trying my hand at creating a fangame anyway. I think I've been doing fairly well so far, however, I've encountered a little "issue". I created a new move for the game, using the combined move effect codes for Blizzard and Flying Press:

    Code:
    class PokeBattle_Move_178 < PokeBattle_Move  
      def pbModifyDamage(damagemult,attacker,opponent)
        type=getConst(PBTypes,:DRAGON) || -1
        if type>=0
          mult=PBTypes.getCombinedEffectiveness(type,
             opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
          return ((damagemult*mult)/8).round
        end
        return damagemult
      end
      
      def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
        if @battle.pbWeather==PBWeather::HAIL
          return 0
        end
        return baseaccuracy
      end
    end

    I've tested it and the move actually seems to work just fine, albeit with one small little issue I have. This "issue" occurs when I use the attack on a Fairy Type Pokemon. Now, in theory, it works fine. The attack plays the attack animation, and due to it technically being considered a Dragon-Type Move it does no damage, as to be expected. My problem isn't really with the move itself, but with the attack animation. It's just kind of strange for a giant snowball to be hurled at the target only for it to do zero damage. I've tried and tried to implement the "it doesn't affect the foe..." line in every way I could think of, and I got it to pop up using:

    Code:
    if opponent.pbHasType?(:FAIRY)
          @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
          return -1
        end

    However, it would still just end up playing the attack animation right after, and once again doing zero damage. Can someone point me in the right direction to accomplish this? I really do apologize if this is an asinine request and something that I could have easily fixed through further research, I'm just not too sure where to look anymore for the proper solution.
     
    I guess Essentials doesn't check if the overall damage multiplier ends up being zero, and skipping the animation in that case. You could try following the code backwards from pbModifyDamage until you (hopefully!) find a place that both has access to that overall damage multiplier and does the check for regular type immunities, and then shuffle the code around a bit to incorporate the multiplier==0 check with the typemod==0 one.
     
    Back
    Top