Ilya_indeec Posted January 17 Posted January 17 (edited) Guys, I'm stuck, I know it's probably a stupid question, but still: I have a loop on inventory items, but the item itself doesn't have a number, I kind of see the getCount(InventoryItem) function - but the script crashes if you use it that way. What am I missing, please tell me. p.s. I'm just new to modding, just learning how and what to do. player_inventory = self.character:getInventory() local player_inventory_items = player_inventory:getItems() for j=0, player_inventory_items:size()-1 do local item = player_inventory_items:get(j) itemName = item:getName() - all good local stack_count = self.character:getInventory():getCount(item) -- ? problem end; Edited January 17 by Ilya_indeec
N0wh3re Posted Thursday at 03:26 PM Posted Thursday at 03:26 PM local itemType = item:getFullType() getInventory():getItemCount(itemType) Will work https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/inventory/ItemContainer.html#getItemCount(java.lang.String)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now