Project Zomboid

Project Zomboid

Spear Crafting Fix
27 Comments
Coldsteel 31 Jul, 2024 @ 5:02pm 
I don't mean to be rude or anything. I did it as a proof that it's possible and it works. Ideally I'd want you to take the whole thing and put it into your mod, it would reach more people that way. BTW the SOMW part is identical to the normal code, it's just SOMW has an additional separate pair of these functions specifically for spears crafted out of planks.
Coldsteel 31 Jul, 2024 @ 3:13pm 
I didn't use your code, and I didn't override anything. Which is how I'm not having issues with SOMW and WeaponModifiers compatibility.

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3300366479
Neidmare  [author] 31 Jul, 2024 @ 9:10am 
@Coldsteel Sure, feel free to re-use the code. I think the other mod also replaces the original method though, so depending on load order it might not work.
Coldsteel 31 Jul, 2024 @ 7:17am 
@Neidmare well you can remake it such that it doesn't needs to entirely replace it. Since you overwrite the durability value anyway, you can let the original code finish before running your own.

I'm making mod that fixes a different spear issue and I can always just throw in a fixed version of your code in there too.
Neidmare  [author] 31 Jul, 2024 @ 7:09am 
@Coldsteel Ah and the other thing is that my code replaces the vanilla method entirely
Neidmare  [author] 31 Jul, 2024 @ 7:04am 
@Coldsteel IIRC, the load order of the mods is not fixed. If the other mod gets loaded later, it will overwrite my method.
Coldsteel 31 Jul, 2024 @ 6:00am 
@Neidmare I haven't looked at your code but this sort of issue is normally remedied by daisy chaining the calls instead of overwriting them.

local originalFunction = Recipe.OnCreate.UpgradeSpear
function Recipe.OnCreate.UpgradeSpear(...)
originalFunction(...)
your_code(...)
end
Neidmare  [author] 22 Jun, 2024 @ 12:41am 
@cortex3973 I had a look at weapon modifiers. We overwrite the same method in the code. Not possible to make them compatible unfortunately.
Rezonaise 21 Jun, 2024 @ 1:34pm 
mod dont work
Borris the Conqueror 10 May, 2024 @ 5:04pm 
Cortex is indeed correct, mod doesn't work now and i too have Weapon Modifiers v1.1.3 installed as well
cortex3973 6 May, 2024 @ 3:25pm 
@Neidmare Hey, sorry for taking so long to answer, I forgot to check notifications. Following your comment, I did some thorough testing and found the incompatible mod. It is called ‘Weapon Modifiers v1.1.3’. The load order is irrelevant; while that mod keeps working, yours stops. Sadly, it is one of my favorite mods, as is your mod. Please consider making a patch for it if possible.
Neidmare  [author] 1 May, 2024 @ 10:47am 
@cortex3973 Just tested it myself, works. Spear has full durability.

Can you double check that the mod is enabled? When you add it to an existing savegame, you have to go though Load Game -> Click savegame -> Bottom right 'more' -> top left 'choose mods'
cortex3973 1 May, 2024 @ 10:40am 
doesn't work, i crafted a spear with brand new screw driver and new spear and the durability was about 40%
Kras 20 Aug, 2023 @ 3:13pm 
@Neidmare - I'll stick to your mod then, it seems to work regardless of modded spears while SOBS doesn't.
Neidmare  [author] 20 Aug, 2023 @ 1:09pm 
@Kras I dont think so. We overwrite the same basegame methods.
The issue that this mod fixes might not be present with SOBS, have not tried it tho.
Night Fox 8 Jul, 2023 @ 8:20pm 
In the base game when you reclaim a broken item from a spear the spear has full durability still but this mod changes that
Neidmare  [author] 6 May, 2023 @ 11:23am 
@pzhda'tan Its been a while since I've looked at the code, but theoretically any material should work.
pzhda'tan 6 May, 2023 @ 9:06am 
"It should work with all other mods that add spears with attachments, as long as they are using the same methods as the base game."
Does this imply only duct taped attachments from other mods are compatible? Or leather strip/twine/rope also works?
Champy 13 Mar, 2023 @ 12:57pm 
Hi @Neidmare , can I use your code for my Weapon Modifiers mod ?
Nick Name 25 Jan, 2023 @ 3:25am 
oh yeah nvm i misunderstood
Neidmare  [author] 24 Jan, 2023 @ 2:28pm 
@Nick Name When you craft a spear from a plank or branch, the durability of the crafted spear depends on your carpentry skill.

When you attach a weapon to that spear, the durability only depends on the durability of the used materials, i.e. the weapon and the spear.
Nick Name 24 Jan, 2023 @ 1:56pm 
Ok just to clear this up, the final durability depends on your own carpentry skill. it is very possible to get a max durability spear. you'll just need to raise your carpentry a bit
MyNameis_Mati 24 Jan, 2023 @ 7:52am 
@Neidmare hello, i sent you a friend request, can you accept it? I can ask you something about LUA for a mod of mine
Neidmare  [author] 22 Jan, 2023 @ 7:07am 
@lnicdsxu What doesnt work? The mod?
lnicdsxu 22 Jan, 2023 @ 6:10am 
i am so sad that it does not work, or the spear will be the best weapon
mw00 20 Jan, 2023 @ 3:18am 
cant believe that Indie Stone couldnt get someone to fix this in all those years