• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
    4
    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.
     
    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