• 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] Consime ( eat berry instantly)

36
Posts
8
Years
    • Seen May 22, 2021
    The name say it all, trying to get a move consume which instantly consume and take the effects of the berry.
    My script does nothing at all when i tested. eh what am I doing wrong?


    Code:
    class PokeBattle_Move_168 < PokeBattle_Move
      def pbConsumeItem(recycle=true,pickup=true)
        itemname=PBItems.getName(self.item)
        @pokemon.itemRecycle=self.item if recycle
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        if pickup
          @effects[PBEffects::PickupItem]=self.item
          @effects[PBEffects::PickupUse][email protected]
        end
        self.item=0
        self.effects[PBEffects::Unburden]=true
        # Symbiosis
        if pbPartner && pbPartner.hasWorkingAbility(:SYMBIOSIS) && recycle
          if pbPartner.item>0 &&
             [email protected](pbPartner,pbPartner.item) &&
             [email protected](self,pbPartner.item)
            @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
               pbPartner.pbThis,PBAbilities.getName(pbPartner.ability),
               PBItems.getName(pbPartner.item),pbThis(true)))
            self.item=pbPartner.item
            pbPartner.item=0
            pbPartner.effects[PBEffects::Unburden]=true
            pbBerryCureCheck
          end
        end
      end
    end
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    it's not ever going to do anything because what you just did was define a battler method in a move class. The code only know to call the consume code on a battler object, it's never going to do that to a move. Also your code will crash if it was some how called, since half these class variables don't exist on a move object and default to being nil.

    You're better off calling the consume code on the attacker in the pbEffect method of the move class. Look at similar function codes, that's very helpful too. 0F4 (Bug Bite, Pluck) does almost what you want, eating the opponent's berry.
     
    36
    Posts
    8
    Years
    • Seen May 22, 2021
    ok, I tried your method but it still doesnt work.
    I make a little tweaks
    just to activate the user own berry

    but also does not work, this is what I have. still need help


    Code:
    class PokeBattle_Move_168 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,turneffects)
        if !attacker.hasWorkingAbility(:KLUTZ) &&
           attacker.effects[PBEffects::Embargo]==0
        else  attacker.pbConsumeItem(false,false) 
                 attacker.pbActivateBerryEffect(item,false)
                @battle.pbDisplay(_INTL("{1} eat the berry instantly",attacker.pbThis,itemname))
        end
          # Symbiosis
        if attacker.item==0 &&
            attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
          partner=attacker.pbPartner
          if partner.item>0 &&
              [email protected](partner,partner.item) &&
              [email protected](attacker,partner.item)
            @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
                partner.pbThis,PBAbilities.getName(partner.ability),
                PBItems.getName(partner.item),attacker.pbThis(true)))
            attacker.item=partner.item
            partner.item=0
            partner.effects[PBEffects::Unburden]=true
            attacker.pbBerryCureCheck
          end
        end
      end
    end
     
    Last edited:
    Back
    Top