- 17
- Posts
- 3
- Years
- Seen Dec 14, 2022
So I wanted to change the "held items and trade" evolutions to "use" evolutions like the evolution stones, but I'm running into an unexpected problem. Using the Up-grade as an example, I changed the Porygon line in src/data/pokemon to {{EVO_ITEM, ITEM_UP_GRADE, SPECIES_PORYGON2}}, as well as changing the Up-grade's code in src/data/items.h to .type = ITEM_USE_PARTY_MENU and .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone. Additionally, in src/data/pokemon/item_effects.h I added the line [ITEM_UP_GRADE - ITEM_POTION] = gItemEffect_EvoStone.
However, this code produces the following problem:
As you can see, it is alllllllmost working, given that we get the HP display for the correct Pokemon like you see with evolution stones. But then we get the same message: It won't have any effect. I've tracked down the bit of code that does this last message, located in src/party_menu.c:
However, this is where I hit a brick wall. I have no idea why the above if statement evaluates to true for Porygon. The ExecuteTableBasedItemEffect_ function only exists in this file and nowhere else in the decomp, and has 3 arguments:
The first two don't really matter for our purposes (I think) but it's the last one that I am tearing my hair out about. monMoveIndex only exists in this file, and as such I have no idea what it is, what it does, how it decides when to be = 0 and when not to be, nor what that even means. I am totally stuck.
However, this code produces the following problem:
As you can see, it is alllllllmost working, given that we get the HP display for the correct Pokemon like you see with evolution stones. But then we get the same message: It won't have any effect. I've tracked down the bit of code that does this last message, located in src/party_menu.c:
However, this is where I hit a brick wall. I have no idea why the above if statement evaluates to true for Porygon. The ExecuteTableBasedItemEffect_ function only exists in this file and nowhere else in the decomp, and has 3 arguments:
Code:
static bool8 ExecuteTableBasedItemEffect_(u8 partyMonIndex, u16 item, u8 monMoveIndex)