MV Modifying the "Select Item" window

The "Select Item" command/window normally lets you select 1 item and then the ID of that item is stored in a variable.

What I would like to do instead, is have this command/window let you select multiple items and then store all the IDs as elements of an array within one variable.

What is the most efficient way of doing this? would it require creating an entirely new class of window objects or is it enough to mess around with "Window_EventItem" and its functions?
You could create a plugin that makes an alias of that function with the commands you want (push the item id into an array)
I think this is the function?

Code:
Game_Message.prototype.setItemChoice = function(variableId, itemType) {
    this._itemChoiceVariableId = variableId;
    this._itemChoiceItypeId = itemType;
};

But it's only setting the properties, it doesn't call the actual window... so I'm not sure in which of the files to look for the relevant code
What I would like to do instead, is have this command/window let you select multiple items and then store all the IDs as elements of an array within one variable.
Just to point it out, you're conflating two different things. You can do whatever you want with a window that you code into RPG Maker.

But you can't do anything to edit the actual event command in the editor or how you use it.

P.S. if you search for other occasions of the itemChoiceVariableId member variable, you'll find the Window_EventItem is what you're looking for.
if you search for other occasions of the itemChoiceVariableId member variable, you'll find the Window_EventItem is what you're looking for.

Thanks!

I got this:

Code:
Window_EventItem.prototype.onOk = function() {
    var item = this.item();
    var itemId = item ? item.id : 0;
    $gameVariables.setValue($gameMessage.itemChoiceVariableId(), itemId);
    this._messageWindow.terminateMessage();
    this.close();
};

So I think I understand more or less how it works and will try to modify this function
I was just wondering how is this window getting opened in the first place via $gameMessage.setItemChoice()? there doesn't seem to be anything in that function that calls it
I was just wondering how is this window getting opened in the first place via $gameMessage.setItemChoice()? there doesn't seem to be anything in that function that calls it
Did you, in fact, do a search for that variable name? 😉

The act of setting it is what creates the window. Its value is returned by Game_Message.isItemChoice(), and Window_Message.startInput() checks isItemChoice() to call itemWindow.start()
Did you, in fact, do a search for that variable name? 😉

The act of setting it is what creates the window. Its value is returned by Game_Message.isItemChoice(), and Window_Message.startInput() checks isItemChoice() to call itemWindow.start()

Ohhh okay, I didn't realize there was both Game_Message and Window_Message. it took a bit of jumping back and forth between the two files but it makes sense now

Thanks!
I suggest the following:

- Make a new Window class. Right now, I cannot tell you from which class it should derive, it could be Window_Scrollable, Window_Selectable, Window_Command, or any other Window class.
- Make your new ItemCommand Window that derives from your new Window class. This way, you will have 2 classes which usually makes the flow easier.
- Override this function from rpg_scenes -> Scene_Battle

Code:
Scene_Battle.prototype.createItemWindow = function() {
    var wy = this._helpWindow.y + this._helpWindow.height;
    var wh = this._statusWindow.y - wy;
    this._itemWindow = new Window_BattleItem(0, wy, Graphics.boxWidth, wh); // this line!!
    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);
};

so it creates your window instead
- Last but not least, you will need to override some logic in Scene_Battle, BattleManager, and probably some other classes. This would be the hardest part, I think.
Thank you for the suggestions! 🙂 my game doesn't use the battle scene, so it's fine

I ended up simply modifying Window_EventItem.prototype.onOk() and it appears to work as intended, just need to remove the selected items from the inventory manually after each selection so that the player can't select the same item again.
I just saw that CT_Bolt had written a plugin that lets you alias any function so that might be useful for anyone who wants to do something like the OP

Original thread: https://forums.rpgmakerweb.com/threads/modifying-the-select-item-window.157161/