diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8787760e74..f0957241ca 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -66,6 +66,8 @@ #include "constants/pokemon.h" #include "config/battle.h" #include "data/battle_move_effects.h" +#include "follower_npc.h" +#include "load_save.h" // table to avoid ugly powing on gba (courtesy of doesnt) // this returns (i^2.5)/4 @@ -16034,6 +16036,9 @@ static void Cmd_givecaughtmon(void) { CMD_ARGS(const u8 *passInstr); enum GiveCaughtMonStates state = gBattleCommunication[MULTIUSE_STATE]; + // Restore players party in order to handle properly the case when a wild mon is caught. + if (IsNPCFollowerWildBattle()) + LoadPlayerParty(); switch (state) { @@ -16171,6 +16176,9 @@ static void Cmd_givecaughtmon(void) gBattlescriptCurrInstr = cmd->nextInstr; break; } + // Save the player's party again to not interferes with RestorePartyAfterFollowerNPCBattle() called after battle. + if (IsNPCFollowerWildBattle()) + SavePlayerParty(); } static void Cmd_trysetcaughtmondexflags(void)