Let a Pokémon forget any move they know (Emerald)
As you all know, there's certain moves that a Pokémon can't forget on their own, these are the Hidden Machine Moves.
There is a function which handles that, it's called
CanReplaceMove
and it can be found in the
src/pokemon_summary_screen.c
file.
By making this function always return a value of
TRUE
, we can let any Pokémon forget any of their moves at will.
To do this, let's open up the
src/pokemon_summary_screen.c
file and change the
CanReplaceMove
function from this:
Code:
static bool8 CanReplaceMove(void)
{
if (sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES
|| sMonSummaryScreen->newMove == MOVE_NONE
|| IsMoveHm(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]) != TRUE)
return TRUE;
else
return FALSE;
}
To this:
Code:
static bool8 CanReplaceMove(void)
{
return TRUE;
}
Save, build a ROM and that's basically it.
Alternatively, we can instead remove this function and adjust the code where it's called from accordingly.
Thankfully, the
CanReplaceMove
function is only called in the
Task_HandleReplaceMoveInput
function, so basically we'd need to:
1) Remove the declaration of the
CanReplaceMove
function
(Line 214 by default).
2) Remove the
CanReplaceMove
function
(Lines 2210 to 2218 by default).
3) Adjust the
if
check of the
Task_HandleReplaceMoveInput
function where
CanReplaceMove
is called, changing it from this:
Code:
else if (gMain.newKeys & A_BUTTON)
{
if (CanReplaceMove() == TRUE)
{
StopPokemonAnimations();
PlaySE(SE_SELECT);
sMoveSlotToReplace = sMonSummaryScreen->firstMoveIndex;
gSpecialVar_0x8005 = sMoveSlotToReplace;
BeginCloseSummaryScreen(taskId);
}
else
{
PlaySE(SE_HAZURE);
ShowCantForgetHMsWindow(taskId);
}
}
To this:
Code:
else if (gMain.newKeys & A_BUTTON)
{
StopPokemonAnimations();
PlaySE(SE_SELECT);
sMoveSlotToReplace = sMonSummaryScreen->firstMoveIndex;
gSpecialVar_0x8005 = sMoveSlotToReplace;
BeginCloseSummaryScreen(taskId);
}
Quick Showcase:
And that's pretty much it.
EDIT: I completely forgot to link it here, but thespbgamer brought up a fair point in this thread about 3 months after I originally posted this.
The changes I present in this post don't cover the replacement of a move in battle, because I absolutely forgot that was a thing honestly.
Click here if you want to learn how to address that.
EDIT2: And just as I finish editing this post, Jaizu is telling me that I also forgot to mention the removal of a move after evolution.
Just go to
src/evolution_scene.c
and remove the 2
if
statements that call the
IsHMMove2
function.
That means you have to do something like this:
As evidenced by
git grep "IsHMMove2"
, the function is not used anywhere else, so y'all can safely remove it if you want to.