Item Type Count[SOLVED]

I need to get the count of the type of items I have in my possession. I'm making a storage system through eventing. Place the regular item in a box it becomes a hidden item. It'll still be in my possession but not counted as such. I know there are plugins but I don't need all the extra stuff that is required to use them.
what exactly do you mean by "type"? the count of how many of one item you have is part of the game data section of control variable...
I want the count of the items I have of certain types. Regular items will be what's in my bag and hidden items A will be what's in storage.

Screen Shot 2022-02-12 at 3.08.48 AM.png
But that item type cannot be changed by eventing.
so in a pure event-based system like you claimed the number of items of one type will always be constant and can be counted in the database.

if you are using plugin commands or scripts to change that type, then it completely depends on how you do that, and it would also require scripts in a loop to count the different types.
ok I don't need to change item types I just wanted to know if there's a script that gets the count of item types. I have a workaround for changing item types which is really just duplicating items but that's irrelevant right now. Is there no such script? If not well then will it be an elaborate plugin request? I doubt it'll be made if so.
The script call $gameParty.items().filter(item => item.iTypeId==X).length will return the number of items you have of item type X.
So I think you could just have a box where you click on it, and the actual item count goes down by 1 when you put something in it, but you increase the count of your hidden (copy item) goes up by 1. At that point, you can just use the items. What do you need the count for?

As an alternative, if you really need that count, you could just assign a variable for each item, where the value is the number in storage. In that case you would not need to duplicate the items.
I want them to see what they have in storage still in the item list I use the item scene as a inventory check so the use button is not there. So I can't just use the item because they will no longer be in my possession and show up in the list. I needed the item type count filter (Thank you @ATT_Turan ) because there's a limit to how much the player can carry as to why they need to store it or dispose of it.
Lets say all they can carry is what's in their hands. All regular Type items.
- ItemLimit = 2


My variable now(example not actual script) every time the player picks up an item:
ItemCount = $gameParty.items().filter(item => item.iTypeId==X).length


I was using but wasn't right:
ItemCount = $gameParty.items().length

The count I needed to stop a player from picking up another item was the former because I don't want the entire item database count I hope that makes sense.

(Is it no longer eventing if I use scripts? Just curious)

I use the select item window to use items btw because I don't use the battler at all nor the original menu window. So now I can use the ID number of the item and move it to storage. I was hoping I'd be able to change the Item type at that process through script too but according to @Andar that's not possible so perhaps a plugin is what I need at that point and so the search continues and I hope if I have to make a request its not something major.

I also need to figure out why a certain plugin is not working for me which changes the position and number of columns and rows shown of the select item window. This plugin if you're curious.

Thanks again for responding. Everybody get hung up on things and it hinders progress, I should make a list of what I need and move on and finish the barebones of the game but I'm not disciplined enough for that.
I was hoping I'd be able to change the Item type at that process through script too but according to @Andar that's not possible so perhaps a plugin is what I need at that point
what you need to do this is a plugin that creates a dynamic database.
because the default database files are read-only, even if you change the data in the dataitems by script command, that change will not be saved and revert on loading saved games.

and no, I don't know if such a plugin exists - there was a script like that for Ace, but mostly to reduce the limits on the database, and MV's database doesn't have the same restrictive limits.
what you need to do this is a plugin that creates a dynamic database.
because the default database files are read-only, even if you change the data in the dataitems by script command, that change will not be saved and revert on loading saved games.

and no, I don't know if such a plugin exists - there was a script like that for Ace, but mostly to reduce the limits on the database, and MV's database doesn't have the same restrictive limits
Well on to plugin request... It sounds like it'll be a big plugin.
fingers crossed wish my luck!

Thank for clarifying.
Ok so here's my work around instead actual plugin through eventing the last two I didn't fill out yet.

- Player goes to chest
- it opens select item window the item selected database number will be set to variable "ItemSelected" which is 1
- Variable 2 "StoredItem" = $gameVariables.value(1) + 1; ( which will be the duplicated item always the following item in database but with a hiddenA item type and I don't know the script that adds up numbers but I know it exists unless what I wrote was correct)
- $gameParty.gainItem($gameVariables.value(2), 1);
- $gameParty.loseItem(ItemSelected, 1);
- ItemCount = $gameParty.items().filter(item => item.iTypeId==X).length
- StorageCount = $gameParty.items().filter(item => item.iTypeId==X).length

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Reopening at OP's request.

The script call $gameParty.items().filter(item => item.iTypeId==X).length will return the number of items you have of item type X.
Hmmm I tried the call and I didn't receive any errors so I thought this was solved buuuuut it keeps returning 0 regardless of what ID type X I put in. Now I did $gameParty.items() to check and make sure I do have these items an that they have an type and realized its a lower case T for itypeID and so the call is actually:

$gameParty.items().filter(item => item.itypeId==1).length

Thanks again!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/item-type-count-solved.144869/