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

[Scripting Question] A healing ability?

  • 69
    Posts
    14
    Years
    • Seen Sep 26, 2016
    Hey guys, I've troubles making an ability which works like leftovers.

    This is my try but it doesn't work.

    # Reinheit
    # A Pokémon's turncount is 0 if it became active after the beginning of a round
    if i.turncount>0 && i.hasWorkingAbility(:REINHEIT)
    if hpgain=i.pbRecoverHP((i.totalhp/16).floor,true)
    pbDisplay(_INTL("{1}'s {2} restored its HP a little!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
    end
    end

    Can you help me out please?
     
    Last edited by a moderator:
  • 824
    Posts
    9
    Years
    I've been doing almost the exact opposite of what you've been trying, making items that mimic certain abilities. But the trick is almost exactly the same.

    1.) In PokeBattle_Battler, around line 1942, you should find this code
    Code:
        if hpcure && self.hasWorkingItem(:LEFTOVERS) && self.hp!=self.totalhp &&
           @effects[PBEffects::HealBlock]==0
          PBDebug.log("[Item triggered] #{pbThis}'s Leftovers")
          @battle.pbCommonAnimation("UseItem",self,nil)
          pbRecoverHP((self.totalhp/16).floor,true)
          @battle.pbDisplay(_INTL("{1} restored a little HP using its {2}!",pbThis,itemname))
        end

    2.) Add this directly below it:
    Code:
        if hpcure && self.hasWorkingAbility(:REINHEIT) && self.hp!=self.totalhp &&
           @effects[PBEffects::HealBlock]==0
          PBDebug.log("[Ability triggered] #{pbThis}'s Reinheit")
          pbRecoverHP((self.totalhp/16).floor,true)
          @battle.pbDisplay(_INTL("{1}'s {2} restored a little of its HP!",pbThis,PBAbilities.getName(self.ability)))
        end

    3.) Be sure to add Reinheit to the PBS file abilities.txt
     
  • 69
    Posts
    14
    Years
    • Seen Sep 26, 2016
    Hmm, i got this message then:

    ---------------------------
    V-16
    ---------------------------
    Exception: NameError

    Message: undefined local variable or method `hpcure' for #<PokeBattle_Battle:0xb8d5f70>

    PokeBattle_Battle:3831:in `__clauses__pbEndOfRoundPhase'

    PokeBattle_Battle:3822:in `each'

    PokeBattle_Battle:3822:in `__clauses__pbEndOfRoundPhase'

    PokeBattle_Clauses:42:in `pbEndOfRoundPhase_old'

    EliteBattle_Battle:318:in `pbEndOfRoundPhase'

    EliteBattle_Battle:249:in `pbStartBattleCore'

    EliteBattle_Battle:248:in `logonerr'

    EliteBattle_Battle:248:in `pbStartBattleCore'

    EliteBattle_Battle:232:in `loop'

    EliteBattle_Battle:253:in `pbStartBattleCore'



    This exception was logged in

    C:\Users\Fred\Saved Games/V_16/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------
     
    Last edited:
    Back
    Top