Project Zomboid

Project Zomboid

Infinite weapons durability
18 Comments
Tidurian 5 Mar @ 1:45pm 
if PrimaryItem:getCondition() ~= PrimaryItem:getConditionMax() or PrimaryItem:getHeadCondition() ~= PrimaryItem:getHeadConditionMax() or PrimaryItem:getSharpness() ~= PrimaryItem:getMaxSharpness() then

and

if SecondaryItem:getCondition() ~= SecondaryItem:getConditionMax() or SecondaryItem:getHeadCondition() ~= SecondaryItem:getHeadConditionMax() or SecondaryItem:getSharpness() ~= SecondaryItem:getMaxSharpness() then

those are one continous line. Steam breaks them into three lines.
Tidurian 5 Mar @ 1:38pm 
@Thrice should not matter but "every line below a IF "one tab in" every "end" one tab back. but yeah should not matter.
Thrice 5 Mar @ 1:37pm 
@Tildurian - Steam removed any formatting in that text you posted. Does that matter? Total lua noob.
🆃🆄🅶🅸 25 Feb @ 8:45am 
This mod has a bug — sometimes it gets stuck in aim mode. It's rare, but when it happens, the only thing you can do is walk, and you have to reset the game
Tidurian 10 Feb @ 12:00am 
Core.Main = function()
local player = getPlayer();
if player ~= null then
local PrimaryItem = player:getPrimaryHandItem();
local SecondaryItem = player:getSecondaryHandItem();
if PrimaryItem ~= nil then
if PrimaryItem:getCondition() ~= PrimaryItem:getConditionMax() or PrimaryItem:getHeadCondition() ~= PrimaryItem:getHeadConditionMax() or PrimaryItem:getSharpness() ~= PrimaryItem:getMaxSharpness() then
Core.DoRepair(PrimaryItem)
end
end
if SecondaryItem ~= nil then
if SecondaryItem:getCondition() ~= SecondaryItem:getConditionMax() or SecondaryItem:getHeadCondition() ~= SecondaryItem:getHeadConditionMax() or SecondaryItem:getSharpness() ~= SecondaryItem:getMaxSharpness() then
Core.DoRepair(SecondaryItem)
end
end
end
end
Tidurian 9 Feb @ 11:54pm 
Core.DoRepair = function(ItemToRepair)
-- sets the maximum conditions
ItemToRepair:setCondition(ItemToRepair:getConditionMax() )
ItemToRepair:setHeadCondition(ItemToRepair:getHeadConditionMax())
if ItemToRepair:hasSharpness() then ItemToRepair:applyMaxSharpness() end
end
Tidurian 9 Feb @ 11:54pm 
i went ahead and rewrote the entire "infiniteWeaponsDurability.lua" includes sharpness and also checks the secondary hand. also replaced reoccuring checks with local Variables. (should be better for performance)

will be a multipost since Steam dosnt allows me more then 1000 letters for comments....
Tidurian 9 Feb @ 11:37pm 
Feature suggestion b42 : Keep bladed items sharpened as well as repaired. i already know the function to use within your mod : just add in your "Core.DoRepair function" : "if ItemToRepair:hasSharpness() then ItemToRepair:applyMaxSharpness() end"
TimmyNeutron 22 Jan @ 3:14pm 
@Bryoda thank you so much kind sir your code works <3
TarLink 14 Jan @ 3:16am 
@Bryoda , thanks, I used your code and it works ! :steamthumbsup:
TarLink 11 Jan @ 5:02pm 
I confirm, the axe broke, but the handle is still there !
Bryoda 3 Jan @ 8:27pm 
@TimmyNeutron @Sham the fart that addition only replaces the functions repairing the handle with ones that repair the head. if you replace the original functions with this it should work. If there is a function to repair sharpness that could be added too but I'm not a modder

Core.Main = function()
if getPlayer()~= null and getPlayer():getPrimaryHandItem() ~= nil then
if getPlayer():getPrimaryHandItem():getCondition() ~= getPlayer():getPrimaryHandItem():getConditionMax() or getPlayer():getPrimaryHandItem():getHeadCondition() ~= getPlayer():getPrimaryHandItem():getHeadConditionMax() then
Core.DoRepair()
end
end
end

Core.DoRepair = function()
-- gets the item in the players hand
local ItemToRepair = getPlayer():getPrimaryHandItem()
-- sets the maximum conditions
ItemToRepair:setCondition( getPlayer():getPrimaryHandItem():getConditionMax() )
ItemToRepair:setHeadCondition( getPlayer():getPrimaryHandItem():getHeadConditionMax())
end
SCH 31 Dec, 2024 @ 9:49pm 
pls made sharp:steamthumbsup:
TimmyNeutron 30 Dec, 2024 @ 7:23pm 
@sham the fart this seems to break the handle repairing mechanism
Sham the fart 23 Dec, 2024 @ 3:33pm 
if you path to C:\Program Files (x86)\Steam\steamapps\workshop\content\108600\3386659539\mods\InfiniteWeaponsDurability\42\media\lua\client\ISUI\InfiniteWeaponsDurability.lua and open it in a text editor you can add

Core.Main = function()
if getPlayer()~= null and getPlayer():getPrimaryHandItem() ~= nil then
if getPlayer():getPrimaryHandItem():getHeadCondition() ~= getPlayer():getPrimaryHandItem():getHeadConditionMax() then
Core.DoRepair()
end
end
end

and

Core.DoRepair = function()
-- gets the item in the players hand
local ItemToRepair = getPlayer():getPrimaryHandItem()
-- sets the maximum conditions
ItemToRepair:setHeadCondition( getPlayer():getPrimaryHandItem():getHeadConditionMax() )
end

to also make head condition infinite, no idea how to make sharpness infinite, if you figure it out please tell me.
︻デ 一GOD_SKplCSGOSKINS 22 Dec, 2024 @ 4:18am 
please make head condition unbreakable
caveira6614 20 Dec, 2024 @ 1:49pm 
bild 42
Rex87 19 Dec, 2024 @ 4:56pm 
only makes handle durability infinite, the head of the weapon still does get damaged and eventually weapon will just fall apart anyway

still this mod makes weapons just a tiny bit more durable but sadly not unbreakable