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

[Error] NoMethodError - undefined method 'iv' for #<PokeBattle_Battler>

SupGamer NL

SupGamer NL
  • 6
    Posts
    8
    Years
    I don't know why, but whenever a Pokémon wants to use the move Hidden Power I get this error:

    Exception: NoMethodError
    Message: undefined method 'iv' for #<PokeBattle_Battler>

    I have a screenshot of the full error with the backtrace.
    [PokeCommunity.com] NoMethodError - undefined method 'iv' for #<PokeBattle_Battler>


    I can also add the errorlog.txt to this thread.
    Spoiler:

    I have tried to find similar cases, but at last, I didn't find anything related to my problem.
    I hope someone can help me with this problem
     
    Last edited:
    I have the same exact problem. I have the gen 8 project installed but not EBDX, if that helps

    EDIT: This problem doesn't occur in default essentials 19.1
     
    Last edited:
    So, it seems to be a multiple step problem, and it appears to be related to the Gen 8 project (or at least the process of installing it). The first issue is that "iv" is undefined in the PokeBattle_Battler, where it is normally defined in v19.1. Under "class PokeBattle_Battler" add the following line of code:

    Code:
    attr_accessor :iv

    However, if you just do that, it gives you a different error. You also need to go to the "Battler_Initialize" and head to the "def pbInitPokemon(pkmn,idxParty)". Towards the bottom of that definition you'll see this:

    Code:
    pkmn.moves.each_with_index do |m,i|
          if (isSpecies?(:ZACIAN) || isSpecies?(:ZAMAZENTA)) && @form == 1 && m.id == :IRONHEAD
            moveID = isSpecies?(:ZACIAN) ? :BEHEMOTHBLADE : :BEHEMOTHBASH
            @moves[i] = PokeBattle_Move.from_pokemon_move(@battle,Pokemon::Move.new(moveID))
            @moves[i].realMove = m
            maxPP =  GameData::Move.get(moveID).total_pp
            @moves[i].total_pp =  maxPP + (maxPP * m.ppup / 5)
            calcPP = ((m.pp/m.total_pp.to_f) * @moves[i].total_pp).to_i
            pbSetPP(@moves[i],calcPP)
          else
            @moves[i] = PokeBattle_Move.from_pokemon_move(@battle,m)
          end
        end
    end

    In between the first and second "end" at the bottom of the script, you need to add these lines
    Code:
    @iv           = {}
        GameData::Stat.each_main { |s| @iv[s.id] = pkmn.iv[s.id] }

    After doing both these steps, you should no longer get an error when using Hidden Power. I tested it, it works both when you use it and when the opponent uses it. And the type is still dependent on your ivs.
     
    Thanks, it works now! Thank you so much, I've also added the code in the newly generated PokeBattle_Battler.rb & PokeBattle_Initialize.rb just to be sure.

    Spoiler:
     
    Back
    Top