Updated Repeated Field Medicine Use (markdown)

ghoulslash 2021-09-19 18:42:07 -06:00
parent 60139b8745
commit 9abb1cdf4d
1 changed files with 30 additions and 11 deletions

@ -98,20 +98,39 @@ Finally, find `Task_DisplayHPRestoredMessage`. Replace `gTasks[taskId].func = Ta
## Addendum: Rare Candies ## Addendum: Rare Candies
Credit: AsparagusEduardo Credit: AsparagusEduardo, ghoulslash
You may also want to use this for Rare Candies, so all you have to do is find `PartyMenuTryEvolution` and replace `gTasks[taskId].func = Task_ClosePartyMenuAfterText;` with: You may also want to use this for Rare Candies, so all you have to do is find `PartyMenuTryEvolution` and replace it with:
```c ```c
static void PartyMenuTryEvolution(u8 taskId)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0);
if (targetSpecies != SPECIES_NONE)
{
FreePartyPointers();
if (gSpecialVar_ItemId == ITEM_RARE_CANDY && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingRareCandy;
else
gCB2_AfterEvolution = gPartyMenu.exitCallback;
BeginEvolutionScene(mon, targetSpecies, 1, gPartyMenu.slotId);
DestroyTask(taskId);
}
else
{
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1)) if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gTasks[taskId].func = Task_ReturnToChooseMonAfterText; gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
else else
gTasks[taskId].func = Task_ClosePartyMenuAfterText; gTasks[taskId].func = Task_ClosePartyMenuAfterText;
}
}
``` ```
And add the function, `CB2_ReturnToPartyMenuUsingRareCandy`, somewhere in the file:
And finally, when using a Rare Candy on a Level 100 Pokémon it would normally go back to the Bag menu. To avoid that, we search for `ItemUseCB_RareCandy` and replace `gTasks[taskId].func = task;` with:
```c ```c
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD) static void CB2_ReturnToPartyMenuUsingRareCandy(void)
gTasks[taskId].func = Task_ReturnToChooseMonAfterText; {
else gItemUseCB = ItemUseCB_RareCandy;
gTasks[taskId].func = task; SetMainCallback2(CB2_ShowPartyMenuForItemUse);
}
``` ```