You can try to approach a coding solution that
is not really elegant, but still. I'm not sure the way you're adding custom categories to the game, but you can try to do this:
Code:
(function() {
var _old_item_category_makeCommandList = Window_ItemCategory.prototype.makeCommandList;
Window_ItemCategory.prototype.makeCommandList = function() {
_old_item_category_makeCommandList.call(this);
var scene = SceneManager._scene; // Storing current scene;
if(!(scene instanceof Scene_Shop)) {return;} // If not scene shop, we'll not process the code
if(scene._commandWindow.currentSymbol() !== "sell") {return;} // If we're not selling, we'll not process the code. Adding this line considering the chance that you added a plugins for supporting categories on buyWindow, too.
this._list = this._list.filter(function(command) {
return ![/*Add here the symbol of the categories you want to hide*/].contains(command.symbol)
// Example: return !["keyItem", "myCustomCategory"].contains(command.symbol)
}.bind(this))
};
var _old_scene_shop_commandSell = Scene_Shop.prototype.commandSell;
Scene_Shop.prototype.commandSell = function() {
this._categoryWindow.refresh(); // Refreshing the category window on command sell;
return _old_scene_shop_commandSell.call(this)
}
var _old_scene_shop_commandBuy = Scene_Shop.prototype.commandBuy;
Scene_Shop.prototype.commandBuy = function() {
this._categoryWindow.refresh(); // Refreshing command window on command buy
return _old_scene_shop_commandBuy.call(this)
}
})()
In general, it's not necessary to proceed this way for the Scene_Shop, as in vanilla MV, category window works only for the Sell Window. However, acting this way, we should prevent the situation of another plugin that adds categories to buy window, too.
Add the script above in a JS file and it to your plugin manager. Remember to edit the array of above with the symbol of the categories you want to hide.
Sorry for late reply. Thank you for your time. It somehow worked. It hides the key items but not the custom categories.
I create custom categories using yanfly yep_x_itemcategories.js . It works like this,
TO create custom category, inside the plugin you need to add " Category: Custom Name" ( Ex: "Category: Food".) .
I have three categories " Category: Books" , "Category: Gameplay Mechanics" , "Category: Construction Materials".
I used your code and added " Category" as the custom-name but it hid all the three custom categories. I just want to hide the "Category: Books" and " Category: Gameplay Mechanics" from showing in sell shop?
------------------------------------------------------------------------------------------------------------------
I attached the yanfly category plugin, if you would want to take a look.
Again, thank you for your time and effort.