RMMV Separate main menu entries for normal items & key items, close to a solution

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
(tl;dr: How can I hide or bypass the item category selection window, while preserving separate item categories?)

Hello!

In my game, "Key Items" have been renamed "Apps" and allows players to access tutorials screens, music player, note-taking, fast travel, etc. Apps are accessible from the main menu because there will be some situations where players might need to access Apps repeatedly (solving puzzles etc).

I'm using CGMV's menu plugin, as well as this bit of script that I figured out from searching these forums:

Code:
const alias = Scene_Item.prototype.start;
Scene_Item.prototype.start = function() {
    alias.call(this);
     if($gameSwitches.value(5)){
         const symbol = $gameVariables.value(1);
        this._categoryWindow.selectSymbol('keyItem');
    }
};

app.png

From the main menu, selecting "Items" will open up normal Item inventory and selecting "Apps" opens up the Key Items inventory -- so far so good!

However, I want to hide / bypass the item category selection window, to save players the button press and to prevent players from switching between items/equipment/key items.

I tried Mr. Trivel's No Item Categories plugin (by the way huge thanks to Mr. Trivel for so many excellent plugins), but it presents two problems for me: firstly it collapses all the item categories together, and secondly it conflicts with the script I posted above.

I'd be fine with collapsing Items / Weapons / Armor into the same menu category, but keeping Apps separate will keep the user experience tidy.

How can I hide or bypass the item category selection window, while preserving separate item categories? I feel like this is probably pretty simple, but I'm quite new to working with javascript and code in general.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,096
Reaction score
3,248
First Language
English
Primarily Uses
RMMV
Open the Trivel plugin in a text editor and change line 46 to read:
Code:
return item.itypeId!=2;

In what other way does it conflict with the other plugin?
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
Thanks, I made that edit. The other conflict seems to be with SumRndmDde's debug/window editor, or might be a plugin order issue?:

Screenshot 2022-06-25 101414.png
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,096
Reaction score
3,248
First Language
English
Primarily Uses
RMMV
I don't see anything in there that references SRD's debug window, it's referencing the exact line you just edited, line 46 in NoItemCategories.

I'm not sure why it's looking at a null item, but change your edit to say
Code:
return item && item.itypeId!=2;
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
That fixed it when I access the Items menu! Still not there, though... When I access apps/keyitems, I get this:
Screenshot 2022.png

The line it's referencing from keyitem2.js is
Code:
        this._categoryWindow.selectSymbol('keyItem');
Thank you for the help thus far, this is adding to my understanding.
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
I was able to prevent the crash by adding a line:
Code:
const alias = Scene_Item.prototype.start;
Scene_Item.prototype.start = function() {
    alias.call(this);
     if($gameSwitches.value(5)){
        const symbol = $gameVariables.value(1);
        Scene_Item.prototype.createCategoryWindow = function() {
        this._categoryWindow.selectSymbol('keyItem');
    }
};

but now the main menu entry for keyitems/apps just pulls up normal items.
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
Still trying to get the above feature to work... ever closer, but still not there. I'm trying to edit rpg_scenes.js directly and I've turned off MrT's NoItemCategories. I added a couple lines to rpg_scenes after 1256, the last two lines in the block below:

JavaScript:
Scene_Item.prototype.createItemWindow = function() {
    var wy = this._categoryWindow.y + this._categoryWindow.height;
    var wh = Graphics.boxHeight - wy;
    this._itemWindow = new Window_ItemList(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);
    this._categoryWindow.setItemWindow(this._itemWindow);
    this._itemWindow.select(0);
    this._itemWindow.activate(0);
};

Window_ItemList appears to be active, but unfortunately the category window is simultaneously active. I feel like I'm one line away from getting it to do what I want?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,041
Reaction score
4,654
First Language
English
Primarily Uses
RMMZ
The "start" function runs before the "create" one, so you're trying to do something with _categoryWindow before it exists.
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
I see -- but I'm not sure what to change. As far as I understand it, the code in my original post is executing what I intend (main menu options of "Apps" and "Items" bring up the correct item lists when SceneItem is pushed) it's just that Window_ItemCategory is active when SceneItem gets pushed, and I just want Window_ItemList to be active. I can't tell what is activating Window_ItemCategory, or if it just automatically gets selected when it gets made?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,041
Reaction score
4,654
First Language
English
Primarily Uses
RMMZ
I see -- but I'm not sure what to change. As far as I understand it, the code in my original post is executing what I intend (main menu options of "Apps" and "Items" bring up the correct item lists when SceneItem is pushed) it's just that Window_ItemCategory is active when SceneItem gets pushed, and I just want Window_ItemList to be active. I can't tell what is activating Window_ItemCategory, or if it just automatically gets selected when it gets made?
The reason this happens by default is that Window_ItemCategory inherits from Window_Command, and Window_Command's initialize function calls the .activate() function at the end.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,064
Reaction score
2,372
First Language
Dutch
Primarily Uses
RMMV
NEVER EVER edit the core files directly unless you know what you do,
its best to write a plugin and "overwrite" the function to do something else.

but if you have more, you also missing something:

as I use this line for the key items only (in my case)

JavaScript:
this._itemWindow.setCategory('keyItem');

which might work for you too?
 

frgmthbrd

Villager
Member
Joined
Jul 24, 2021
Messages
12
Reaction score
3
First Language
English
Primarily Uses
RMMV
I keep a backup of the core files whenever I mess with them, I appreciate your concern!

So, now knowing that Window_ItemCategory inherits from Window_Command, I'm still not sure how to get Window_ItemList to be active when SceneItem gets pushed.

I'm watching tutorials and slowly making my way through this but I've been asking here since I continuously feel like I have just one thing I'm missing. At least each time I ask, I learn about another thing I'm still missing, lol!
 

Latest Threads

Latest Posts

Latest Profile Posts

Food for thought. Factorio: Spaghetti belts make your factory inefficient as you fight for space constantly. Satisfactory: Spaghetti belts and massive clipping is the most efficient way to run your factory since it's the shortest distances.
ScreenShot_8_19_2022_8_51_4.png
Both Mike and Ray here are in a "HYPE!" state after Mike uses "Wild Party", which also heals everyone. they'll do more damage and counter more often, but defense is lower along with hit rate.
WHEEL3.gif
Ooker spookers and fun attack mechanics! What a Friday!
Not today... Not today...
I guess I should send my CV to Hasbro. I've made Monopoly cheaters edition more fun and challenging. I've developed custom cheats and chest/chance cards for it. And I've cleared many nightmares through my cards and rules.

Forum statistics

Threads
124,707
Messages
1,165,417
Members
163,520
Latest member
Foxx042
Top