1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
## Keep Party Menu Open During Field Medicine Use
Credit: ghoulslash
If you're using a lot of potions at once, it can be annoying to keep returning to the bag after use. This simple fix keeps the menu open unless you run out of potions. The user will have to select `Cancel` or press `B` to exit the party menu. But this is intuitive.
Let's start by opening [src/party_menu.c](../blob/master/src/party_menu.c)
### 1.
First, find the function `ItemUseCB_Medicine`. Inside the code block that starts with `if (ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0))`, replace `gTasks[taskId].func = task;` with:
```c
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD)
gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
else
gTasks[taskId].func = task;
```
### 2.
Next, stay in the function `ItemUseCB_Medicine`. Towards the end of the function, replace
```c
.....
else
{
GetMonNickname(mon, gStringVar1);
GetMedicineItemEffectMessage(item);
DisplayPartyMenuMessage(gStringVar4, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
```
with
```c
.....
else
{
GetMonNickname(mon, gStringVar1);
GetMedicineItemEffectMessage(item);
DisplayPartyMenuMessage(gStringVar4, TRUE);
ScheduleBgCopyTilemapToVram(2);
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(item, 1))
gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
else
gTasks[taskId].func = task;
}
```
### 3.
Finally, find `Task_DisplayHPRestoredMessage`. Replace `gTasks[taskId].func = Task_ClosePartyMenuAfterText;` with:
```c
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
else
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
```
|