RMMV How can I hide some specific categories while selling at shop?

andy123

Villager
Member
Joined
Dec 8, 2020
Messages
28
Reaction score
5
First Language
english
Primarily Uses
RMMV
So I am using "yepitemcategories.js" and have 6 categories for items which are " Weapons, armors, items, key items, books , collectibles" . When I go to shop to sell items under " items" category, all the other category show up.
Is there any way to HIDE the " key items " category along with custom created category ( i.e books , collectibles ) while SELLING ?

Thanks in advance
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,145
Reaction score
1,155
First Language
English
Primarily Uses
RMMV
Just as a quick bit of advice, it is generally considered to be disruptive to make post subjects in all capital letters, which you've done a few times today - when typing to people, that's considered to convey shouting. The most formally correct way is to use capitalized words headline-style, or anything more casual than that. Also, you posted the same question multiple times in different forums, which is never necessary.

As far as your question, everything is possible, and this has even been done before!

I Googled "RPG Maker MV shop hide key items" and I found this thread, which has a plugin posted halfway down to do what you're asking.
 
Last edited:

andy123

Villager
Member
Joined
Dec 8, 2020
Messages
28
Reaction score
5
First Language
english
Primarily Uses
RMMV
Just as a quick bit of advice, it is generally considered to be disruptive to make post subjects in all capital letters, which you've done a few times today - when typing to people, that's considered to convey shouting. The most formally correct way is to use capitalized words headline-style, or anything more casual than that. Also, you posted the same question multiple times in different forums, which is never necessary.

As far as your question, everything is possible, and this has even been done before!

I Googled "RPG Maker MV shop hide key items" and I found this thread, which has a plugin posted halfway down to do what you're asking.
Sorry , I didn't know all those rules. Changed them now as you suggested so thanks for that.

Now moving to context I already have seen that plugin but it doesn't solve my issue. It only shows the "items" while selling. What I want to do is something like this : I have 6 categories of inventory ( 4 are the default ones and 2 custom ) . When selling , I want to hide the 2 custom category and 1 default category . How do I do this?


For reference, I found this but it's for VXA and I don't know how to port it to MV,

 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,670
Reaction score
15,291
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

BlueMoon

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
363
Reaction score
485
First Language
Italian
Primarily Uses
RMMZ
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.
 

andy123

Villager
Member
Joined
Dec 8, 2020
Messages
28
Reaction score
5
First Language
english
Primarily Uses
RMMV
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.
 

Attachments

  • YEP_X_ItemCategories.js
    14.8 KB · Views: 0

Latest Threads

Latest Posts

Latest Profile Posts

I wonder if color LUTs is possible for RPG Maker. It would be game changer and can replace the not so good looking tint screen
new mechanic in battle where you can mentally erase enemies when you deplete all their MP instead HP. this gives you a special item of their "memory". it's pretty to do in battle so far.
Apparently MZ lets you preview move routes in the move route editor without having to start up test game. That could save a lot of time during development compared to MV, especially for a long game that uses a lot of event movement for cutscenes.
A repost of an old meme I had made, now with music

Forum statistics

Threads
115,862
Messages
1,093,545
Members
151,082
Latest member
ak29
Top