#mod_development
1 messages · Page 286 of 1
That last line there is an example of a tooltip.
Vanilla PZ guns don't tell ya what they are or what they do, so I just have tooltips on each new thing I've made that gives a short easy-to-understand tip like that 🙂
Oooooo ok great ill use that as reference
okay for some odd reason the mod doesn't pick up on 42's version of MaleZombieCombined and FemaleZombieCombined
Hello! Sorry if this is the wrong place but I wanted to make my own custom challenge (like the CDDA one), with custom sandbox rules, spawn point, clothes, and maybe even some injuries. I couldn't find anything on the wiki or online for how to do this, though
Does anyone know how drainable ingredients with type = Drainable (IE baking soda) differ from ingredients with type = food like rice?
I'm sure you've noticed that crafting cooking recipes using the crafting panel now consumes whole items of sugar, rice, etc when cooking, which is a big block to cooking unless you debug spawn extra ingredients
I noticed the advanced recipe files call for X ITEMS with the tag flour/sugar etc, which seems like why the whole flour or rice bag gets used up in a recipe
But I can't see why these weren't given the Drainable type so that they just use X units of the item rather than the whole item when crafting
yeah we have limited resources after all
check out
mod resources:
mod tools:
Oh! Thank you, I'll see what I can find
goodluck
Rice, pasta etc are all missing UseDelta in their scripts
Gravy mix, baking soda etc still have it
Makes me wonder if just adding UseDelta back to flour etc would work but I'm guessing not
Okay I have confirmed that in 41, flour and rice and sugar did indeed have type = Drainable, which has been changed to type = food in 42
However, the format of recipes has obviously changed
But UseDelta still works for baking soda when crafting say, cookies
For example, cookie recipes call for ingredients like this:
inputs
{
item 1 tags[RollingPin] mode:keep flags[MayDegrade],
item 1 tags[MixingUtensil] mode:keep flags[MayDegradeLight],
item 1 [Base.Bowl] mode:keep,
item 1 [Base.BakingTray],
item 2 tags[BakingFat],
item 5 tags[Sugar],
item 2 tags[Egg] flags[IsUncookedFoodItem;InheritFoodAge],
item 1 [Base.BakingSoda],
item 1 [Base.CocoaPowder],
item 1 tags[Flour],
item 1 [*],
-fluid 1.0 [Water],
}
outputs
{
item 1 Base.CookiesChocolateDough,
}
If you make choc cookies, you'll use up 1 UNIT of rbaking soda, but 1 ITEM of flour
so I wonder if it's a bug with the tags...
Just wish I knew why the Devs opted to change Drainable food items to Type = Food instead of Drainable - must be a reason
how would i go about making an axe destroy a door/tree in 2 swings?
Give it mega TreeDamage and DoorDamage stats 😄
2000 didn't do it for some reason 😭
whats classified as mega high
Holy smokes
i tried 450 first, which had no effect
and then 2000 didn't either
so now i'm stumped
unlike the fuckin tree which is still sitting there staring at me
Oh, after changing those damage values you'll have to spawn a new version of the item in.
Otherwise they can retain their old stats.
i did
It might be hard limited? Did you try something like 99?
hmm no i didn't
i'll try that
why wouldn't a higher value than a limit just default to the hard limit though
doesen't make sense
Kinda like a bag of flour going poof with one use
it does that??
Yup and like a box of cereal. Make yourself one bowl of cereal, and poof
99 didn't seem to do it either
has anyone gotten around to undoing that??
Aurum ^ up there is apparently at least giving it a good look 🙂
hope he figures it out!
think i figured out my issue tho... mod creator had 2 seperate instances of the item in the file, i was editting the wrong one
No luck, I need more understanding of the new recipe system
My best guess is that it's cos they've changed Drainable type items to food
Flour for example does have a Tag "MinorIngredient" but idk if that's supposed to have it act like it used to
Yeah I noticed that
But with no UseDelta I can't see how the game is meant to know to only take a bit of it
Did you rename the files?
is it possible to load custom classes from lua to pz?
By custom classes you mean java classes ?
ye
nop
In Minecraft you can do something similar, but I don't know where
tho Minecraft modding is mods are loaded on startup bcs they are java
PZ doesn't allow that
you need to manually install the java mod
and expose the functions possibly I guess
Hey yall i have a quick question if anyone might be able to help, i personally have no experience with development or much tinkering but maybe i can shoot it by yall?
Im trying to add a mydistribution.lua so items spawn in specific containers,
For anyone who code
On pzwiki it says to use
table.insert(ProceduralDistributions.list["CrateFarming"].items, "TUT.Someitem");
table.insert(ProceduralDistributions.list["CrateFarming"].items, 0.1);
I get that the location name is put where “cratefarming” is, and i know you put what ITEM and its name/code into where “TUT.someitem” is, I.E “Base.baseballbat”
Can someone give me an example of how the finished code should look for say base.bandage at (1), i cant find any examples and feel im making a mistake, like do i keep the “” around the item name or?
As well…..for the life of me….i cannot find the item names for WORKSHOP MODS, such as britas, bushcraft, etc. all i can find is vanilla names that the wiki provided (base.plate, base.pencil, etc.)
require 'Items/ProceduralDistributions'
table.insert(ProceduralDistributions["list"]["ArmySurplusTools"].items, "RainsToolsandBlades.SawbackMachete");
table.insert(ProceduralDistributions["list"]["ArmySurplusTools"].items, 2);
^That's straight from the lua file
table.insert(ProceduralDistributions["list"]["ArmySurplusTools"].items, "Base.Bandage");
table.insert(ProceduralDistributions["list"]["ArmySurplusTools"].items, 1);
so i would keep the "" between the item name!!!!!
one last question that will help immensely!
Where would i find the names for items (such as we would find Base.bandage) that a mod includes?
is there a specific folder/file/lua that will show these per mod?
/media/script/ANY.txt
so recipes, items, models are here
lua/server
oh wait i understood wrong maybe
Everybody names their proceduraldistributions differently. Mine are usually rainssomethingdistributions but they can be named anything
so after adding a mydistribution.lua file along where the other lua's are it should shouw up within game as a spawn rate for such item per container?
im enierly new to this and only just starting with coding/luas and messing with my own server 🥲
yall are freaking amazing
moddings Rigged lol
literally just did this wondering if i could 😛
so i found the names in the mods thank you! now when i make mydistribution.lua do i need the first 2 lines that say require?
I know I do lol
probably cause some an attachable item?
You use that one to put weapons in zombies such as machetes in their bellies, or like shotguns on cop zombies' backslots, pistols in holsters, etc
❤️ ty, so should i just keep the first one for items in containers? im not to worried about on zombies 😛
Correctomundo, BushCraftTools has their machetes and hatchets in those attached zombie slots but it's a separate lua file
what is default path of getFileReader()?
im bouncing around thinking about getting this close to figuring it out 🥹
love how some will name the items like "base.item" such as vanilla does, then there is bushcraft and sapphs who name it "sapphscooking.item" "BCG.item"
😤
That's when a mod only adds new items and in the script.txt files uses the imports Base thingie
Like how for example my gun mod has to overwrite the base PZ guns so I don't import Base for that, I use base.Pistol for the M9 overwrite
But then again for my axes & blades mod I use imports Base because my items will be from the module RainsToolsAndBlades instead of Base
can shared lua files be shared between compleatly different mods/vanilla?
such as ------ require 'Items/SuburbsDistributions'
nvm i think i answered my own question here
Yeah you can use 100 mods that all require SuburbsDistributions because they're just doing table.inserts anyway
my own worry is mainly adding weapons to certain containers, and upping the chance at food items from sapphs within the world over the vanilla items. not so much looking to change every loot table 😛
just tired of constant wipes after hard work and want to start a 10yr (in game run) to start off with
I'm a bit new to Zomboid, but what is the way the server communicates with the client using sendcommand? Or does it have some kind of triggerevent?
I've seen a lot of mods that use sendcommand but there are triggerevent functions
they don't take a specific amount of real or in-game time
client sends sendClientCommand which triggers the OnClientCommand event on the server, server sends sendServerCommand which triggers the OnServerCommand event on the server
How to reload scripts?
triggerEvent will not affect the server/other clients, if you've seen it around networking code that may be for singleplayer compatibility (as server commands don't work there, even though client commands do)
On B42 in the debug menu there’s a script manager menu; you can reload scripts from there.
In a save game?
Yes.
Thanks.
And just incase you weren’t aware; you can also reload lua from the f11 menu.
%UserProfile%/Zomboid/Lua/
Already know that, I just wanted a faster way to reload my vehicle script.
Finally got it working! Now I just need to retexture. Right now the vehicle has a messy UV with tons of wasted space.
Already looks rad as hell
I used to make a generator mimic a chosen sprite in 41, it seems this method doesn't work anymore but it does look like the functions still exist. Not sure where to go with it as it is not an item you can carry around.
local spr = thisObject:getSprite():getName()
local NewSiloGenerator = IsoGenerator.new(nil, square:getCell(), square)
NewSiloGenerator:setSprite(spr)
Thanks.
What metric system does the vehicle mass use?
is possible make a mod for a server that checks if the files are the same on the server, specific with the following archives LightingJNI$JNILighting.class LightingJNI.class or for all files on iso path
not without requiring all of your users to also mod their games to allow it
Oh I understand thanks, a question this function/event is related if one uses a command in the console example /say hello or something custom /send "random"
nah, they're separate things with a similar name
Ah, I understand, but you can create commands, taking the handle of the text I suppose
is to get rid of mods like 360 or more scales
there isn't a way from lua to reach these files so you can't checksum them without having your users install a java mod to do that
Which metric system does the game use? Does it use mph or kmh; lb or kg; etc.
it would probably still be pretty easy to defeat but unless your server is being targeted by actual hackers (unlikely), nobody who simply installs java mods will be able to get past it
It is a UK based dev team so I'd say kg
I have always referred to the metrics in the game as project zomboid arbitrary weight units.
The weights of items are definitely kg, not lbs
the weights of items aren't in any metric, it's not even called weight
Sure but the numbers themselves are much closer to what they would be in kg 😄
it's an arbitrary measure of how hard something would be to carry, so bigger objects take up more even if they'd be very light
(except when they don't)
makes sense, a combination of weight and volume
True true, I've never cooked a bean soup that weighed 10+ kg lol
i would expect speed to at least be in metric since tiles are roughly a meter anyway
is there a command i can use in debug to turn the power off or on?
not my server but i searching if there is something to do with these mods and i cant call them hackers
It's not reloading.
so im stuck with no luck i created a mydistributions.lua, made sure the first line of insert was there (tried with and without that first line) made sure the item code was right as all sapphs items start with sapphscooking.item
used this to test and look into bathrooms cabinets for sporks but found none in any ive searched
i have the pathfile as C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\server
That's not going to work
😮
Slap your lua file into Sapph's own media/lua/server folder and try again
ill get back with ya on that 🙂 one sec
And for testing purposes, change that 8 into 80
Then you'll know real quick if it works or not 😄
also it originally wouldn't ever of worked even if it was to work that way, i never had the mod added
got it... the genItem is needed now. I think because there are multiple. local spr = thisObject:getSprite():getName()
local genItem = instanceItem("Base.Generator")
local NewSiloGenerator = IsoGenerator.new(genItem, square:getCell(), square)
NewSiloGenerator:setSprite(spr)
Lol oops 😄
haha so if im trying to spawn certain items from a mod its gotta be placed within the server folder of the mod itself ?
just figured since pzwiki hadn't said that it was just in the regular game server files
then again even excel is challanging for me, so ty for bearing with my questions 🙂
Yeah you can do it to your local copy of the mod in the 108600 folder
or
You can give yourself an aneurysm or two and create a mod of your own in users/yourusername/zomboid/workshop 😄
ill take the ladder and save myself some of that brain rot 😉
cause the last two days ive been laugh/crying at figuring this out
anyone who codes or develops needs therapy cause why do this to thyself 🥲
This is about day 11 of me trying to fix something that the Indie Stone broke with B42
thats the error i got after adding it to
Oh noes, you're using it in MP
not able to huh
Yeah you are, BUT it will take you actually developing that mod... 😄
Yeah because PZ MP uses mods from the actual Steam Workshop, so not only do the mods you want on your server have to be actual mods, they also have to be set to "public" on the workshop
i thought they can be unlisted
i mean can just add to the LUA thats in vanilla files ive seen, ik that add things to certain locations and tried adding baseballs to cabinets which worked
I guess that might be true? If you're hosting? Idk?
but would mod items work technically or does that gotta go through the mod LUA files only
think only can be unlisted if allowed for used with hosted servers by owners of mod
again im still new to this all
welp, guess ill just have to play with the spawn rates how they are and tweak them only in the actual LUA files
Anyone knows how to track custom(whatever) items/objects, after server reloading without brute forcing through the whole stuff on start? I mean, if we have onCreate callback on firsty created item, any chance to have something similiar onLoad? Didnt find some clues in docs, but Im sure it shouldnt be a super seldom problem and some1 could tried to figure this out
which i can still do, right?
can't choose wherever itll spawn but can choose the chance it shows up right?
i would help but i have no idea 😦
I don't know anything about hosting a PZ server, I've only admin'd a few, and the story of why I ever got to modding in the first place was for one of those servers.
We wanted machetes to be worn on belts, and bang - I was suddenly a mod "dev" lmao
hahaha well ill mess around with seeing if i can add modded items to the vanilla lua and or tweak the modifier for chance to show within the lua of the mod
does anyone know how to set a non page-based literature item as read (eg. magazine, generic book, etc)?
cant figure it out for the life of me
anyone know the file name of the big backpack and the military version
if neither work well least brita overides the base guns and ill still find hella base items for weapons when i do loot runs within the army bases/police
the fbx i mean
im confused cant you just make a mod
for me it was the moodles i just couldn't handle them lol
media/models_X/Skinned/BackPacks
M_ALICE_Pack
F_ALICE_Pack
ty again @ornate sand
excel is even hard to do for me lol i know nothing of modding
thanks!
all i wanted to do was basically change some of the areas the items spawn at, as well maybe take out some of them so that its not always clothes as well in places, plus modify the multiplier chance
its a good chance to learn a little bit of code
but if that takes making a mod, i think ill just slowly learn and play it with how it is and enjoy it, cause i like computers, ive wanted to learn coding so maybe i should spend a hr each day trying to learn a bit
just ive put off playing so i could make my own little server for myself mainly and some friends when they are bored
and most servers are wiping after 1-2 months so its hard to wanna put in all that time for multipul proffessions in the game 😛
So uhh I need a little advice so for build 42 (I don’t even know if moding tools are out yet just random spitball) I’m thinking of a mod that would only cause muscle strain after encountering zombies so like once you clear the zombies so many tiles away from you, after 3 or so minutes then the muscle strain kicks in, this would try replicating adrenaline but I have 0 clue about modding and I’m wondering how difficult implementing would be/if it’s even possible since b42 just came out
May I ask how you guys test your vehicle? Do you guys have a workflow?
Also where is the best place to test a vehicle? Top Speed, Handling, etc.
I always enjoy taking a muscle car down the highway between West Point and Louisville. It's pretty straight for long stretches, and it has some turns along the way too
hey all, i wanted to share a lil mod i made today! a custom player voice hailing from the east end of london. probably Bow. https://steamcommunity.com/sharedfiles/filedetails/?id=3400496387
"Oi you lot" sent me 🤣
Is there a way to read console inputs? through lua
I think speed is in mph and the mass is 10x kg (it shows the calculated mass in the mechanics menu), but mass and power don't really relate very well to irl, so you just have to estimate them based on the handling you want
Does anyone know how to modify the suspension of the rear wheels?
It tilts a little too much.
oh yeah also the speed shown in the speed dial is not the real speed lol
I doubt anyone can go above 200kmh lol
it just lies to keep the 'speed' in a believable range without actually going too fast
I can't even reach the 5th gear.
i don't know the exact relationship to the real speed though
i think it's just a multiplier
See? Can't even reach the 5th gear.
now that i'm thinking about it it might just be the internal speed is kmh actually nevermind
speedValue = math.max(0,math.min(1,math.abs(self.vehicle:getCurrentSpeedKmHour())/120));
- -
self.speedGauge:setValue(speedValue * BaseVehicle.getFakeSpeedModifier())
public static float getFakeSpeedModifier() {
if (!GameClient.bClient && !GameServer.bServer) {
return 1.0F;
} else {
float var0 = (float)ServerOptions.instance.SpeedLimit.getValue();
return 120.0F / Math.min(var0, 120.0F);
}
}
hm... get 'Fake' SpeedModifier... who can say really...
low speed limits must look pretty silly then
you could set the limit to 1 and it'd say you're going 120 i guess?
If I use :getModData() to set moddata on a corpse, and that corpse despawns. Does that data get garbage collected and removed? Or am I building an ever growing data leak?
That is kind of strange. Why should the speed limit affect what the speed gauge shows (unless the speed is supposed to be a percentage and not units?)
does anyone know where the image files for the new character creation map are?
On file requests - can anyone find the item files for potatoes or cabbages in the scripts folder? I can't see them in any of the items_food files or in items_agricultural_products or any other item files
But I've seen potatoes spawn into my 42 games
Got it, it's in farming
I added the "speedValue" to the code I posted before. It would seem that the speed internally and in the gauge is actually in kmh (if there is no speed limit)
nothing is leaking
i guess it might just be intended to make the speed limit less obvious? but i think it's weird yeah
How do I reset the mechanics UI?
Reset the vehicle stats/parts?
Yeah, like the horsepower and such.
I quess they should update if you reload the vehicle script
Nope.
How do you reload the script?
Script Manager.
Doing "Reload All" in the vehicle editor seems to work
At least for me it seems to reload everything from the vehicle script (in b41)
@ornate sand do you know if your allowed to change spawn chance within the original distribution for MP or is it just not able to be done without mod being made or being on SP
I would imagine that a direct edit like that would only work for SP
figuring cause immediately get a error that the LUA doesnt match whats on file
if you want to just make direct edits to your mods without making a new mod, yeah that won't work in multiplayer
well dang nabbit
so only SP hmmm do i wanna do a 10 yr run by my lil old self
just sucks cause i wanna not get 1000 clothing items in military containers when i really need ammo 🥲 damn you brita
I remember finding a .50 BMG minigun in the little ol' Riverside PD one time.
Like okay Brita, I see how it is.
i mean i get it i can really just spawn it in if i REALLY can't find it which wouldn't be to often needed since its really just me and 2 others in a large modded map
just prefer NOT to mess with any run with a dev option
but between how brita spawns its ammo and how sapphs spawns all its stuff along with vanilla, it takes alot of time to find specifics
but mainly its ammo, metalworking materials and the cooking materials i really prefer to find this run
Would this work? Im not very experienced with lua code...
module
require "NoodleDefense"
{
sound SOUNDCLIP
{
clip { file = media/sound/SOUNDCLIP.ogg, }
}
}
local player = getPlayer()
function PlaySound()
getSoundManager():PlayWorldSound("SOUNDCLIP", player:getCurrentSquare())
end
if IsNoodleDefense == true
PlaySound()
end
you can just send them the edited mod and it should work
? what do you mean send them the edited mod
i personally don't know how to "edit" the mod other then opening the lua in notepad and editing the modifier number, let alone just learned how to make a mydistributions.lua (though unsure if it worked cause was trying it all on MP)
So, I am sure I can look up how to do this, but I can't figure out the terminology to search for what I am looking for.
I want to grab gridsquares around the player, and I have done that successfully, but I want to make the influence, more circular?
I have a set of for loops that get gridsquares cells, for horiz = -x, x, for vert = -y, y.
I want to only target the GREEN SQUARES here (the grey square is 0,0 and the players origin.
what math am I looking for to exclude the red squares? I could make a table that exludes those combos, but that seem... icky? lol
you could do it correctly with pythag theorem eg. discard a square if sqrt(x^2+y^2) > radius or for a more performant algorithm with less circular but very similar results, you could discard if x+y > radius
sqrt(x * x+y * y)< 4.4
Awesome, Pythagorean Theorem was the term escaping me, thank you so much.
Ty as well!
how can I get current animstrip playing from character?
i wanna test some things fo B42 in local but my game doesn't see my mod, i tried Users\{user}\Zomboid\mods
i even upload mod to workshop unlisted, subbed and still nothing
check the pinned messages for the b42 mod structure
I had a code to do this with any size of circle actually, it would create a table of coordinates to check around a square for a specific order of square, going from center to outer rings
But if you want to check for any range and don't care about the distance, that's not necessary
The range will change, based on different circumstances, for sure.
Is there a method to send chat to client or print chat on client?
ok i forgot about common dir now works
I used :Burn() to mark out the tiles selected. Works great, thanks again @mellow frigate and @finite scroll
Will mods for b42 unstable work immediately on release for b42
probably
I presume most mods being made on b42 unstable will continue to be developed for any updates throughout b42 so barring major code updates yes.
Hi all, is there any way to get a handle on the data available in the Statistics table from the server admin panel?
I'm looking to write some of that data to file for admin purposes.
B41
um, Hi I'm New here. I joined to ask a question.
(Not sure if I should post here or mapping)
I was wondering if anyone knows why my water keeps vanishing when I am making a map? I am following Dirk tutorial, for some reason the water won't work. If anyone has any ideas what going on here I am all ears.
i would reccomend posting in mapping, but my best guess would be that your rgb value for water is slightly off
if that's not it you'll need someone with real experience lol
Okay thank you, I'll double check the values. Btw should I move the post there now and delete it from here then?
you don't have to delete it here but more people who actually know the answer will see it in mapping
That was the issue!! Thank you so much!! You made my day. Its was off by 1, it was 137 not 138. thank you!
np, glad to be of use
thank you. I will leave here then. the issues is now sovled
i see this Tutorial about Procedual Distributions https://pzwiki.net/wiki/Procedural_distributions does anyone know the max number or how they are calculated?
is it possible to intercept this via lua? some event or something similar
Have a look at the vanilla procedural tables to see if that makes it clearer.
...nevermind, still confusing.
it seems to go from 0.05-20 i just picked 5.8 to have a high propability spaw nrate 🙂
Quick question is a week before out or is it still in development
In dev
Oh.. okay
Oki
Any reason anyone knows, of why when spawning a zombie with addZombiesInOutfit(...), a zombie will spawn stale and get deleted by the server?
Does adding a ; after do any thing at all to prevent this, as the zombies in the horde spawner within debug mode seem to all spawn fine, but in my script, spawning 1 zombie at different x y z locations within a for loop will cause a random amount to be stale and are deleted by the server.
Are you spawning the zombie the same way the horde manager does it ?
The horde manager should have some syncing code
; doesn't do anything in lua, it's equivalent to white space (or a comma in a table initialiser)
Yes, please stop using it, it just bloats code with useless characters 
Ok, so the item Kettle has a tag called SmeltableIronSmall. Say I want to add a tooltip to every item with this tag, how would I go about adding the 'Tooltip' line to those vanilla items?
starlit library has an event for this, but if you don't want to add a dependency it's actually really complicated 😓
I don't mind using a dependancy, I'm assuming its updated for 42?
yep!
Ok neato
I uh, actually dont know how to use dependencies yet but let me try to figure it out lol
Not fully doing it the same, it has some code for if isClient() then command... end
Will check this more and replicate it. Thanks 🙂
you have to add to your mod.info require=\StarlitLibrary (and after you upload the mod, add it on the steam page too or people will miss it)
Yes, commands are used to sync
Would I be using the InventoryUI module or the Reflection module @bronze yoke ?
That could be interesting, also idk if Dismerion is still around, to possibly add your library to the API Steam collection ? Tho I think I'll make a wiki page about it
InventoryUI
Ok yay thanks
The loot goblin in me wants to make it obvious what items can be smelted lol
Thanks. Its hard finding what to use, I'm coming from fivem LUA which is a cake walk compared to figuring out what does what and how in PZ, thanks for the info 🙂
I keep saying to myself, I should put functions together that do things that work, but get caught up testing, checking logs and never remember to put a file together, which could help with a wiki for this. Love figuring it out though, and love how the debug log gives exact line and path to the issue.
Sorry for a newbie question, but where do I put LUA files with code in my mod folder?
I've only created clothing objects thus far
So not sure if the process is similar
they should be in media/lua/ and then either client/ shared/ or server/
since you're doing ui it should be in client/
is it impossible to create a statistic of total fish caught?
If you've in debug mode and turning cheats on/off whiel working on mods you've probably noticed the extra animal info (floating text on animals) is bugged - comment out these lines in media\lua\client\DebugUIs\DebugMenu\General\ISCheatPanelUI.lua to stop the text toggling every time the cheat menu is opened:
IsoAnimal.setExtraValues(bool) seems bugged
I don't see any reason it would be - have a "fishCaught" counter that the mod loads/saves, add a hook to code that triggers when you catch a fish, increment the counter
Does using the client/server/shared folders actually change anything, or is it a best-practice to keep code organized?
mostly the latter, but it does have a couple effects
hahahahah of course there are some special cases
the client folder doesn't load on the server (but the server folder *does* load on the client) and they load in separate stages
all shared files -> all client files -> all server files
translation might be special too?
translation is just a hardcoded location, it has to be in shared, it's not even lua
Since you use the same filenames there, but it doesn't overwrite existing translation files.
it shouldn't even be in there but i'm guessing from the syntax it used to be lua or something and that was the simplest way to convert it over to their new system
nods just a bit more technical debt.
also, server files don't load on the main menu, they only load when you join a server or start a singleplayer game (the only interesting consequence of this that i've found is OnGameBoot happens *before* server files load most of the time)
Aparently, I have done something very wrong.
Everytime I Quit (using the pause menu) a game after testing my mod, the save game has all mods removed.
No stack trace errors. Very fun. Anyone have any ideas?
I've seen similar that when something causes the mod loader to give up parsing mods (like a bad mod.info)
If it just started easiest firststep is to remove any mods you just added/edited, see if that fixes problem.
what does that save's mods.txt look like? maybe something weird in a mod id is making it unparseable or something? lol
Then look at mods.txt for the save and console.txt for clues
Also, does this affect all saves?
If you make a new test save.
VERSION = 1,
mods
{
}
maps
{
}
I'll create a new one to see if its messed PRE-Quit
So this is the first LUA code I've ever written, I'm sure that the syntax for this for loop is incorrect. (And probably a lot of other things too).
What do I need to change to make it correct?
local onFillItemTooltip= function (tooltip, layout, item)
local itemTags = item.getTags()
local isSmallSmeltable = false
for i = 0, itemTags.size(), 1 --- prob won't work but maybe might? lol
do
if itemTags[i] == SmeltableIronSmall --- not sure what the LUA syntax is for this
then
isSmallSmeltable = true
end
end
getFishes(), may either get fish in inventory or all fish ever caught, not sure, but you can reference it here: https://projectzomboid.com/modding/zombie/randomizedWorld/randomizedZoneStory/RZSFishingTrip.html#getFishes()
declaration: package: zombie.randomizedWorld.randomizedZoneStory, class: RZSFishingTrip
Throw this into chatgpt and it'll fix all the small mistakes
VERSION = 1,
mods
{
mod = \MoodleFramework,
mod = \TKE,
mod = \LookLibrary,
}
maps
{
}
This is before quitting
\TKE and \LookLibrary are unpublished mods.
hmm yeah, that looks normal, probably something else
to call instance methods we have to use : (so item:getTags()), to skip all the complicated looping you can do if itemTags:contains("SmeltableIronSmall") then instead
yo wsg fellas just asking if anyone knows how to add occupational clothing
Ah I see, thats much better
This might be of interest to you, tho it's still wip:
https://pzwiki.net/wiki/Lua_(API)
Especially this part about static and non-static methods
https://pzwiki.net/wiki/Lua_(API)#Exposed_methods
Sorry for the ping @bronze yoke, but can you tell me the difference between these two methods?
layoutItem:setLabel("Grown at:", 1, 1, 0.8, 1)
layoutItem:setValue("Sweet Apple Acres", 1, 1, 1, 1)
setLabel sets the text on the left, setValue sets the text on the right
I see, thank you!
uhm... sorry for bumping.
#mod_development message
In this case, Can i think it's a bug or still there is any possibility of me did something wrong?
I just want to get better knowledge, or want to be sure.
I don't have enough skill to judge "I'm sure it's a bug so I won't mind" so i can't get rid of curiousity
I'm testing it again, but I think my mod being disabled had something to do with excessive use of print() in Events.OnPlayerUpdate 😄
What's craftRecipe ?
lol wtf @bronze yoke
Would that be possible ?
I'd find it surprising ?
I pulled my logging out of my script and now I can't get it to mess the save file up anymore.
I'm adding it back now.
i've crashed the game with prints on stupid events and it's never cared
Yeah that'd be a new safeguard devs would have added
Which seems like it would cause more problems than fix any imo ?
lua\client\Entity\ISUI\CraftRecipe\ISWidgetRecipeListPanel.lua
I was working on this file directly.
and i think it means each craftRecipes on Crafting/Building UI
local craftRecipe = _item and _item.item;
craftRecipe is the script craftRecipe
declaration: package: zombie.scripting.entity.components.crafting, class: CraftRecipe
Are you sure getXPAward is properly giving you the object ?
xplist could be nil
Also what's the error you were getting ?
yep and doesn't this mean it's not nil?
Sry didn't even notice the screenshot
I don't even know how to read that fucking menu, it's so dogshit
I added logging back and its not crashing. I have no idea. I can't get it to mess up again. It was every time too lol.
error type was non-table of getAmount()
like, getPlayer():getAnythingPlease() and you will get non-table of getAnythingPlease()
Do you not read your errors directly through the console ?
If you have the error from console, please send in, never open that dogshit F11 menu ever again please it's terrible to use 😂
I'm waiting for that new debug menu they promised tbf
Yeah the new one looks so much better
ohh i have console, i just wanted to check if xplist is nil, but it was not nil
I may still have console. let me find right one.
Sorry for interjecting, but does anybody know how to take all world items / inventory items ? or whatever workarounds for tracking items. I need to build some cache on start, but dont even sure that it is available without some additional ritual dances
Though, this log is WILD all the number should be at 2 decimals.
LOG : Lua f:228, t:1736046189026> 0.8
LOG : Lua f:229, t:1736046189042> 1
LOG : Lua f:230, t:1736046189057> 1.2
LOG : Lua f:231, t:1736046189074> 1.4
LOG : Lua f:232, t:1736046189091> 1.5999999999999999
LOG : Lua f:233, t:1736046189107> 1.7999999999999998
LOG : Lua f:234, t:1736046189124> 1.9999999999999998
LOG : Lua f:235, t:1736046189140> 2.1999999999999997
LOG : Lua f:236, t:1736046189159> 2.4
LOG : Lua f:237, t:1736046189173> 2.6
LOG : Lua f:238, t:1736046189190> 2.8000000000000003
LOG : Lua f:239, t:1736046189207> 3.0000000000000004
LOG : Lua f:240, t:1736046189224> 3.2000000000000006
LOG : Lua f:241, t:1736046189241> 3.400000000000001
LOG : Lua f:242, t:1736046189258> 3.600000000000001
LOG : Lua f:243, t:1736046189274> 3.800000000000001
LOG : Lua f:244, t:1736046189290> 4.000000000000001
you don't use the debugger??????
No that menu makes me shoot myself, I never use it
just expected floating point imprecision
F11 menu is hella helpful for some issues.
If it wasn't terrible to read
my debugging process would take at least three times as long without it
it can give you info the console doesn’t.
do you just print everything?
Please make a guide on how to use it lmao
Oh right, these are untyped values huh.
Yea lol
yeah, all numbers in lua are doubles 😭
search for ``getAmount of non-table`
and it's all about getAmount()
i mean printing is wise and very useful but the debugger lets me check values i didn't even know i needed to check when i wrote the code
wdym ?
from the debugger you can inspect all local variables
particularly including looking inside tables and seeing field values on java objects
It lets me know things I’m fucking up that I didn’t even know I was fucking up in the first place.
Like I said, do make a guide about it, really, the menu is so dogshit I never figured out how to even use it
I mean for me, if it errors, that means I need to check it out, that's it
Never had a need to look inside anything else, I already print stuff and shit
The log is for data you know you wanted, the debugger is for what is actually happening.
Real time tests with reloading lua in-game and done
Again, y'all give me this fucking argument and I don't even know what it's supposed to mean
I never had a need for this shit, printing always gave me all the info I needed
*if* you knew you had to print that info in the first place
half of the time that means you need to add prints to everything to see what's going on, and then re-run the code
And again, sure do make a guide on how to use this dogshit interface that a gnome would have made better
with the debugger i can quickly just look at everything whenever an error happens
Hell yeah, string.format("%.2f", unformattedDouble)
LOG : Lua f:145, t:1736046800965> 170.40
LOG : Lua f:146, t:1736046800982> 170.30
LOG : Lua f:147, t:1736046800999> 170.20
LOG : Lua f:148, t:1736046801015> 170.10
LOG : Lua f:149, t:1736046801031> 170.00
LOG : Lua f:150, t:1736046801049> 169.90
LOG : Lua f:151, t:1736046801065> 169.80
Whatchu got against gnomes damn
me too when i use debugger mainly, i want to jump to something easily and i can see everything inside of, so i can know what functions i can use next
i'm definitely excited to see a more professional debugger since the current one is a little buggy and has some limitations but it's a massive help already
I get it, and I will never try to learn this by myself, I tried already and I really can't use it, nothing makes sense to navigate. The door is open for a guide on how to use it tho
shit my typing is so slow... i cant follow you XD
The new debugger looks fun to mess around with as well haha
Sure do make a wiki page about it if you all find it so useful, that'd be amazing
btw, do any of you guys know how to set breakpoints on tables in the debugger? i've seen so much code for it but i've never found where you actually do it
it seems like you're supposed to be able to catch whenever a specific table gets read from or written to
Nothing, they are doing a great job in fact
Now there is a LOT more to debugger. But this is a super quick overview of using it.
How do you open tables ? What does it look like ?
you double click them in the locals/object stack
double click and you will be able to open.
for example, i clicked xplist to open and see what is inside of xplist
So i was able to figure that xplist is not 'nil' and it has getAmount() function and value of amount is 5 with int
I'll give it another go once I can, but I swear clicking anything in this menu will send you to the backrooms
You just get instantly lost
Lmao it’s incredibly frustrating at first. It took me a long time to parse it especially since I’m not from a programming background.
My experience has been more than negative with this menu in the past, it's an instant uncheck "Break on Error" and continue button
i had no idea our debugging styles were so different
anyway, just want to back to my thing,
java.lang.RuntimeException: attempted index:
getAmount of non-table:
zombie.scripting.entity.components.crafting.CraftRecipe$xp_Award@49dbf3df at KahluaThread.tableget(KahluaThread.java:1667).
so it looks unusual, because it's too long whatever its meaning.
this is usually i've seen for non-table error
java.lang.RuntimeException: attempted index:
hasTag of non-table:
null at KahluaThread.tableget(KahluaThread.java:1667).```
Do you mean I tried to go too deeper inside?
yeah, xp_Award is a nested class that isn't itself exposed
if you use my starlit library it can read fields from unexposed objects and you'd be able to get them that way
oh okay now puzzle fits together
need to think little bit more because what you said is I've never heard before. :p
How do I modify script templates? I tried modifying template = GasTank, earlier with
template GasTank,
part GasTank
{
itemType = Base.NormalGasTank,
container
{
capacity = 31.7,
}
}
```but it was throwing an error.
so this must not a report thing, right?
#1318920979581501502 message
it should be exposed, it's weird that we have to do this, it's unlikely unintentional and definitely worth requesting if not reporting
ooh i see clearly. btw that's why I love here. I learned absolutely new thing today again. thank you Albion and sir doggy jvla
field access is probably one major exploit discovery away from being disabled anyway LOL so we shouldn't get complacent with needing to use it
It can be pretty crazy to see how different people’s workflows in general are while still often coming to the same conclusion.
Do you use item:getTypeString() to check for a specific item, or is there a better way?
item:getFullType()
I want to discuss with you an important mental model. It is a means by which we can understand and evaluate risk.
It is called the 'Swiss Cheese Model'. In any situation where grave risk is involved, one cannot rely on a single layer of protection and protocol.
A howling storm in the dead of night cloaks the sound of a zombie picking a hole in your perimeter, boards landing quietly into sodden mud and infested boots shortly behind them.
It slips through a hole in one layer of cheese. Each layer of defense will, inevitably, have holes. With a risk as constant and serious as we face, single points of failure are death.
But here, you are wise. The infected bumbles about, sifting your fresh scent from the night rain. It has clearly learned to follow the cracks of light, for which it hunts.
A gleam, in the dim. Your lights, pouring out through bars of steel much too thick for it to punch through, but it doesn't care. It sees gaps. Its hands thunder through the gap.
Hissing, snarling, pulling, its arms nearly coming apart against the might of the unyielding steel. You stir, and stalk towards your window, slipping a spear off a nearby table.
Through the bars, and between its eyes, an effortless and easy kill from behind the safety of the second layer of cheese. Perhaps you could use a third, though.
Four, maybe eight nails the next day--a much lighter cost than your life.
Heed my wisdom, and carefully manage the alignment of your cheese, survivors. [light, warm chuckle...]
Stay safe. That is all. Next up... ```
working on radio dialogue for the upcoming update to mfteotw :3
LOL nah this is dialogue for a mod
I turned on my gpt
God DAMN there's so many more zombie sounds than I thought
I'm trying to add a zombie sound replacer to my mod as an optional thing, but I'm the one doing the voices for it so I'm gonna have to recreate over 400 zombie sounds...
yeah its a nightmare
I'm trying to make a mod that basically makes the zombies look/sound like they have tuberculosis on crack so I'm gonna have to do 400 something different variations of coughing and wheezing-
My poor throat lmao
Is blood spray or rain puddles in any form recreate-able
Or is it all so hardcoded that it's either impossible or not worth it
I think i spent too much effort to make this stupid thumbnail lmao
More QoL mods! 
It was annoying me how some items were smeltable and others werent and it was a guessing game haha
Um, how do you actually publish to the workshop? Can you do it in the game?
Yes. You can transfer your mod to Zomboid/Workshop and then go to the game.
Yeah straight from the main menu 🙂 You'll need a preview.png you can make from your poster.png
preview.png can only be 256x256 (Steam limit), poster.png can be 512x512.
How do I add additional images to the page?
Hmmm alright I uploaded it but Im not sure how long it takes for it to actually get out there
in my experience it doesn't matter how well you explain the mod in the description, the average commenter can only look at the pretty pictures
any1 know how to insert into distributions?
proc distro is fine but i cant insert into distributions without nuking the whole list
Is it normal for Steam to make a phantom private listing after I uploaded it in the game lol
no
Hmmm
did u change the workshop.txt from private to public? or vice versa
oh this just is a nothing file nvm tf
word on the street is that it's slightly more feasible to make new 'scenes'/world story events in b42, is that true?
a la parties/suicide scenes/etc in houses
Someone on the bug report forums figured that UseDelta was actually being stored as number of remaining charges... by a short int. Which can be fixed by adjusting UseDelta so batteries have fewer than 32767 max charges.
I havent touched anything modding related today. Ive just been playing 😄
Thanks for that mod Dr. I kept wondering why my cars battery kept getting drained
How can I add a custom idle animation based on custom variables? Like a character shaking if they have the plague. Would I have to make it a timed action?
Yeah, this is how I have one of my gun cases set up. I edited the file to show how it's done for just one for the purpose of this screenshot, but my full GunCases.lua has all of my custom gun cases in it if you want to see the whole thing.
my file is almost the same but without the requires and relies on a proclist
im making a few edits and will check. if that doesnt work then im out of luck
After you've set up your distributions you'll need the regular table.insert into proceduraldistributions too.
And yeah I probably don't need all of those require lines but I slapped them in there just for the ol' "better safe than sorry" idea
Shouldn't a very simple lua code like this be enough to make a crafted item have less than its full uses left? Anyone has any idea why when crafting this, the item still appears with all its uses?
function Recipe.OnCreate.MakeConsumable(craftRecipeData, character)
local result = craftRecipeData:getAllCreatedItems():get(0);
result:setUsedDelta(0.5);
end```
Also what is an easy way to detect if my function is being called at all while crafting? Can I print to the ingame console or something?
print("MyModName: some message")
you'll see if in the LUA console, and also in console.txt
Don't leave those statements in for the release version - it's fine to print messages for one off things, but you want to avoid log spam in normal operation (or add a debug setting that can be toggled on/off as needed.)
It appears like the function is not being called at all. I do it via OnCreate = Recipe.OnCreate.MakeConsumable, in the recipe script. Ideas why it is not being called?
Never done that with recipes. I've done it with items that call a function when they are created.
OnCreate = NepDIYSpecialLootSpawns.NepDIYOnOnCreateBSToolsSchematic,
am i cooked or? the proclist does work. verifiably. as does depositbox and depositboxes is the room
I also made my own set of functions instead of adding to the existing function table.
all = was a test to see if it worked at all
Shouldn't need to do that, but might matter.
Does lua let you add a table to a table that way?
I thought you had to iterate and call insert on each element, or is distributionTable a single top level element being added?
is the file in the correct location? that should be correct so i'd question if the file is loading
I may be 100% wrong... but I 100% know I hate lua tables. Which is a problem, because lua is 100% made of tables. 🤣
Yeah I'm lost as well. I just have cases that have specific stuff in 'em.
Thanks for the help. It is in the correct location. I now found the issue. It appears you can't use /* and */ to comment stuff in Lua. The function was called but created errors and therefore never was executed fully. I found out I need to use -- for comments in lua.
multiline
comment
]]--``` also works.
Awesome, thank you
i have no idea what i did but it works
spot the difference lol
That's always the best result. I have zero idea why but it works 😄
yall know where moodle icons are located
media/ui/Moodles
i look in ui but theres no moodles file
no but there's a Moodles folder, ya silly sod
ya
ik
i call em files
unless im blind i dont really think they there
or maybe i am
who knows
Oh, are you in B41 still? Because then idk
nah im asking cuz imma replace b42 moodles with b41 ones
b42 moodles are a bit uhhhhhh
i mean
it looks like this
you know
it doenst fit in
like who thought this one was a good idea honestly
i wanna replace em
waitaminute, so you did find them
Right
only moodle i could find in b41 folders are the windy one
i can find the code for moodles in the .class files but the icons seem to hide from me
Yeah somebody in here joked that B41 moodles are more hardcoded than anything else in the game. I mean they could be in one of those texturepacks I suppose?
not the hardcoded pixels
lmao
yeah not in the texture packs
nah this shi does not exist bro
Is xp gain, java or lua script?
It would be stored in the java object but lua can addXP
declaration: package: zombie.characters, class: IsoGameCharacter, class: XP
Harvesting plants give no xp
What is your goal with XP?
Is it meant to give XP?
Yep
yeah farm xp when harvest
Yep, I just debug myself some Agriculture levels because not a single blooming crop has given me a point of xp
media\lua\shared\Farming\TimedActions\ISHarvestPlantAction.lua
Thank you stalker i will delve in now
if plant then
SFarmingSystem.instance:harvest(plant, self.character)
-- we successfull harvest our plant, we may gain xp !
if isPlayerOwn then
SFarmingSystem.instance:gainXp(self.character, plant)
end
end
Throw some debug print statemenst in there and see what's going on.
It is possible that the java side is borked, but you can at least poke the lua side.
im worried because it says may gain xp
ooof
That is harsh man xD
Farming is utterly terrible now 😂
Well the chance is less than 0 then because I've harvested something like 60-70 blooming crops by now
"I think I'll be hungry in late 1994, better get started farming"
Oh intresting
I love how all 3 found the code related to it almost at same time
Meanwhile the dairy farmer is drowning in butter, the fisherman has huge piles of 30lb rotten fish fillets because he can't eat it all, the scavenger hasn't run out of canned food and dried beans yet...
This is how I made unloading magazines give the same xp as loading 'em
local chance = 5;
local xp = 1;
if self.character:getPerkLevel(Perks.Reloading) < 5 then
chance = 2;
xp = 4;
end
if ZombRand(chance) == 0 then
addXp(self.character, Perks.Reloading, xp)
Where is this line of code
ISHarvestPlantAction.lua
No the sfarmingsystem. instance
ah
media\lua\shared\Farming\TimedActions\ISHarvestPlantAction.lua
God your a legend thank you
No i know that one the sfarming.instance
You start to get a feeling for where things will be/what the files will be named.
media/lua/server/Farming/SFarmingSystem.lua
Nvm i found it 😄 thanks rainmaker
And then you find that the pencil isn't in items_literature, or items_office, or items_misc... it's in items_one_handed_stab
John Wick reference ftw
-- add xp, depending on the health of the plant
function SFarmingSystem:gainXp(player, luaObject)
local xp = luaObject.health / 2
if luaObject.badCare == true then
xp = xp - 15
else
xp = xp + 25
end
if xp > 100 then
xp = 100
elseif xp < 0 then
xp = 0
end
addXp(player, Perks.Farming, xp);
end
WTF who names a variable "luaobject"
Might as well name it "variable"
So xp gain is tied to the HP of the plant, am i reading that right?
yes.
Is Elseif Supposed to itself?
xp = xp - 15
MINUS 15 xp?
"Bad care", goddamn things got to blooming without a hitch. Watered 'em every other day too
You screwed up that plant. You learned nothing. Infact, you unlearned stuff.
Actually, I don't care... I tried to grow every crop that could be planted in august, the only thing that sprouted was kale and I hate kale.
I'm now on a diet of butter for calories and 1/4 a can of softdrink for everything else.
quick question, how can I fix this?
Axe is wrong diraction
So it's 100 xp / 2 + 25 = 75? I am so new to this so feel free to laugh 😄
offset rotate
I think I'll mod in 50mL shot glasses so I can drink my life sustaining blueberry cola in style. (and also, it would be a shame to be able to mix alcohol and not make shots)
Turn it in Blender
or that
Imo better to do that in Blender
What hair is this if you don't mind me asking?
(i do have my priorities straight)
Wednesday
Could anyone tell me how to code checking the players inventory for particular items and then equipping them? Been trying getInventory() and getInventoryitems() but doesn't seem to work
I was trying to create it with chatgpt and giving it all the information about fishing, from the client/shared/server files plus all the information that you sent me on the web. also using the simple ui library mod I couldn't detect the interface well either. I have no idea about programming but I already made other codes for other games with chatgpt and it worked for me. It's my fault that I don't know how to give you the prompts correctly.
what does elsief mean?
else if
well that spelt it wrong
if the first if doesn't take, then the else if can check another condition
tHaT tHInG No HapPEn ThEN ThiNg hAPPeN
if condition then
perform the thing
elseif anotherCondition then
perform the other thing
end
optional: an "else" at the end which will trigger if nothing previous matched.
Nevermind i can't read hahaha
forgot "do" is keyword lol
Omg, I'm bout to screamcry lol.
Been troubleshooting my code for about an hour, only to find out, getWornItems() just doesn't seem to get masks? wtf.
Would be even more fun it it returned all equipped items except masks, and all masks with condition low enough to be (worn)
printing out the output would help 
Hey I'm no longer axe


<log when I put mask on >
LOG : > Belt2
LOG : > Tshirt_WhiteLongSleeveTINT
LOG : > Socks_Long
LOG : > Shoes_TrainerTINT
LOG : > Shorts_ShortFormal
LOG : > PPE score is : 0
< log when I take mask off >
LOG : > Belt2
LOG : > Tshirt_WhiteLongSleeveTINT
LOG : > Socks_Long
LOG : > Shoes_TrainerTINT
LOG : > Shorts_ShortFormal
LOG : > PPE score is : 0
and my net connection just hiccuped lol
Can line of codes have double =?
yes
"==" is an evaluation, used to check if one value is another value.
1 == 1 comes out as true
1 == 2 comes out as false.
might I recommend reading a bit about programming? There are websites that can teach you the very basics in like 30 min, will save you a lot of question in here (because if you ask what's == and how if works you'll be asking another 300 questions)
but you do you
Can i have a link please as i am eager to learn
something like this and start going down
https://www.tutorialspoint.com/lua/lua_basic_syntax.htm
Thank you kind sir
all of these sections will answer like 60 questions that you might have if you never coded
Top man thank you
and if you need some clarifications feel free to ask here or chatgpt, it's very good for this kind of thing, just start msg with "I'm learning how to code and I'm starting with lua, can you explain XYZ"
it shouldn't make any mistakes when it comes to basic concepts of programming
Wow i have never used chatgpt before i just put in the code, and has already came up with 4 likely errors, thats insane
I'd recommend asking it to explain the fixes it makes so you understand why it should be this way and not another
Well its the TIS code not mine
keep in mind that TIS code is meant to be working with other 300 files that chatgpt doesn't have access, and while it can usually understand and explain what's going in inside the file it's pretty much guessing based on context (which it can do good but then again it doesn't have other files)
yeah i kind of guess that.
but ye i sometimes send it code blocks that i want it to explain and it does pretty decent job
tldr: chatgpt is a tool, not a solution
I threw the lua problem I've had for 12 days now at GhatGPT and it gave me several ideas to try 😄 That is pretty rad
yep
I found GPT super useful as a tool for accomplishing busy work.
"Hey GPT, Here is a list of items I have, format it in (whatever format)"
Then I don't have to hit CTRL v 150 times to make a lua table
Where would i find Perk.farming
wdym?
farming is probably scattered across multiple files
its not like there's a file with farming and everything is in it
it's not that easy :D
Wish I knew this before I manually inserted skill books to every single possible library table 😂 🤣
Telling me brother 😄
FUCKKKKKK
function SFarmingSystem:gainXp(player, luaObject)
local xp = luaObject.health / 2
if luaObject.badCare == true then
xp = xp - 15
else
xp = xp + 25
end
if xp > 100 then
xp = 100
elseif xp < 0 then
xp = 0
end
addXp(player, Perks.Farming, xp)```
Nailed it
So, My base assuption about adding like, a ton of code to execute on the "OnPlayerUpdate" event is gonna cause performance issues isn't it?
I've been avoiding it mostly, but checking distance between objects etc.
for what reason? is it important to have it being 100% updated all the time?
you can also have it be on every X playerUpdate by manually skipping X updates
i try to avoid anything more frequent than everyOneMinute
this is the only code that i have in 4k lines that's OnTick 
---Function responsible for processing Pain Tolerance execution logic
local function painTolerance()
local player = getPlayer();
local PainTolerance = player:HasTrait("PainTolerance");
local stats = player:getStats();
local pain = stats:getPain();
if PainTolerance and pain > SBvars.PainToleranceThreshold then
stats:setPain(SBvars.PainToleranceThreshold);
end
end```
should just be > actually

Yeah, that's kinda what I have been doing.
At this point OnPlayerUpdate is just running math. raising a number by a predetermined amount based on a playerdata variable, or lowering it if the varable is 0.
All the other stuff, checking the distance, setting the variables on the player etc is done in EveryMinutes and EveryTenMinutes
Working on my own version of an airborne infection for the expansion to They Knew
i mean would it be terrible if it's every minute?
I'd rather have slightly less accurate math and less performance strain than other way around, but that's just me
probably not lol. I can just mess with the numbers.
Pretty much why I asked. I was feeling off about running the data THAT often
---Function responsible for managing Cat Eyes trait
---@param isKill boolean
local function catEyes(isKill)
local isKill = isKill or false;
local player = getPlayer();
local nightStrength = getClimateManager():getNightStrength()
if nightStrength > 0 then
local playerNum = player:getPlayerNum();
local checkedSquares = 0;
local squaresVisible = 0;
local square;
local plX, plY, plZ = player:getX(), player:getY(), player:getZ();
local radius = 30;
local modData = ETWCommonFunctions.getETWModData(player);
local playerIsInside = player:isInARoom();
local hasEagleEyed = player:HasTrait("EagleEyed");
local thisMinuteIncrease = 0;
for x = -radius, radius do
for y = -radius, radius do
square = getCell():getGridSquare(plX + x, plY + y, plZ);
checkedSquares = checkedSquares + 1;
if square and square:isCanSee(playerNum) then
local squareDarknessLevel = nightStrength * (1 - square:getLightLevel(playerNum)) * 0.01 * (square:isInARoom() and playerIsInside and 2 or 1) * (hasEagleEyed and 2 or 1);
squaresVisible = squaresVisible + 1;
thisMinuteIncrease = thisMinuteIncrease + squareDarknessLevel;
end
end
end
modData.CatEyesCounter = modData.CatEyesCounter + thisMinuteIncrease;
if detailedDebug() then
if isKill then print("ETW Logger | catEyes(): was triggered by a kill") end;
print("ETW Logger | catEyes(): Checked squares: " .. checkedSquares .. ", visible squares: " .. squaresVisible .. " with total darkness level of " .. thisMinuteIncrease)
end;
if debug() then print("ETW Logger | catEyes(): CatEyesCounter: " .. modData.CatEyesCounter) end;
end
end
i got this every minute
checking visible squares
it worked fine with on tick but i still opted for every minute cuz math accuracy lost was negligable and checking 900 tiles every tick is not a good idea
you'll (probably) find farming getting exp in files that manage farming actions
like planting or whatever
Yeah its that code that i showed you, but it's not working as intented
dis?
Indeed
what about it
It does not work
how do you know
Because i have planted 4 crops and grown to the last stage, and got nothing when i havested them
Rainmaker has planted and harvested atleast 60 and got nothing also @ornate sand are you using uncursed plants?

Uncursed, tasty and great wabbit bait too
😄
With that code would the xp gain be 75 if a plant hp is 100?
Just as another data point, did you all see that farming doesn't give any xp for plants YOU didn't plant?
You don't get xp for your own plants 😄
I wonder when you plant them its giving that function tho
🤔
Like all plants are not yours regardless if you plant them or not
you can always just edit the function and add printouts to check
-- add xp, depending on the health of the plant
function SFarmingSystem:gainXp(player, luaObject)
local xp = luaObject.health / 2
print("aaaaaaaaaaaa | xp = "..xp)
if luaObject.badCare == true then
xp = xp - 15
else
xp = xp + 25
end
print("bbbbbbbbbbbb | xp = "..xp)
if xp > 100 then
xp = 100
elseif xp < 0 then
xp = 0
end
addXp(player, Perks.Farming, xp)```
then jsut check in console
Oh good shout
-- local i = self:getLuaObjectCount()
-- while i > 0 do
for i=1,self:getLuaObjectCount() do
if not self:getLuaObjectByIndex(i) then break end
local luaObject = self:getLuaObjectByIndex(i)
if luaObject then self:checkPlant2(luaObject) end
end
local i = self:getLuaObjectCount()
while i > 0 do
if not self:getLuaObjectByIndex(i) then break end
local luaObject = self:getLuaObjectByIndex(i)
if luaObject then self:plowFadeCheck(luaObject) end
i = i - 1
end```
Is that the code for planting?
bollocks to it just going to give myself 75xp per harvested plant in debug
^
😄 Thank you music
Ok, Harvest happens in ISHarvestPlantAction.lua
Lines 55 - 83
function ISHarvestPlantAction:complete()
local prop = farming_vegetableconf.props[self.plant.typeOfSeed]
local lootPosition = "Low"
if prop.harvestPosition then lootPosition = prop.harvestPosition end
if lootPosition == "Low" then
local skill = self.character:getPerkLevel(Perks.Farming)
self.character:addBackMuscleStrain(1 - (skill * 0.05))
end
local plant = SFarmingSystem.instance:getLuaObjectAt(self.plant.x, self.plant.y, self.plant.z);
local isPlayerOwn = false
if isClient() then
isPlayerOwn = self.character:getOnlineID() == plant.owner
else
isPlayerOwn = self.character:getPlayerNum() == plant.owner
end
if plant then
SFarmingSystem.instance:harvest(plant, self.character)
-- we successfull harvest our plant, we may gain xp !
if isPlayerOwn then
SFarmingSystem.instance:gainXp(self.character, plant)
end
end
return true;
end```
You could grant yourself XP there.
Is there a way for me to change the fluid values of containers without replacing the item?
what language is this?
LUA?
I'm assuming you can target the value using lua script, but idk anything about scripting
WARN : General f:5771, t:1736087013007> AnimatedModel$AnimatedModelInstanceRenderData.initMatrixPalette> skinningData is null, matrixPalette may be invalid
what does that mean? xd
looks like it's trying to render an animation that doesn't exist
hello, in serverside doesn't exists Events.EveryOneMinute?
warns can be ignored usually
It does
Does anyone know if it possible to create a mod that makes a day length in PZ to 1 hour and 30 minutes?
I hate playing on 1 hour length, but 2 hour length seems too long 😦
Someone help me understand why TIS does this in IsoPlayer? They are comparing the player instance to the player object?
protected boolean playerIsSelf()
return IsoPlayer.getInstance() == this;
end
Hello guys i'm trying to add my items to conteiners but i got this error B41
I got a mod suggestion a way to produce cars with the use of a factory line using a mod called Industrial Revolution
could someone tell me how to make custom masks to hide calf part of the legs? I somehow managed to make boots in blender, what's even more surprising to me is they do work in game 😆 The issue is they only reach up to knees, so i can't use the default masks, cuz that would hide the thighs. Here's a screenshot of my issue:
Hi, I was trying to fix the Trolleys mod, I have fixed part of the code and used the "KitsuneLib" library (it's Tsar's but updated for 42b) for the moment everything works, but the animations are not applied, I don't know if it has changed, I have tried to contact the original author but I see that he has not given any signs of life for more than a year 😭 
Is the cache folder:
[SERVER] LOG : General , 1736097038807> 10.822.431> cachedir set to "C:\Users\Kaori\Zomboid"?
Okay, I place the file in the folder C:\Users\Kaori\Zomboid\Lua\file.lua, but it is not loaded when the server starts.
If I place it in C:\pzserver\media\lua\server, it gets loaded, but it is detected by the checksum. For local testing, this isn't a problem, and it works fine, but if someone else connects, they'll get kicked due to the checksum.
However, there are still some things that don't work. For example, if I try to call the getFileWriter function, it is not invoked; it doesn't exist in this file's context. Am I doing something wrong?
Also, the EveryMinute event function doesn't work when the file is placed there, but I can handle the OnClientCommand function.
I want to load a server-side script without using a Workshop mod and load the client-side script with a Workshop mod. Is this the only way to do it?
Is what I’m trying to do too far-fetched, or is it simply not possible? Or am I doing it wrong?
Am I supposed to make a mod that uses loadstring() to load this from the cache folder?
Sorry for the long message, but I’m increasingly confused. The documentation for Project Zomboid is basically nonexistent. 😦
to the last question, yeah
you'd use getFileReader to read the file in the cache directory and then use loadstring() to execute it
i don't know what specifically this is being used for but there are four players in splitscreen and only one is the instance - i don't know exactly how much of the code this affects but i have seen areas where they just loop through all players and set each to the instance before calling some functions, presumably to patch around old code that just targets player instance instead of e.g. passing a specific player as an argument
these things not existing/not working is not a known issue to me, but basically you want to create a mod that runs only on the server that loads files from the cache directory and runs them - all the users have to download is the mod with the loading code, they don't need or even see what's in the cache directory
I believe its because that's called from IsoCharacter so its checking if character object is the player or not would be my best guess. For example IsoCharacter could be used for a npc or animal or something, in which case IsoPlayer.getInstance() == this(IsoCharacter) would return false. Also i think IsoPlayer.getInstance() == this would return false if IsoPlayer.getInstance() was null or has not been created yet.
I looked in the java and playerIsSelf() is called from IsoGameCharacter. Since IsoGameCharacter is a base class for IsoPlayer and IsoZombie then the correct answer would be an IsoZombie calling playerIsSelf() would return false while IsoPlayer calling playerIsSelf() would return true
protected void initTextObjects() {
this.hasInitTextObjects = true;
if (this instanceof IsoPlayer) {
this.chatElement.setMaxChatLines(5);
if (IsoPlayer.getInstance() != null && !(this instanceof IsoAnimal)) {
DebugLog.DetailedInfo.trace("FirstNAME:" + IsoPlayer.getInstance().username);
}
for example this instance of IsoGameCharacter is checking whether it currently represents a player or an animal
Makes a lot more sense now. I havent even looked at B42 code yet.
if I want to override and existing base recipe with once I want to us can i just use
Override:true, ?
from what I know it doesnt exist anymore for b42
was also looking to override a vanilla recipe aswell
Yup same here, couldn't override them anymore. 😦
this is for b41
for example
I want to used this base one because it is half the time to do as the MCH one is way too long
For B41 yeah, override:true, should do it
does anyone know how to mark a literature item as read?
where can I find the base game recipe list file?
anyone know of a method to determine if two isoobjects are in the same room?
steam\steamapps\common\ProjectZomboid\media\scripts\recipes
thats for b42*
exacly
obj:getSquare():getRoom() == obj2:getSquare():getRoom()
Ah! Ok that makes sense, I saw that in java IsoObject has some room methods, but they don't seem to be usable in lua
Not sure whom to ask here - it's an Indie Stone question I think. I'm updating a somewhat popular mod (furry mod, about 100K users) to b42. That's going well enough.
However I was also investigating if it was possible to get rid of the clothing approach now that b42 has animals with custom models.
But (in Java - I'm a professional Java developer) the method ModelManager#getBodyModel(IsoGameCharacter) still ignores HumanVisual#setForcedModel and just uses the default player models.
Given b42 is in development, I wonder whom I could ask to see if we could have a backdoor to allow for player characters to honour HumanVisual#setForcedModel?
If you manage to do this without causing the Aiming = game crash issue then you'll have solved a very big issue for player models
you can make suggestions in this thread https://discord.com/channels/136501320340209664/1318920979581501502
I’d be surprised if they did allow this; but as Rainmaker and Albion said if you suggest it and they allow this then it’ll open the door for a lot of different model options.
I looked into it myself quite a few times to little luck.
if I want to be able to use any combination of items for a recipe that requires 5 garlic
could i just do
WildGarlic2/WildGarlic=5,
so if i have either comination of these two items it should work?
You should specify which version you want to make it for, B42 might allow it but im not 100% sure, while b41 would probably require lua for testing maybe?
hmm okay yea looks like the mod herbalmedicine has like WildGarlic but there is also WildGarlic2 so trying to make it so you don't need 5 of each different one
will try this if it doesn't work can always adjust
Is it possible to add custom vehicle sounds?
Hi, is there anyone here who understands b42 recipe scripts? I'm having trouble with mine. 8 recipes and I could only get 1 to work.
Ehh, I know how to turn item A into item B, or items A, B, C, and D into item E, or 50 item A into 1 item B but that's about it 😄
Well all im trying to do is craft alcohol out of yeast, sugar, water, etc
along with a few extra recipes that let me craft those ingredients. I was able to turn canned corn into "take Corn out of can" lol
Ahh yes, the new liquid system causing issues like Liquid Snake himself
Is it the water thats the problem?
Try to take a look at vanilla recipes that use water?
sound
{
engine = VehicleEngineSportsCar,
engineStart = VehicleEngineSportsCar,
engineTurnOff = VehicleEngineSportsCar,
horn = VehicleHornSportsCar,
ignitionFail = VehicleIgnitionFailSportsCar,
}
``` just add something like this in the vehicle config and put the custom sound files in the media/sound as .ogg
Thanks. This car is about to sound sick as heck.
After you finish your super car throw together something that sounds like this majestic thing
Id totally use that if it was a mod
found some issues with the wine base code
still cant get the recipes to work tho lol
is there a way to import vanilla animation into blender? or at least a pose of first frame
Why did this work for a few attempts and suddenly not anymore?
if weapon:getFullType() == "Base.M60" then
😦
can someone help me with this please
Engine? For when the hood is open (if animated) or uninstalled?
How do I make that appear in my model? Do I have to model a separate hood lid?
No idea but I know that KI5 had animated parts so it was possible in B41 at least
#modeling will be better place to ask
Can I share a recipe script for someone to look at? is that possible
just wondering what Im doing wrong
Dunno why I made this, but I did. God bless the guy who created animation guide.
How would I be able to make some sort of vehicle armor?
So I'm noticing there's no longer highlighted targeting with firearms in B42. While I understand there is a new reticle system for mouse and keyboard, for controller players atm there is no way to figure out which Zed you are targeting with a firearm. Would this be an easy mod to make, to bring back highlight targeting for firearms/ranged weapons? Or am i overlooking a setting they have changed 🤔
seems like its only for mele now
Why does that error message appear after I set wpn:setAttachedSlot(1); ?
- the item is being properly attached
- did you even read the error ?
Excuse my ignorance, but I started this PZ modder thing 2 days ago. I've tried clicking on the error pop-up but nothing happens.
yoo how do i add occupational clothing?
ClothingSelectionDefinitions.lua
ty
That's fair
The red popup is an error
It appears in the console
Inside %UserProfile%/Zomboid
Check console.txt
you can also view it by hitting F11 then errors i believe
I think it's something related to getAttachedItem.
The errors tells which part of the code the error happens
The exact line
🤔
Not quite sure what is going on here.
- We know
playeris notnil. - We know
self.chatElementis notnil. - We know
self.chatElementhas an object. - We know
update()is a valid method.
java.lang.RuntimeException: attempted index: update of non-table: zombie.chat.ChatElement@11870995 at KahluaThread.tableget line:1689..
if not self.chatElement then
self.chatElement = player:getChatElement()
end
self.chatElement:update()
https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#getChatElement()
declaration: package: zombie.characters, class: IsoGameCharacter
We might need more info
chat element is not an exposed class
not all getters are for lua
How do you know if its exposed or not? Its not static.
i just check my decompile, LuaManager.Exposer#exposeAll() lists every exposed class
also if you have umbrella it doesn't create class definitions for unexposed classes
I feel like I need to to pickup Umbrella but I keep telling myself, "After I finish this project."
it's not something that would interfere with any projects, since it's an ide extension, so you can install it no problem
Ahh, i was thinking about PipeWrench
I thought food recipes were the simplest scripts to make. Even with b42
what fucking piece of shit
made the capitalization
completely inconsistent
why is this an issue that is throughout the entire game
just choose one case format
and stick with it
it's really not that hard
Lol
(B41)
Is TileScale ever not 2?
https://github.com/piromasta/PZDecompiled/blob/4a130973322f57ade82a9a313cb1360c79fd80db/zombie/core/Core.java#L222
https://zomboid-javadoc.com/41.78/zombie/core/Core.html#TileScale
they have the entire game decompiled on github? that's not legal 😅
in b41 it can be 1 if the player has double sized textures disabled
in b42 they removed the option entirely
Interesting, that explains why its not exposed
how can I solve attempted index: playSound of non-table: null
lua code I used
require 'ISUI/ISEmoteRadialMenu'
require 'SFsound.txt'
player:playSound(soundname)
i've genuinely never seen a mod that supports non-double size textures and people accidentally turning it off causes a lot of bug reports
require 'ISUI/ISEmoteRadialMenu'
require 'SFsound.txt' --This is wrong
player = getPlayer()
player:playSound(soundname)
you didnt set the player object and soundname needs string.
You also don’t need to use requires; and requiring a .txt doubly does nothing.
Won’t hurt anything. But it’s pointless.
heyoo, I'm looking to code the groundwork for a server economy, useable ATMs.
I checked out an ATM in game in debugger mode, but its parameters seem totally empty, and the item itself seems to be cosmetic.
Does anyone happen to know where I could find the script entailing the ATM entity, or the tile spawn on the map for it?
hice una guia con logros ficticios para quien se quiera platinar este juegazo o simplemente hacer algunos desafios valoren positivamente porfavor me costo un par de horas pensar los 60 logros
https://steamcommunity.com/sharedfiles/filedetails/?id=3399956905
archivements to project zomboid
im still getting the same error, I set my playsound(soundname) to module base
{
sound Soundname
{
clip { file = media/sound/Griddy.ogg, }
}
}
I'm not understanding the issue at hand
might anyone know where the ATM is located in the base game files?
can packed textures replace ones that are pngs by default?
you mean like the texture for the tile?
I think the ATM is just fully cosmetic right now lmao
hardly any parameters, and they're mostly blank
I couldn't find it mentioned in any entities
yep its entirely cosmetic tmk
but I'm hoping to find the object in the game files, and add an interact button for my own ATM interface
I'd just need to find where the ATM is in the game files
like the tile entity
or even if I could just find the cosmetic skin, I could introduce my own entity and texture it with that ATM
might anyone know where the ATM is located in the game files?
I took that screenshot for the parameters of it
but the steam screenshot came out low quality Xd
Like any other tile; it’s going to be assigned to a tilesheet and have an associated tileID
You can view tilesheets ingame with the brush tool and you can unpack them in tilezed
You can also pull its tilesheet info with the brush tool by right clicking it and viewing which tilesheet it’s on.
do you know where I can download tilezed?
its a 3rd party mod right?
It’s in zomboid modding tools
How does one add the workshop ID to the mod.info so it shows up in the B42 Modmanager?
On Steam, make sure you filter for Tools:
Anyone here know anything about b42's recipes? I got a script I need help with. Its a tool to take food out of cans
the workshop id isnt used yet
I don't think you have to change anything inside of mod.info for B42. just copy and paste B41's
thanks!
Ah I see thank you guys
I've got another noob question lol
I'm in game in debug mode
how do I use modding tools like tilezed?
You launch them from the folder they are downloaded to
Check this channel out. Was very helpful for me:
https://www.youtube.com/@daddydirkiedirk/videos
Is this the right place to ask for help with scripts?
thanks!
I have no idea why only first recipe works and anything else doesn't. they just doesn't to be appeared?
Nope, only the first one appear in the crafting table
Yah but its convoluted formatted like that. Use the triple dot highlighting or something like https://pastebin.com/
Did you get no errors? Check your logs, they could have occurred while it was loading.
you can't find them in Craft Recipes in debug menu too?
Yes, I was in debug and only the corn showed
😬 
Ive been getting errors all day in between editing the file. Sometimes it prevents me from starting the game because the file is messed up
I'll just keep working on it
I'm watching a youtube tutorial about tilezed, but it seems to be speaking only about custom made maps made by the user in the map editor.
Does anyone know if I can just load a default map like Muldraugh?
Is there a way to allow all books as an ingredient in a crafting recipe? Just like "SharpKnife" accounts for like 20 different knifes without mentioning them all. Is there something similar with book? Because there are like 50 different books or more.
My mod apparently causes thousands of errors on steamdeck but not PC. Anyone know why this could be the case?
Ive been trying to upload my mod to the workshop but it says it doesnt have a mod.info file when it does.
Also are the modding tools from steam good or do i need to look on fourms?
this is the B42 file for my mod, am i doing this correctly? i was able to upload before no problem
would have to see the errors, but im guessing its tied to controls
media folder needs to go inside a "common" folder and the other files need to go into the "42" folder
I am unsure on b42 as ill be waiting
so just create a "common" and a "42" folder and move those files
but ideally you'll make copies instead of just moving, that way it works on b41 and b42
because what you have is the b41 format
yes i have done that
not B42, just 42
lol, no worries
thank you
Guys, which parameters do I modify so that the suspension doesn't go so low when braking or stopping?
mass = 1490,
brakingForce = 120,
stoppingMovementForce = 4.0f,
rollInfluence = 0.25f,
centerOfMassOffset = 0.0000 0.3000 0.1583,
extents = 2.1167 0.8833 4.1500,
extentsOffset = 0.5 0.5,
physicsChassisShape = 2.1000 0.8833 4.1500,
shadowExtents = 1.6172 4.1464,
shadowOffset = 0.0000 0.1524,
maxSpeed = 295f,
engineForce = 4550,
engineLoudness = 90,
engineQuality = 75,
gearRatioCount = 5,
gearRatioR = 4.7,
gearRatio1 = 3.6,
gearRatio2 = 2.2,
gearRatio3 = 1.3,
gearRatio4 = 1.0,
gearRatio5 = 0.73,
steeringIncrement = 0.03,
steeringClamp = 0.3,
suspensionStiffness = 100,
suspensionCompression = 1.83,
suspensionDamping = 1.88,
maxSuspensionTravelCm = 10,
suspensionRestLength = 0.20f,
wheelFriction = 3.0f,
frontEndHealth = 150,
rearEndHealth = 150,
seats = 2,
I havent actually messed with it, but I would guess suspensionCompression
I've made it high and low but didn't notice much difference.
what about maxSuspensionTravelCm
No. Too high and the tires clip through the vehicle, too low and the vehicle goes through the ground.
maybe its just too much mass for that brake force? have you tried lowering both of those a bit?
Yes.
yeah you've probably tried just about anything I can suggest then tbh
one day I'll play with these a bit more, I know these systems need some work
You need to put it into an event function, e.g. it may be player creation event.
Events.OnCreatePlayer.Add(function(int, player)
player:playSound(soundname)
end)
Otherwise you are trying to use player that does not exist yet (at the very beginning of the game).
Apparently I spent too much time modding and not enough time maintaining my generator.
Anyone know what's wrong with this?
if weapon:getFullType() == "Base.M60" then
Is the M60 your custom gun?
Sure is
Hmmm just looks like a simple string check, thats weird
The really weird part is that my function got waaaaaay past that one before, until it randomly decided not to
Null instance?
Can you print weapon and weapon:getFullType()?
if weapon:getFullType() ~= "Base.M60" then
print(weapon)
print(weapon:getFullType())
end```
made this moo... this is my first time using blender. howd i do?
That won't work now either
That is freaking cool 😄
Looks awesome!
workin with a buddy of mine to mk a mod pack. it will be out soon. ill keep yall posted
Can you make it so the player gets damaged on eating a hot hot pocket
im wanting to make the sound of doing something like openeing a door or eating food a meme sound for me and my friends and im wondering how hard it would be to do that for someone who has no experience with modding or scripting
Id reccomend looking for sound replacer mods and trying to see how they did it
ah thats smart
Study the file structure of the base game and also the mods
So it's not getType, it's not getFullType so how in the fuuu~ do I make this silly game check the weapon's gosh darn name 😄
