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

HeyHeyHenry

HeyHeyHenryΔ
11
Posts
4
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?
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
Can you post the code you wrote and what the error was (or multiple codes and errors if you tried a few things)?
 

HeyHeyHenry

HeyHeyHenryΔ
11
Posts
4
Years
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...
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
Since (I assume) you added the happiness parameter, did you pass happiness in all the places where calcstat is called?
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
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.
 

HeyHeyHenry

HeyHeyHenryΔ
11
Posts
4
Years
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
 

HeyHeyHenry

HeyHeyHenryΔ
11
Posts
4
Years
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
---------------------------
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
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?
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
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.
 

HeyHeyHenry

HeyHeyHenryΔ
11
Posts
4
Years
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