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,190
Reaction score
1,171
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,686
Reaction score
15,294
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 Profile Posts

I just love the MV feature that allows you to create your own animations!
I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!
Creating 3D CGs for Cutscenes. :kaosalute:

Forum statistics

Threads
115,906
Messages
1,093,867
Members
151,157
Latest member
Kelard
Top