-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Infinite TM usage
Credit to paccy for this tutorial in the Simple Modifications Pokecommunity thread.
This tutorial will make all TMs infinitely reusable, unholdable by Pokemon, unsellable to shops, and also removes the number from appearing in the Bag.
Normally, the game checks if the item used was a TM or an HM, and consumes the item if it was a TM. We can just simply remove this check.
Edit src/party_menu.c:
static void Task_LearnedMove(u8 taskId)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
s16 *move = &gPartyMenu.data1;
u16 item = gSpecialVar_ItemId;
if (move[1] == 0)
{
AdjustFriendship(mon, FRIENDSHIP_EVENT_LEARN_TMHM);
- if (item < ITEM_HM01_CUT)
- RemoveBagItem(item, 1);
}
GetMonNickname(mon, gStringVar1);
StringCopy(gStringVar2, gMoveNames[move[0]]);
StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3);
DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = Task_DoLearnedMoveFanfareAfterText;
}
If you were to stop here, TMs can still be given to Pokemon and you can still see the number in the bag. The next step will address this.
struct Item
has a field importance
. If this field has a nonzero value, then the item is treated like a key item, and cannot be held, tossed, or deposited in the PC, and it will not display an item count in the bag. Furthermore, items with a price of 0 cannot be sold.
Edit src/data/items.h:
[ITEM_TM01_FOCUS_PUNCH] =
{
.name = _("TM01"),
.itemId = ITEM_TM01_FOCUS_PUNCH,
- .price = 3000,
+ .price = 0,
.description = sTM01Desc,
+ .importance = 1,
.pocket = POCKET_TM_HM,
.type = 1,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.secondaryId = 0,
},
You will need to repeat the above for every TM.
And that's it!
Notes: Pokemon will replenish their PP if a TM move is forgotten and relearned.
Alternatively, see this commit for an implementation by Karathan that turns TMs and HMs into a bitfield, freeing up some saveblock space. This saves space, but is slightly more complex.