Scrumch Posted August 19, 2020 Share Posted August 19, 2020 (edited) Hello, I've managed to add a custom inventory widget for my weapon, but I'd like to have the tile icon (the tan square) be invisible. I know you can do this since Walter's slingshot has an inventory tile with a rock on it. But how would I go about implementing this? Edited August 23, 2020 by Scrumch I figured out where it is I need to add code, but not how Link to comment Share on other sites More sharing options...
krylincy Posted August 19, 2020 Share Posted August 19, 2020 (edited) You can change this in the widget setup of your weapon. bgatlas and bgimage eg: containerparams.casket = { widget = { slotpos = slotpos, pos = Vector3(0, -100, 0), bgatlas = "images/casket-ui.xml", bgimage = "casket-ui.tex", }, issidewidget = false, type = "casket", } Edited August 19, 2020 by krylincy Link to comment Share on other sites More sharing options...
Scrumch Posted August 20, 2020 Author Share Posted August 20, 2020 Thank you I've tried that and it just makes the inventory slot itself invisible, not the tan square? Here's my widget setup: Spoiler local Vector3 = GLOBAL.Vector3 local require = GLOBAL.require local modparams = {} ----------------------------------------------------------------------- ----------------------------------------------------------------------- AddComponentPostInit("container", function(self) function self:RemoveSingleItemBySlot(slot) if slot and self.slots[slot] then local item = self.slots[slot] return self:RemoveItem(item) end end end) function OnlyArrows(container, item, slot) if item.prefab == "wakes_arrow" then return true end return false end modparams.wakes_bow = { widget = { slotpos = { Vector3(0, 0, 0), }, animbank = "wakes_bow_ui", animbuild = "wakes_bow_ui", bgatlas = "images/casket-ui.xml", bgimage = "casket-ui.tex", pos = Vector3(0, 40, 0), }, issidewidget = false, itemtestfn = OnlyArrows, type = "hand_inv", } local containers = require("containers") for k, v in pairs(modparams) do containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0) end local OldWidgetSetup = containers.widgetsetup function containers.widgetsetup(container, prefab, data) if modparams[prefab or container.inst.prefab] and not data then data = modparams[prefab or container.inst.prefab] end OldWidgetSetup(container, prefab, data) end Also the mod itself if I've put the inventory slot somewhere wrong. icontest.zip Link to comment Share on other sites More sharing options...
Scrumch Posted August 20, 2020 Author Share Posted August 20, 2020 Progress! I looked in the containers (not container) file and found out I need to set it up with slotbg: modparams.wakes_bow = { widget = { slotpos = { Vector3(0, 0, 0), }, slotbg = { {atlas = "images/inventoryimages/quiver_slot.xml"}, { image = "quiver_slot.tex" }, }, animbank = "wakes_bow_ui", animbuild = "wakes_bow_ui", pos = Vector3(0, 40, 0), }, issidewidget = false, itemtestfn = OnlyArrows, type = "hand_inv", } This works when I just use previously mentioned default tiles (like Walter's, { image = "slingshot_ammo_slot.tex" },) but when I try to add my own image files I get a blank space (which is good) but it can't be interacted with? Does anyone know how the devs set these slotbg's up? 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