Project Zomboid

Project Zomboid

Spiffo's Workshop
Welcome to Spiffo's Workshop, the place to find Project Zomboid mods, maps, buildings, and other things to tinker with. For our Modding Policy, click the "Learn More" Button below.
Learn More
STIMP_TM 1 9 Jul, 2022 @ 8:30am
Foraging Item Pick Up Bug
When picking up custom foraging items added by mods, the game displays an incorrect path to the item texture instead of the icon itself.

It adds 'media/textures/' in front of the correct, absolute path:

media/textures/C:\Program Files (x86)\Steam\steamapps\workshop\content\108600\2788256295\mods\AmmoMaker\media\textures\Item_ammomaker_BirdExcrement.png

Thanks in advance for any hints!

Known mods with this issue:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2788256295
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2618566294
Last edited by STIMP_TM; 28 Jul, 2022 @ 8:14pm
< >
Showing 1-5 of 5 comments
those mods dont have icons i believe
STIMP_TM 1 29 Jul, 2022 @ 5:17am 
They do have icons and those icons get displayed correctly while foraging or in inventories. This only happens when picking up a foraging item from the ground.
Lil Psycho Panda 29 Jul, 2022 @ 5:25am 
@STIMP_TM you didn't have to delete my comment in the general discussion.
I've also been looking at your code and PZ's codebase, but couldn't see where the issue was coming from. I'll let you know if I find out what's going on.
Lil Psycho Panda 29 Jul, 2022 @ 3:12pm 
@STIMP_TM found the problem. Basically, their code is ♥♥♥♥ and all over the place. There is a logic in their (The Indie Stone's code) ISForageAction.lua lines 81-85 that makes no sense.

Put this code in the media/lua/client/ammomaker_forageDefinistions.lua :

require 'Foraging/ISForageAction' function ISForageAction:forage() forageSystem.doFatiguePenalty(self.character); forageSystem.doEndurancePenalty(self.character); forageSystem.giveItemXP(self.character, self.itemDef, 0.75); -- -- add the items to player inventory -- these items are generated when the icon is first spotted in self.forageIcon.itemList local itemsAdded = forageSystem.addOrDropItems(self.character, self.targetContainer, self.forageIcon.itemList, self.discardItems); local itemsTable = {}; for i = 0, itemsAdded:size() - 1 do local item = itemsAdded:get(i); if not itemsTable[item:getFullType()] then itemsTable[item:getFullType()] = {item = item, count = 0}; end; itemsTable[item:getFullType()].count = itemsTable[item:getFullType()].count + 1; end; -- --create the halo note, injecting the item image --TODO: this requires item images to be in media/textures - should get the image location from the texture here instead local itemTexture; for _, itemData in pairs(itemsTable) do local item = itemData.item; local count = itemData.count; if getTexture(item:getTexture():getName()) then itemTexture = "[img="..tostring(item:getTexture():getName()).."]"; end if not self.discardItems then table.insert(self.manager.haloNotes,itemTexture.." "..count.. " "..item:getDisplayName()); end; end; end

You owe me few beers, cuz I wasted my time with this! :)
Last edited by Lil Psycho Panda; 29 Jul, 2022 @ 3:14pm
STIMP_TM 1 29 Jul, 2022 @ 4:54pm 
antonije...well done :)

I sure will find a way to send you some beer :steamthumbsup:

Added a custom ISForageAction.lua with your code in ...\media\lua\client\Foraging\... of Ammo Maker and it works!
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: 9 Jul, 2022 @ 8:30am
Posts: 5