• 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] Help with a function code

  • 5
    Posts
    6
    Years
    • Seen Mar 25, 2020
    I'm trying to make a move that heals the user and increases its accuracy and evasion. So, I'm trying to combine the functions of recover and a move I already made which increases accuracy and evasion. So the function looks like this:

    Code:
    class PokeBattle_Move_161 < PokeBattle_Move
      def isHealingMove?
        return true
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        return 0
      end
      
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self) &&
           !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
          @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
          return -1
        end
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        showanim=true
        if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
          attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self,showanim)
          showanim=false
        end
        if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
          attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
          showanim=false
        end
        return 0
      end
    end

    I tried messing around with it but no matter what I do, the move only either heals or boosts acc/eva, not both. What am I doing wrong?
     
    How do I combine them? Sorry I'm new at this and I don't know much about scripting.
     
    Back
    Top