• 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.

[Question] Need help with a dual healing move script

  • 5
    Posts
    5
    Years
    • Seen Mar 13, 2021
    I'm trying to create a new signature move for a Pokemon I'll be creating for a custom game of mine. However, the attempts at the script have, so far, given me nothing but syntax errors.
    I will admit that Ruby is sort of like gibberish to me right now, but I understand how 'end' works, and it seems I have enough to fully close the script.

    Code:
    ################################################################################
    # Heals the user and their ally by 1/3 of their respective max HP. (Divine Order)
    ################################################################################
    class PokeBattle_Move_17B < PokeBattle_Move
      def isHealingMove?
        return true
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.hp==attacker.totalhp && if attacker.pbPartner.hp==attacker.pbPartner.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          @battle.pbDisplay(_INTL("{2}'s HP is full!",attacker.pbPartner.pbThis(true)))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.pbRecoverHP(((attacker.totalhp+1)/3).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        if attacker.pbPartner && !attacker.pbPartner.fainted?
        attacker.pbPartner.pbRecoverHP((attacker.pbPartner.totalhp/3).floor,true)
        @battle.pbDisplay(_INTL("{2}'s HP was restored.",attacker.pbPartner.pbThis(true)))
        return 0
        end
      end
    end

    I assume that this isn't a very efficient way of coding this move in (heals both active 'mons on the user's side by 1/3rd if applicable), since I have two pbDisplay calls one after another and a seemingly imbalanced amount of 'return' codes.
     
    Last edited:
    not a clue why but it's like the code isn't recognizing the first end for that first if as it's close. this should work though
    Code:
    class PokeBattle_Move_17B < PokeBattle_Move
      def isHealingMove?
        return true
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.hp==attacker.totalhp && if attacker.pbPartner.hp==attacker.pbPartner.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          @battle.pbDisplay(_INTL("{2}'s HP is full!",attacker.pbPartner.pbThis(true)))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.pbRecoverHP(((attacker.totalhp+1)/3).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        if attacker.pbPartner && !attacker.pbPartner.fainted?
         attacker.pbPartner.pbRecoverHP((attacker.pbPartner.totalhp/3).floor,true)
         @battle.pbDisplay(_INTL("{2}'s HP was restored.",attacker.pbPartner.pbThis(true)))
        return 0
       end
      end
     end
    end
     
    Back
    Top