Goregonzola Posted January 14, 2021 Share Posted January 14, 2021 Hello there! I'm wondering if there's a easy to do method to reduce the number of inventory slots to a custom survivor (similarly to Wheeler from Hamlet). I've tried the following coding in the local master_postnit section, but it looks like this is not as easy as it seems, it crashed the game: Quote inst.components.inventory.maxslots = 10 If I understand it right, DST has no built-in inventory slot commands. I've lurked around in the Hamlet Characters Mod in the Wheeler section. I've found the following and added to my character. lua, but it's still stinky, the game crashes: Spoiler AddComponentPostInit("inventory", function(self) local _OldEquip = self.Equip function self:Equip(item, old_to_active) if item == nil or item.components.equippable == nil or not item:IsValid() or item.components.equippable:IsRestricted(self.inst) then return end local eslot = item.components.equippable.equipslot if eslot and self:GetEquippedItem(eslot) and self:GetEquippedItem(eslot).components.equippable.un_unequipable then self.inst:PushEvent("cantequip", {item=item, eslot=eslot}) return end return _OldEquip(self, item, old_to_active) end function self:Count(item) local num_found = 0 for k,v in pairs(self.itemslots) do if v and v.prefab == item then if v.components.stackable ~= nil then num_found = num_found + v.components.stackable:StackSize() else num_found = num_found + 1 end end end if self.activeitem and self.activeitem.prefab == item then if self.activeitem.components.stackable ~= nil then num_found = num_found + self.activeitem.components.stackable:StackSize() else num_found = num_found + 1 end end if self.overflow then local overflow_found = self.overflow.components.container:Count(item) num_found = num_found + overflow_found end return num_found end function self:GetFreeSlotCount() local count = 0 for k,v in pairs(self.itemslots) do count = count + 1 end return self.maxslots - count end end) What do I do wrong? Link to comment Share on other sites More sharing options...
Thomas Die Posted January 14, 2021 Share Posted January 14, 2021 Are you using caves or no caaves Link to comment Share on other sites More sharing options...
Goregonzola Posted January 14, 2021 Author Share Posted January 14, 2021 I've only tried it with caves so far Link to comment Share on other sites More sharing options...
Thomas Die Posted January 14, 2021 Share Posted January 14, 2021 Try without caves, im pretty sure it shows if it's a client or server problem 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