igormaozao Posted January 8, 2023 Share Posted January 8, 2023 Hi, I've been trying to create a mod by myself, but I didn't find a good documentation about it. Anyway, I want to add a button in the inventory window to "Drop all" items from that container into the floor, it's kinda anoying when I need to empty a container to destroy it, so I was trying to find a easy way to drop all items from the current loot container into the floor. Thanks Link to comment Share on other sites More sharing options...
Ysa Posted January 9, 2023 Share Posted January 9, 2023 Hey, do something like this: local ISInventoryPagecreateChildren = ISInventoryPage.createChildren function ISInventoryPage:createChildren() ISInventoryPagecreateChildren(self) local titleBarHeight = self:titleBarHeight(); local textWidth = getTextManager():MeasureStringX(UIFont.Small, "your_text"); local button = ISButton:new(0, 0, textWidth, titleBarHeight, "your_text", self, your_function); button:initialise(); button.tooltip = "your_tooltip" button.borderColor.a = 0.0; button.backgroundColor.a = 0.0; button.backgroundColorMouseOver.a = 0.7; self:addChild(button); button:setVisible(true); -- I'd also expose button for other mods if planning to release public self.MY_MOD_BUTTON_NAME = button end or check out my mod's source here https://github.com/SharePickle/easy-drop-n-loot/blob/master/media/lua/client/KADropnLoot/KAInventoryPageButtons.lua igormaozao 1 Link to comment Share on other sites More sharing options...
igormaozao Posted January 9, 2023 Author Share Posted January 9, 2023 11 hours ago, Ysa said: Hey, do something like this: or check out my mod's source here https://github.com/SharePickle/easy-drop-n-loot/blob/master/media/lua/client/KADropnLoot/KAInventoryPageButtons.lua Hey, thanks for the help, to be honest I found your source before and I was using it inspired in that piece of code, and I could add the button itself, but I couldn't make the real action to get the current "loot inventory" container and the "floor" container and add the action to move all items. Link to comment Share on other sites More sharing options...
Ysa Posted January 9, 2023 Share Posted January 9, 2023 Try local floorContainer = ISInventoryPage.GetFloorContainer(self.player) I was looking through PZ's own lua, this file ISInventoryPage.lua is very helpful to understand what's what with containers in PZ. You can find game sources here <path>\ProjectZomboid\media\lua igormaozao 1 Link to comment Share on other sites More sharing options...
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