summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghoulslash <41651341+ghoulslash@users.noreply.github.com>2020-07-22 09:26:52 -0600
committerghoulslash <41651341+ghoulslash@users.noreply.github.com>2020-07-22 09:26:52 -0600
commit74259bf722beaa3bb9d887929b61d21e5c081fab (patch)
treeb9b03d2b635a95399111d00fe0296fc19c98f3ef
parent5f2cd8deea942170747bbfc99faebeb78cd2caa4 (diff)
Created Disable Bag Use In Battle (markdown)
-rw-r--r--Disable-Bag-Use-In-Battle.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/Disable-Bag-Use-In-Battle.md b/Disable-Bag-Use-In-Battle.md
new file mode 100644
index 0000000..378a0d8
--- /dev/null
+++ b/Disable-Bag-Use-In-Battle.md
@@ -0,0 +1,24 @@
+## Disable Bag Use In Battle
+
+Credit to ghoulslash.
+
+Using a flag, we can prevent the player from using items in battle.
+
+### Define the flag.
+In [include/constants/flags.h](../blob/master/include/constants/flags.h), replace an unused flag with `FLAG_DISABLE_BAG`, eg.
+```c
+#define FLAG_DISABLE_BAG 0x493
+```
+
+### Toggle Bag Usage
+Open [src/battle_main.c](../blob/master/src/battle_main.c). Search for the line, [case B_ACTION_USE_ITEM:](../blob/master/src/battle_main.c#L4262) in the function `static void HandleTurnActionSelectionState(void)`. Change the code directly underneath to:
+```c
+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.` \ No newline at end of file