• 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] Happiness changing the Effort Values

HeyHeyHenry

HeyHeyHenryΔ
  • 11
    Posts
    5
    Years
    Hey, I was trying to do something similar to the Awakening Values from Let's GO (Inserting happiness to the Effort Values), but I always received an error, one time it worked, but all evs and the happiness itself were 0.
    Somebody knows how to help me with this?
     
    Can you post the code you wrote and what the error was (or multiple codes and errors if you tried a few things)?
     
    Can you post the code you wrote and what the error was (or multiple codes and errors if you tried a few things)?

    I can't send you the error message RN, but I have the code and I remember the error message a little...

    This is what I wrote (I tried to add happiness to this method):
    def CalcStat (base,level,happiness,iv,ev,pv)
    return (((base*2*iv*level/100).floor+5)*(pv/100))*happiness).floor+ev
    end

    The error was saying that I have 6 of 5 arguments...
     
    Since (I assume) you added the happiness parameter, did you pass happiness in all the places where calcstat is called?
     
    I don't know. Something must be calling calcstat otherwise you wouldn't get an error. In fact, if you had looked at the line number of your error it would tell you exactly where one of the calls is.
     
    I don't know. Something must be calling calcstat otherwise you wouldn't get an error. In fact, if you had looked at the line number of your error it would tell you exactly where one of the calls is.

    I'll take a better look later, I hope it works, thank you for helping me btw
     
    I really found another part of the same script that uses the "CalcStat", I added the happiness to it, but now I receive another error D:

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

    Exception: TypeError

    Message: nil can't be coerced into Fixnum

    PokeBattle_Pokemon:872:in `*'

    PokeBattle_Pokemon:872:in `calcStat'

    PokeBattle_Pokemon:893:in `calcStats'

    PokeBattle_Pokemon:888:in `each'

    PokeBattle_Pokemon:888:in `calcStats'

    PokeBattle_Pokemon:968:in `__mf_initialize'

    Pokemon_Forms:43:in `initialize'

    PSystem_PokemonUtilities:79:in `new'

    PSystem_PokemonUtilities:79:in `pbAddPokemon'

    Debug_Menu:427:in `pbDebugMenuActions'



    This exception was logged in

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

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------
     
    Is happiness nil? Easiest way to check is remove happiness from the calculation. If so... shrug? I guess either you're reading it from the wrong place, or in some circumstances Essentials will have a nil happiness?
     
    In def initialize in script section PokeBattle_Pokemon, happiness happens to be defined after a call to calcStats. That may be it. Just move them around a bit.
     
    Thank you! It worked perfectly, I just had to divide happiness per 10 because it was a bit too much in the Evs @-@
     
    Back
    Top