MV Adding categories/organization to Item menu in battles?

Hi there. I just had a question of if there is any way, via plugin or otherwise to add categories into the battle item menu. I am aware Yanfly has a plugin for item categories, but that only applies to the item menu on the map when you pause, not in battle. I've found with my playtesters for my game that players use item menu in battle way more often than the pause menu version, so I want to make sure it's organized. I was maybe thinking something could be done with SRD's Hud Maker, but I'm not sure. Does anyone know if a plugin for this type of thing exists?
so far I know, battle item is linked to the item scene (shared itemList).
in case you want 2 complete different inventories, than it should be made
I think.

I didn't really pay attention on the map and battle how the scene look like.
and maybe I should, but there can be changes or alter/patch item categories
to a notetag for battle tag?

but I don't use the item categories or the item core of yanfly as I have my own.
Hmmm, I tried adding the item categories there. But didn't test it that much. And since I copypasted a lot, there might be some unnecessary stuff. You also need to change the category names (currently they're named the base MV categories) in the code and then add notetags to your items, like 1, 2, 3, 4 depending on which of the 4 categories you want them to show in. Notetag is like <itemTypeIndex:2> If you want to change the number of categories etc you need to edit the code. And it's made for base code, don't know how it works with plugins.

function Window_BattleItemCategory() {
this.initialize.apply(this, arguments);
}

Window_BattleItemCategory.prototype = Object.create(Window_HorzCommand.prototype);
Window_BattleItemCategory.prototype.constructor = Window_BattleItemCategory;

Window_BattleItemCategory.prototype.initialize = function(x,y) {
Window_HorzCommand.prototype.initialize.call(this,x,y);
this.hide();
this.deactivate();
};

Window_BattleItemCategory.prototype.windowWidth = function() {
return Graphics.boxWidth;
};

Window_BattleItemCategory.prototype.maxCols = function() {
return 4;
};

Window_BattleItemCategory.prototype.update = function() {
Window_HorzCommand.prototype.update.call(this);
if (this._itemWindow) {
this._itemWindow.setCategory(this.currentSymbol());
}
};

Window_BattleItemCategory.prototype.makeCommandList = function() {
this.addCommand(TextManager.item, 'item');
this.addCommand(TextManager.weapon, 'weapon');
this.addCommand(TextManager.armor, 'armor');
this.addCommand(TextManager.keyItem, 'keyItem');
};

Window_BattleItemCategory.prototype.setItemWindow = function(itemWindow) {
this._itemWindow = itemWindow;
};


///////////////

Scene_Battle.prototype.createItemCategoryWindow = function() {
var wy = this._helpWindow.y + this._helpWindow.height
this._itemCategoryWindow = new Window_BattleItemCategory(0, wy);
this._itemCategoryWindow.setHandler('ok', this.onItemCategoryOk.bind(this));
this._itemCategoryWindow.setHandler('cancel', this.onItemCategoryCancel.bind(this));
this.addWindow(this._itemCategoryWindow);
};

Scene_Battle.prototype.createItemWindow = function() {
var wy = this._helpWindow.y + this._helpWindow.height + 72;
var wh = this._statusWindow.y - wy;
this._itemWindow = new Window_BattleItem(0, wy, Graphics.boxWidth, wh);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this.addWindow(this._itemWindow);
};

Scene_Battle.prototype.commandItem = function() {
this._itemWindow.contents.clear();
this._helpWindow.clear();
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemCategoryWindow.activate();
};

Scene_Battle.prototype.onItemCancel = function() {
this._helpWindow.clear();
this._itemCategoryWindow.activate();
this._itemWindow.contents.clear();
};

Scene_Battle.prototype.onItemCategoryCancel = function() {
this._itemWindow.hide();
this._itemCategoryWindow.hide();
this._actorCommandWindow.activate();
};

Scene_Battle.prototype.onItemCategoryOk = function() {
this._itemWindow.refresh();
this._itemCategoryWindow.deactivate();
this._itemWindow.activate();
};

const myEdit1_SceneBattle_createAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
myEdit1_SceneBattle_createAllWindows.call(this);
this.createItemCategoryWindow();
};

Scene_Battle.prototype.isAnyInputWindowActive = function() {
return (this._partyCommandWindow.active ||
this._actorCommandWindow.active ||
this._skillWindow.active ||
this._itemWindow.active ||
this._actorWindow.active ||
this._enemyWindow.active ||
this._itemCategoryWindow.active);
};

Scene_Battle.prototype.onSelectAction = function() {
var action = BattleManager.inputtingAction();
this._skillWindow.hide();
this._itemWindow.hide();
this._itemCategoryWindow.hide();
if (!action.needsSelection()) {
this.selectNextCommand();
} else if (action.isForOpponent()) {
this.selectEnemySelection();
} else {
this.selectActorSelection();
}
};

Scene_Battle.prototype.onEnemyCancel = function() {
this._enemyWindow.hide();
switch (this._actorCommandWindow.currentSymbol()) {
case 'attack':
this._actorCommandWindow.activate();
break;
case 'skill':
this._skillWindow.show();
this._skillWindow.activate();
break;
case 'item':
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemWindow.activate();
break;
}
};

Scene_Battle.prototype.onActorCancel = function() {
this._actorWindow.hide();
switch (this._actorCommandWindow.currentSymbol()) {
case 'skill':
this._skillWindow.show();
this._skillWindow.activate();
break;
case 'item':
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemWindow.activate();
break;
}
};

Window_BattleItem.prototype.includes = function(item) {
let included = false;
if (item) {
const itemTypeIndex = Number(item.meta.itemTypeIndex);
included = itemTypeIndex === SceneManager._scene._itemCategoryWindow.index() + 1;
}
return $gameParty.canUse(item) && (included ? included : false);
};
Hi there. I just had a question of if there is any way, via plugin or otherwise to add categories into the battle item menu. I am aware Yanfly has a plugin for item categories, but that only applies to the item menu on the map when you pause, not in battle. I've found with my playtesters for my game that players use item menu in battle way more often than the pause menu version, so I want to make sure it's organized. I was maybe thinking something could be done with SRD's Hud Maker, but I'm not sure. Does anyone know if a plugin for this type of thing exists?

bandicam 2023-10-28 04-57-27-234.png


I did a few things to accomplish this kind of thing in my game.

#1: I removed the default Battle Inventory function and use a custom lookalike Item command via Himeworks's Actor Battle Commands. This item command menu is technically a skill menu, and the "items" are skills that consume the item via Yanfly's Skill Core and its extension plugin Skill Cost Items.

This allows me to have the items in this menu function like the default interface but with more customizability.

#2: I used SRD Skill Extender to make these "categories" (Both Recovery sections, EP heal, Combat items). When you click on these categories, it summons a list of skill "item" IDs.

Caveats with this approach are:
* You gotta make skill versions of existing items.
* You have to teach the characters these "skills" (the categories specifically) by default so they show up in the menu. If you don't, they don't show up.
* You have to manually keep track of which items count as which category - they don't update automatically unless you add them yourself, which can be repetitive if you don't mind doing everything piece-by-piece like I do.
Hmmm, I tried adding the item categories there. But didn't test it that much. And since I copypasted a lot, there might be some unnecessary stuff. You also need to change the category names (currently they're named the base MV categories) in the code and then add notetags to your items, like 1, 2, 3, 4 depending on which of the 4 categories you want them to show in. Notetag is like <itemTypeIndex:2> If you want to change the number of categories etc you need to edit the code. And it's made for base code, don't know how it works with plugins.

function Window_BattleItemCategory() {
this.initialize.apply(this, arguments);
}

Window_BattleItemCategory.prototype = Object.create(Window_HorzCommand.prototype);
Window_BattleItemCategory.prototype.constructor = Window_BattleItemCategory;

Window_BattleItemCategory.prototype.initialize = function(x,y) {
Window_HorzCommand.prototype.initialize.call(this,x,y);
this.hide();
this.deactivate();
};

Window_BattleItemCategory.prototype.windowWidth = function() {
return Graphics.boxWidth;
};

Window_BattleItemCategory.prototype.maxCols = function() {
return 4;
};

Window_BattleItemCategory.prototype.update = function() {
Window_HorzCommand.prototype.update.call(this);
if (this._itemWindow) {
this._itemWindow.setCategory(this.currentSymbol());
}
};

Window_BattleItemCategory.prototype.makeCommandList = function() {
this.addCommand(TextManager.item, 'item');
this.addCommand(TextManager.weapon, 'weapon');
this.addCommand(TextManager.armor, 'armor');
this.addCommand(TextManager.keyItem, 'keyItem');
};

Window_BattleItemCategory.prototype.setItemWindow = function(itemWindow) {
this._itemWindow = itemWindow;
};


///////////////

Scene_Battle.prototype.createItemCategoryWindow = function() {
var wy = this._helpWindow.y + this._helpWindow.height
this._itemCategoryWindow = new Window_BattleItemCategory(0, wy);
this._itemCategoryWindow.setHandler('ok', this.onItemCategoryOk.bind(this));
this._itemCategoryWindow.setHandler('cancel', this.onItemCategoryCancel.bind(this));
this.addWindow(this._itemCategoryWindow);
};

Scene_Battle.prototype.createItemWindow = function() {
var wy = this._helpWindow.y + this._helpWindow.height + 72;
var wh = this._statusWindow.y - wy;
this._itemWindow = new Window_BattleItem(0, wy, Graphics.boxWidth, wh);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this.addWindow(this._itemWindow);
};

Scene_Battle.prototype.commandItem = function() {
this._itemWindow.contents.clear();
this._helpWindow.clear();
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemCategoryWindow.activate();
};

Scene_Battle.prototype.onItemCancel = function() {
this._helpWindow.clear();
this._itemCategoryWindow.activate();
this._itemWindow.contents.clear();
};

Scene_Battle.prototype.onItemCategoryCancel = function() {
this._itemWindow.hide();
this._itemCategoryWindow.hide();
this._actorCommandWindow.activate();
};

Scene_Battle.prototype.onItemCategoryOk = function() {
this._itemWindow.refresh();
this._itemCategoryWindow.deactivate();
this._itemWindow.activate();
};

const myEdit1_SceneBattle_createAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
myEdit1_SceneBattle_createAllWindows.call(this);
this.createItemCategoryWindow();
};

Scene_Battle.prototype.isAnyInputWindowActive = function() {
return (this._partyCommandWindow.active ||
this._actorCommandWindow.active ||
this._skillWindow.active ||
this._itemWindow.active ||
this._actorWindow.active ||
this._enemyWindow.active ||
this._itemCategoryWindow.active);
};

Scene_Battle.prototype.onSelectAction = function() {
var action = BattleManager.inputtingAction();
this._skillWindow.hide();
this._itemWindow.hide();
this._itemCategoryWindow.hide();
if (!action.needsSelection()) {
this.selectNextCommand();
} else if (action.isForOpponent()) {
this.selectEnemySelection();
} else {
this.selectActorSelection();
}
};

Scene_Battle.prototype.onEnemyCancel = function() {
this._enemyWindow.hide();
switch (this._actorCommandWindow.currentSymbol()) {
case 'attack':
this._actorCommandWindow.activate();
break;
case 'skill':
this._skillWindow.show();
this._skillWindow.activate();
break;
case 'item':
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemWindow.activate();
break;
}
};

Scene_Battle.prototype.onActorCancel = function() {
this._actorWindow.hide();
switch (this._actorCommandWindow.currentSymbol()) {
case 'skill':
this._skillWindow.show();
this._skillWindow.activate();
break;
case 'item':
this._itemCategoryWindow.show();
this._itemWindow.show();
this._itemWindow.activate();
break;
}
};

Window_BattleItem.prototype.includes = function(item) {
let included = false;
if (item) {
const itemTypeIndex = Number(item.meta.itemTypeIndex);
included = itemTypeIndex === SceneManager._scene._itemCategoryWindow.index() + 1;
}
return $gameParty.canUse(item) && (included ? included : false);
};
Trying it out right now. This works just fine with all my plugins so far! I'll let you know if something comes up. Thanks!
Window_BattleItemCategory.prototype.makeCommandList = function() {
this.addCommand(TextManager.item, 'item');
this.addCommand(TextManager.weapon, 'weapon');
this.addCommand(TextManager.armor, 'armor');
this.addCommand(TextManager.keyItem, 'keyItem');
};

Actually, I do have one question. Is there a way to change these name categories? I've changed them, restarted the engine and hasn't worked. Here's a screenshot of my .js file for reference.
1770279536962.png

Is there something more I have to do or am I putting these names in the wrong place?
Yeah, change the names instead of the symbols. The names currently get the info from TextManager.X. So change it to for example "Food"
Cool deal. I was able to get a system like this going. I'm actually using a combination of Yanfly's Item Categories and your plugin now. I decided to get rid of Items from the combat menu altogether and keep it's name since I don't want players opening up the pause menu and clicking on something like "Drugs" or "Food" as the Item menu, since changing it in the system wouldn't just change it on the battle screen, but everywhere also. Once again thank you very much for your help!
Yeah, change the names instead of the symbols. The names currently get the info from TextManager.X. So change it to for example "Food"
1770283633831.png

Original thread: https://forums.rpgmakerweb.com/threads/adding-categories-organization-to-item-menu-in-battles.182262/