MV Remove items from a storage when inventory is not full

Hi everyone. I am using this plugin (RPG Maker MV) that allows to store items in a warehouse or box (like resident evil).

the plugin works great but I wish it had something else:

I'm using a plugin that allows a certain maximum number of items in the inventory, this number is stored in a variable. I would like the PH Warehouse plugin to not allow to withdraw items if you have full inventory (according to that variable).

In conclusion:

if number of items in inventory < variable X (max. inventory capacity), don't allow the player to withdraw items from the warehouse (box).

I would contact the creator of the plugin but does not connect to the forum since 2018.

could someone help me with this?
If your max inventory value is static, why not add a conditional to check against that variable before showing the inventory to the player?

You could do this right before the script call to show the inventory, or you could add it as a condition for an event page.
If your max inventory value is static, why not add a conditional to check against that variable before showing the inventory to the player?

You could do this right before the script call to show the inventory, or you could add it as a condition for an event page.
If I knew how to handle plugins, I would have done it already. The conditional must be done within the plugin itself, not outside of it, because it is the plugin that must check in the warehouse menu (withdraw tab). In there, it must be checked if the inventory is full, then the plugin will not allow you to withdraw items from the warehouse.
Okay, this is maybe a little hackey, but see if it works.

Go to line 884 and add to the beginning of the line:
Code:
if ($gameParty.allItems()<$gameVariables.value(x))
where x is the variable ID storing your max items held.

Save the plugin, right-click it in your plugin manager and Reload, save your game, start a new play test.

That should prevent the Withdraw command from appearing in the list if you have too many items.

It's not printed as a traditional command so I"m not sure how to make it still print but be greyed out and not selectable. It also won't prevent you from using some "withdraw all" option, if that exists, to go over your limit. That would require more significant edits to the plugin.
Okay, this is maybe a little hackey, but see if it works.

Go to line 884 and add to the beginning of the line:
Code:
if ($gameParty.allItems()<$gameVariables.value(x))
where x is the variable ID storing your max items held.

Save the plugin, right-click it in your plugin manager and Reload, save your game, start a new play test.

That should prevent the Withdraw command from appearing in the list if you have too many items.

It's not printed as a traditional command so I"m not sure how to make it still print but be greyed out and not selectable. It also won't prevent you from using some "withdraw all" option, if that exists, to go over your limit. That would require more significant edits to the plugin.

I already did everything you told me but the "withdraw" command can still be selected.

The word "withdraw" does not appear, but it can be selected.

I think the solution could be on line 1080, in this conditional:

if (numItems < $gameParty.numItems(item))

What do you say?

another thing, the conditional shouldn't count weapons or armors, I just want it to count normal items.

also, the number of repeated items should not be counted. For example, if I have 2 health kits and 3 keys, I only have 2 items (slots), not 5.
I think the solution could be on line 1080, in this conditional:
Yeah, that looks like it would work. Before the last close parenthesis there, put && and then the condition I gave you before. Still wouldn't help if there's a functionality to withdraw multiple, though.

another thing, the conditional shouldn't count weapons or armors, I just want it to count normal items.

also, the number of repeated items should not be counted.
Then instead of allItems(), you'd do $gameParty.items().filter(element => element>0).length
<$juegoVariables.valor(

Yeah, that looks like it would work. Before the last close parenthesis there, put && and then the condition I gave you before. Still wouldn't help if there's a functionality to withdraw multiple, though.


Then instead of allItems(), you'd do $gameParty.items().filter(element => element>0).length

It doesn't work, it still allows you to withdraw items.

So I have line 1080, will it be correct?

if (numItems < $gameParty.numItems(item) && $gameParty.items().filter(element => element>0).length < $gameVariables.value(19)) {
SoundManager.playEquip();
PHPlugins.PHWarehouse.withdraw(item);
That looks correct to me, but again I'm not using or testing with the plugin. If that's still not doing anything different for you, it'll require a deeper dive into the code.
That looks correct to me, but again I'm not using or testing with the plugin. If that's still not doing anything different for you, it'll require a deeper dive into the code.

Would it help in something if I send you the demo? Here is the link.

I would really appreciate it if you could help me with this, it's really frustrating not being able to use that warehouse plugin in my game if I can't fix this.
testing and testing I think I'm very close to achieving the goal.

look at the code. It works almost 100% but it is missing something very important.

wet.png


If you have 8 items and you try to withdraw an item, it won't let you, but if you try to withdraw an item you already have, it should allow you to withdraw that item, because it won't count as a new slot.

That detail is the only thing I need to solve.

For example, I have 10 bullets and I want to withdraw one more, I can't. I should be able to.
I finally managed to solve it on my own, this is the line I had to put:

if ($gameParty.getAllItemsByMICategory(0).length < $gameVariables.value(19) || $gameParty.numItems($dataItems[item.id]) >= 1)
{
SoundManager.playEquip();
PHPlugins.PHWarehouse.withdraw(item);
$gameParty.gainItem(item, 1);
}
else
{
SoundManager.playBuzzer();
}

Original thread: https://forums.rpgmakerweb.com/threads/remove-items-from-a-storage-when-inventory-is-not-full.152526/