• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

Would this work?

  • 220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    The code is for a move that, when known alongside three other moves, has its base power and effect chance doubled. Now I'm very new to this (started this morning :S ) and couldn't see an obvious answer so I tried this rather hacky method whereby the effect is determined by the function itself. But would it work?
    Code:
    class PokeBattle_Move_138 < PokeBattle_Move
      def pbBaseDamage(basedmg,attacker,opponent)
        multiplier = 1
        moveIDs = Array.new
        moveIDs << attacker.moves[0].id
        moveIDs << attacker.moves[1].id
        moveIDs << attacker.moves[2].id
        moveIDs << attacker.moves[3].id
        if (moveIDs.include? 561&&564&&576&&591)
            multiplier = 2
          end
           return basedmg*multiplier
        end
      end
    
    def pbAdditionalEffect(attacker,opponent)
        multiplier = 1
        moveIDs = Array.new
        moveIDs << attacker.moves[0].id
        moveIDs << attacker.moves[1].id
        moveIDs << attacker.moves[2].id
        moveIDs << attacker.moves[3].id
        if (moveIDs.include? 561&&564&&576&&591)
            multiplier = 2
          end
        [email protected](10/multiplier)
        case rnd
          when 0
            return false if !opponent.pbCanConfuse?(false)
            opponent.effects[PBEffects::Confusion][email protected](4)
            @battle.pbCommonAnimation("Confusion",attacker,opponent)
            @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
        end
        return true
      end
    end
     
    I literally just opened this right before I got to go out, which I shoudn't of done...

    Problem that I see straight off the bat, too many ends, you end the class before you should.

    This would get rid of the first error you find.

    I don't think it would then error (if at all) until you use that particular move... I probably shouldn't comment with no help, but I felt the need to at least point that out.
     
    When making a thread, name it properly! A thread's name should describe what that thread is about. Calling a thread "Question" is bad, but calling it "[Question] How do I change the screen size?" is good.
    That's my first comment.

    It's a bit hazy, but aside from the extra "end" in the first def, it looks like it'll work. Any changes would just be to make it neater. For instance:

    You wouldn't need to check whether the attacker knows the move it's currently using, for obvious reasons. Using getConst(PBMoves,:TACKLE) is easier to read than listing the required moves by number. The additional effect currently returns true even if the random number choice was failed; it should only return true if the opponent ended up being confused.
     
    Would this solve that:
    Code:
    def pbAdditionalEffect(attacker,opponent)
        multiplier = 1
        moveIDs = Array.new
        moveIDs << attacker.moves[0].id
        moveIDs << attacker.moves[1].id
        moveIDs << attacker.moves[2].id
        moveIDs << attacker.moves[3].id
        if (moveIDs.include? 561&&564&&576&&591)
            multiplier = 2
          end
        [email protected](10/multiplier)
        case rnd
          when 0
            return false if !opponent.pbCanConfuse?(false)
            opponent.effects[PBEffects::Confusion][email protected](4)
            @battle.pbCommonAnimation("Confusion",attacker,opponent)
            @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
          else
            return false
        end
        return true
      end
    end

     
    Last edited:
    I don't know which part of what I said you're trying to solve with the code you quoted. I assume it's the "should only return true if the effect happened" thing.

    Your code would work, but I'd say it's a bit untidy. I would return true as part of the confusion effect, not later on at the end of the def. Like so:

    Code:
      def pbAdditionalEffect(attacker,opponent)
        multiplier = 1
        moveIDs = Array.new
        moveIDs << attacker.moves[0].id
        moveIDs << attacker.moves[1].id
        moveIDs << attacker.moves[2].id
        moveIDs << attacker.moves[3].id
        if (moveIDs.include? 561 && 564 && 576 && 591)
          multiplier = 2
        end
        [email protected](10/multiplier)
        case rnd
          when 0
            return false if !opponent.pbCanConfuse?(false)
            opponent.effects[PBEffects::Confusion][email protected](4)
            @battle.pbCommonAnimation("Confusion",attacker,opponent)
            @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
            return true
        end
        return false
      end
     
    Back
    Top