#mod_development
1 messages ยท Page 311 of 1
In Debug, make sure Health Panel Cheat mode is on. Then open the Health Panel. Right-click a body part > Visual Change > Add Blood.
If the body part has clothing on it, the blood gets added to the clothing item.
Thank you, it is all of the sudden working now for some reason
well i need an example for how to do it since im just starting in lua haha
I see, the problem is it won't apply blood to both the left and right item with BloodLocation = LowerArms when they are equipped at the same time in b41
anyone knows if theres a counterpart for non inventory item containers? like the object containers
i need to limit a container
or maybe an item being on container,.. if theres non then i guess i should make a function to just drop the item on the ground automatically
Do you have one item equipped to both lower arms, or on item on each arm?
If it's two items you likely need the blood locations for each lower arm seperately
You mean inventory attached to items in the world?
Can't remember what they are called in the scripts, but I'm pretty sure that if you add a container it can have an accept function
Like stoves and crates and shelves and stuff
but im looking for something related to world containers
Accept functions
See if the scripts for world objects support them when you add capacity
The wiki page should have some example usage
Nah but you can do it via Lua
You could even link to the timed action of attaching attachments
There should be one I guess
Instanceof inventorycontainer
Or do you mean sprites?
the thing that disallow certain items on containers
you can look at the manage containers mod?
that might tell you how its done i think
Did more digging and seems like adding vehicles/boats on a trailer and unloading shares something with Tsar library not sure what but finding the source and reference will help
i encountered an issue so i might not need the restriction anymore..
basically what im doing is a cooking vat on top of the campfire
at first i thought to change the campfires type but the game automatically changes it back so now im gona need to use the cooking vat and just spawned it ontop of the campfire
oh cool, brewing mod?
moonshine distillery
its overwhelming
i dont know what to look for. like how do i convert the data from campfire to the cooking vat
and then the item its suppose to be cooking
plus i dont know much of food cooking but i know it should be 1 item only per dish right
hmm....i feel like i need to hook onto campfire data
but its got a lot of code
my brain isn't firing on all cylinders yet, but could you check that your vat and the campfire.isLit are on the same square?
thats doable
but the thing is campfires are global objects
so it might die without client knowing
idk
can someone help me fix this lua? easy one
function OnEat_Handwarmer(food, character, pct)
local bodyDamage = character:getBodyDamage()
bodyDamage:setWetness(bodyDamage:getWetness() - 0.001)
bodyDamage:setTemperature(28)
end
How may I enable or disable the digital watch HUD from the debug menu options in-game? I cannot remember where that button is.
what's the question...?
there is no question lol, the code is slightly bugged i need help fixing it
cant figure out whats wrong
well, whats the error/bug?
what does getWetness() and getTemperature() return? start there i guess
those are float values, maybe setTemperature is from 0 to 1? 
You are not understanding what I am saying. What is your native language so I can use a translator to explain the issue to you?
Or not. ๐ ยฏ_(ใ)_/ยฏ
Pretty sure setTemperature doesn't work. Unless they've recently fixed it.
POC of randomized, persistent, procedural in-world license plates. Supports getting/setting the value (so movable from vehicle to another), can be added by just editing the vehicle script. Full range of possible combinations 3x A-Z + 3x 0-9 and two randomized backgrounds
whats the fix or thing to replace it with then?
either my code is wonky or the military base has some more secrets?
those are only squares that have a room
well, nevermind. I guess I never explored below 13. I didn't know it went deeper
Anyone developing an amputation mod for b42?
Anyone know how to get a lua code to check an item condition?
either item:getCondition() or item:getCurrentCondition()
getCurrentCondition for a 0-100% value, getCondition for the item's condition as an integer (more of an internal thing, like scripts)
Thank you, I've been scouering the lua codes for hours, but haven't been able to find it, much apreciated @grizzled fulcrum
declaration: package: zombie.inventory, class: InventoryItem
Thanks a bunch, that website is gonna come in handy
Are there any other websites like this that I can use for PZ modding to feed into Grok3? It seems the more data LLMs have the better it can generate code.
step 1: dont use ai
Can someone tell me why SetTempereture doesn't work?
Yeah, everyone says that, but I have used Grok3 to make two successful mods.
it hurts you more than helps, and when you dont understand the code, you dont understand how to fix errors, so then you are out of luck
and what it was replaced by
what are you trying to do with it
make the player warm using an oneat or oncreat
bodyDamage:setTemperature(temp)
b41 or b42?
42
because in b41, player:setTemperature(temp) is the way to do it
Recipe.OnCreate.Handwarmer = function(CraftRecipeData_, Character_)
local pl = getPlayer()
local bd = pl:getBodyDamage()
local wet = bd:getWetness() + 40
bd:decreaseBodyWetness(wet)
bd:setTemperature(28)
end
rip, I am of no help then
Another question about that, how do I specify the item it self then?
Trying to make a recipe b41 where you get a different result depending on the condition of the item you use
item would be what is used in the callback for the recipe
Initially I thought I didn't need to specify it since it's part of the recipe
^ exactly
But since I added it, it doesn't seem to work
Hmm.. lua without prior knowledge is quite difficult ๐
hopefully a little more helpful than the monotonous lua manual
Thanks a lot, at least there's a lot of material to read and learn
this is the params you should have in your oncreate function ( and it explains them )
would highly recommend using vscode for lua dev
Already using VSCode, I'll check it out, thanks a lot
I would guess it's not an issue, but does Zomboid care about using ' ' instead of " "?
no
it might be bad in translation files/other files that use quotation marks as syntax but at least for lua there's no difference whatsoever
Awesome, ty
WIP with working doors/hood animations
I'm curious what the problem with your mirrors was
Model issues I guess, I fixed the topology
One day I'll definitely finish it and put it in a game. 
Is it against any rules to ask for coding help when your making personal edits to a mod that you won't be re-distributing?
if you're not going to redistribute it then it's personal use and you can do whatever you want
Yea, just want to double check before I ask for help with the code as there is a weird oddity I am trying to figure out but can't seem to figure it out
Cause I don't know if I could share some of the code / translation files as at least the translation file is theirs originally minus what I added
Asking is fine
Sharing code is also fine; any mod published on steam has the code publicly available.
I wonder if there's any way to give users a lua to run to remove the extra dynamic spawns from the carts & trolleys dynamic spawns and then have them remove it. Or would that be too complicated? I kinda feel bad some users have had this issue and it will persist in their world. 
Option1: Add a function to the mod that does the cleanup but never gets called, and tell them to go into debug mode and type "TrollCleanup()" into the lua box. no seperate download needed.
Option2: add a "clean up on next game start" option that calls the cleanup code, possibly with a safeguard so it only gets called once.
Is comments allowed in translation files?
Hmmm. This is tough hahaa. I like Option2, but that also requires users to download another mod (sandbox options).
Some vanilla translation files have comments
If it if for B42, use built in mod options
Dope, this code is all over the place, reworking this is gonna take a bit, it seems their using two types of translation files with both files having the same translations ๐
Ohhh yes I always forget about those!
that adds config to options -> mods -> <your mod>
There's a "mod options example" mod that is a big help getting the syntax right
Oh heck yea. Thanks!!!
The defines.lua ?
Where do you find that mod?
you can add mod options into any lua file.
Just making sure I'm looking at the right stuff hahaa.
Ahhh, I see what you mean. That makes more sense. Thank you!!! โค๏ธ
I'd suggest linking this wiki page
Sums up very well the entire thing
I believe I linked the mod example too ?
I don't remember lol
Yeah, that's a better resource... I needed to figure it out in ye-olde days when there no wiki page for this
yup
I can't wait to be done forking this carts & trolley mod lol.
is there a path find test or did I dream that? Just need to test if the player can path to somewhere
Is there a way to run a function or something when either the player ticks a tickbox or when they click apply?
Honestly kinda wish the addTickBox() had a function arg
In what context? I know code for when a player "eats/uses" an inventory item but I know almost nothing regarding the UI
In the mod options, apologies
ah, sorry chief, I haven't messed with options unfortunately
All good
you can add a button to your mod options that runs a function
function Options:addButton(id, name, tooltip, onclickfunc, target, arg1, arg2, arg3, arg4)
Yea, the thing is I'd rather it be a tick box as it's enabling & disabling something and having it be a tick make more sense imo, unless the button can be a tick box too?
Are you able to run a function when the apply button is hit?
I haven't messed with mod options at all, but maybe you can create an update button that runs a function to change whatever options you want
Yea, that's what I just thought of too
Guess it'll do till I can run a function on tick boxes ๐
Of course I try this and the mod options menu disappears hahaa... I love my luck...
no menu for you
I just want to be done ffs hahaa. I fixed the duplication issue and all that. I just want to get it out but also give users the option to erase the present spawns from their saves so they don't have to start a new save.
still gotta get rid of that OnTick bull, right?
One step at a time hahaa.
lol, yea I looked at it and said "not today satan"
and not sure if you know but there is a bug if you climb through a window with a trolley equipped
Is there a way to connect a lua file that is in the 42\media\lua\client\ISUI and connect it to a lua file handling the mod options code in the client folder?
...ill add it to the list... 
(I'm not really sad, I kinda figured there would be an issue there...)
Appreciate it.
you have more patience than I do
very helpful...
public boolean TestPathfindCollide(IsoMovingObject obj, IsoGridSquare from, IsoGridSquare to) {
return false; }
public boolean TestCollide(IsoMovingObject obj, IsoGridSquare from, IsoGridSquare to) {
return false; }
I just hate UI stuff. That I have zero patience with and I'm already enraged and needing to take a break from adding to the mod options menu lolll.
Might help if I don't forget the local config at the header. I blame the jet lag. 
it took me forever to get my head around simple UI stuff. Brain bad
and I still can't find the path find test so I must have fever dreamed it
Kinda of a silly question how do I see the console where prints are sent too?
are you in debug mode?
No, though I am on B42, I thought it was pre-enabled?
Enable debug, but you can also view console.txt here: C:\Users\%username%\Zomboid
That file regenerates every time the game is run, though, so if you want to save something from it you'll need to make a copy to keep elsewhere.
that idk, I haven't been out of debug in months
It's not, but the devs leave the debug stuff stuck on for some reason (the UI stuff only). There's a mod to remove that if debug is not enabled, though. Requires manual file transfers, though.
If I recall correctly I need to set the launch perimeters with -debug right?
Yup. That's it.
Anybody know how to center text in the workshop mod description? I assume probably not able to do it, but... maybe... idk... hahaa.
I finally got on to making that less ugly 
the only way I know how to do it is to spam whitespace
Sadly that's not possible
Laaame. Hahaa. Figured, though. Oh well.
it looks like ass on a phone so I quit using it
Is there a mod you guys can think of that has a Mod options button that resets the values to default in the MODS tab for B42? I am having trouble getting a "Reset Values to Default" button working and would be nice to reverse engineer a mod with a working "default reset" button .
Ooof, yeah I'd say so. 
Unfortunately I'm pretty new to the whole thing (literally tonight).
But if you mean doing this for your mod only, wouldn't the same default functions for Sandbox Options work? Genuinely curious.
keep in mind that this doesn't mean you can necessarily take it for use, though most if not all cases, personal use without redistribution is fine
I mean... yes, but also no. Okay to reference 100%, but copy-pasting is a little shady imo.
I can't remember who Rocco is in chat here, but holy crap that CleanUI mod looks incredible now.
Has anyone here messed with the in game lighting yet for build 42? For reference I made a UV Bulb and I have the prompt showing up to install it in lamps but nothing happens.
Absolutely, I was meaning "sharing code snippets here on discord to discuss is ok"
Yea, one of the top mods right now is for car hi-beams.
That's me!
Lighting is very much java based with limited options to mess with it,
What do you want the UV bulb to do?
Since there are coloured light bulbs making a dull purple light should be fine.
Thanks @storm trench. I need to be able to install it in lamps and other house hold objects.
But making things under the light react by having blood and white clothing glow...
I freaking love the mod. I've been waiting forever for the new B42 lighting to finally have decent car headlights lmao.
I'll add version 2 WIP to the download as a seperate mod shortly, it gets even more light by using the "rear headlights" as well
See my code checks sunlight and UV light (It's a dying light inspired mod). I've been trying to get the bulb to install into light fixtures but I might have to settle for a purple
My suggestion would be make a purple bulb, track an array of where your bulbs are installed and then when you check for UV you can see if any installed bulbs are nearby and on.
๐
I thought maybe you were trying for Project Phasmophobia for a moment
Honestly... not a bad... idea.....
You could also make a dedicated "UV lamp" and/or daylight lamp placeables
lol, fair point. I'll just settle for the games purple bulb. I already track it with.
function UVLightChecker()
local player = getPlayer();
local playerdata = player:getModData()
local Sqr = player:getSquare()
local B = Sqr:getLightInfluenceB()
local G = Sqr:getLightInfluenceG()
local R = Sqr:getLightInfluenceR()
if player:HasTrait("LabRat") then
if Sqr then
if R == 85 and G == 0 and B == 255 then
playerdata.InfectionImmunityTimer = 120 + playerdata.ImmunityBonus
playerdata.inUVrange = true
elseif not R ~= 85 and G ~= 0 and B ~= 255 then
playerdata.inUVrange = false
end
end
end
end
Events.EveryOneMinute.Add(UVLightChecker)
@silent zealot You are a saint, that's what I will do
I'm not sure how the light influence stuff works, but will that get thrown off if there is a normal bulb as well?
That's a very fair point, I haven't gotten to test that yet as I've been fighting the bulbs. It probably will so I might swap for an array to track them
For what it's worth, 90s UV bulbs for normal sockets were not great. I used once in a roleplaying game so the room could being near darkness but it was still possible to read things printed on flourescent paper, but there was not much glow.
Flourescent UV lamps work fine though, since flourescent tubes produce UV that gets converted to visible light by the inner coating on the tubes
same for LEDs, a white led is blue light that gets converted down to all wavelengths, so skip that step and push the frequency a bit and you have modern UV LEDs.
But... other than some people telling you that you're wrong in the mod comments no one will mind if you go gameplay first (or "I can make the mod work this way" first)
See I have a hand held lamp made but I haven't gotten it to work. (I've been trying to change the color.) So I just make a check so if the player is holding it then they're in UV.
Pretty sure colour is fixed for hand held torches, as that is 100% set in java code that ignores whatever the list gives it
My released mod checks total light level constantly so realistically I also don't need to change it but I'm doing it for a friend.
oh.. so many hours down the drain
Don't feel bad. I tested my B42 fork of the trolleys mod for 5 days before realizing my issue was (thanks to someone else) that I didn't have a second media folder in the top level... hahahaa.
Functionally handheld torches seem to be VehicleLights but the code gets confusing
that's strange, okay, so thats just beyond my control then. I'll just assign a inUV = true to the player while holding the lamp
Likely the best way for hand-held lights. If I can figure a way to hack the light colour/intensity I'll let you know
You're a savior. I was playing with the Isolight and it says you can set the RGB. All this is from the javadocs for
Isolight will handle a fixed position light
VehicleLight is when a torch/headlight is moving with the player
And the stupid lighting code just says "lol nope get the range and intensity based on part condition if its attached to a Vehicle part"
And you can't get part condition above 100 with damage(-100) because I tried ๐ญ
I see, that is very unfortunate
Maybe if I learn the dark art of java reflection via lua and can get write access to some things that we're not meant to have write access too...
But I'm not sure if that's even theoretically possible.
Read access is, Albion has done great work there in the starlit library
question then. Regarding the games preset lamps in bedrooms and what not. IsoLightSwitch seems to handle (I may be wrong) these fixtures, could I not override the addLightBulb(IsoGameCharacter chr, InventoryItem bulb) to fit a special bulb. I'm very new so sorry if I'm a bit slow to understand
Ahhh nevermind it's that darn generative fill. How do I keep missing this dumb crap? 
I think I'm going to freaking bed. Nite all.
Night, thanks you two for the help
you can write in debug mode only
i never bothered adding api for it since it's only mildly useful for debugging and way too annoying to find out you accidentally made a mod that doesn't work without it
Just need to reflection the bit that makes it debug only then reflect the bit you want, easy. <if there was an emoji for being insane I would put it here>
Hi, guys. I am trying to get a "Reset to Default" button in the MODS tab to work, but it's not doing anything when I click it. Here is the lua file I have made. Lines 70-99 are the respective code. But 89-99 just doesn't work when I click. Not sure what's up?
No wonder light placement can be weird on oddly sized vehicles, offsets are multipled by vehicle size.
instead of adding the vehicle size
onClick should be onclick
Ah, thank you! OK, now I am running into other errors I have to fix. ๐
by the way, what is the usage of mod data here trying to accomplish? it seems really odd
i don't think you're needing to use mod data here, mod data is for persistently storing data with the save file
Oh, good to know. I do not know what I am doing, because I am using Grok3 to help lolz. Everything but the "Reset to Default" button works thus far.
that makes sense
๐
Does modData reduce game speed if it continuously stores data into the save file?
with proper caching no (but it doesn't look like your ai is caching basically anything based on the file you posted), but it bloats the save file and is just more complex to work with
in this example the mod options and the mod data are two opposing systems fighting each other ๐ but if it works
Haha. Wild.
Oh, so, wait. Currently, the mod only works in-game after the f4-f6 sliders have been modified and hitting accept via the MODS tab. When changing the sliders at the main menu and going into a game, they don't seem to apply until the former as mentioned is done. With a caching system would the sliders work properly in-game after altering them in the main menu?
Wouldn't modData only get saved when the object it is attached to gets saved? (other than player and vehicles that go straight into an SQLite database)
it's global mod data, so it saves when the world does
I know chunks can take a long time to save based on rollback from a crash after organizing my entire $%@#$ing base. I assume they just stay in memory with no save while still active.
yeah, they save when they unload / the save is exited
servers can set an autosave interval too
Does anyone else REALLY like the new debug icon in-game? What an upgrade from the other one.
Yeah, I just think it looks adorable.
Are the devs planning to make map-making more intuitive at all?
no
the exception is that during timed actions, animation events trigger a function in the timed action
๐ค you could use the GrapplerLetGo event to trigger lua code actually
it triggers the lua event of the same name with a string argument
you'd have to store any necessary information to recognise your specific triggers and any extra data you need in that one string
its not rly blonging here but i need some smart ppl to answer it. Why do we only get 1/4exp of the recipe exp if we dont have a trait belonging to it(exp modifier). Lets take tailor, ripping cloth gives 1xp, without trait 0.25, with 1. (only have that 1 mod active and apoc setting, so no changes to any multiplier)
For some reason devs decided that the base XP gain would be 25%
instead of 100% and multiply everything by four.
If you start with points in the skill, that increases.
Pretend an average human has 2 in all skills, and our characters are morons. Or something.
yeah ok, its just super strange and unnecessary. one of the reasons i never go without eletric trait anymore xD
How can I add 4 wheels in the back? I checked a mod and it had files only for 4 total wheels, not 6
If you want double tires you can cheat and just make a double-wide tire axle.
If you want an extra axle... I don't think I've ever seen a mod do that.
No wait, here's one: https://steamcommunity.com/sharedfiles/filedetails/?id=3409472393&searchtext=
tsarlib
well, ig I'll just add tsarlib to my game again
Thanks
Btw, I also checked the [B42] Tatra 815 and I didn't see any custom ATA template or anything like that, I wonder how does it work
he is using the rearleft and right wheel, the model of each is the same, with tires on both sides
Ohhhhhhh
Ill try to add it with tsar lib for now
for the mod to work in build 41 and 42, do I need to put the mod data into the 42 and common folders? Or what?
You can have common be empty and have your b42 files in 42, and your b41 files in that parent folder
You effectively have two 100% separate copies of the mod.
The common folder loads first, if you have files like models and textures that are the same for both builds you put it there
But I keep it empty
Except that 41 doesn't load common
yes
Also, another question, if I want to add 3 seats, I cange the template to 3 and simply name the extra seat any name I want?
Also, I think I added the ATA template wrong?
I put the file in the scripts folder first, made 2 more model templates in main file for middle wheels with the same name as the ones in the template script and called the template in the main file
thanks
the game only loads the default wheels I had
+I added tsar lib b42 to my mod list
part TireMiddleLeft
{
model InflatedTirePlusWheel
{
file = ATAPetyarbuilt_WheelRear_L,
offset = 1.3 0.0 0.0,
}
}
part TireRearLeft
{
model InflatedTirePlusWheel
{
file = ATAPetyarbuilt_WheelRear_L,
offset = 1.3 0.0 0.0,
}
}
template = ATA6Wheels/part/TireMiddleRight,
part TireMiddleRight
{
model InflatedTirePlusWheel
{
file = ATAPetyarbuilt_WheelRear_R,
offset = -1.3 0.0 0.0,
}
}
template = Tire/part/TireRearRight,
part TireRearRight
{
model InflatedTirePlusWheel
{
file = ATAPetyarbuilt_WheelRear_R,
offset = -1.3 0.0 0.0,
}
}
```
If I understand right, I need this after the template! = ATA6Wheels, line?
you dont need that line
Hold on, I had "," after the model name, I think this is the issue
Oh, last time I used tsar that's how it worked
template = ATA6Wheels/part/BrakeMiddleLeft,
template = ATA6Wheels/part/SuspensionMiddleRight,
template = ATA6Wheels/part/SuspensionMiddleLeft,``` you need this too
At least for spare wheel
just look at the template_ata_petyarbuilt
yeah, I'll look at it better and see what it loads
+I think I also need to do the same thing for the suspension
So i will have wheels, brakes , suspension
nvm, you sent it...

you should resize the model a bit its looking super tiny for a truck ^^
Don't worry, I usually do it at the end, with areas and everything
Any ideas on why OnMechanicActionDone event is not triggered after an install/uninstall of a part? "receiveObjectChange" is printed without string after it and the event is not called (B42)
Coding a culling of spawned carts & trolleys that are spawned in the world to be run out of the mod options menu is going super bad. Doesn't even work when trying to get it to run. Sigh.
Aight, work for today is done
I hope your characters love the grease and dirt hahaa.
They really do, nothing better than 40 years old soviet grease
it is, I resize my models after I finish the hard work
I cannot figure out how to get this game to run a removal for all world objects spawned by the mod

Holy s---... wait... did I finally do it!?!
I did... but only sorta. Only works on presently loaded cells 
Guess I'll just keybind it/keep a local despawner in the mod options... let players clear as they wish and add a spawner in the mod options menu to spawn the carts & trolleys they lose. Bummer, but better than nothing I guess.
where on earth are the recipes for forging items, like axe heads and such, I've looked all over in the game files recipe folder but can't find a single thing to do with forging axe heads, knife blades or anything of the sort
cell is probably the best you could hope for
Yeahhh... shame. Oh well, I gave it all I could hahaa.
Do you think CTRL+ALT+SHIFT+L is too cumbersome of a keybind? It'll be in the mod options menu, but I want a not-so-easy-to-mistakenly-bump keybind to allow players to clear their current cell of cart & trolley spawns without having to go into the mod options menu. (You can spawn new carts & trolleys in that mod options menu tho to replace one you'd lose by running the culling tho btw).
I think any combo that requires both hands would be ok
Thanks friendooo ๐
nvm this can be ignored, ended up just using debug to dig through the recipe list and figure out the format I needed that way
<@&671452400221159444>
thanks
I'm currently trying to do stuff when the player equips a clothing item, as OnClothingUpdated is being called when the clothes gets bloody and dirty, it doesn't sits right by me to loop through the inventory every time, right now I'm using the getItemsFromCategory function to only iterate through relevant items, but I was wondering if anybody had a better way to detect an item that was just equipped ? Or maybe get the last equipped item.
for just clothing you can tap into ISWearClothing:perform() and grab the item
Thanks for the answer ! Is there an associated event or are we talking about monkey patching it ?
the OnClothingUpdated fires before the action is performed. Have a look at:
https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/api/README.md#overwriting-vanilla-code
I would go with the "Store the original function in a local variable. If your overwrite doesn't need to run, call the original." option
Yes I am on that guide right now
in this case you very likely want to always call the original
when I see albion typing after I post and I'm like uh oh, what'd I get wrong ๐
it would be self.item
Yeah just noticed that, I really should look harder before typing ๐ญ
Well thanks, it does seem like a better option.
Hi, all. How may I make sliders in the MODs tab refresh it's numbers live and/or do a UI refresh when I click the "Reset to Defaults" button I made? I have the following code, which resets the numbers on my sliders, but the numbers only refresh after hitting Accept and going back into the MODS tab:
-- Attempt to refresh the parent panel
if config.options and config.options.instance and config.options.instance.refresh then
config.options.instance:refresh()
print("[ModOptionsSetup] Refreshed mod options panel")
elseif config.f4_slider and config.f4_slider.parent and config.f4_slider.parent.refresh then
config.f4_slider.parent:refresh()
print("[ModOptionsSetup] Refreshed parent panel")
end
I don't know much about mod options, but maybe your "Reset to Defaults" button function should set the values where you want them, save it and then call load. Might be worth a try
A good idea, thank you. I actually have the default slider values stored, and the sliders do reset to those numbers when the reset button is click, it's just the UI is not refreshing for some reason.
For whatever reason, when I click the Reset to Defaults button, it's like there was no actual user input, because the Apply button at the bottom of the Options screen doesn't highlight/cannot be clicked on, but when I click on a slider arrow, then the Apply button is highlighted and can be clicked on, thus updating the UI.
This mod options BS is going to make me lose my freaking mind. This is wild. I have been fighting with it for hours now. It just will not freaking work lolll.
is it possible to change a sound script after the game loads in lua? Like changing the clip filename on the fly?
I hear you. What are you having trouble with.
No matter what, it just won't show up since I gave keybind alternatives to some of the options in the mods options menu lolll. Make it make sense...
"It" being what, exactly? The text in your UI_EN file?
My stuff, which would show up in the mod options menu before I added the keybind alternatives, now does not.
I'm guessing there's no errors?
Nope, it just won't work. I have even tried staring at multiple mods that use it and referencing mine and it just doesn't work. Who knows. About to just delete all the related stuff and start back over from scratch again.
I can't wait to stop working on this mod.
You have at the top the ones you are using of your script?
local config = {
keyBind = nil,
checkBox = nil,
textEntry = nil,
multiBox = nil,
comboBox = nil,
colorPick = nil,
slider = nil,
button = nil
}
and local options = PZAPI.ModOptions:create("UNIQUEID", "Example")
nah, don't do that. if you want to dm the code I'll have a look
If it helps, I have been using Grok3 for all my coding purposes, and have been getting by with making mods, even getting mod options to work. I fed it the original code from the ExmapleModOptions mod and that helped greatly for Grok3 to figure out.
It's fine... I'll figure something out, idk. I appreciate the effort to help tho, I do.
Does anyone know if the author (Rezistor) for the Combat Text (B40+B41+B42) mod is active in this discord?
These mod options are just kicking my butt.
Want to share what you have, maybe I can help?
In case you need it
For you too it could be useful
Thank you. I am almost there, I hope. I got it to show the mod name in the mod options menu, just none of the options.
How do I make a fluid container return to it's original item?
Hi there! question, does anyone know how to modify the value of beds to increase the quality of sleep?
For example. I want a large pop bottle of coke to return to being an empty bottle instead of an empty version of the bottle of coke
If you want to add a keybind, you need to add it to the top on local config and then add in config.keyBind = options:addKeyBind("0", getText("UI_options_UNIQUEID_keyBind"), Keyboard.KEY_Z, getText("UI_options_UNIQUEID_keyBind_tooltip")) in the main body of the code somewhere.
The "UI_options_UNIQUEID_keyBind" and "UI_options_UNIQUEID_keyBind_tooltip" are the text that displayed for the button and are drawn from the UI_EN .txt file, located in Workshop\Your mode name\Contents\mods\Your mod name\42\media\lua\shared\Translate\EN
Like I said, I explained to Grok3 my issue and what I was trying to achieve, and attached my mod's lua file, the ExmpleModOptions.lua file and my UI_EN.txt file in the chat box for Grok3, and it was able to add in the proper mod options code.
The keybinds are working 100%. There's no issues there. But since implementing them there seems to be a snowball affect affecting the mod options. If my next try doesn't work, I might actually remove CleanUI because I am starting to get a hunch that's the issue.
Snowball effect ?
What exactly are you trying to do again? Temporarily disable CleanUI and see if that fixes the issue.
Yep, for whatever reason those keybinds have been hurting my ability to implement mod options. I had them all set and working before I did it.
No but what do you mean snowball effect
Snowball effect is when you start with putting in something small, and it effects everything down the line. Like a snowball rolling down a snow-covered hill.
yeah but like, what's happening?
if the keybind options appear but stop others from appearing there's probably a runtime error somewhere between that and wherever you add the others
do you get any errors?
OK, how do I disable the stuff that appears/happens when I am in debug mode and hit F2 (a bunch of overlays), F3 (character going invisible) and F6 (long string of text that appears next to character)?
Mostly, no. The only time I get errors is when it's almost working (IE - the name of the mod is in mod options, but none of the items).
I'm sorry but I still don't get the problem ๐ญ
This literally doesn't say anything about what your problem is
Sigh. I dunno. I have been fighting with this all day. 12 hours. I'm fried.
Yeah, take a break. Definitely do something else, so you can come back and tackle it when you are refreshed another day.
Is there any kind of audio monitor tucked away in a debug menu? Something to tell me what audio files are playing? I'm trying to track down the body-dragging sound, I've searched all the keywords I can think of
thinking they might just be reused vehicle sounds but still an audio monitor would be a nice thing to have
in %userprofile%/Zomboid/debuglog.ini you can set sound to Debug and then it should print sound info into the console
Do you have issues if yor mod is the only mod? Worth checking if you ever suspect another mod is somehow causing problems.
Yea I ended up ruling that out.
perfect thank u!
If you want, send me your mod and I'll have a look at your mod options. Took me a bit longer to make them all work than it should have, so I'll see if I can figure out why they don't like you.
I need a good sitraction, my jaw has locked up and instead of being able to wiggle ita bit and clunk it back into place I just.. can't open my mouth more than ~cm without pain, like I've badly pulled a jaw muscle.
And after an ER visit turns out that just like teeth are luxery bones, so is your jaw and I will need a TMJ dentist if it does not go away on it's own so... disctration good lol
I would but tbh it's a total and complete mess by now. I keep straddling the line somehow between not working without errors and partially working with errors. So everything is just all over the place and idk. It would be a mess to have someone look at because to me it's already chaotic. Hah.
Ohhh that's awful I'm so sorry to hear that ):
What if you made a new mod, copied over the mod options, and all the new mod does is a function called MizzOptions() that prints out the options?
easy way to test without dealing with everything else
"luxury bones" - must be in the US too
I want zombies to grab animals and drag them off.
Hmmm... I mean, maybe. Idk. Something just isn't right in general. Idk how to place it.
how can i make a hair use hair gel to put on? Like the mohawk or smt?
for my mod that is
from what i REMEMBER i think it was a certain true/false thing in hairstyles but digging in the vanilla files there i cant find it
NVM, no longer needd
needed*
Is there any mod/api that can provide server information?
You mean require hair gel to set your hair to a mohawk?
What sort of info are you after?
all kind, players(name, id, location in map, zombie deaths, all i can track), inserver time, day, power is down or not, etc.
is there anything already built somewhere i could take advantage of or should i just build it from scratch?
Those things are all available, but all in different places.
I think that would have to be a mod installed on a per-server basis for it to work right?
Maybe not total zombie deaths.
Because the servers dont expose stats like that unless you join the game as a client, unless im mistaken
if you're trying to get that data for your server you can make a mod that writes that stuff to an external file (presumably you want to use it for something external?)
i was already thinking about creating a mod to get that information cause i know most of the info is not exposed to the public, i was just wondering if theres already a mod or tool that does that kind of thing
e.g: power is getWorld():isHydroPowerOn()
ye i was thinkin a mod to display that info into an endpoint for an api or whatever
so i can get real time info
check to see if any existig mods do that
Figure out how you're getting the info from the server to whatever will make it public; I don't think there are any lua-accessible function for pushing data to external servers for example.
Then just work trough the list of stuff you want to collect piece by piece.
I've never seen such a fucntion, which does not mean there isn't a way.
Keep in mind that (in theory at least) lua functions that can affect things on the filesystem or outside the gane shoud be removed or locked down.
wdym
You can print text to console.txt and have some application consume that.
but that would require me to perma log something on a file
instead of just pinging the information on a request for example
Think about security: what happens if you let any mod on steam do anything it wants to player's computers?
im not uploading the mod anywhere but my machine
this is for private server purposes
mine crypto 
Sure, but the games implementation for lua wasn't built for your single server. It was built for everyone.
oh wait
you mean that for security reasons i might not be able to do what i want right?
sorry my english aint that good
I'm not saying you can't do it, I'm saying don't assume that all general purpose lua functions for making external API calls/hosting something that can accept external API calls/writing to files will be available.
I recommend figuring out how to get data out before spending time collecting the data to send out.
im on it
If there are any existing mods that do that, checking how they did it is an easy first step.
where is this info btw? functions, methods etc
https://demiurgequantified.github.io/ProjectZomboidJavaDocs/ <-- that's for B42
package index
There is a project zomboid javadocs site for B41 as well, check the modding wiki: https://pzwiki.net/wiki/Modding
(I don't have the B41 link handy anymore)
42 info aint gonna work for me since mp isnt available yet 
I know; that's why I mentioned the version. There is a zomboid B41 javadocs hosted somewhere, I just.. forget where.
Thanks Sir Doggy!
lovely
Yeah I'm 100% just deleting everything I worked on today and starting over. This is ridiculous.
can i run a small script and if i can where? do i have to create a "mods" folder in the server files?
like here or somthn
parts of what youre asking for can be found here
https://steamcommunity.com/sharedfiles/filedetails/?id=3345011340
where do you put the mods you are testing?, i dont have workshop id or anything so how do i install them in the server?
Tried that... this is what I got and it didn't work.
that's just for your mod menu?
The mod options in the pause menu.
lol it's fix was to add a commented line...
I guess I could add these for reference. I don't have the original mod options code I was trying anymore. I literally tried for 12 hours to make it work. Just canned it.
I've seen that tires in game have a friction attribute, is it possible to add low friction tires (drift purposes)?
theres a drift car mod you can look into I think its the 240sx
I'm glad you got it working!
No, not even close. I mean that AIs "fix" to it not working is to add a comment line.
Idk. I'm at my wits end with this.
f grok
All of em, really.
https://steamcommunity.com/sharedfiles/filedetails/?id=2698655004&searchtext=240sx
This one? (It says it has drift car in debug mode, but Im just making sure)
so it looks like you need a checkbox to enable key binds, some key binds to spawn carts / trolleys, and a button or key bind to remove carts / trolleys? @storm trench
the announcements you could probably get away with an OK modal if you needed that
Really just a button to spawn carts, spawn trolleys, remove all spawned carts/trolleys in as wide an area as possible, and turn on/off dialogue above the player head an enable/disable the keybinds. I've worked all day just to make this work. I had everything else working as of last night. But being that this update is geared to players with existing games with the (fixed, but unreleased) overspawning issue, I don't want to roll out the fix and leave everyone completely stuck with it.
The keybinds are only 1 each for the spawning and then remove all spawned carts/trolleys.
yeah thats the one and also try looking at the ae86
kk, does the reset system work for you?
Yeah, everything works. It's just not this stupid freaking menu.
nice
Yeah, I couldn't and still can't make any sense of it.
hang on, I'm learning with ya here. I've never played with mod options before...
that didnt took long to make 
is this for b41 mod options? b42's official mod options don't have syntax literally anything like this
That's AI for yah. Figured I'd try it because the person I responded to said it worked great.
It didn't. And then when I told it the code didn't work, its fix was to add a comment line on the end lolll.
yeah, ai really isn't effective for modding at all
It's a nightmare, I swear. I tried it exactly the right way, the wrong way, everything in between. Even took a Hail Mary with AI. No dice.
Closest I got was the name of the mod appearing in the mod options only when I had an error for using the wrong property. And only that one property.
I'm having issues too but we'll get it
I just don't know how to read
Idk, it might be useful to put you into the right direction?
local config = {
checkBox = nil,
button = nil
}
local function ZuperOptions()
local options = PZAPI.ModOptions:create("ZuperCartModOptions", "Zuper Cart Mod Options")
options:addTitle("Zuper Cart Mod Options")
options:addDescription("Grok can f itself")
options:addSeparator()
config.checkBox = options:addTickBox("Chatty", getText("UI_options_ZuperCartModOptions_Chatty"), false, getText("UI_options_ZuperCartModOptions_TickBox_Tooltip"))
options:addSeparator()
config.button = options:addButton("SpawnCart", getText("UI_options_ZuperCartModOptions_SpawnCart"), getText("UI_options_ZuperCartModOptions_SpawnCart_Tooltip"), spawnCartFunc)
config.button = options:addButton("SpawnTrolley", getText("UI_options_ZuperCartModOptions_SpawnTrolley"), getText("UI_options_ZuperCartModOptions_SpawnTrolley_Tooltip"), spawnTrolleyFunc)
options:addSeparator()
config.button = options:addButton("Remove", getText("UI_options_ZuperCartModOptions_Remove", getText("UI_options_ZuperCartModOptions_Remove_Tooltip"), removeCartsFunc))
end
ZuperOptions()
To access your options from your code:
local options = PZAPI.ModOptions:getOptions("ZuperCartModOptions")
local tickBoxValue = options:getOption("Chatty")
you'll obs need to make the translations
not sure what you'd need to delay it for
I wasn't thinking it through
learning complete, time for more drink
I mean if it works, it works. At least I can carefully tailor it from here. You're the best, reinvigorated for tomorrow!!! Hahaa. But not a minute sooner. Such a long day lolll remind me why I got into this again.
because a lot of us have been waiting for it ๐
Hahaa I know, I was one of em. Hahaa.
Hey @silent zealot, just to let you know i finally made it work
, also i realized server-side mods are not a thing in Zomboid, but i also realized as long as players have a mod with the same id it will still let them in so they can install an empty mod with the same id and they will be able to join.
when theres players inside the server the mod just writes info in a json and updates it every 1m (i guess if theres no LOGS in console this wont be a problem at all), then i just use an api to read that file and print the info
imma still check if i can get events like player death, or player shoot etc.. i want my discord bot to say: Shotgun shots heard in "city"!
tomorrow imma buy a few redbulls and make somethin gud 
Good idea!
https://pzwiki.net/wiki/Lua_event you could track things like number of zombies killed and post a message if it's above a threshold
I just realized something, mods wont work if theres no players in the server, so i cant know if theres 0 players 
im just gonna check if the mod is updating, if not imma put players: 0

Also, ahora this https://pzwiki.net/wiki/Lua_event compatible with 41? atleast most of them? so i can test them
most are
noice
The trick seems to be working...
When im playing:
After 30s with no updates: (clears player list)
is it possible to get the exact degree of the angle where the character is looking? And is it possible to turn the character exactly by a degree during timedaction?
anyone know how to make a patch for other mod?
i make that cleanui mod,but the position of autoloot button is not good for my mod
if getActivatedMods():contains("\\AutoLoot") then --autolootbutton function--- end something like that? just copy the function that creates the button and change what you need?
Should I add a trunk door if it has a flatbed?
depends how realistic you want to have it i guess? if it has a door at the back why not. its the same for the pickups, you can still loot them even if the door is closed
Yeah, I thought of something similar too
part SeatMiddleLeft
{
door =,
}
I wonder what would happen
explosion? ๐คฏ ๐
would be sent to the backrooms
less total item sprites, even more possible variety.
not really sure how to do the math this time, since 2 of the weapons can't use the mag feed attachment, and 2 of them can't use the stock attachment
4 weapons total, 2 bolt action and 2 semi auto
Now I just need to edit the code so it knows what color the mag tape should be as well
Mags are now appropriately colored ๐
awsome mod
Anyone has experience with adding custom number of seats? I tried 3 different ways already and nothing worked, I need 3 seats (Front left, right and middle)
it took me a while to get every thing fixed and updated and playtested it for 2 days

iam glad its done
This van has a middle row of seats, for example: .../steamapps/common/ProjectZomboid/projectzomboid/media/scripts/vehicles/vehicle_van_seats.txt. Did you change the seats = 6, to match the defined seats?
Yes
ill check this script, but tried with templates and so on
So there are incorrect number of seats?
Yes. Then just add FrontLeft, FrontRight and MiddleLeft (for example), seats, their corresponding areas and set their position correctly in the editor
what if i use 6 seats and delete 3?
Just quick and dirty "middle seat". You have to select which side of the vehicle player can enter the middle seat (when you are setting the area)
I was thinking if i can set it to null so the player has to switch the seat to get out
I quess that should work as well
Doesn't RV's for RV interior mod does this, or busses? IIRC you enter bus in all seats with a only entrace being side one?
There are also two door cars with four seats
And if you have a seat with no door I believe sitting in it makes you safe from zombies.
I did that before on my satsuma mod, but that was easy
Thanks~
I found a serious bug.
When you enable group attack and attack both zombies and windows at the same time, the game crashes.
2 Grip options
3 Magfeed options
3 Stock options
4 Barrel options
7 colors
2x3x3x4x7 = 504 possible combinations
@tacit pebble hey just realized N0wh3re on Steam is you, I've sent a comment on your magazine API that I made a wiki page to document your API
https://pzwiki.net/wiki/Magazine_API
Cool stuff !
Is there any way to remove the 3 rear seats of a 6 seats template?
These only appear in the seats UI as I removed them from the script
Freaking finally.
Now does it work? 
Oh yeah and I was reading the wiki you sent.
and you know what, that's what I really wanted to know lol. I didn't think there's also about modules in wiki.
very thank you for your work. I was figuring out how I can do that.
now I'm gonna change my codes hehe โค๏ธ
An alternative way of accessing option values:
https://pzwiki.net/wiki/Mod_Options#Alternative_accessing_method:_module
Np !
how do you attack window? you mean windows like the one you can barricade? or UI?
in any case thats a weird bug
I heard a lot of people has said same as rocco said so.. that should be a bug.
Because since B42.0, there's a bug that window is also destroyed when you attack zombie, when window is located at same direction. (Like bullet tracer // I felt like player's melee penetrated zombie and destroy window behind of zombie)
Hey made a wiki page for your API, don't hesitate to add or modify the informations on it, I also linked your example usage video of forestry
https://pzwiki.net/wiki/JB_ASSUtils
3 seats template doesn't exist
You should be able to just copy everything from a template to your script (and edit it to have only 3 seats), or create a new template from it. The vanilla templates should be in the same scripts folder
Yeah I did that twice, didn't work, I also tried to modify the 6 seats one, it shows 3 seats but the areas dissappear
I need to dig into mod options sometime. It feels a little more friendly than sandbox options
Take in mind that anything which modifies gameplay NEEDS TO BE SANDBOX OPTIONS
I was working on this yesterday and got sidetracked. Much appreciated!
Anything that is user depend, like UI elements and shit, can be mod options
Fixed the size
Now I gottta fix the seats template, physics and minor texture, then make the other variations
Ah ok. I can check later if I have gotten it working somewhere
Thanks, ill try it again and see if I can fix anything
guys I've discovered a different issue, I deleted my mods everywhere, even used the safe launch but my pz just keeps the mod files there.
youre not subbed?
#mod_support im dumb
I'll have to release it without the ability to turn off announcement and keybinds, but at least I'll be able to release it.
local options = PZAPI.ModOptions:getOptions("ZuperCartModOptions")
local tickBoxValue = options:getOption("Chatty")
if tickBoxValue then "do announcements code" end
same idea for the key bind. you'll want to pull the keybind value into your code and set an Events.OnKeyPressed.Add(function) to your code and then check if the key pressed was your keybind value
Yeah, nah. Immediately greeted with errors and other issues. I'm not that worried about it. This is only going to be in the code for the next couple weeks until I feel the spawn issue is gone and nobody has to clear areas of spawns anymore. I would rather move onto more important things like maybe finally starting to fix the container capacity in java.
you can check this videohttps://discordapp.com/channels/136501320340209664/1348288025045500030
i test it without any mod loaded
...wait... where would I put a java folder? In just \42? Or would I need a top level one like media as well? Or just within media so it goes where that goes?
Wdym a java folder ?
Java mods require manual installation
You could have a look at something like No Mo Culling to see how they did it. That's for 41 but it shouldn't be much/any different for 42
https://steamcommunity.com/sharedfiles/filedetails/?id=3115293671
Well that makes my life a whole lot easier, but not everyone elses.
I suppose I'll work the alternative means first.
Hello, can I ask a question? If the mod I want to translate and create a separate translation mod for already has a built-in translation into my language (but of poor quality), how can I make my translation take priority? Currently, only the existing built-in translation is being displayed.
- Make a new own mod
- Put your mod bottom of original mod
- Done
Detail: Original mod will be loaded first
and your mod will be loaded later
(Top to bottom sequentially)
So your mod will be able to override original mod's translation key
(translation key is something like.. IGUI_HelloWorld_EN = "Hello, World!")
Maybe I should just make a java mod for the fix I need, entirely separately from the main mod, and set it as a requirement. That way maximum capacity changes can be used by others and not simply by only the carts in the mod? I am mostly worried about description bloat and people not following directions.
haven't people already fixed that without java? you could add the mod that does that as a dependency
Yeah mods already exist for that
We are looking to recruit a staff member in exchange for 10% of all server donations. We are looking for help in specifically adding SSR quests into our server. If youโre interested, please reach out
...such as? @bronze yoke @bright fog
Also Albion, weren't you the one who told me fixing this limit in java would be my best option? lol
You can make commissions on the modding Discord
https://discord.com/channels/136501320340209664/1125248330595848192
it would be the easiest way to do it but i don't really encourage anyone to make java mods, it's too annoying for the end user
i can't find that mod because iirc it was a default icon mod with a terribly unhelpful name and description
I'm 100% certain mods already do it
And I believe some exist that do java-less
CapacityLimitBypassB42
This mod has a submod
It's a manual install
how did they even need to change 20 java files for this
i'm 100% sure there's a pure lua one that they just made completely fucking impossible to find
Yea
Maybe we can just yell at TIS to stop introducing dumb stuff we can't mod around.
Easily, anyway.
We already did in #1318920979581501502
Likely isn't that B41 or earlier, tho? Or did you see this post B42?
But I haven't seen many requests actually being introduced in the game, or when they did they didn't even do it properly 
Sooooo this mod you're thinking of exists in B42, or...?
yes
Thanks.
it wasn't something that interested me so i didn't subscribe to it or anything but they were bragging about it a bunch here
this doesn't help(( still shows the built-in translation, not my mod
Yeah I'm fairly certain I remember that mod too
But finding it, yikes
the only thing that helps is when I delete the folder with the translation into my language in the original mod, but it is unlikely that every user will do this
No just clearly state in the description that they should load your mod last
Welp, without finding that mod I guess the best thing is to introduce a limited one for the mod fork.
Can't seem to be able to find the lua fix
Just tell people to manually install the fix if they want to go over 50
What is your mod about ?
I need a break a bit from modding for the day, so I'm just gonna pester a bunch of AIs about running through the decompiled code to find a flaw I can maybe exploit.
It's the ZuperCarts port.
Hmm
Yea
This applies to every containers
But I bet it has something to do with the timed action of putting items in containers
And so you might be able to just ignore the check. But if it's hardcoded to stop putting items in containers if it goes over the limit then you're fucked
And java it is
the only real lua flaw I found is you can increase the capacity during transfer. it breaks animations though and probably other important stuff
Yea, I looked at this one. It also doesn't work for drag and drop past the limit. I want a true fix, not a cheeky and kinda annoying one. It'll prolly end up being Java.
what i'll say is that even though the limit is defined in java, it is 100% enforced by lua
by patching the right methods you can definitely bypass it without a java mod
I didn't find the mod that did it
I wasn't able to find one but does anybody know if there's a mod that turns hay bales into usable hay for animal feed?
Does anyone know where to find the vehicle collision sound? I'd like to trigger it during a certain code event in my mod!
Thanks in advance! 
Probably in the bank files
thanks!
Sorry - totally new to the sound portion of this - bank files? Where/what is that? (Also - Thank you so much Jvla!)
Another question: I have been able to update the condition of all parts on a vehicle from client side, but it doesn't sync to the server.
How can I get the vehicle condition set on client side synced to the server?
Bank files are files that store a lot of sounds
Want to get started with modding zombie spawning and behavior. Can someone recommend the best decompiler and some essential up to date tools to get started looking at the source code? Have some low level programming experience. Feel overwhelmed by the mod tools and resources thread.
this is the decompilation tool i maintain: https://github.com/demiurgeQuantified/ZomboidDecompiler/
if you're on windows and have a steam copy of the game, you should be able to just double click it and everything will be done for you (assuming you have java)
for browsing the source code i recommend intellij idea but a lot of people here will use vscode since you'll probably use that anyway for actually writing mods
It was way more complicated to get working than I expected, but this seems to. Added the template for 3, and a middle front seat. You have to also add translation for "IGUI_SeatFrontMiddle"
Game files
Does anyone know if itโs possible to make mods that add custom radio stations or TV shows?
There might be a way if you figure out the file paths with TVRadio Reinvented mod
It's possible, because existing mods do it
You need to transmit the part conditions
https://steamcommunity.com/sharedfiles/filedetails/?id=3102060630&searchtext=survivor+radio <-- adds a bunch of voices stations and music, really cool mod with some night stories being told via broadcasts. Plus a text-only channel of other survivors
https://steamcommunity.com/workshop/filedetails/?id=2973493897 <-- the B42 version of survivor radio uses this framework, the B41 version is standalone
Welp, I got the trollies to hold 50... but still can't equip it if it is holding more than 37 encumbrance.
You need to be able to pick up a bag (or trolley-shaped bag) before encumberance reduction to equip it.
And your character has a hard-limit of 50 kg held
I think if you make a function that 1) adds trolly item directly into player inventory then 2) removed item from world and 3) equps it it will work around that, since you would code that without the capacity checks - I don;t think java ever checks cpacity, it trusts lua to do that.
Got java, downloaded v0.15 of ZomboidDecompiler. Extracted it. See no application jar to run. Tried the command line java -jar ZomboidDecompiler.jar "C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid". But it cant find the path:
java.io.FileNotFoundException: logs\main.log (The system cannot find the path specified)
etc
Simplified decompilation tool for Project Zomboid powered by Vineflower. - demiurgeQuantified/ZomboidDecompiler
I got that. All I see is a bunch of objects and a .class object
i'm really surprised you can even get that error, but that error just means the logger failed to create its file which doesn't prevent the rest of the program from running
it's a .jar file, no need to extract anything.
You can extract things, since a .jar is like a zip full of .class files and other bits, but you should leave it as a jar to run.
ok so, is java not installed properly or something? Do I open it with java?
because its showing up as winrar file
I suspect java is not installed =- have you manually insatlled a Java run time on your system?
yes I got java 23 from https://www.oracle.com/fr/java/technologies/downloads/#jdk23-windows
they did get some java output, my guess is maybe it doesn't have a file association?
the normal operation is to just download the jar and then double click it and wait
if I double click it, it opens in winrar and I see a bunch of folders and module-info.class
so right click the 'zip file', open with Java SE binary?
yeah
java's jar files are literally just zip files with java stuff in them, they aren't actually different formats other than the fact that specific files are expected inside them to be a runnable java program
ok doesnt work, because the command line didnt work either
you say etc, do you get other errors? the one you posted doesn't really tell me anything, that one can happen with no real consequences
I have a few more things up to try, but that route will be sooner or later if I can't do it another way.
C:\Program Files\ZomboidDecompiler>java -jar ZomboidDecompiler.jar "C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid"
java.io.FileNotFoundException: logs\main.log (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:295)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:185)
at java.base/java.io.PrintStream.<init>(PrintStream.java:364)
at com.github.zomboiddecompiler.FileLogger.<init>(FileLogger.java:11)
at com.github.zomboiddecompiler.ZomboidDecompiler.initLoggers(ZomboidDecompiler.java:253)
at com.github.zomboiddecompiler.commands.Decompile.call(Decompile.java:177)
at com.github.zomboiddecompiler.commands.Decompile.call(Decompile.java:17)
at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at com.github.zomboiddecompiler.commands.Decompile.main(Decompile.java:188)
C:\Program Files\ZomboidDecompiler>
I wasn't sure if they were literal zips or a slightly different compression algorithm, hence I hedged my bets in my coomment. ๐
permissions issue maybe?
that's possible but this exception is caught, it shouldn't really matter```java
try {
log = new FileLogger(new File(logDirectory, "main.log"));
} catch (FileNotFoundException e) {
e.printStackTrace();
log = new DummyLogger();
}
try: make a logs directory and a ``main.log` file in it
the jar file is in C:\Program Files\ZomboidDecompiler
it might need more permissions to do stuff in program files
try putting it in C:\ZomboidDecompiler or something
ok
Make a c:\pz\ with Everyone/full permissions to rule out it being a permissions issue.
I think Albion might be right about Program Files being a bit more locked down to random processess creating files.
He was
moved to C:\ZomboidDecompiler
still looks like a rar file, couldent open with. Had to run command line again but now there is log and output folders created as expected
yay
glad it worked out, i'm reshuffling a couple things internally so it'll log stuff like this better in the future
you can fix the file association if you want, but you're probably only going to use this once per Zomboid update.
I changed association now it looks like an executable jar file at least
tried running with double click but don't see any change in the main log file
i actually had issues with the file association too (mine was stuck on a way older version of java) and it's a real pain to set up properly
if you know how to use it from the command line it's probably not worth the effort
i don't remember exactly what it was but you have to edit the file association using some command line crap because it needs something more complex than the windows picker allows
i think if you just have the association the normal way, it tries to run java ZomboidDecompiler.jar when it needs to be java -jar ZomboidDecompiler.jar
Please advise how to search through multiple files with VS code. For example all occurrences or origin of "ZombieGroup" from zombie\ai\ZombieGroupManager. As I want to learn how the grouping and instance deactivation works. I'm not used to dealing with multiple large code files
Sadly I think you have no choice but to get used to the programming language you are looking at to find paterns
if you open the whole source folder, you can use ctrl-shift-f to search the entire directory for text
That's what he did from my understanding of it
i assume you have a java extension (or maybe vscode comes with one), you can most likely use that to jump to the definitions/usages of elements
I remember there was a way to do it with notepad++ but I don't know how to do it with VS
I need something like that 
i'm not in vscode so the shortcuts are likely different but when i press ctrl-n it opens a search window for class declarations (or i can move to the symbols tab to search for functions and fields too)
when i'm there i can click the 16 usages text or ctrl-click the name of the class to show me every place that class is used
Yea got nothing like t hat
Might be things to be able to do that idk
check your java extension for any settings with the term 'code lens'
that's usually what it's called
adding "Extension Pack for Java"
I want to check all the java source files in zombie\ai\ for where "ZombieGroup" shows up in the code
Simply search for the term in this specific java folder
You don't need no extension for that
that means I have to open them all and search each one individually?
you can open entire folders in vscode
it should be in the dropdown when right clicking a folder in file explorer
mb thought the way you asked your question that you had read the wiki page
you can also do it from here
ctrl-shift-f should search the entire workspace
Usually the go-to is to open the entire decompiled java, then use the search function (loop on the left bar) and search in specific folders if needed
But that works too
Use the loop function on the left bar
Or what Albion said probably
Sounds good
Any advice on how to browse the code effectively to learn about zombie ai, grouping, and spawning? I have a general idea of how they are coded conceptually from this video:https://www.youtube.com/watch?v=hglrA6FrxOw&ab_channel=Retanaru
But I would like to start associating their behaviour with the code. Do I start from the bottom level or top level then down?
In this video I explain and show off the zombie migration mechanics. The sandbox mode lets us modify many of the main mechanics of the game and allows me to show off what does what. The redistribution hours and in game sound events are the primary movers of zombies while the rally group system and others help to smooth the rest out.
https://ko-...
wdym bottom and top level ?
You're getting started with the java with quite a beast I think here
The way I'd do it is start from something I know about which is related to the spawning of zombies
Notably the sandbox options
well you know, low level where all the base things are defined and the top level where they are used to build things out of
yeah its a beast to learn but I just wanted to start with some browsing to get an idea of how things are structured. I'm used to really low level stuff, not how to relate large seperate files of code relate to each other
That's fine, like I said the way I'd do it is start from something I know
You know like finding an item script, I'd start with its name
to be honest you probably need to understand one to understand the other
this is likely one of the most complex things you can start with
I think the issue you might encounter is that it probably is spread out a lot ?
But I don't know how it's defined in the java so hard to say
But it does feel like a complex system
so start with something simpler like doggy suggested? How the sandbox settings affect the population in code?
I mean, you got to start somewhere to even know where the spawning system is defined
It's not like there's a big sign saying SPAWNING SYSTEM IS DEFINED HERE, COME OVER
You got to know where to look for
And I don't know if ZombieGroup is it
So the way I'd find it is by starting from the sandbox options
And from here, go up until I find what I was looking for
Ok thanks. And the best way is to search up functions or variables and see where they are used/defined?
In the case of sandbox options, I'd search from the sandbox option ID but I just realized they are not defined classically for the vanilla options
Still worth starting there I'd say
i'd recommend trying to get code lens to work since that'd make finding usages of things massively easier especially if they have kind of generic names
usually not class names but function names and field names can be really generic and hard to search for by text
is it possible to get the exact degree of the angle where the character is looking? And is it possible to turn the character exactly by a degree during timedaction?
Yes !
I did exactly something like that with a timed action
I made the character aim at a direction
However, it required aiming in my case
it looks like red hat's java extension https://marketplace.visualstudio.com/items?itemName=redhat.java has it, which i think is the one i used before i switched back to idea
Ok code lens and what do you think about copilot?
That ...
Has nothing to do with what albion described I think ? ๐ญ
-- get job delta
local delta = 1 - self.action:getJobDelta()
-- get coordinates
local character = self.character
local p_x,p_y = character:getX(),character:getY()
local squareTarget = self.squareTarget
-- get vector
local vector = self.vector
vector:setLength(self.distanceToStartPoint * delta)
local x_target = squareTarget:getX() + vector:getX()
local y_target = squareTarget:getY() + vector:getY()
local x,y = x_target - p_x,y_target - p_y
vector = Vector2.new(x,y)
self.character:setForwardDirection(vector)
self.vectorEnd = vector
That's how I was setting the player looking direction, but it was only working if I force the player to aim
i don't have any experience using copilot but i'd expect it to be unreliable
It's okay
I use it and it does okay, but it will hallucinate some stuff as usual
Like any AI tool you need to stay critic of it
I mean in terms of helping my inderstand the code it could be helpful to understand the basic structure? Idk I haven't used AI for coding except gpt for unity to give me starting points
It won't help you understand Project Zomboid's code I think
people post ai code here sometimes and it's always dreadful and 90% hallucinations
For multiple reasons if I have to guess:
- it won't have the entire game code in mind when answering questions or specific elements
- it won't understand some principles of PZ API
Thank you very much! This is exactly what was missing
AI will tell you "open up ZombieAI.class and look at getSwarmBehavior()" and it will be great advice until you realize ZombieAI.class doesn't exist.
you could be optimistic and start withe the classes under the ai folder, like zombie/ai/zombieGroupManager
ran into a strange bug where TV presets disappear. I tried to force to add them back in with addPreset() and it doesn't stick even on the device as the preset list is pulled up. I can tell that all the channel info is there because if I force the channel it works just fine. self.deviceData:setChannel(222)
self.deviceData:getDevicePresets():addPreset("Monty Python TV 24/7", 222)
What makes the presets disappear?
Also are you adding a 24/7 Monthy python channel because that is a great idea.
That's the odd part, been using dynamic channels for a while with radio stations and its never been an issue, added one TV Channel and it makes other mod channels disappear in the presets. If I stop that one channel from loading it works fine. I also noticed it does that with Emergency TV Channel
So the Monty Python channel already exists. for some reason the TMRadio TM MTV channel makes the preset disappear on tv's.
but if I force the tv to 222 it works fine
Sounds like something is coded with "makes the preset the vanilla presets + my station" instead of "presets = current presets + my station"
If I have the code print out the presets it sees it does not see 222 anymore.
Or the gui can't handle that many presets... do they show if you access presets via lua?
nevermind, you just answered that one.
So I never added the presets with the TMRadio code, they get added to the list of channels in the game. On the save I can see the channels loaded. even if I edit the save and add the 222 channel it still does not appear in the preset.
Basically the TV Channels and Radio channels are handled the same in game just different frequencies. At the last leg the TV doesn't allow you to create presets, it loads them from self.deviceData:getDevicePresets():getPresets()
and the addPreset function exists and doesn't kick an error but doesn't work.
Not sure where the game pulls the preset list from.
going to check the max presets...
Wow! Good call! The max presets is set to 10, one more than the list in vanilla. So every time someone adds a station it kicks the last one off...
That's my theory anyways...
yay!
Now the real question is can you get past that max preset value, or is it hard-coded in the java?
At least it's not like the "9 projectiles max from a shotgun" limit where going higher crashes the game because it casually goes out of bounds on an array.
that also explains why my working method of adding channels would not add more than one...
that did it, bumped the preset limit and then it worked immediately...
so now I just need to find where that is set in the game to adjust all devices from the start if I can.
zombie.radio.devices.DevicePresets
just call setMaxPresets before AddPreset
why is this a thing
I know, right...
I only had 4 TV channels in the 1900s, so 10 should be enough for anyone!
I could decorate the read presets function but I would love to have it do it upon creation of the tv.
But also... yeah, why is it a thing? Unless the GUI has a limit of 10? But it probably doesnt, the list is just a dropdown that can hold lots of entries.
yeah I just proved I can move it to 11...
which is just awesome, cause this one goes to 11...
But it is probably oversight as before 42 there were less channels.
But even so, why put a limit on? the presets go into a list so it's not like there is an array that cna only hold 10 elements
does seem suspicious...
A general "more presets" mod would be handy, I find myself having to delete radio presets when I have statiosn added
Which means this was not MontyPythonTV's issue or TMRadio's issue or Emergency TV Channel's issue, but a failure before us...
Well I think you might get your wish because I will build in a maxpreset setting into TMRadio that will work for TV's and Radios...
Sandbox it in case anyone is worried.
So I am still going to have to add the missing stations back in because by the time I get to add the max preset the damage is done. But I can handle that on a list if I need to.
you add your presets with addPreset(), correct?
why not just setMaxPresets(getMaxPresets()+1); addPreset()
Or do you put your station into a lua table and then the general radio code populates things?
hook addPreset to do that even
Can you hook a lua call to a java function?
The lua metatable of the thing calling the java function?
local index = __classmetatables[DevicePresets.class].__index
local old_addPreset = index.addPreset
index.addPreset = function(self, ...)
local maxPresets = self:getMaxPresets()
if self:getPresets():size() >= maxPresets then
self:setMaxPresets(maxPresets + 1)
end
old_addPreset(self, ...)
end
bear in mind that java doesn't go through lua's metatables so it doesn't affect java-to-java calls
And I have also always put "learn metatables" lower on my priority list.
When's a horse mod dropping
that's still immensely helpful, especially when a mod idea is really "change two java api calls, but they show up in 57 different places"
I can make you a horse dropping mod.
extend the range of dung already in the game.
Well that'd be a start
we're working on it
Hopefully we don't get this again๐
graphics are still WIP but we're doing a little better than that
Neat๐๐
Best of luck y'all give it ur best
looks like a horse to me!
I assume the high level plan is add animations/behavior/make it ridable/add saddlebags
Yep, I'm no modder but I'm pretty sure making it rideable is the hard part
all of which are potentailly very difficult.
Hardest*
we've got a proof of concept for riding, most of the rest is just a matter of time (we have a couple rough animations, but we need a *lot* for a functioning animal)
Then you need to add horse blinkers to reduce panic from zombies. And once you have the code to do that you'll have to extend it so the horse can wear hats.
Can't the behavior be a duplicate of the cows or smthn
a lot of the behaviour is primarily dictated by their animations, which we have to do from scratch since we have a completely different skeleton
So whenever a zombie is near the horse charges the closest part of your base to destroy it, even if that means running back from freedom towards the danger just to $^@# your base up?
That sounds horrible to deal with.
That means rideable cows would be much easier to make ๐๏ธ๐๏ธ
And also explains why things didn't make much sense when I looked ta code trying to work out why my bull wasn't getting my cows preganant
it's honestly probably the best way for it to work, but it's a lot for us to do
Bit more on the goofy side
i'm considering it
You sir are a legend
Ridable cows would be a fun mod while waiting for the full horse.
Agreed
Bonus: create a summonable ridable cow skeleton.
There needs to be some purpose for all the animal blood we can colelct when killing them!
Do sum black magic shit, create a start symbol frm the blood
Lolz
Star
Does pour something on the ground leave a trail?
Pouring*
It'd been a fun feature ngl, we could make trails of gasoline n set traps for the zed n stuff
I lua code a table through a revision of the dynamicradio system.
Wow, I thought I would need to use Burryaga's DOME for that. I have used that to trick hasElectricity to report back what I wanted.
No way to edit the max before presets are added then, because the java creates a new DevicePReset (with max of 10) and then puts in the TV stations before you have any chance to do something.
Thank you for checking that.
can you clear the list and then just do this from lua?
Which makes my fix pretty clear, check on readpreset.
I poked RadioData a bunch for the Plug in Your Radio mod.
yeah, because you know the TV station list should have every station, unlike radios with their random stations.
Anyone else remember twiddling little knobs to tune in their TV then having to adjust the vertical hold to stop the picture scrolling up and down endlessly?
so far there are only 3 mods with channels
I am a cable guy by trade... the knobs where easier than the veractor tuners
imagine tuning your tv with that...
those things can $#^@# off lol
lol
The knobs probably turned the same piece underneath, but they were a lot esier to use.
and that is how long I have been a cable guy...
basically, this big tuning system allowed each channel independant fine tuning so you could just puch a button later versus tuning the station each time with one big knob.
My TV as a kid was pretty much exactly this:
yup
there was a little knob for each channel (I think it had 6, which is all you ever needed in Australia - 5 free-to-air-station and an old top loading VCR)
two screws for a screw in antenna adapter for an atari, etc...
ah, here in the states we had one knob for UHF and one for VHF that had a setting that flipped to UHF.
ok so im trying to make a compatability mod for an abandoned clothing mod (im not going to publish it as i merely want to learn how they work) how would one go about it?
compat might not be the best descriptor for it
B41 -> B42?
yeah
see the sticky threads, also this reddit post I made: https://www.reddit.com/r/projectzomboid/comments/1hgwccl/if_there_is_a_mod_you_absolutely_cant_live/
ah thanks
If there are recipes you will need to redo them
im not confident with the actual coding yet i just wanna get used to how the actual models work and form around the body
If there is an existing B41 mod that has already been done; that part of the game did not change in B42
what do you mean with "that part of the game did not change in b42"?
oh yeah i probably should have elaborated that the reason the mods got abandoned is that they were built on a body type that was originally abandoned in 2023
i was trying to see where i could find a resource on how to change the model to work with the vanilla model
the character model didn;t change in B42.
If the clothes were not built for the default character model though, try #modeling channel if you need some help.
ah thanks
And if you have not used Blender before, enjoy the initial learning curve. ๐
i know how to rig and make basic changes im just not the most knowledgable
That's good, you at least know the basics of using the interface.
Can someone make a mod that adds corpses to some cars which we can drag out n stuff
As in the walking dead universe
Hi, does anyone know where I can find the file that defines the frequency of burnt houses/building stories
hello im new in this modding community i just wonder how was the folder structure in b42?
Check the pins. There's a guide there made by one of the devs
Probably not with the new corpse drag mechanic.
what, I am doing wrong D:
- find the names of the variable in sandbox settings 2) search for that
High chance it will be in the java, not the lua
Ah ok
seems to work fine with just /MOD-ID, at least for incompatibleWith
Me too but I guess that's why this is happening.
#1318920979581501502 message
๐คฃ
So the code ignores the way every mod is <steam>/108600/12335452/mods
And that's why WorkshopID is blank here.
(I think... but that is definitely the bit that generates the errors, and it's because it's asking Steam "what is the workshop id of "mods"?" when it coudl just look at the name of the parent folder...
(OK ignore that second bit, the function throwing the error doesn't get used to populate that bit. Plus it does still return the list of workshop IDs. So maybe steam gives multiple entries, and some are to "mods" folder and teh rest to correct folder? Either way, the error spame is not caused by mod.infe but by the way steam hands over list of paths to installed mods.)
the problem is that they check one folder too shallow
this code was written for the old mod structure where that would have been correct
i think they don't want to fix it yet because it'll break half of all mods and makes modding permanently more annoying
the supposed purpose isn't even relevant until multiplayer comes out so i suspect they'll fix it around then
I figure if they're going to do a breaking change, might as well do it in b42 considering it's a major update not a bugfix
i sort of pray they leave it how it is forever or come up with a middle ground but idk
They could fix it easily, just rewrite getIDFromItemInstallFolder() with correct assumptiosn about the paths being given
or even... if string == "mods" return null
I mean they could just have a legacy mod loading system for still supporting old structure
the main bullet points are:
- every mod with a dependency is broken by this change, because the dependency's id will change
- working on dependencies is permanently more annoying because your local copy has a different id from the live copy, you have to change require ids every single time to test