• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Ability that increases EV yield

  • 55
    Posts
    7
    Years
    • Seen Nov 24, 2023
    Hi,

    Love the forums for its wide variety of additions for the games!
    I was wondering how I would need to script an ability that increases the EV gain for a Pokemon that has that ability. So essentially an ability-version of Macho Brace.
    Could anyone help me with that?
    I use V17.2 btw.

    Thanks!
     
    Did you try just copyin how MACHOBRACE works? o.o

    On 'PokeBattle_Battle' script, inside def pbGainExpOne(index,defeated,partic,expshare,haveexpall,showmessages=true), add your ability, like:
    Code:
      def pbGainExpOne(index,defeated,partic,expshare,haveexpall,showmessages=true)
        thispoke=@party1[index]
        # Original species, not current species
        level=defeated.level
        baseexp=defeated.pokemon.baseExp
        evyield=defeated.pokemon.evYield
        # Gain effort value points, using RS effort values
        totalev=0
        for k in 0...6
          totalev+=thispoke.ev[k]
        end
        for k in 0...6
          evgain=evyield[k]
          evgain*=2 if isConst?(thispoke.item,PBItems,:MACHOBRACE) ||
                       isConst?(thispoke.itemInitial,PBItems,:MACHOBRACE) ||
                       isConst?(thispoke.ability,PBAbilities,:SEBASTIANNZ)
          case k
          when PBStats::HP
            evgain+=4 if isConst?(thispoke.item,PBItems,:POWERWEIGHT) ||
     
    Yeah I tried that but I get an error when I do.

    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17.2]

    Exception: NameError

    Message: uninitialized constant PokeBattle_Battle::PBAbilties

    PokeBattle_Battle:1846:in `pbGainExpOne'

    PokeBattle_Battle:1842:in `each'

    PokeBattle_Battle:1842:in `pbGainExpOne'

    PokeBattle_Battle:1808:in `pbGainEXP'

    PokeBattle_Battle:1802:in `each'

    PokeBattle_Battle:1802:in `pbGainEXP'

    PokeBattle_Battle:1773:in `each'

    PokeBattle_Battle:1773:in `pbGainEXP'

    PokeBattle_Battle:3841:in `__clauses__pbEndOfRoundPhase'

    PokeBattle_Clauses:42:in `pbEndOfRoundPhase'



    This exception was logged in

    C:\Users\Sebastiaan\Saved Games\Pokemon Essentials\errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    Thats what I get.
     
    Yeah I tried that but I get an error when I do.

    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17.2]

    Exception: NameError

    Message: uninitialized constant PokeBattle_Battle::PBAbilties

    PokeBattle_Battle:1846:in `pbGainExpOne'

    PokeBattle_Battle:1842:in `each'

    PokeBattle_Battle:1842:in `pbGainExpOne'

    PokeBattle_Battle:1808:in `pbGainEXP'

    PokeBattle_Battle:1802:in `each'

    PokeBattle_Battle:1802:in `pbGainEXP'

    PokeBattle_Battle:1773:in `each'

    PokeBattle_Battle:1773:in `pbGainEXP'

    PokeBattle_Battle:3841:in `__clauses__pbEndOfRoundPhase'

    PokeBattle_Clauses:42:in `pbEndOfRoundPhase'



    This exception was logged in

    C:\Users\Sebastiaan\Saved Games\Pokemon Essentials\errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    Thats what I get.

    Read the error buddy: you wrote wrong. It is "PBAbilities" instead "PBAbilties". You forgot an "i" there. :p
     
    Last edited:
    Back
    Top