forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 3
Disable Bag Use In Battle
ghoulslash edited this page Dec 7, 2020
·
3 revisions
Credit to ghoulslash.
Using a flag, we can prevent the player from using items in battle.
In include/constants/flags.h, replace an unused flag with FLAG_DISABLE_BAG
, eg.
#define FLAG_DISABLE_BAG 0x493
Open src/battle_main.c. Search for the line, case B_ACTION_USE_ITEM: in the function static void HandleTurnActionSelectionState(void)
. Change the code directly underneath to:
if (FlagGet(FLAG_DISABLE_BAG) || gBattleTypeFlags & (BATTLE_TYPE_LINK
| BATTLE_TYPE_FRONTIER_NO_PYRAMID
| BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_x2000000))
{
// etc.
If FLAG_DISABLE_BAG
is set, selecting BAG
in battle will display the message Items can't be used now.
Open src/overworld.c and find the function Overworld_ResetStateAfterWhiteOut
. Add the following alongside the other FlagClear
functions:
FlagClear(FLAG_DISABLE_BAG);