https://github.com/pret/pokeemerald/wiki/Infinity-Rare-Candy-Item
METHOD 1: Infinity Candy
a new item called "Infinity Candy" from pokeemerald++ by mynameisProjects
--note: this code has been modified slightly from what appears in
pokeemerald++
include/item_use.h
add to end of file, before enum ItemTMHMOrEvolutionStone
void ItemUseOutOfBattle_InfinityCandy(u8 taskId);
include/party_menu.h
add to end of file, before #endif // GUARD_PARTY_MENU_H
void ItemUseCB_InfinityCandy(u8 taskId, TaskFunc task);
include/constants/items.h
replace an unused item (ITEM_066 102 used for this guide) with
#define ITEM_INFINITY_CANDY 102
src/data/item_icon_table.h
replace the same item that you chose above with
[ITEM_INFINITY_CANDY] = {gItemIcon_RareCandy, gItemIconPalette_GoldTeeth},
src/data/items.h
replace the item chosen above with
[ITEM_INFINITY_CANDY] =
{
.name = _("INFINITYCANDY"),
.itemId = ITEM_INFINITY_CANDY,
.price = 0,
.description = sInfinityCandyDesc,
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_RareCandy,
},
src/data/pokemon/item_effects.h
add to end of gItemEffect_* section, before const u8 *const gItemEffectTable[] =
const u8 gItemEffect_InfinityCandy[10] = {
[3] = ITEM3_LEVEL_UP,
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
[5] = ITEM5_FRIENDSHIP_ALL,
[6] = ITEM6_HEAL_HP_LVL_UP,
VITAMIN_FRIENDSHIP_CHANGE(7),
};
then add to the table const u8 *const gItemEffectTable[] =, before [LAST_BERRY_INDEX - ITEM_POTION] = NULL
[ITEM_INFINITY_CANDY - ITEM_POTION] = gItemEffect_InfinityCandy,
src/data/text/item_descriptions.h
add to end of file
static const u8 sInfinityCandyDesc[] = _(
"Reusable. Raises a\n"
"Pokémon's level\n"
"by one.");
src/item_use.c
add to end of file, before #undef tUsingRegisteredKeyItem
void ItemUseOutOfBattle_InfinityCandy(u8 taskId)
{
gItemUseCB = ItemUseCB_InfinityCandy;
SetUpItemUseCallback(taskId);
}
src/party_menu.c
add to end of file:
void ItemUseCB_InfinityCandy(u8 taskId, TaskFunc task)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
struct PartyMenuInternal *ptr = sPartyMenuInternal;
s16 *arrayPtr = ptr->data;
u16 *itemPtr = &gSpecialVar_ItemId;
bool8 cannotUseEffect;
if (GetMonData(mon, MON_DATA_LEVEL) != MAX_LEVEL)
{
BufferMonStatsToTaskData(mon, arrayPtr);
cannotUseEffect = ExecuteTableBasedItemEffect_(gPartyMenu.slotId, *itemPtr, 0);
BufferMonStatsToTaskData(mon, &ptr->data[NUM_STATS]);
}
else
{
cannotUseEffect = TRUE;
}
PlaySE(SE_SELECT);
if (cannotUseEffect)
{
gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
else
{
gPartyMenuUseExitCallback = TRUE;
PlayFanfareByFanfareNum(FANFARE_LEVEL_UP);
UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon);
GetMonNickname(mon, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
DisplayPartyMenuMessage(gStringVar4, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_DisplayLevelUpStatsPg1;
}
}
METHOD 2: RareCandy Box
a key item "Rarecandy Box" that gives you 999x Rare Candies in your bag from Modern Emerald by resetes12
include/item_use.h
add to end of file, before enum ItemTMHMOrEvolutionStone
void ItemUseOutOfBattle_InfiniteRareCandies(u8 taskId);
include/constants/items.h
replace an unused item (ITEM_065 101 used for this guide) with
#define ITEM_INFINITE_RARE_CANDIES 101
include/strings.h
add to end of file, before #endif // GUARD_STRINGS_H
extern const u8 gText_infiniteCandies[];
src/item_use.c
add to end of file, before #undef tUsingRegisteredKeyItem
void ItemUseOutOfBattle_InfiniteRareCandies(u8 taskId)
{
PlaySE(MUS_OBTAIN_ITEM);
AddBagItem(ITEM_RARE_CANDY, 999);
if (gTasks[taskId].tUsingRegisteredKeyItem) // to account for pressing select in the overworld
{
DisplayItemMessageOnField(taskId, gText_infiniteCandies, Task_CloseCantUseKeyItemMessage);
}
else
{
DisplayItemMessage(taskId, 1, gText_infiniteCandies, CloseItemMessage);
UpdatePocketItemList(ITEMS_POCKET);
}
}
src/strings.c
add to end of file
const u8 gText_infiniteCandies[] = _("You obtained 999 Rare\nCandies!{PAUSE_UNTIL_PRESS}");
src/data/item_icon_table.h
replace the same item chosen above with
[ITEM_INFINITE_RARE_CANDIES] = {gItemIcon_RareCandy, gItemIconPalette_RareCandy},
src/data/items.h
replace the same item chosen above with
[ITEM_INFINITE_RARE_CANDIES] =
{
.name = _("RARECANDY BOX"),
.itemId = ITEM_INFINITE_RARE_CANDIES,
.price = 0,
.description = sInfiniteRareCandy,
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_InfiniteRareCandies,
},
src/data/text/item_descriptions.h
add to end of file
static const u8 sInfiniteRareCandy[] = _(
"Gives 999 Rare\n"
"Candies for your\n"
"personal uses.");