Setting a nature or gender in trainer_parties.h results in any unset nature, gender, or ability liable to be inadvertently changed from its default. This relates to #3641 which shows trainers already don't have their vanilla emerald PID/nature. That issue's proposed solution of explicitly setting trainer pokemon natures in trainer_parties.h will fix natures but in the process break gender and ability from their vanilla values. The following shows that setting nature can change a pokemon's default gender (even with the personalityHash problem from #3641 commented out).
To explain, the personality value of this poochyena is 136 and it has whatever nature is 11. The modify nature function simply adds or subtracts from personality to get to the new nature. If I set the nature to 1, it subtracts 10 from 136 to get 126. Only 126 is below the gender ratio of 127 for poochyena, so it becomes female. "Life uhhhh finds a way."
The solutions I see are:
Don't care about vanilla nature, gender, ability, or default values being changed by unrelated set values.
Restore nameHash from vanilla emerald to get the nature, then generate a PID from nature, gender, and ability all at once.
Go ahead in setting vanilla natures in trainer_parties.h but still generate a PID like above.
I wrote a function that can generate a PID like I mentioned, just waiting for the greenlight. I think solution 3 makes the most sense as nameHash is only useful for getting the nature. But, nature is the only value of the personality-derived values (nature, gender, ability) that isn't immediately obvious from looking at the code and most trainer pokemon natures can't be looked up anywhere.
Description
Setting a nature or gender in
trainer_parties.h
results in any unset nature, gender, or ability liable to be inadvertently changed from its default. This relates to #3641 which shows trainers already don't have their vanilla emerald PID/nature. That issue's proposed solution of explicitly setting trainer pokemon natures intrainer_parties.h
will fix natures but in the process break gender and ability from their vanilla values. The following shows that setting nature can change a pokemon's default gender (even with thepersonalityHash
problem from #3641 commented out).To explain, the personality value of this poochyena is 136 and it has whatever nature is 11. The modify nature function simply adds or subtracts from personality to get to the new nature. If I set the nature to 1, it subtracts 10 from 136 to get 126. Only 126 is below the gender ratio of 127 for poochyena, so it becomes female. "Life uhhhh finds a way."
The solutions I see are:
nameHash
from vanilla emerald to get the nature, then generate a PID from nature, gender, and ability all at once.trainer_parties.h
but still generate a PID like above.I wrote a function that can generate a PID like I mentioned, just waiting for the greenlight. I think solution 3 makes the most sense as
nameHash
is only useful for getting the nature. But, nature is the only value of the personality-derived values (nature, gender, ability) that isn't immediately obvious from looking at the code and most trainer pokemon natures can't be looked up anywhere.Version
1.7.3 (Latest release)
Upcoming/master Version
No response
Discord contact info
hungry_pickle