Project Zomboid

Project Zomboid

[B42]DebugMenu
I've found a fix for the item generation error
Thanks to Grok for the help figuring this one out and creating the code. So apparently there's an issue with WeaponPart items in conjunction with and setMountOn during initialization when you open the item generation menu. What Grok came up with was a way to skip the code if it is a WeaponPart. I'm thinking that modders are using this old code for their b42 mods but its no longer in the game. the only downside to this is you can no longer spawn in weapon parts but imo its better than not being able to spawn anything in.

For this fix you need to go to this file: Steam\steamapps\workshop\content\108600\3386556284\mods\DebugMenu\42.0\media\lua\client\IS\ISItemGenerateUI.lua.

Then you'll need to replace the entire "iniList" function with the below code. It should be between lines 33 and 77. Don't remove lines 30 and 31, that's part of the code above it which is ok.

function QNW_DMItemGenerateUI:initList()
local allItems = {}
local modMap = {}
local mods = {}

local items = getScriptManager():getAllItems()
for i = 0, items:size() - 1 do
local itemScript = items:get(i)
local ItemType = itemScript:getFullName()
if ItemType and ScriptManager.instance:getItem(itemScript:getFullName()) then
-- Check item category before instantiating
local itemCategory = itemScript:getTypeString() -- e.g., "WeaponPart", "Food", etc.
if itemCategory ~= "WeaponPart" then -- Skip WeaponParts to avoid crash
local item = instanceItem(itemScript:getFullName())
if item and not itemScript:getObsolete() and not itemScript:isHidden() then
local modName = item:getModName()
if not modMap[modName] then
modMap[modName] = {}
table.insert(mods, modName)
end
table.insert(modMap[modName], item)
table.insert(allItems, item)
end
end
end
end
table.sort(mods, function(a, b)
return not string.sort(a, b)
end)

local cat = QNW_DMItemGenerateTable:new(0, 0, self.panel.width, self.panel.height - self.panel.tabHeight, self)
cat:initialise()
self.panel:addView(getText("IGUI_QNW_DebugMenu_All"), cat)
cat:initList(allItems)
cat = QNW_DMItemGenerateTable:new(0, 0, self.panel.width, self.panel.height - self.panel.tabHeight, self)
cat:initialise()
self.panel:addView("Project Zomboid", cat)
cat:initList(modMap["Project Zomboid"])

for k, v in pairs(mods) do
if v ~= "Project Zomboid" then
cat = QNW_DMItemGenerateTable:new(0, 0, self.panel.width, self.panel.height - self.panel.tabHeight, self)
cat:initialise()
self.panel:addView(v, cat)
cat:initList(modMap[v])
end
end
self.panel:activateView("Project Zomboid")
end
Last edited by TnT4u; 9 Mar @ 6:51pm
< >
Showing 1-2 of 2 comments
@TnT4u, your fix works, thank you so much, hopefully the mod gets updated soon.

I hope you are able to find a fix for the weapon parts as well, since i only use this mod to test my modlist, without having to search for the items, havent installed none weapon mod, because of it.

Cheers.
TnT4u 12 Mar @ 12:12pm 
I haven't had much time to look for a fix for the weapon parts. Its either something with the base game missing something or the firearm's mods are using old code. Honestly I don't really feel like trying to fix other mod's issues to work with a mod that I'm not even developing. I just figured I'd share the temporary fix to at least let us use this mod.
< >
Showing 1-2 of 2 comments
Per page: 1530 50