Advertiser Content
Male
Seen 4 Weeks Ago
Posted May 31st, 2019
30 posts
3.5 Years
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?


 

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]=@battle.nextPickupUse
    end
    self.item=0
    self.effects[PBEffects::Unburden]=true
    # Symbiosis
    if pbPartner && pbPartner.hasWorkingAbility(:SYMBIOSIS) && recycle
      if pbPartner.item>0 &&
         !@battle.pbIsUnlosableItem(pbPartner,pbPartner.item) &&
         !@battle.pbIsUnlosableItem(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

Vendily

Female
Seen 20 Hours Ago
Posted 4 Days Ago
916 posts
4 Years
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.

Male
Seen 4 Weeks Ago
Posted May 31st, 2019
30 posts
3.5 Years
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


 
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 &&
          !@battle.pbIsUnlosableItem(partner,partner.item) &&
          !@battle.pbIsUnlosableItem(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
Advertiser Content