#mod_development
1 messages · Page 266 of 1
does anyone here ever used the steam deadicated PZ server?
the circle but i modify the radius on tick
can someone help me figure out why my local dedicated server fails to lunch when i add some mods to the server.ini?
LOG : General , 1729009340017> 568,311,756> Workshop: onItemQueryCompleted handle=1 numResult=84
LOG : General , 1729009340023> 568,311,762> Workshop: GetItemState()=NeedsUpdate ID=2694448564
LOG : General , 1729009340025> 568,311,765> Workshop: item state CheckItemState -> DownloadPending ID=2694448564
LOG : General , 1729009340060> 568,311,799> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG : General , 1729009340063> 568,311,802> Workshop: download 0/0 ID=2694448564
LOG : General , 1729009340164> 568,311,903> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG : General , 1729009340165> 568,311,904> Workshop: download 0/0 ID=2694448564
LOG : General , 1729009340266> 568,312,005> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG : General , 1729009340267> 568,312,006> Workshop: download 0/0 ID=2694448564
LOG : General , 1729009340302> 568,312,041> Workshop: onItemNotDownloaded itemID=2694448564 result=2
LOG : General , 1729009340302> 568,312,042> Workshop: item state DownloadPending -> Fail ID=2694448564
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'CFileWriterThread'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'CFileWriterThread'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x00007FF99D741B60/0x000'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x00007FF99D741B60/0x000'
is the mod private?
it feels like it's failing to save the file but i tried running this as an admin and still wont work
it's the same mods i have installed in my client and on my gportal dedicated server
trying to setup a local version to debug why i get that weird black screen when adding my mod to it
this is the steam version of the dedicated server, nothing changes regardless of running it through the steam luncher, or executing the bats directly from windows without or without admin priveledges
if anyone else runs into this issue there is a steam_appid.txt in the dedicated server folder which is corrupted
just edit it in notepad and put in PZ steam id of 108600
What did Steam do to the workshop front page?
The mods showing in the carousel are ancient (compared to my expectations).
Hello! Is there anyone who is very knowledgeable about mods? I need to communicate with such a person in private messages if he is willing to give me time. I have a small mod (not mine) that people say causes errors in saves. I tried to fix it, but I need someone to be able to look at it and draw conclusions
only reason i can think for a mod to mess with saves is if either messes with ModData or removes Item defenitions somehow, but i'm no expert here
ok i figured out the file that causes my stuck in black screen while loading when using my new mod in multiplayer....
it's my recipes file that suppresses existing vanilla and other mod recipes
module Base {
recipe Make Stone Axe {
IsHidden:true,
Override:true
}
(...)
}
if i remove this file from both the client and server then it loads just fine anyone has any idea why this happens?
just a guess and may be completely wrong, but maybe even hidden recipes require some of the other properties, maybe copy the full recipe in and add IsHidden and Override and see if it helps
i'd go for```Override:true,
Obsolete:true,
i'm not sure just setting hidden is enough (and some popular mods ignore it lol)
yep this did it thanks, again and again @bronze yoke
not sure if this is the right channel to ask but has steam recently changed how the workshop can be searched?
until recently, when I checked for mods with setting "most popular" and time period "one week", steam apparently showed me all mods which have been popular during the last week. this almost exclusively included new mods.
since a few days, steam seems to show me simply the mods which are most popular all time (I see stuff like skill recovery journal, noir's attachments etc., all the old classics).
anyone else with this experience? maybe steam is just bugged at the moment?
ok... I am not the only one with the problem 😅
Yeah, the new ranking is cooked
hope they bring the old system back soon. impossible to find new interesting mods currently.
is IsoGameCharacter.die() the only place that creates a dead body when a character dies? And subsequently, does this mean that deaths are only triggered when in the PlayerOnGroundState?
apparently its happening for every game
Yea, I'm hoping its a bug, not a feature
praying its just a mistake because theres no way valve would make a change this terrible
What do you guys think of this mod I'm working on?
I'm still working on optimizing it and fine tuning the flickering room chance
Hello good night everyone ✌
Excuse me, I am looking for a group of modders who may be looking for more members for the team 😄 I have some years of experience in Blender.I would like to contribute my grain of sand to the game and his community. I enjoy a lot the game and could be awesome to continue polishing my 3D skills while working on the game
If you are interested we have a group of modders that make TLOU related mods
https://discord.com/channels/136501320340209664/1244302148544630880
I provide a comprehensive 3D character creation package, covering everything from advanced sculpting and detailed modeling to rigging and lifelike animation.
Utilizing the latest industry software, I ensure your characters are visually stunning and move seamlessly, whether for film, games, or interactive projects.
My focus on realistic texturing and optimized performance ensures your characters are platform-ready, tailored to your specific needs.
Let’s bring your vision to life!
Thank you! I already joined the group ✌
Are there any highly-skilled Modders out there, who love both Project Zomboid AND Shadowrun / Cyberpunk?
If so, hit me up! I'll be reposting this question often, really want to create a 'Shadowrunner' type of PZ Server...!
Hey I invite you to post a request for commission on the modding Discord, you'd have possibly more chances to find someone
https://discord.com/channels/136501320340209664/1125248330595848192
what's the modding discord?
guys
where are item icons stored?
are they stored in IconsMoveables.pack?
if so, how do i open the .pack file
most of them are in UI2, some older ones are in UI, the ones for moveables are probably in IconsMoveables
you can open a pack with tilezed
where might this TileZed be?
spongies mentioned how to do this the other day
🙇♀️
thanks for this
finally I found out this channel
Guys, if I just assign a .ogg file with the same name as the id of a line of WordZed, will it work?
I wanna make a mod that alters a zombie's clothes, but have zero idea how to even go about this. Any ideas?
Is there any way to send http POST requests through Lua?
Just kidding! Found it.
I have a small list of spawn locations
I've done it in the past, it's possible but kinda tricky. I believe you can only send data but not retrieve them (I might be wrong). My main concern was that steam might block your queries / mod for security reasons.
Can you send me an example
We plan to use it for discord web hook integrations
@uneven ore
what does query stand for?
unfortunate, not quite what im looking for
i wanna know if it's possible to have some books spawn only in certain bookshelves
like survivor house bookshelves
but not bookstore shelves
It's basically your data, previously encoded by encodedGETRequest
Variable and function names might need a rework I agree, I kinda let this project dust so tbh
where in the code do i put the message (what i want to send)
local data = {
x = rawData.x,
...
}
You could replace x by the message
x = "my message"
?
And the encodedGETRequest will chain all the field in the data table to construct a string like ?x=x&y=y&whatever=whatever&message=message
the 'x' doesn't really matter, it's just an example
You could do
message = yourMessage
}```
alright, where would i put the webhook url?
local function sendData(rawData)
local data = {
playersOnline=rawData.playersOnline, -- lets say 3
worldAge=rawData.worldAge, -- lets say 24
}
local dataSuccess, encodedData = pcall(encodeGETRequest, data)
...
}
Here, encoded data would be ?playersOnline=3&worldAge=24
If you have different endpoints you might want to change it a little bit but, in the example, it's the second argument of this pcall function
local request = pcall(sendPostRequest, 'https://example.com/my-route', encodedData)
Mind you, I don't know if it'd work with discord. You might need a middleware
try
openUrl()
@uneven ore
Does that really work? Wish I knew it
to me it does
i think it opens the steam browser
but if youre using nosteam
it will open your default browser externally
Huh, interesting, can’t think of a good use case but that’s nice. I don’t think that’s what @uneven ore is looking for however.
Give me an example of openUrl sending post requests
tl;dr it can't
idk how to do that exactly
i just gave you a possible solution
rest is up to you
Good afternoon! I will pay money to a person from Russia (unfortunately, I cannot transfer money outside the country) who can make an adequate version of the mod. I need someone with more experience working with mods for Project Zomboid. It is necessary to have successful work in the Steam workshop and provide proof that you are the author.
It is advisable to have experience working with vehicles, their modification and understanding how they are initialized in the game.
Write to me in private messages if you think you are suitable for the task. My mod will need to be finalized and supplemented, it is very small, but there are some problems. First, I will demonstrate it, we will discuss some points and decide whether it makes sense to redo it.
I want to get into Modding PZ. Is there a quick-start guide? I've never coded in LUA, but it seems similar to Ruby based on what I've seen. What IDEs' work best? How do I get access to all the PZ files?
W Patrick youtube video gets you a good start on where to find things and how to upload
Thank you!
No problem! goodluck 🙂
i just use notepad++ lmao
most people would recommend vscode
it has the best lua support out of any ide really and there's a lot of pz-specific tools developed for it
I use vscode, but if changing a name in bulk i use ++
i find the replace just easier and nicer to look at
I am stuck; I'm trying to add sandbox options, even followed albion's guide. I have exactly the same and it just is not showing up in solo sandbox options
Do I need anything else other than the sandbox-options.txt and the Sandbox_EN.txt files for them to start showing up in the sandbox options menu?
I write integration software for modding pz in vscode.
you should only need the sandbox-options.txt to at least see them
Yeah that does not work at all and I don't understand why
Literally copy-pasted from your guide:
VERSION = 1,
option sapphcookingnebulafixes.Name {
type = KEEP READING,
numValues = 3,
default = 1,
page = MyPage,
translation = sapphcookingnebulafixes_OptionName,
valueTranslation = sapphcookingnebulafixes_OptionName_Values,
}```
Not exactly like that but yeah
btw don't expect all of the cool 1 liner syntax stuff from ruby in lua, even after using Ruby, Lua feels like a child compared to ruby and that's saying something lol
type = keep reading???
you mean enum -_-
type = should be the type of your option, i see that's not exactly clear in my guide
maybe you should put a disclaimer saying that the code provided is not universal or something lol
Even with that it didn't work
I've tried renewing the file 3 times with all correct stuff
is it in the right place? media/sandbox-options.txt
I'm basically just retrying until it magically works again like how it can be with programming at times
Ayup
hi integration software for pz modding vscode writer pythoid (ur so busy jesus)
Would someone be so nice to help me with a sendservercommand problem that I'm having? I'm testing the following on a dedicated server:
I have a function on the server that grabs a player and runs
sendServerCommand(player, "testmodule", "test", nil)
and i have the following client function
local function HandleServerCommand(module, command, args)
if module ~= "testmodule" then return end
if command == "test" then
print("Test")
end
end
Events.OnServerCommand.Add(HandleServerCommand)
Instead of the function being called, I'm being kicked for a malformed packet. According to the API this should be correct, what could be wrong here?
you passed nil instead of an args table
if you have no arguments pass an empty table
Thought that was optional.
Huh. Thought nil would work there. Let me try that out real quick.
this actually does come out as nil on the other end which is nothing but annoying
2-arg version??
no such thing, though number of arguments is used for overload resolution so passing nil would still be invalid
im not gonna keep pestering about all the small things, but just to be sure that the mod is loaded
It is, only this mod and the mod that is required to use it
I've seen some people forget to load the mod and then spend an absurd amount of time trying to fix a non-existent issue
yea thats weird
I had work where I had to ask people "Did you plug it into the socket?", I know all about it lol
turn it off and turn it back on 🙏
Nope. setting it to {} rather than nil gives me the same issue
by chance, does the start of the function get executed before the kick?
that's really unusual
I'm fr just gonna restart everything in the hopes it magically works
The function on the client side doesn't run, there's no 'test' log being printed
restart your game, if not then try to just strip the mod to where there's literally only the mod.info beside the media folder and the sandbox options file in the media folder
dont even worry about translations lol
oh if your mod is on the workshop already unsubscribe from it
for some reason sandbox options in particular really struggle when you have two copies of the mod
i hope that's the issue from their perspective lol
most things will prefer the local copy but sandbox options seem to prefer the workshop one
is player definitely a player object? does it still happen without a player argument? is this code definitely running on the server? (the game is very misleading about what actually gets executed where)
I feel like the malformed packet thing could be the underlying reason
as in it's a symptom
yeah, i've never ever seen commands cause that so it has to be something weird
I am not subscribed to it on the workshop
I'll try this
The player should be a player object, the same player variable is used to check the player's inventory in the function.
The server code is under the server folder, to my knowledge that should be enough for it to run on the server?
The same also happens if I don't have the player arg
anything in the log when you get kicked?
the server folder runs on the client, in fact most of the vanilla code in there is exclusively client code
the only way to ensure your code only runs on the server is to include a check for it in the file (usually if isClient() then return end at the start of the file)
if you're successfully checking the player's inventory that confirms your code is running on the client as player inventories aren't replicated to the server
you should get a stack trace when the game kicks you hopefully
Huh. That's odd. I thought it ran on the server side only, as the server function outputted the print in console rather than in player console. It's good to know that my thought process on that was wrong, at least 😅
I'll have to try with the if isClient() then return end that you mentioned
if not then 😰
Give me just a second, because I did already close the server
Even this did not work - I'm gonna make a completely new testMod to see if that one does work, if not, I have no clue anymore
yeah, i'm only really trying common pitfalls here, to my knowledge calling sendServerCommand on the client doesn't cause a kick (or do literally anything)
I have had sending commands cause kicks before, but it was almost always because of something pretty bad happening that it kicks you
it's possible that you're relying on an event or some other kind of trigger that doesn't actually occur on the client, so it doesn't end up running your prints there even though the file itself does run
you shouldn't get any kick after changing from nil to empty table after looking at it more
double checking myself it does seem like nil is valid after all
in that case surely there's a stack trace in teh console
This works, what....
Ahh, yeah. That's correct. I have the function tied to EveryOneMinute temporarily, that's what might be causing that.
It doesn't seem like I'm getting kicked anymore, but the command is still not being sent.
The serverside code doesn't reach the statement with the command anymore. But that's probably something on my end.
I don't understand this anymore
I just changed the sandbox-options.txt to EXACTLY what I had before, and it does work in a completely new clean mod folder....
Wait I just had a thought, I'm going to test something
Life of a developer in a nutshell I guess - stuff just magically decides to work sometimes and vise verse
Okay, I got it working- I think. Apparently you can't check the inventories from the server side. Thank you for your help.
my best advice on how networking works in this game is that it's generally best to assume things are client only
especially if it would be a security issue 😭
That's fair! I've always been terrible at networking, and it would've been great if this could have been done from the server side to prevent potential tampering 🙂
i genuinely would not even think about security with mod development
cheaters are essentially omnipotent already
Ahhh. Fair, fair. Gotcha.
@bronze yoke @grizzled fulcrum I found the solution
And why it didn't work-
When testing the mod on my own system, I have my mod in the C:\Users\%UserName%\Zomboid\mods folder. HOWEVER, when I had to upload it to the workshop, I had to put it in C:\Users\%UserName%\Zomboid\Workshop as well,
Apparently, they both need to have exactly the same files, for sandbox-options.txt to work........
yeah, always make absolute sure you only have one copy of your mod when you're working on it
sandbox options in particular are a pain in the ass about this but it can cause issues with other systems too
Don't you need your mod in both folders?
no, you can just use the one in workshop
i usually start in mods and move to workshop when i'm ready to upload (deleting the one in mods when i do), others will prefer to work from workshop from the start
I sees I sees, good to know now, thank you both anyhow with trying to figure out why it wasn't working 🙏 🙏
symlink time
i got a github folder like c:\github and all my mods in there I symlink to my zomboid dir at c:\dev\zomboid\mods
so I change it in github foflder and it updates
then I have a python script to generate the dist files, and the dist folder it outputs is symlinked to the workshop folder like c:\github\AoqiaZomboidUtils\dist\ <-> c:\dev\zomboid\workshop\AoqiaZomboidUtils\
one day i'll get around to writing an upload script so i don't have to touch that workshop folder
That's not a bad idea actually
well the python script doesn't matter that much
I only use it to remove not needed files before I upload to the workshop like the git stuff, docs if any, resource project files like psd and blend (they are still in the repo, just not in the steam workshop version)
so the file size isn't too big 😄
but I don't have a way to auto upload it without opening the game, I still have to do that manually lol
i think the formats you need to set things up in for in-game upload are kinda gross and i'd like to automate version numbers and not have to manually convert my changelogs between github and steam
wdym convert changelogs between github and steam
I just copy my changelog.md over to the changelog box when uploading
the formatting for each is totally different, i don't know what yours usually look like but i have to redo it all and i literally just do headings and bullet points
https://keepachangelog.com/en/1.1.0/
I just follow this
Then I just copy the markdown to the changelog box and remove the heading #'s
I don't really try to format them nicely to look good on steam because they're changelogs
as long as you can read it, that's good enough for me lol
i'm new to pz modding and lua, i like the lang and i was wondering if you have any advice on setting up vscode for pz, i tried the tencent lua ext that comes with a bunch of stuff but fills all the scrip files with red squiggly lines 😭
use the sumneko lua extension (just called lua on the extension manager) and follow these instructions to install umbrella https://github.com/asledgehammer/Umbrella
there should also be an extension called zedscript which adds some limited support for script files
Tysm i saw sumneko was high up, will try now 
ohhh typings
thank god
i was just wondering if lua had a typing/interface system lol
how/where does PlayerOnGroundState get set?
I mean how/where does it get triggered
how would one send a message in a json format?
I'm the part of others, jsut tinker with it while its in workshop folder 
tbh i never knew other option existed 
I didn't even know that the game actually reads the mods in the Workshop folder into the modlist in-game 💀
From my understanding, you can't. The closest you can get is the code I sent you. (I might be wrong)
You could, in theory, convert a table into a stringified JSON (basically replacing my encoding function) and send like I do, then parse it afterward. But again, I'm not sure you can do it directly through discord, maybe you could setup a cloud functions to act a middleware
i did symlink for my references but wondered if it will work with mods to workshop too
i havent tried
glad i saw this
should work with tile making too cuz the png should be saved on both a folder for the mod then x2 folder
then needs to be transferred to the mod itself
my latest mod is broken
i cant seem to spawn a water barrel that functions
ive done
item script spawn via recipe result
item script spawn via oncreate
contextmenu spawn client side
lua spawn moveable item
lua spawn the tile itself using 3 different methods
Water barrel is a special object isn't it?
ye global object

im gona try and use the build menus function that should work
i just dont know how to add options onto submenus after using getOptionByName or something like that
Changing the name field of the RainCollectorBarrel object breaks the global object system, it should be the same as vanilla, like "Rain Collector" or something like that, because it's hardcoded. In BM I solved this problem and you can insert objects that collect water with different names, there is a guide on the project github on how to make addons.
i didnt change the name i only changed the context menu option
just bumping this again in case somebody has an answer:
is IsoGameCharacter.die() the only place that creates a dead body when a character dies? And subsequently, does this mean that player deaths are only triggered from the PlayerOnGroundState? If so, anyone know if there's a way to jump in with lua just before PlayerOnGroundState.execute?
getPlayer():kill(getPlayer()
maybe?
you can also setVariable("DoDeath", true)
i think this also works
but not sure if thats doDeath or DoDeath
this is the variable zeds send to player when they get dragdown
i think i misunderstood the question
could you tell us more what youre trying to do
Any idea how I can make a mod where I can alter a zombies clothing when it spawns?
trying to avoid player die() being called in that state
the best way would be to increase health just before so isDead() is false
but I need my lua code to jump in just before that and I'm not sure what the closest event is
Added new models to my mod :3
I am trying to connect to my reinforcement learning model. Is there an API that can simulate keyboard control in the game? For example, is there an API that can directly pass in movement commands such as WASD (rather than directly using Lua to set the player's coordinates to teleport)?
😀
is it possible you could hook on the actual die fuction then?
how without de/recompiling java?
might still work
local hook = die
function die(...)
end
idk
worth a shot.
it worked for print atleast
Hello everyone. I have a quick question or two that I hope someone can answer for me.
First off:
I am creating a simple mod for Halloween that has some treat bags. I've made the bags, a few variants of them, and got the models to work on player/on ground as they should. All is well there. What I plan on doing though, is having the bags drop off of zombies, which I already know how to accomplish with distributions. But those bags I want to include a bunch of treats/candies/etc when they are found.
It seems I need to setup the distribution list for the bags, and include the items in those separately, but after a bunch of digging I just can't seem to find a good example of how to achieve this easily.
I am wondering how I can reference the bag/item by name within a distribution list, specifically. My items are not set to use the Base. prefix, and instead use the Mod-ID prefix to keep them from conflicting with other mods.
I've seen a few suggestions of making a list/table of the containers/items first, and then iterating through a loop to add them one by one, item by item, bag by bag to the distribution list, which seems the most efficient, since I have (13) variants of these treat bags, and I would prefer to make one list of items to include for all 13 bags, instead of 13 gigantic distribution lists.
Hopefully this is making sense, and someone can help me.
Also, one more question:
In regards to having items spawn into the game, will a distribution list still function if a mod isn't loaded that it's requesting items from, but continue to spawn other items without crashing?
I'd like to have all the base game/vanilla items spawn, as well as some of the items from a few of the very popular food/snack mods that are working. I think this would be cool to let people use the mod without it absolutely requiring those other mods to function at a base level.
Thank you to anyone that can help!
die() is a method in the IsoGameCharacter class, can that still work like that?
Can someone please point me in the right direction to start learning how to make mods for PZ? Sorry if it’s already been posted/mentioned. Thank you in advance
Uuuuh I don't think that works actuallly
I'm pretty sure it doesn't sadly
I believe I tried to use that a few weeks ago to kill the player and play the death animation instead of instantly dying
Hooking Java functions won't actually hook the Java function, only the exposed global variable from the Lua side
So calls from Java to die() will not call your hooked function, only lua code that calls die() will use your hooked code
i see good to know
Actually there are proper hooks I believe
Like attack
Which aren't decorations
but does that require some other method or is it just the same as normal?
It's something completely different
I'm trying to find it again
Was albion who shared it to me a while ago
Tool for generating Lua documentation for Project Zomboid events and hooks - demiurgeQuantified/PZEventDoc
tho that doesn't explain what these are here
Javadoc Project Zomboid Modding API declaration: package: zombie.Lua, class: LuaHookManager
Might be that
Was when she mentioned it
this is only for attack though (and the other very select ones), I just meant like any java function
I think LuaHookManager is for handling event callbacks on the Java side
yea nah it's not a thing sadly
But it's good to know that it exists anyway
ill add support for it but rn just got bigger fish to fry
the thing with Hook hooks is they aren't even hooks
they're like. the opposite of a hook
if you add a hook your code runs instead of some specific java code
this makes them essentially useless unless you actually want to e.g. reimplement the entire combat system in lua (which is what most hooks do)
oh so instead of hooking before/after orig it just replaces it? ;-;
Hello guys, I'm very far from modding Zomboid, but I have a low poly model that I would like to add to the game. I would like the character's body from the game to be replaced with the body of my model, is this somehow possible to implement? Maybe there is some kind of guide? I hear that custom characters can be added like costume
ok thx
yea
im a bit at a loss here, where can i find a reference of the functions i can extend upon/hook in lua? specifically, i want to create a mod that changes the way the containers in inventories are rendered to include the Name of the container next to the Icon. i can look at examples from others, and i know the javadoc, and i know that the java objects are represented in lua as well, but still i cant find "ISInventoryPage" anywhere, and am confused
ISInventoryPage isn't a java object, it's a lua object - you can look at the game's lua in the media/lua/ folder
lol
lmao
Still not having much luck with this. Does anybody have any insight?
you reference a bag in distributions by its type (look for vanilla bags in distributions for examples)
and yeah, you can just add the same table x times for x bags rather than writing x tables
Alright. I've noticed that some of the bags are prefixed with "Bag_XXXX" Is this a requirement? Or is that just how those items are named in the vanilla system?
My mod prefix/item prefix would be GN84-AHE, and then the item name. Do I use that in place of Base.? I don't see the vanilla distributions using Base., so I'm not sure if it's calling the item by name in the script, or some other reference.
that's just how they choose to organise the vanilla items, the bag_ prefix doesn't have any special meaning
i'll have to check how it treats items from other modules, hopefully it treats them properly but it's not unheard of for systems to simply only work for base lol
Alright. I just wanted to avoid any conflicts in case my item matched the naming convention of someone else in the future. I'd assume that you could prefix your items with the module, but not 100% sure.
Mostly trying to figure out how to write the code that references the bag itself.
it looks like it only checks the short type, so other modules will work fine
modules are how you're supposed to avoid name conflicts, but some systems such as this don't really utilise it properly (but at least it doesn't stop it from working entirely like some others do)
Okay, thats good to know. I know when declaring the items you want distributed you can use the module. But wasn't sure when declaring the bag itself if I'm supposed to use the module, or if that name/ID is declared somewhere else. Sort of how sandbox-options are spread out in a few different spots.
You wouldn't by chance have something I can reference that does exactly what I'm talking about, would you? Trying to see how custom bags are coded in distributions, so I can figure out the details better.'
i don't know of anything, sorry
No worries, thank you for your help! Greatly appreciate it
@albion
Well, I've got it working, to a degree. I was forced to use the Base module to create the items, as using my own module wouldn't work with the distributions. I'm wondering if their is some other syntax required to get custom modules to work with distributions?
Its not too big of a deal using the Base module with this mod, but for others I would like to figure out how to handle it. I'm looking at other mods that seem to use module names for the items and that works fine, but in this instance mine wasn't. Though I have another mod that does use the module for spawning items, so I'm just curious as to what the conflict is with this.
Thanks again for the help, at least I can continue with what I was working on now!
when you added it to the distribution did you just put the item name?
you have to put module.itemname
are you asking for the list of locations?
incase you need the list of distro locations
ive got a public spreadsheet with bunch of random tables
log.deathCause
Anyone knows how to dig out what this function can return?
OR better question. Does the "Unknown" cause of death covers all non-zombie caused deaths?
This is what I have that works. I tried using "modulename.itemname" at first, but it wouldn't show up in LootZed. Only after I made my module as Base instead of import>Base did it show up.
require "Items/SuburbsDistributions"
require "Items/ProceduralDistributions"
require "Vehicles/VehicleDistributions"
Distributions = Distributions or {};
local distributionTableHalloweenBags = {
all = {
inventoryfemale = {
rolls = 10,
items = {
"HalloweenBagPumpkin", 9999,
}
},
inventorymale = {
rolls = 10,
items = {
"HalloweenBagPumpkinEvil", 9999,
}
},
},
}
local distributionTableHalloweenBagPumpkin = {
HalloweenBagPumpkin = {
rolls = 10,
items = {
"Bleach", 9999,
}
},
}
local distributionTableHalloweenBagPumpkinEvil = {
HalloweenBagPumpkinEvil = {
rolls = 10,
items = {
"Money", 9999,
}
},
}
table.insert(Distributions, 1, distributionTableHalloweenBags)
table.insert(Distributions, 1, distributionTableHalloweenBagPumpkin)
table.insert(Distributions, 1, distributionTableHalloweenBagPumpkinEvil)
print("Adding Bags to Zombie Loot Distributions")
ItemPickerJava.Parse()
This is awesome, by the way. Thanks!
I was trying to create a new list for the bags, as such, but it threw hard errors and crashed when loading.
local distributionTableHalloweenBagPumpkin = {
GN84-AHE.HalloweenBagPumpkin = {
rolls = 10,
items = {
"XXXX", 9999,
}
},
}
This is similar to what I had. The module prefix didn't work at all, so I couldn't link the bag by name to make it's own distribution.
can anyone see any glaring issues with this item code? I have 2 other items in the same file that do appear in game leading me to think the issue is something to do with me tryin to combine properties of wine and a pop can but very new to modding so:
` item WineInaCan01Red
{
DisplayName = Wine in a Can Red,
DisplayCategory = Food,
Type = Food,
Weight = 0.3,
Icon = Pop2,
FoodType = Wine,
Alcoholic = TRUE,
AlcoholPower = 2,
CantBeFrozen = TRUE,
Packaged = TRUE,
EatType = popcan,
ReplaceOnUse = PopEmpty,
HungerChange = -8,
ThirstChange = -60,
UnhappyChange = -10,
Calories = 140,
Carbohydrates = 39,
Lipids = 0,
Proteins = 0,
CustomContextMenu = Drink,
CustomEatSound = DrinkingFromCan,
StaticModel = PopCanRed,
WorldStaticModel = PopCanRed,
Tags = HasMetal,
}`
There is beer in a can, which would work exacly like pop can but is also aclohol, why not use it as a base?
thanks for the jumping off point. Can confirm it still doesn't work even when using the default beer can values (altering nothing), do I have to do anything when referencing base world models/ icons from witihn my mods module? The other 2 items I have working do use custom icons/ defined world models, that's the only difference I can think of at the moment but I haven't noticed any other mods using Base.PopCanRed for example
I'm either reading wrong/missing something, or you did not really stated whats the issue, if there is any?
sorry, the item does not appear in game. I don't mean in terms of spawning in containers, I'm using a cheat menu to spawn in items to do testing with. The other 2 items I have in the items file do appear in the cheat menu so I know it's reading my items file, but this one doesn't, leading me to think I'm doing something wrong with this item specifically that the game isn't even recognising it as a valid item but i'm struggling to see what
Are all of those in same txt file?
yeah, is there a limit/ should I use multiple files in any instances?
Can you just copy/paste whole txt file?
It shouldnt take much space if not expanded
too long without nitro unfortunately https://pastebin.com/Uu7eniBE
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
so only the bottom wineinacan is not working
Is it a mod that you released and just updating?
There is a version on the workshop without the wineinacan but I'm just creating single player games with a loacl version to test this
If it uses same IDs then it will use steam version
So you either have to unsubscribe from it
or change id for testing
ahhhh I feel stupid, I didn't even try to break it to see if it was using local files. Thank you so much
Happens to the best. Do let me know if it still doesn't work
yup thta's all it was - thanks again!
Hello everyone. Please tell me where and in which file you need to register the path to your weapon model?
model_X
Hey hey hows everyone?
another weird question from my self.... is this 'LShift' thingy actualy a thing on this page or is this outdated because i can't seem to trigger the debug mode like that no matter what i do:
https://pzwiki.net/wiki/Debug_mode
it'd be new to me
I'm not aware of it personally
someone should totally make a gas mask mod that adds alot of popular gas masks, not alot of mods currently that add them
Then do it
i dont know how to model
hello everyone I need some help.
I created a trait in a mod and I would like this trait when selected to give the character the ability to wire vehicles. Is the ability to wire vehicles a recipe? If so what is it called?
It`s me again. How do I move the weapon so that the handle is in hands?
Origin point is where right hand will be located
any way to fetch these from zombies ?
ZombieLore.Strength
ZombieLore.Toughness
ZombieLore.Cognition
ZombieLore.Memory
ZombieLore.Hearing
ZombieLore.Sight
you can read the fields, but keep in mind some of their values don't line up exactly with the actual option
yup
you mean the sandbox ? yeah i guess cuz we change the sandbox then set their stats so that it matches right?
there's no such thing as setVisible on a profession
i am sorry mate but i am newbie and i used most chatgpt
hey hello! I would be happy to help you guys with animations for ur mods. So feel free to contact me if you'll need any
Hello, I'm trying to import a custom animation, just for testing. I replaced the sneakwalk animation with a crawling animation I made, and it does trigger the animation but it also stops my character from moving. Anyone know what I've done wrong?
movement is controlled by animations, so if your animation doesn't move the character that would be why
Do you mean the root joint needs to move forwards?
Here's a vid of it just to show the issue.
I moved the root joint forwards throughout the animation and now my character does move. But now the animation loop is wrong, because the root position jumps back at the start of the animation.
move the translate bone
not the root
Hey there fellow modders! I'm trying to remove vehicles from the world and later adding them again without destroying the vehicle instance and recreating a new one again (I was able to do it this way). I've been using BaseVehicle functions like addToWorld. I'm able to enter the vehicle, turn it on and I see it accelerating but 3dmodel doesn't seem to follow. Even physics works because it bumps into other cars and make them move, but original car stays still. I've tried every possible update method from BaseVehicle and also GPT'ing a lot but nothing seems to work :/
I might need to copy all properties from the car into ModData and recreate it again but I was hoping to avoid that cause it's a lot of work.
Any suggestions here?
That worked! Thanks!
xyberviri did this with carwanna already
stores the moddata and properties into pink slip
delete the vehicle
and using pinkslip again to
spawn another instance

you might want to check out how the zed crawlers turns around by inspecting the xml
you will see that there are 2 types of crawler rotations(turning)
Oh this seems interesting 👀. Will check the code for that mod. Thanks!
Do radio stations startscript just fire when a save is created/server launched? Is there a way to manually trigger a reset if a save is already in progress?
anyone with experience with ContainerButtonIcons (and a little free time on your hands) I'd love to pick your brain.
I can't add movable items to inventory like that? 🤔
If you don't show the code, it's hard to help you buddy
it's on screenshot, but okay
player:getInventory():AddItem("Moveables.appliances_refrigeration_01_38")
this obviously doesn't work but I wonder what's the correct way or where to find working example..
declaration: package: zombie.inventory, class: ItemContainer
Requires an InventoryItem
You're giving it a string
I'm not familiar with how tiles as items are handled tho so I can't point you in the exact direction on how to add tiles in your inventory, to be placed
it works like this for regular items
player:getInventory():AddItem("Base.Twine")
but not for movables it seems
You are right actually, there's other options that can take strings
Then it must be how tiles are handled
Unsure if it was someone here or another community for modding, but added the Scrap Cleaver someone recommended here or there: https://steamcommunity.com/sharedfiles/filedetails/?id=3196209274.
playerInv:AddItem("Moveables.Moveable"):ReadFromWorldSprite(sprite)
Does anyone know off the top of their head if their is a rolls/item count limit for Distributions?
I've got a ton of small items I want to include, but it seems that some will never spawn even if all the weights/percentages are identical with 100 or more rolls. Only filling up maybe 20 total items/5 encumbrance out of a 20enc/50red bag I created.
Any ideas?
Previously for zombie loot I made multiple smaller dist tables and then inserted them one by one in code. Is that the solution to this?
Thanks for the help!
how do you know they dont spawn?
the roll doesnt have to equate to 100 as total
its just how many times it attempts a roll for that item
the way to determine spawn when modding is by using lootzed (load with -debug parameter)
turn on lootzed cheat(bottom option)
rightclick on the container icon
then loot zed there you can look at the loot table and you can check if your item is there
Firetruck update has dropped!
Trying to make my first mod managed to get it working as it should and in the game but the weapon is invisible and im not sure how to fix it
Things that could go wrong:
-You exported empty fbx file
-Your model is too big to fit into screen,
-Your model is too small and can't be seen (very rarely happens)
-Your origin point is so far from gun model that it makes it appear in diffrent place (possibly outside of screen)
-Your Model pathway is wrong: Texture Or Mesh, or both
-Your mod has more than one material, where UV map you used is on 2nd material or something like that.
what is the relation of infection level and isInfected?
can i toggle the isinfected just by changeing the level?
you can't change the level directly, it is recalculated every frame
the level? well it works im able to set it
you may be refering to the sickness
the problem im facing now is that when i set tye infected to true my player dies instantly even tho the setting isnt set to instant
cuz i want to make the player zombie infected once blood level reached 100
BloodInfection = BloodInfection or {}
----------------------- ---------------------------
function BloodInfection.getWornBloodLevel()
local pl = getPlayer()
local wornItems = pl:getWornItems()
local itemBlood = 0
local wornCount = 0
local res = 0
if wornItems ~= nil and wornItems:size() > 0 then
for i = 0, wornItems:size() - 1 do
local item = wornItems:getItemByIndex(i)
if instanceof(item, "Clothing") then
if item:getBloodClothingType() ~= nil then
local currentItemBlood = item:getBloodLevel() or 0
if currentItemBlood > 0 then
wornCount = wornCount + 1
itemBlood = itemBlood + currentItemBlood
end
end
end
end
if wornCount > 0 then
res = itemBlood / wornCount
end
end
return res > 0 and round(res) or 0
end
----------------------- ---------------------------
function BloodInfection.getBodyBloodLevel()
local pl = getPlayer()
local vis = pl:getHumanVisual()
local level = 0
local maxLevel = BloodBodyPartType.MAX:index()
for i = 0, maxLevel - 1 do
local bloodLevel = tonumber(vis:getBlood(BloodBodyPartType.FromIndex(i)))
level = level + bloodLevel
end
--level = the total level value
if level > 0 then
local res = (level / maxLevel) * 100
--print(round(tonumber(res)))
--res is the percent
return round(tonumber(res))
end
return 0
end
----------------------- ---------------------------
function BloodInfection.getTotalBloodLevel()
local pl = getPlayer()
local wornLvl = BloodInfection.getWornBloodLevel()
local bodyLvl = BloodInfection.getBodyBloodLevel()
if wornLvl == 0 then
return round(bodyLvl)
elseif bodyLvl == 0 then
return round(wornLvl)
else
local res = (wornLvl + bodyLvl) / 2
return round(res)
end
end
function BloodInfection.isLeveReached(current, threshold, max)
local res = threshold * max
return current >= res
end
heres how i did the blood level computation
i guess you can set their infection level while they aren't infected
the instant death is usually caused by not setting their time of infection
Made Insurgent Jacket Rollable, rolled up model from SMUI, I don't have steam so feel free to upload it yourselves, edit it or whatever you want.
Hello again!
Is it possible to get existing player animations into blender? (In this case I'd like to have a look at Bob_WalkBat)
Thanks for the help! got it figured out.
From what I understand, infection in zomboid is a progressive value that gets set and increases quicker depending on sandbox settings, what you could do is make a new variable for fakeinfectionlevel, and when it reaches 100 you kill the player
the reason why i was dying was cuz of the sandbox option i didnt configure the right option, lol
not given a shoutout 
oh right i should do that on the mod desc too
clothing blood function referred from ETW by @dull moss

In weapon scripts, what's WeaponSprite mean? I figured it was just another icon situation but uhh
I've no idea but I wanna know if it's drastically important
Its model of weapon
Model with texture, that you state in txt file. In vanila this file is in media>scripts>models_items.txt
So in your mod you create txt file, with diffrent name than that, preferably very unique
and there you declare your model
I see
https://pzwiki.net/wiki/Scripts_guide/Item_Script_Parameters#Weapon Here you should find everything about it
In terms of what is what, Weaponsprite and such
wondering if anyone can help me figure out why my weapon model isn't rendering
defined my model like this
{
mesh = Weapons/1Handed/Macuahuitl,
texture = Weapons/1Handed/Macuahuitl,
attachment world
{
offset = 0.0000 0.1400 0.0000,
rotate = 180.0000 0.0000 180.0000,
}
}```
defined my item like this
``` item Macuahuitl
{
DisplayCategory = Weapon,
MaxRange = 1.23,
WeaponSprite = Macuahuitl,
MinAngle = 0.7,
Type = Weapon,
SwingSound = MacheteSwing,
HitFloorSound = MacheteHit,
ImpactSound = MacheteHit,
DoorHitSound = MacheteHit,
HitSound = MacheteHit,
MinimumSwingTime = 4,
KnockBackOnNoDeath = FALSE,
SwingAmountBeforeImpact = 0.02,
Categories = LongBlade,
ConditionLowerChanceOneIn = 15,
Weight = 2,
SplatNumber = 2,
PushBackMod = 0.3,
SubCategory = Swinging,
ConditionMax = 13,
MaxHitCount = 2,
DoorDamage = 10,
SwingAnim = Bat,
DisplayName = Macuahuitl,
MinRange = 0.61,
SwingTime = 4,
KnockdownMod = 2,
SplatBloodOnNoDeath = FALSE,
Icon = Macuahuitl,
WorldStaticModel = Macuahuitl,
TreeDamage = 10,
CriticalChance = 20,
CritDmgMultiplier = 5,
MinDamage = 2,
MaxDamage = 3,
BaseSpeed = 1,
WeaponLength = 0.3,
DamageCategory = Slash,
DamageMakeHole = TRUE,
AttachmentType = BigBlade,
Tags = CutPlant;SharpKnife,
DoorHitSound = MacheteHit,
HitSound = MacheteHit,
HitFloorSound = MacheteHit,
BreakSound = MacheteBreak,
SwingSound = MacheteSwing,
}
The weapon works but the model is invisible
The model shows on ground (but way too big)
but not in hand
Hello!
I'm trying to create a mod to put stews/soups into cans.
Everything works except for two things.
I cannot do it from the crafting menu, only by right clicking the empty can.
I canned a hot stew but I still got the cold negatives on it. I do not have the BadCold=True on it, I guess I need to adjust the finals with what it would have been hot instead?
I also do not wish to see the nutrients without the Nutritionist trait, how do I do that?
hello all, im new to PZ modding entirely and foreign to lua.
my goal is to add a "lung cancer" mod where you progress through stages of lung cancer based on how many cigarettes you smoke
my idea is to add a count variable to the cigarette item and as it increases we check the count based of whatever breakpoints we have
for the lung cancer stages and add that as a moodle, any tips on the process or how to start would be appreciated thanks!!!
well you definitely want to learn the very basics of Lua as a minimum, just enough to be able to read basic code should be enough to get you started.
when you want to set up your mod and need to know the structure, look at https://pzwiki.net/wiki/Modding/
For the cancer accumulation feature, you would want to use player mod data (player:getModData()) to store the cancer delta / cigarette count / whatever else you need
For the moodle you can use an api on the workshop to simplify things like MoodleFramework
For the trait if you decide to add one, there are trait apis to abstract stuff but its not hard to use TraitFactory global in Lua (vanilla)
My biggest tips are to learn the lua, read resources like pzwiki and pins in this channel, ask for help when needed!
This is supposed to help for a general guidance of what to do later after learning the lua, you are probably most likely going to need to ask for more specific things here when it comes time.
im semi-experienced in c#/python if that has any similarity to lua but im assuming not
Oh and don't forget to use and learn from the vanilla lua code in your games steam folder in media/lua
C# def not, python might be similar but its a stretch
lua is more of a scripting language not like c# or python
think of lua like a really baby version of python with a lot of the functionality stripped away lol
i guess i will get on figuring out lua then
imagine python if the standard library was like. fifty functions total
😔
i think it's a pretty simple easy to learn language, especially for someone who already has experience
apparently the cigarette icon name is "icky stick" which is hilarious
where is the player script or file thing where i could add the moddata?
in a lua file you do player:getModData()
because i would add my cigarette count there right and then on the cigarette item we can say that whenever you smoke one it just increases that
you would do something like player:getModData().myModData.cigCount i think
player:getModData() returns a table so you can just add your own tables and variables to it
myModData would be a table you can use to store all the stuff from your mod and then cigCount is just a variable
The crafting menu problem seems to have been caused by forgetting to add class prefixes on items.
Now I just need to sort of the unhappiness stat and nutrition trait
this is the moddata i have for my mod for reference
this function gets called on the event "onnewgame" which is whenever a player is first created which is where you'd want to set up the initial cig count to 0
then you can access cig count and change it whenever you want
this file is in media/lua/client btw
a lot of modders will prefer OnCreatePlayer for compatibility with existing saves
i had to load in some data from character creation so i had to use both
i have this for when creating the character and then it sets the data a different way in oncreateplayer if they dont already have moddata set
actually yeah for the cig count it'd be better to do oncreateplayer
is SPNCharCustom like a custom table then that you have in the modData?
yeah
modding is hard so im learning
which folder?
just here
give it a unique name though so it doesnt overwrite anything
oh like you made a custom lua file for that then?
or im tweaking because i dont see it
yeah you make it yourself
okay so to clarify, you add this function to initialize your mod data and its called alongside the actual OnNewGame function when you said Events.OnNewGame.Add(onNewGame)
yeah
although albion just pointed out that the event should be OnCreatePlayer instead
yeah that makes more sense
i had to use OnNewGame instead because of something specific to my mod
when you use OnCreatePlayer though you'll have to add a check at the start of the function that returns if the player already has their modData set up
if player:getModData().myModData ~= nil then return end
OnCreatePlayer is called when any player loads into the game so the code to set up your mod data will only run if their character was made before the mod was added
so do i have create like a myModData file or table thing somewhere then?
no that all gets done in this function
is it necessary for me have that if im just having one variable to keep track of
could i just say like player:getModData().cigCount
or something like that
you can but you risk name conflicts
yeah
except i forgot to return
looks good except the top part
its checking if cigcount is nil when it should do the opposite
it needs to return if the cigcount already exists
oh rightttt, if its not nil then skip
yeah
something like that?
actually i think that would also return an error
remove the cigcount part so it just checks lungcancer
yeah thats good
hell yeah
the issue is that if the player doesnt have modData then lungCancer is nil so trying to get cigCount from it will cause an error
so just remove cigcount i think
ahh okay
so then i could just add to the cigarette item that it increases that count by one and then do whatever other moodle logic based off that count
im not sure i've never messed with item stuff rip
how would i actually check the console in game to see if it get initialized
hey guys, what is "cdt=" in radio and tv files?
okay i think i need to change or add to the OnEat_Cigarettes function to also increment the count by one
i just cannot find where that is
you can add print() with any string inside () and then it'll show up in debug mode or console.txt in the zomboid folder
thx
do you know if like with OnCharacterCreate, i would add onto this, can i just modify it here and it would work
i think you can do this?
it stores the original OnEat_Cigarettes function as a variable called originalOnEat_Cigarettes and then you replace the function but call the original function at the start
so you can essentially add your own code onto the end of the original function
would i do within the actual lua file with the OnEat_Cigarettes function or in a new file or even the same one with the OnCharacterCreate
in a new file or the same as the create character one
character here is just the player so you can still do character:getModData etc as well
oh right
so my question is like, how is this file implemented when running the game? like how is OnCharacterCreate actually added on to with the new mod data initialization
this line subscribes your function to the game event so whenever the game decides to call that event it will trigger any function subscribed to it
OnCreatePlayer is triggered whenever a player loads into the game so when you load it will run the code that adds your data to their moddata table
okay i see
that makes more sense now
what about for the OnEat_Cigarettes thought? we arent saying .Add() for that one
im not really sure how it works lol but i know it does somehow
hey you know if it works it works
i guess i will add some console logs and then test it out
food items can just set a function that's called when they get eaten, what you're doing here is replacing that function so yours gets called instead
but since you don't actually want to get rid of the vanilla behaviour you save the original and call it in your overwrite
how do i open debug mode?
right click the game in your steam library and type -debug into the launch options text box
then when you open the game you get a console window at the bottom
amazing thank you
whenever you get an error in debug mode though it'll open a fullscreen error monitoring window so you have to press f11 to close it
unfortunately this is as much as i can help with i think since ive never touched anything like moodles or status stuff
not related to development but how did you guys get into modding in the first place
is there something i would need to do when running? this isnt working it seems
Hi, I'm improving the sound of my guns and I'm wondering if it's possible to change the sounds of gunshots according to the environment (like vanilla) through lua. Is there any guide or something like that?
As far as I can tell, some of the items in the distribution list don't spawn at all in the bag, it's only the first few.
I set it to 100 rolls, just to make sure the bag got fully populated, so I could test what got spawned in.
Unfortunately, being it's a bag, lootzed doesn't seem to work like it does with other containers.
Trying to determine if their is an item limit in distribution tables, or if it's something I'm doing wrong with the code for it, possibly a misspelled item, or something else causing the list to truncate? I'm not sure.
Do you have commas after every entry
Just dump it in a Lua compiler and see if the table throws errors
Yes, I do. But, I noticed just now while looking at the commas, that there was some white space afterwards on some of them. That may have been the problem.
Okay, that seemed to fix one of the issues. I guess the extra whitespace at the end of a line will truncate the rest of a table/list. Thank you for pointing me in the right direction to see the issue.
Now, my bag still only gets filled with a few items, although they are from the entire length of the list still. Only fills about 5-6 out of a 20 sized bag.
Any reference to look at?
sorry ive never done dito that way
ive always used table.insert()
distro sample 1
local toSpawn = 'Base.Whatever'
local roll = SandboxVars.myMod.distroRoll or 2
local locations = {
"RandomFiller",
"GasStorageMechanics",
"MetalShopTools",
}
Events.OnPostDistributionMerge.Add(function()
for i = 1, #locations do
table.insert(ProceduralDistributions.list[locations[i]].items, toSpawn)
table.insert(ProceduralDistributions.list[locations[i]].items, tonumber(roll))
end
ItemPickerJava.Parse()
end)
distro sample 2
local demoSpawnTable = {
{ location = "RandomFiller", item = "Base.Whatever1", roll = 2 },
{ location = "GasStorageMechanics", item = "Base.Whatever2", roll = 3 },
{ location = "MetalShopTools", item = "Base.Whatever3", roll = 1 },
}
Events.OnPostDistributionMerge.Add(function()
for i = 1, #demoSpawnTable do
local spawnData = demoSpawnTable[i]
local location = spawnData.location
local item = spawnData.item
local roll = spawnData.roll
table.insert(ProceduralDistributions.list[location].items, item)
table.insert(ProceduralDistributions.list[location].items, roll)
end
end)
Thank you for the information!
could someone explain whats wrong with this and why it doesnt work when you smoke a cigarette? thanks!
does anyone have any idea why my weapon model is showing on the ground but not in hand when equipped
I can share more info if needed, I’m just not sure what’s relevant
refer to my substance x mod
it uses on_eat iirc
you might have to try requiring the original file at the top of your lua file
put something like require("FOLDER/Whatever file OnEat_Cigarettes is in")
the filepath you put in there already starts inside media/lua/client
those ram args in Steam don't get passed to the jvm!! only to ProjectZomboid64.exe launcher which doesn't use those
you have to edit the jso launcher config files ProjectZomboid64.json or make your own and use that like -pzexeconfig ProjectZomboid64Aoqia.json where id recommend to just completely remove the minimum and maximum memory for the jvm and to just let it manage it on its own like literally every other application
or you can edit the bat scripts but that's ugly for end users
my head hurts
I don't even know why the devs kept the 3g ram maximum in the config in the first place
y
I looked at the launcher in ida and it only loads jvm args from the json config file
BTW for context ProjectZomboid64.exe isn't an actual game exe, its just a wrapper that basically parses the args in the json config, starts the game and sends those args to the jvm
if you look at the working set to test with those args, it doesn't increase the minimum, and also you will notice in your log file that it says like invalid arg or something
the args getting passed to ProjectZomboid64.exe (that aren't for the launcher) like -debug get passed to the Java program itself (in this case they get passed to the main entry point like how normal Main Java funcs work with the string args param)
so tl;dr is it won't work because you're technically passing the ram args to the Java program instead of the jvm which will obviously not work
The reality is that it's not necessary, bcs vanilla files always load first
yeah i thought so too but i cant think of why it wouldnt work
that isn't a func
idk it should just be calling it there isn't any other reason why it wouldn't
is your stress going down when you use cigarette?
if so, that means the func isn't being hooked properly
it calls the original function though so it should still decrease stress
ik, but if the hook isn't working properly, the stress will decrease but you wont get the print in the console
thats how u tell if it is calling the orig or not
Let's just start by having you sharing the script file of your cigarette here
There can be many reasons why it doesn't work properly but it's better if we see the cigarette script to verify that aspect
ohh im stupid thats what you meant
is it possible to add moddata to room/buildings?
yea
to buildings are least
for rooms idk
i was just curious.. do we treat them as squares? with transmit? or like characters?
would probably nice to be able to name rooms
Check how Cordyceps Spore Zone associates mod data to a building
local buildingDef = IsoBuilding:getDef()
local sq = buildingDef:getFreeSquareInRoom()
Something like that
noted. thnx, cuz i want to control zeds on specific location
im trying to come up with a better way to do it.
since i dont know much abt building and rooms i was wondering if i can use it lol
otherwise ill just save the data to the player
Afternoon peeps, I've done some updates to my item inventory mod to enhance it when using either of this 3 mods: Equipment UI, Have Been Read and Eggon's Have I Found This book???
https://steamcommunity.com/sharedfiles/filedetails/?id=3344798556
requiring a vanilla file does literally nothing, it will never fix an error
require is very useful to control loading order though, it forces the file that requires it to be loaded after the required file
but you can't control the loading order of vanilla files
no no that's not what i meant at all he he
require is definitely one of the most important functions in lua, it's the only reason the module structure is even possible
I don't get how lua load order using require could be useful at all
i was going to nitpick that myself but the main reason is that even though you shouldn't write your mods in a way that load order matters, most mods *are* written that way and you may need to interact with that for compatibility
for example a lot of api mods aren't written as modules
I thought they should be
like an API should use modules more than any other mod, because other developers are going to use it and it makes more sense imo to modularise your api
they should be, but the unfortunate fact is that even if you do everything right you're still stuck in an ecosystem that doesn't
but I see a lot of API just shove all their funcs in a global table and call it a day ;-;
it really comes down to vanilla lua not using modules
most mods just copy the vanilla lua, even people with prior experience with programming who have the sense to structure things that way will look at all these references and just assume you can't write lua that way
they use vanilla code as reference, and other mods which probably also used the vanilla code as reference
I see, so its like infectious lol
i urge people to just read the damn book lol but if you looked at nearly any example you would have no reason to think require can do that (or is even a function lol)
one thing that I sadly think about is that removing the major performance impacts of Lua for pz might make some people lenient to writing good code and then we will have a problem lol
I mean like, right now if someone writes bad code, they are usually punished for it. call getPlayer():getInventory() without any variables every tick and it will have issues with func call overhead. remove the overhead then people can and I know will assume that they won't need to use a variable to cache things like you usually do in good practice
kinda like people who used to make games for consoles like SNES and PS1 had to really optimise their game to get good results, and now we have UE5 where developers just slap lumen on everything and wonder why performance is in the bin
to be honest i don't see this as a major issue because people already commonly write code that way, it don't think it would get worse in a notable way
not against the engine btw lol just how ppl use it
and there are ways in which the performance issues punish writing good code
both true
particularly the overhead on lua functions is really punishing
even moreso than Java calls?
the java overhead is much heavier but i can't really avoid calling java beyond caching where possible
our you mean just in general like you expect lua to be fast
Examples exactly like this are fairly common in vanilla code, so people learning from that probably don't think about why that's bad
the lua - lua function call overhead is still pretty high, it discourages writing smaller functions or using functions within loops
I do it anyway cause ik im gonna fix it later but I see your point
you should, because it's good for maintainability
it just sucks that we have to balance performance and good code
ye sacrifice little bit of performance to make it readable is a win
i think this is an issue all but lua jit faces but kahlua is a lot worse than standard lua from my testing
I'm still on the edge about the whole lua in Java thing
like I'm all the implementations I could find are ancient
the closest I could see to good is native functions in Java but they have to be compiled and all this wasteful processes
our I just write one myself but I take that not so lightly as that will take a while
yeah, i can find java lua implementations that boast much better performance than kahlua but i can't find one that actually looks maintained
I got an idea to communicate like Java - C++/Rust - Lua
and it might just work but will require some more effort
just so many caveats
and what's worse is you don't even know it'll run well until you do it
for example just using luajit with JNI could improve a lot, or the double interop might just make all the common performance issues even worse than before
yep 😭
then I get so many different ideas I start and stop stuff a lot so it's hard to finish what I've half done
Got a dumb question: a mod I am using on a server needs me to make a new mod to store its configurations. How do I make that empty mod, to start? Just duplicate the exampleMod folder and go from there?
Okay. How do I get a mod ID for that mod? Or is that in the info file, or other loose files, etc?
Is it possible to reload the lua in game? or do I need to restart each time I change my mod?
in debug mode you can use f11 and reload files but I think it does not always work as you wish
You create one by specifying it in the mod.info file
make sure it doesn't collide with another mod, eg just make it something really unique
if you're in debug mode you can just reload the save
Hi everyone!
I'm creating a mod that adds various traits.
I would like to associate recipes to some traits.
This is the code I created
local expertFishermanTrait = TraitFactory.addTrait("ExpertFishermanTrait", "Expert Fisherman", 10, "3 points at Fishing.", false)
expertFishermanTrait:addXPBoost(Perks.Fishing, 3)
-- Force adding recipes to the character with the trait, regardless of magazines
expertFishermanTrait:getFreeRecipes():add("Make Fishing Rod")
expertFishermanTrait:getFreeRecipes():add("Fix Fishing Rod")
expertFishermanTrait:getFreeRecipes():add("Make Fishing Net")
expertFishermanTrait:getFreeRecipes():add("Get Wire Back")
The trait is created and is working but the recipes do not work. the character doesn't know the recipes
Where am I going wrong???
Did you try the recipe without it being trait specific ?
Does it work ?
those are vanilla recipes
Didn't notice
UNRELATED but still kinda related
local expertFishermanTrait = TraitFactory.addTrait("ExpertFishermanTrait", "Expert Fisherman", 10, "3 points at Fishing.", false)
expertFishermanTrait:addXPBoost(Perks.Fishing, 3)
-- Force adding recipes to the character with the trait, regardless of magazines
local recipes = expertFishermanTrait:getFreeRecipes()
recipes:add("Make Fishing Rod")
recipes:add("Fix Fishing Rod")
recipes:add("Make Fishing Net")
recipes:add("Get Wire Back")
please put it in a local variable instead of calling it multiple times 🙏
cache it
are you making a new character? the recipes won't be applied to existing characters who gain the trait, if you're trying to test it that way
I do all the tests by starting a new game
it doesn't work....but i'll keep trying
Some food items use OnCanPerform and some use OnTest. Which one would be correct? I want to prevent adding a uncooked stew/soup to a can.
I copied the logic from the make bowl of stew (OnCanPerform:Recipe.OnCanPerform.SliceCooked)
But with that I cannot put the stew into my can from the crafting menu (all items are highlighed, craft button is grayed out)
But I can craft with right clicking the item in my inventory. Removing that line and I can craft both ways.
I don't get this part
OnTest is for checking if an item is okay to put in a recipe, OnCanPerform is for checking if the player is currently able to perform the recipe
you would want to use an OnTest here
Thanks!
Seems that the vanilla stew crafting also has this problem, can't create it from the crafting menu, but I can by right click, so no wonder it didn't work for mine as well 😄
they probably did that on purpose, with the crafting menu you can't select the ingredients so you wouldn't know which stew you're separating anyway
That actually make sense, maybe I should keep that function as well as mine is identical, just a cannable can instead of a bowl
so what is the best practice?
local function OnPlayerUpdate_sample(player)
local inv = player:getInventory()
end
or
local inv = getPlayer():getInventory()
local function OnPlayerUpdate_sample(player)
end
like cache it outside?
tho im pretty sure this will error
definitely the first one
caching it outside isn't viable because you don't know which player the function will be called for
even without splitscreen the player object can change
cuz the player isnt loaded yet at some point but i couldnt comeup with better sample
right
so i dont get what
aoqia ment
they meant most people don't cache at all
ah just directly use getPlayer():getInventory():stuff
?
yeah
i see
yep that is what I meant 😄
I have really really thought about making a modding series on YouTube
not sure if it would be that helpful but it's something interesting to pursue once I get the java project rolling
nice!
unironically I grew up watching modding tutorials for java and c when I was like 10 and they helped me a lot so I figure someone might get some value out of it
youre goin to do with voice?
If i do end up making it, I feel like it would be pretty annoying to follow along with text
i don't feel like an unvoiced one would really have any value tbh
yeah, might as well follow a docs guide lol
but visual feedback is still important regardless
actually!
there are people who prefer youtube cuz its more visual
thats why I started out watching youtube tutorials because it's easier to watch someone do something and then follow in their path than read a wall of text
if they still have to read text it's just a text guide with weird forced pacing, a text guide with pictures or even gifs would be better
so they tried and search google and only saw a few
and probably would always show map modding cuz of daddy dirk
even more so if you have adhd or anything similar
i don't personally find video tutorials very useful over text guides but i have noticed half the people who come here open with 'hey i just watched x tutorial' so having some decent ones would at least have a pretty large audience
yeah
which is why i asked if its voiced
cuz it would be very helpful for people to understand stuff that are important but they wont learn not unless they ask here
such as when to use local function
and how to write the code that other people can use instead of writing everything using local function
would force people to overwrite it if incase they need to add compat
and placing print on stuff that are ontick omg
And it being in voice also allows to go in depth more on certain things
at least more naturally anyway
Here's an analogy I thought of to explain why to use modules:
Modules are like containers with ingredients. You want to separate all your cooking ingredients into other containers. You wouldn't put your flour, milk, and butter inside of the same container, because then it will be very hard to separate! Keeping your ingredients separate makes them easy to look at, grab and use, especially at speed. Keeping your code separate in modules allows for easier readability on your end and also for other modders who want to read your code.
I have been working on getting these tiles I made into the game for a few hours now and having trouble.
I made the tiles, then placed them with tiled. I didn't do any tile defs at the time.
After nearly getting done tried uploading it to the mod to see them ingame wouldn't load was just base grass and dirt and wood plank floor where it was saying it was missing the floor.
Later found out I needed to do the tile defs I followed the guide I found on the forums and referenced the tile defs post and added isfloor to my tiles and floor overlay to the ones that was corner pieces.
After messing with the mod settings I finally got black tiles where they should be but the corner pieces dont have any presentation.
Please help me.
I got this error as well when reloading that tiles file
Could this be an issue? Its not loading the bottom half of the list i never noticed that before
Hello! Does anyone know how to disable bandages and wounds from spawning on zeds? Simple solution is to make them transparent, but this way they will be transparent on players too and thats not great.
Hi! Does anyone know how to replace a model from vanilla? I made a new gas mask model but I can't get it to work properly on zombies. They just wear the regular one, even though I added a new file in scripts defining a new hat_gasmask with my model, plus the xml file and guid, still they spawn with the default one
there is no override property for items, that's specific to recipes
simply making a new item with the same name in the same module is enough to overwrite it
Yeah, that's true
My issue is the guid stuff, so when you're making new outfits for zombies, right?
It's a headache to explain, ugh
if you replaced the actual model and texture by placing yours with the same filepaths i think it'd work
otherwise i don't really know if there's a simple way to replace clothing xmls
i think the only way to replace the zombie spawning without replacing the original gasmask clothing xml would be to replace the entire zombie outfit that has the gasmask in it
Alright, how about... should overwriting outfits in clothing.xml work? Like replacing FiremanFullSuit with my own FiremanFullSuit using the same GUID, would that work?
that does work
the only problem is that you have to include every vanilla item used in the outfit inside your mods fileguidtable
its really annoying
Right, in your clothing mods to add people using open jackets and such, is that what you do?
yeah
Whew, looks like it's gonna be a loong day ahaha
if you only need to replace the gasmask it'll be really easy
just grab the guid of the original gas mask and search for it in clothing.xml
hum i'm having 0 success with removing existing vanilla recipes in multiplayer using a new recipes file redeclaring the desired recipe with the same name, 'Obsolute:true' and/or 'Override:true'... feels like i'm missing something...
Obsolete:true is for items
Override:true is for recipes
sorry i had a typo on my message i am using 'Obsolete:true' already
obsolete is both
why do you need to obsolete it?
it just wont go away in multiplayer mode
it works for singleplayer as far as i can tell though
want to post your script file?
Override does not remove the recipe @fleet bridge it allows you to change it, and if i try that with isHidden:true then the client just hangs in a black screen (not frozen) while loading into the server
module Base {
recipe Make Stone Axe {
TreeBranch,
SharpedStone,
RippedSheets/Twine/RippedSheetsDirty/DenimStrips/DenimStripsDirty,
Result:AxeStone,
Time:80.0,
Category:Survivalist,
Obsolete:true
}
(...)
}
no comma at the end?
i've also tried with both Override and Obsolete
IsHidden
not isHidden
also, you need a comma after Obsolete:true
Obsolete:true,
don't set up a whole recipe, just do override and obsolete
i tried that too albion no difference
and i just tested with the dangling , just for sanity sakes even though i was 99% certain that was not going to make a difference and voila still showing
i recommend always having a 'dangling' comma because some script types literally do not work if you don't use them
i don't think recipes need them, i'm sure items don't, but for example sandbox options scripts break without them
i have yet to see that happening albion
and being old fashioned i dont use dangling , anywhere
module Base {
recipe Make Stone Axe {
TreeBranch,
SharpedStone,
RippedSheets/Twine/RippedSheetsDirty/DenimStrips/DenimStripsDirty,
Result:AxeStone,
Time:80.0,
Category:Survivalist,
Obsolete:true,
}
recipe Make Stone Hammer {
Obsolete:true,
}
recipe Make Stone Knife {
IsHidden:true,
Override:true,
Obsolete:true
}
(...)
}
none of this works
could it be because of the braces on the same line? just throwing stuff out there
they've never caused a problem for me
I wanted to but thought it would cause issues if they're on the same line
{
ScrapMetalBits=30,
Result:ScrapMetal,
Time:15.0,
Override:TRUE,
}```
this works for me, i dont need to obsolete it though
i mean guys its not related to the formatting, this works just fine in singleplayer and i have plenty of other new recipes in my mods with this formatting
are you trying to remove it @lect since i have no problem changing existing recipes it's removing that is proving to be tricky in multiplayer only
i've always used lua to recipe:setIsHidden(true) and recipe:setCanPerform("myfunction")
myfunction just returns false
scriptManager:getRecipe('Gather Gunpowder'):setLuaTest('alwaysfalsefunction') also works
wow yeah that seems like a better approach
and you trigger this on gamestart?
also server folder?
do it in shared, and if it's unconditional no point waiting for an event
makes sense
how do you make sure its the right recipe? cuz you can name them the same
override: will only override one of them
ohhhh, yes. override only does it for one of them
if there's multiple you need to do it through lua, and by looping through scriptManager:getAllRecipes() rather than using getRecipe()
local recipes = getScriptManager():getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
local name = recipe:getOriginalname()
if recipesToUnyeet[name] then
recipe:setIsHidden(false)
recipe:setCanPerform("yeppers")
unyeeted = unyeeted + 1
print ("Unyeeted \""..name.."\"..")
end
end```
almost like this 'multiple recipes with the same name' structure is highly impractical for literally every system that interacts with it and already needs several workarounds just to work
something like that (i was undoing some previously blacklisted recipes mid-wipe and didn't want to touch another person's mod)
i reduced the mods down to the minimum to ensure there are no multiples declarations of the recipe i want to supress still wont work, in fact after more extensive tests even for single player it realy only works if i combine override + ishidden, as soon as i get obsolute into the mix it also stops working in singleplayer. however for multiplayer the override + ishidden causes the black screen issue
there are multiple definitions in vanilla though
really? hummm dam it
i can only find one 'recipe Make Stone Axe' on my vanilla media folder 😕
oh wait sorry i got you confused with something else earlier
i don't know why the script approach isn't working but doing it through lua instead might work
yeh i have been trying to leave it for last resource... really wanted to learn why this doesn't work
i definitely remember someone having an issue exactly like this where it worked in singleplayer only but i don't remember what the solution was or anything searchable 😔
yeh google hasnt been much help on this matter for me either
someone answered with a solution to the recipe problem
see message above
Hey everyone! I've recently decided to learn how to mod for PZ after falling in love with the game and I'm trying to make a new type of window barricade or a "curtain" item. However, I think there might be some java coding involved. I have little knowledge of how to mod in general, but I'm willing to learn if anyone is willing to teach me.
I have searched videos, forums and the back of my skull for anseers and only made some progress. The main reason for this is because I have no clue if Im going the right way or not.
I'm using the metal sheet codes as a basis for this mod, but also tried using the Sheet codes. Both lead me to the same part of unknown which is "how do I know this is all I need to make it work". I did the whole lua/server script and created a recipe as well as the item. The recipe and item work, but I can't apply the new barricade on the windows
I've posted on reddit 2 times about this mod if anyone would like to take a look r/JonascomC
this been tested? im gona link this on the mod resources
most mods use lua
I ended up using lua to just hide all the recipes i don't want, though i'm not happy about it, just wated to use the recipes method to supress them
local recipes = getScriptManager():getAllRecipes()
local suppressedRecipes = {
['Make Stone Axe'] = true,
['Make Stone Hammer'] = true,
['Make Stone Knife'] = true,
['Make Stone Sledgehammer'] = true,
(...)
}
DarkhoundsTweaks = DarkhoundsTweaks or {};
function DarkhoundsTweaks.supressRecipe() return false; end
for i = 0, recipes:size() - 1 do
local recipe = recipes:get(i);
local name = recipe:getOriginalname();
if suppressedRecipes[name] then
recipe:setIsHidden(true);
recipe:setCanPerform('DarkhoundsTweaks.supressRecipe');
end
end
Well that's how you do it yea ?
that's what i ended up doing yes, and just updated to include a bogus onCanPerform that always returns false to also suress it from the context menu
That doesn't remove it from the context menu ?
nope it removed it from the crafting window but still had it on my conext menus
this just feels as dirty as it gets
That means profession recipes can technically be accessed by anyone ?
Unless they handle that a different way
wtf i just had a issue where the client would refuse to use my mod from the workshop dev folder and instead would prefer the steamaps installed mod version instead??? 1st this happened, had to deleted the installed version for it to start reusing the dev folder 😕
Yes
That's a known problem that you'll have to deal with when modding 
is it just random? or is there something that triggers it?
It's not random
Just whenever you have mods with the same modID they will fuze together
You can't do anything about it
Either make sure your version in the workshop folder is the same, or you have different modIDs, which you need to remember to change back 
Just make sure to unsub from your workshop mods
That's usually the way to go
B42 will fix this problem
multiple times ive had issues that drove me insane for a whole day before i realised it was because i forgot to unsub from the mod
horrible experience
ye this is common
i test using a different launch option where the folders are different
and this is also my nosteam launch
so i never exp this again cuz i hate wasting a day just cuz of workshop unsub
happened to my quite alot till i changed my launcher for making nods
so i only open steam version now to upload/update or debug servers
I use a lot of tools from the workshop so I personally don't do that, just learning to not sub to your own mod is enough
And in the case of mods that take a while to develop and you might use the mod itself I make beta versions where I change the mod ID
And the uploaded version has a different one
So I got my unstable version and stable version
Also allows me to upload that unstable in another mod to make MP tests
Yes
You want onluatest to remove from context menu
Oncanperform just means you can't do it
There is something you add to your launch option to select the order of local mod loading. But you probably are better off just copying it over into a non uploaded local mod
mind elaborating on what this is exactly?
interesting, thank you @fleet bridge
This is from Evelyn's code btw. She uses it from her ammo crafting mod iirc
Well the onCanPErform did remove it from the context menu but i'll give it a go and see if with onluatest removes both from context and crafting windows if so it's one less check done
gotcha
i just remembered i did something like this before
for my raid mod
i needed to make the recipe show up to faction leaders and admins only
and only when the sandboxoption isCraftable is turned on
so what i did was i made the recipe require learn
and i then via lua automatically teach it and remove it depending on the situation
you might want to try that approach if youre still having problems
not the cleanest way but it works
Depends if craft helper verifies if the recipe is hidden or not
i don't know about craft helper specifically but i've seen other crafting menu rewrites ignore it for performance reasons
Is there any Lua function for sprinting?
Currently, the only function based on movement seems to be
getPathFindBehavior2():pathToLocation

player or zed?
zombie:setWalkType("sprint1")
or maybe
setWalktype()
yeah its the first one
Thanks! Is there any function for players? I can't seem to find the answer in all the current mods and documents.
have you tried setForceSprint/setForceRun?
yes it does
Is it possible to check if a plastic bag has items within through .LUA or something? Plastic bags gonna be used in a recipe but don't need filled plastic bags to be used, only empty ones.
I had time to kill
can a mod change a specific value on an object as it is being used? specifically thrown? I can't think of any examples where the base game does this, but if I hook into an event that the object triggers when thrown, can I modify, say, 'radius' or 'volume' of that object?
similarly, if I override a base object with my own, does setting a value inside an itemData() object persist? especially if it is a new variable of my own creation?
er, item.getDeviceData()
no, it will not persist
if you want persistent data attached to an object look at mod data
yeah, I'm trying to think of an example mod that does something like that
I guess it'd make more sense to figure out how to get a volume control, but I think making the thing a radio means the frequency manager comes along for the ride
huh. a cdplayer is a radio with a volume control, and it even has a frequency range. but I can't see anything in the item definition that causes it to not have a frequency listing. custom java?
oh, huh. I have no idea why, but when I created a radio object and removed the accepted media type, I got just a battery slot and a volume control. but of course it's not throwable because it's not a trap.
here's where multiple inheritance would be really handy. I'd like this item to be both Type = Radio and Type = Weapon...
ah, I guess this is why everybody falls back on the recipe system. I wanted to make the volume remote-controllable, but that's just not possible without reinventing the entire volume system. so I guess three or five recipes, each consuming all of the items and pooping out the item with the setting you want is the way to go.
Hi, im just starting out with modding and I tried going for food, I was wondering how we'd achieve
- the mechanic where if a food is not hot then it gives unhappiness / reduces the unhappiness a hot version of the food would usually provide?
- Reducing unhappiness and boredom only if the food is cooked? (OnCooked function?)
- Any best practices on how to implement the above mechanics?
dunno about best practices but from my adventures with modding I would say you need to tap into some kind of system that allows you to check on the item properties, and change them accordingly, before consuming it
only place i personally know of where to do this is in the item inventory pane, maybe in renderDetails which triggers every tick as long as it's visible, but there may be some triggers you can bind to, maybe some of the more experienced modder in the room can help you with that
WIP of my own mod similar to SMUI, currently showing the M1951 field jacket & M1951 ridgeway cap, and type 1 & 2 OG-107 uniforms
Ok so i just tested using setLuaTest and works exactly like setCanPerform, as in they both remove it from the context menu but i still need to hide the recipe with setIsHidden with either so is there any strong argument on why we should use one or the other?
if invItem:getItemContainer():getItems():isEmpty() then
print("Empty")
end
(Moving this from #mod_support)
hey yall!
Is anyone open to modding commissions for project zomboid? I was looking to make a personal change to something, but open to possibly comissioning a new trait. I would happily pay. Please DM me if interested, thank you
Edit: hey yall! I’ve got the help of someone already! Thank you for all interest
To continue this, I've gotten myself stuck with an issue, where if I add a condiment (that is custom from the mod im making), it sets the value of the food to -30 unhappiness and -30 boredom for some reason, I used EvolvedRecipe to get the final food (which is uncooked and needs to be cooked) however I cannot adjust the unhappiness and boredom values
you should probably hook onto the eat timed action
https://discord.com/channels/136501320340209664/1125248330595848192
I suggest making a request on the modding Discord
oncanperform runs far better
test is for testing ingredients, canperform is for testing everything else - structurally it makes way more sense to gate it at canperform and it also means your function only runs once per recipe check instead of once per every remotely possible ingredient
ok i have a puzzle that is driving me crazy... RecipeManager.getSourceItemsNeeded is returning a zombie.inventory.types.ComboItem when my character starts a saw log recipe but the instance doesn't seem to have any of its parent itemInventory methods 😕
pretty sure it's the log item but i cant find a way to get it's name
Should have the parent methods
what do you mean it doesn't have the methods? it's a child class
I've used those in the past
how are you determining this?
i don't think vanilla even spawns raw InventoryItems in most cases
Hmmm
ComboItem is the 'no special properties' subclass
that's what comboitem is for
items:getName()
that will throw an error @fleet bridge because it's nil
getDisplayName()
getName is a method of it's parent
its a ComboItem, what is that?
in any case getDisplayName is also nil
this is what i'm trying to understand, it;s a source for the saw logs recipe, which i'm nearly certain is the log
I might confuse myself with Drainable here
for some reasons
That must be it then
understandable, there is a drainablecomboitem too
Ah perhaps yeah
because this is an array
hummmmm
for i = 0, arrayList:size()-1 do
local obj = arrayList:get(i)
-- do something with obj
end
i'm blaming my fatty fingers 😛
thanks guys i managed to fix another bug related to this! 😄
a side effect is it now equips the log while being sawn along with the saw since its listed as prop in the recipe he he
Thankyouu! 🙏
Does someone have the base male_body.fbx file?
I am trying to look through it the game files but I only see a file named W_Female_Body.FBX
If anyone can provide it or help me with that I would really appreciate it 🥹
so items all have getModData() implying they have an open-ended table of data that mods can set. can this only be done in lua, or can variables be set (e.g. defaults) in the text files in scripts/?
alternately, is there a way to declare a new type of item?
pinned post #modeling
Thank you!
yes you can add moddata on the script
is there an example anywhere? like a mod that does this?
looking at, say, functional chainsaws, it has a custom fuel amount but doesn't set it in the text file
you can but generally you shouldn't
all you have to do is add a parameter to the script that isn't recognised by the game as anything else
e.g. MyValue = 5, will add moddata under the key MyValue
it's not generally advised because then your value is stored per-instance in the save file, but if it's universal and unchangeable to the item then it could just be in a table somewhere and stored only once and not in the save file at all, and if it is actually meant to differ per instance then the default can be set in code that uses it anyway
Do you think this will work?
if isClient() then return end
local ClientCommands = {}
local Commands = {}
Commands.object = {}
Commands.object.addRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoDoor') or instanceof(o, 'IsoWindow') or instanceof(o, 'IsoThumpable') then
o:addRippedBag(player)
elseif IsoWindowFrame.isWindowFrame(o) then
IsoWindowFrame.addRippedBag(o, player)
else
noise('expected door/window/thumpable got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end
Commands.object.removeRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoCurtain') or instanceof(o, 'IsoDoor') then
o:removeRippedBag(player)
else
noise('expected curtain/door got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end
Events.OnClientCommand.Add(ClientCommands.OnClientCommand)
i just reposted cuz its hard to read im using mobile
if isClient() then return end
local ClientCommands = {}
local Commands = {}
Commands.object = {}
Commands.object.addRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoDoor') or instanceof(o, 'IsoWindow') or instanceof(o, 'IsoThumpable') then
o:addRippedBag(player)
elseif IsoWindowFrame.isWindowFrame(o) then
IsoWindowFrame.addRippedBag(o, player)
else
noise('expected door/window/thumpable got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end
Commands.object.removeRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoCurtain') or instanceof(o, 'IsoDoor') then
o:removeRippedBag(player)
else
noise('expected curtain/door got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end
Events.OnClientCommand.Add(ClientCommands.OnClientCommand)
wait what the function called itself ? thats gona infinite loop? or not cuz it its gona return missing variables
also we need to see server to properly check
could anyone teach me how to add a model i made in blender with the vanilla male body and make it a zombie in game
this will help
but you still need to figure out the model side of things
you have to turn off godmode btw
other wise it will remain 0
press , to open up the mini window panel to see the stats
i'm having trouble syncing an objects inventory with the client, any suggestions of code i could look at?
one i've used is if isClient() object:transmitCompleteItemToServer() if isServer() object:transmitCompleteItemToClients(). not sure if using correctly, also may cause duplicate objects so i delete on client side after transmit
here's one that may actually do this proper isoObject:sendObjectChange('containers')
ty 🙂
Hello, Im encountering an issue where adding a spice to a food im coding changes the unhappiness and boredom change to -30 for each spice added, what is causing that behavior (i have not made any changes to the code in my mod that could introduce this kind of behavior)
i got the model to mod in game, but it wont show up when i wear it how do i fix this
is there a simple process to adding vanilla attachments such as the laser to a custom weapon?
What type of inventory are we talking about here ?
If you use the right way to create or move items, you shouldn't need to sync anything from my experience
it was a crate, but i figured it out ty 🙂 now i have a brand new problem. idk how to refresh synced inventories client side without swapping which container i'm looking at
Not sure what you mean here
the item is in the inveitory but i don't see it unless i cycle through the tabs and back to the crate
OnContainerUpdate
triggerEvent(OnContainerUpdate)
That should do it
Whenever you add or remove items, always do that or you create duplication glitches
so, when i do a containerupdate, (becasue my item is near other items) it refreshes, and but i'm not longer looking at the correct inventory, i'm looking in the cabinet instead
any way to fix that?
Your item is near other items ....?
There's a huge confusion on wtf you're doing here ngl
What is your mod ? What are you trying to achieve here ?
Bcs I don't understand a single shit of what you're trying to do
And that doesn't help me understand what your problem is
Are you trying to create an item within a container ? Moving them ?
Or completely something else ?
i'm spawning an item in a crate from the server.lua, when the item is in the crate, it's invisable until i rotate through other containers (or the ground) back to the container i spawned the item in.
Just throw a OnContainerUpdate then (probably)
I've never added items server side so idk how that handles
it doesn't like it, but, it's not a huge deal,
wdym ?
the oncontainerupdate doesn't refresh the single container, (unless the container is at the top of the buttons) (i'm sorry i don't know how to explain exactly)
I speak very little projectzomboidese
OnContainerUpdate tells the client "update what the player sees to the recent changes"
Where do you trigger it from ?
client
Server side ?
Idk then
What do you use to create your item ?
And add it in the inventory
you know it jsut dawned on me, i'm not technically adding stuff to the inventory, (the player adds it) the server determins what needs to be deleted, and deletes it, so what remains needs to be updated to the client
so i guess this is it:
for i = 1, stuff do
local item = stuff[i]
container:Remove(item)
end
same
i thought youre spawning item
now youre showing remove

yeah i've been coding for like 3 days so


