#mod_development
1 messages · Page 220 of 1
Nah, you can do it to yourself.
i mean, for it to count as work
I'll do that in the multiplayer patch, I have no way to test the mod in multiplayer right now so I'm focused on singleplayer.
however, first aid is kinda weird in terms of defining it as work, since it is basic survival rather than doing tasks towards a main goal
Makes sense.
I won't count crafting because of stuff like "Put Nails in Box" and "Open Box of Nails" lol
yea ofc
are the tasks weighted or do they all reset the non-working stress once you perform an action?
I could do that like: only decrease stress when the task takes more than a minute or something.
But there's too many crafted items.
if it just resets, it might be wise to exclude it completely, since all first aid can be done on the go repeatedly as long as you have an injury to treat
for example, removing a bandage and putting it back on, or stitching and unstitching a wound
Yeah.
There are stuff I've patched before to avoid exploiting it such as:
function ISAddGasolineToVehicle:perform()
-- Avoid spamming siphon and add fuel options.
local minCapacity = self.part:getContainerCapacity() - 0.5
if self.part:getContainerContentAmount() <= minCapacity then
ISTPManager.Workaholic:finishWork()
end
return ISTPISAddGasolineToVehicle.original_perform(self)
end
```and
```lua
function ISTakeGasolineFromVehicle:perform()
-- Avoid spamming siphon and add fuel options.
local minCapacity = 0.9
if ISTPISTakeGasolineFromVehicle.initialItemUsedDelta <= minCapacity then -- Cannot use self.item:getUsedDelta() here because this is when the action is finished.
ISTPManager.Workaholic:finishWork()
end
return ISTPISTakeGasolineFromVehicle.original_perform(self)
end
I'm not sure I can do that with stiching and unstitching even though I have a solution because it's quite complicated and I'm lazy.
there's a variety of ways you can balance it, so it's up to you to decide which way is best for your mod
This single trait is so tedious lol
one such way could be to set a daily limit per action
Nah, Workaholics have no limits.
so u can only do the same action once per day to decrease stress
They'll work until they die if they want.
This comes with a lot of flaw, especially since the player has no way of knowing which actions count as work.
yea i mean workaholics feel more productive if they actually complete necessary tasks right? they wouldnt cheese their condition by repeating the same task that isn't productive after doing it the first time
so if you set a daily limit it could simulate a workaholic's need to do everything throughout the day
but that is just an example. i dont know how you would personally balance it, and you probably have better ideas already
Nah, too tedious.
and here's a really dumb idea, but you could give them a daily task list 😂 and make them go out and do certain things every day to manage their stress
(until the impostor comes and eats them alive)
but yeah, it would take a LOT of work to make the trait feel accurate to how a workaholic would behave
This trait has been tedious so far, 80% of it is just copy-pasting code, renaming stuff, and testing.
I feel you
When I made my first mod, all it did was let you spawn with skill points and weapons
And then I wanted to make a Bitten trait as a joke
which required me to actually do some coding
and after that, I ended up making an Immunity trait mod to go with it
Hehe, I got a 300 points award.
speaking of which, i just realized I fixed the immunity system module of my mod, but not the lone-standing trait module 
i have to fix it!
nice! awards are nice to receive
oh wait past me did fix it phew 😅
This are the last few ones I haven't coded yet.
I removed the UpgradeWeapon
i see
Alright, I've pasted in the codes, all I have to do is test now.
Then Workaholic trait is finally actually done.
What do you think of this trait?
that's a pretty cool one
i think a lot of traits r unique and different so it's cool seeing everyone's ideas
I'm not sure about this one, it was suppose to make you clumsy and then gain the strength modifiers but decided to remove the clumsiness since it's hard-coded into the Java.
What other name should it be called?
what does this mean? you gain stats when ur in panic mode but then get tired really fast?
It's similar to Adrenaline Junkie I guess.
some of these names might be taken already, but I think of Adrenaline Rush, Fight or Flight
also, it seems like a trait that would be more beneficial to weak and unfit players, as stronger and more fit players would get capped earlier (unless you can actually go above 10 with this trait)
I'm not sure what to call it as Reckless doesn't quite fit it anymore.
as long as the description accurately tells the user what it does, and the trait name gives them a general idea of what it is, you are fine
i would just go with Adrenaline Rush if it isnt taken, or Fight or Flight
Just making an node app for auto making the server config Mods= et WorkshopItems=
Anyone want ?
Open source code
not working any ideas? -- Function to destroy vehicles local function destroyVehicle(square) local vehicle = square:getVehicleContainer() if vehicle and not string.find(vehicle:getScriptName(), "TigerII") then if string.find(vehicle:getScriptName(), "burnt") or string.find(vehicle:getScriptName(), "smashed") then sendClientCommand(getPlayer(), "vehicle", "remove", { vehicle = vehicle:getId() }) end end end
console log ?
not giving any errors in the console just not deleting the vehicles as expected
It's like 4 functions and one is calling the other 3
building damage, kill zombies, and the main function all work, just this one seems to not be working
Maybe because I'm trying to do it with sendclientcommand?
print(getPlayer():getInventory():getClothingItem_Legs():getDisplayName())
Hey, I've got a little problem with the clothing.xml file, I've got 2 clothing items, and I want that zombies spawn with either one of them (2x25%) or both of them (25%), but never spawn with none of them (25% :/ ), that's why the <probability> isn't the best option here, what can I do to find a workaround that ?
Do I need to do some lua ?
print(getPlayer():getInventory():getWornItem("Pants"):getDisplayName())
Bruh, why aren't these working.
I don't know much about clothings, but check the subItems entries?
How do I get the pants the player is wearing? And if possible include the underpants too.
Son of a..
It was a player method.
print(getPlayer():getWornItem("Pants"):getDisplayName())
local player = getPlayer()
local wornItem = player:getWornItem("Skirt")
if wornItem ~= nil then
print(wornItem:getDisplayName())
wornItem:setWetness(30)
end
Torso1Legs1
Legs1
Pants
Skirt
Hmm, so you can't make underwears wet for some reason.
They don't get dirty at all or allow cleaning, if I remember correctly. They oughta
can some please mod this up to apply sfx when taking pills/medicines?
https://pixabay.com/sound-effects/search/pills-in-container/
good afternoon! im trying to replace an item on the ground after a timed action, it shows up in the floor container but cant figure out how to show the actual mesh on the ground, this is what i have now:
local _item = sq:AddWorldInventoryItem("Base.UnusableWood", _x, _y, _z);
_item:getWorldItem():addToWorld();
self.floorcont:AddItem(_item);
i tried using sq:transmitAddObjectToSquare(_item) but it throws errors, noticed in the docs that the method expects an int too but not sure what it wants
hi! Tell me how expensive it is in terms of resources in UI:render() to compare var1 == SandboxVars.SU.RegisterDock ?
Or is it better to place the SandboxVars variable in an external variable and poll it, for example, once every 10 game minutes?
in other words: are the SandboxVars variables stored on the client side or is the server polled each time?
Hey, where can I find any documentation for the <subItems> tag in clothing.xml ? I can't find any
Hello everyone. I want to start making mods but don't know where to start. Need guide please. Thank you.
https://pzwiki.net/wiki/Modding#Creating_mods this is a good place to start
ty
any good yt video for LUA learning ?
and how long does it take to learn it ?
I just noticed on a vanilla server that the radios are duplicating text... Is this a known issue? I suspect this may be related to another bug I am tracking where a pickup up radio is still showing the test on the ground where it was but only in MP.
Starting into the server the radio is normal, picking it up and placing it again starts the double lines...
in single player I don't get the duplicate entries...
No mods at all?
zero
https://www.reddit.com/r/projectzomboid/comments/102ad34/radio_messages_duplicating_multiplayer_bug/
found this related through... it does exactly what I see in game, something is being left behind in MP when a radio is picked up.
Since a mod I have works on radio positioning, this is a problem. I need to figure out a way to identify what is left behind and remove it. Otherwise ghost radios are left everywhere...
I imagine when the world item is being removed, it's not being updated to the server and down to the clients.
Move a radio 3 times and get ghosts left behind
Happened to check out B42 feature with negative Y plains (underground, basements) and just realized how funny it would be to have a mod that allows you to dig underground tunnels on existing map, like between two houses 
Or windows traps so zomboids and players fall into the hole thats exactly in front of that window
All these will definitely be doable
Cant wait to make my little bunker in pz and dig tunnels over the whole map
not sure it'll be that simple, not all chunks have all z levels
it'll happen for sure but it'll be a little jank
Thats pz in a nutshell
how can I print the... object, in an ArrayList?
I tried print(tostring(myArrayList(i))) but that didnt work ><
myArrayList:get(i)
myArrayList:get(i)
Should add that java arrays start at 0 and not 1 like the lua ones so you have to potentially index it at one lower
oh no LOL
so... for i = 1, myArrayList:size() do
I might as well start at 0 instead?
print("iteration ", i, " ", myArrayList.get(i))
java.lang.RuntimeException: get: Expected a method call but got a function call. Correct syntax: E obj:get(int arg1)
myArrayList:get(i)
OOF
Imperative that you use : and not .
It actually says right at the bottom of your error how to use it properly
<@&671452400221159444>
yup
welp
Let's hope for you don't get banned lol
You clicked some shit that gave access to your account
Probably nothing to do with a virus
You just connected to your discord account on a website or something
oof
<@&671452400221159444> hey uh the guy that you banned was getting back his access to his account
He was talking with us about it
poor guy
let's hope Discord fixes their shit with those embed links
it waits to pop up that it's a hyperlink when it really shouldn't
Ty
Get them to DM the Spiffo bot and we’ll unban when they get their account back
What do holes even do?
I put 10 holes in a 1/10 leather jacket, it still seems to have 65 insulation, 35 wind res, 45 water res, 20 bite def, 40 scratch def
(all same as 10/10 perfect leather jacket)
I don't know them lol, I don't have them in DMs
Reduces resistances on various parts of the clothing
Check the sewing panel
innnnnnnnteresting. my tooltip was lying to me
Hi! I got a quick question, in the building tool, does the room type also dictate what kind of items can spawn 'outside of furniture' (like how you can find canned foods on top of counters instead of just on them)
I could be wrong, but I'm pretty sure items 'outside of furniture' are just hand-placed by the mapper.
If they aren't there every playthrough, it was either removed due to loot rarity in the sandbox options, or perhaps it was a 'story' that didn't spawn (everyone in the room is wearing baseball stuff / alcohol and chips and red cups / dead body with bleach bottle)
So no, I don't think the specific room type has any effect on world items. (but once again, im just guessing)
Ah alright, thanks!
Items aren't hand placed by the mapper
You will have items that will spawn with item stories
Be it the mod that adds more of those or the vanilla ones (like finding food on counters in the kitchen for example)
hey how do I get the players item that they're wearing?
local function InitalizeMod(playerIndex, player)
print(player.WornItems) -- How do I get the players clothes / any item that they're wearing?
end
Events.OnCreatePlayer.Add(InitalizeMod);
not ideal, but you can use these...
nvm wornItems is an actual.... bodyLocationGroup? hmm
im pretty sure:
player inherits from isogamecharacter, which inherits from charcters, which inherits from zombie
lol ok
no, zombie.characters is just the package IsoGameCharacter is in
all of zomboid's classes are in the zombie package
It's basically a file in a folder, where the file is called a "class" file and the folder is called a package.
Also, to be clear, player is an IsoPlayer
This is its inheritance path:
So it is an IsoGameCharacter but more specifically it's an IsoPlayer
as I suspected, in vanilla in multiplayer the game leaves behind invisible radios when one is picked up...
Poor Norby is trying to perfect a lot of weird edge cases with stopping sounds when radios move because he is working on True Music Radio @bright fog.
(Spared you needing to write that while you suffer, Norby.)
He accidentally figured this out while trying to understand why the radio would leave ghost audio for people as though radios were still in places they shouldn't be.
I see
That could explain why when True Music boomboxes burn you still have the small text saying they are playing, tho those are items and maybe that was fixed since that happened to me
That could also explain why Survivor Radios when running on a radio breaks a save when it burns
No idea on that front. I am very glad these weird edge cases don't apply to jukebox object lmao.

ugh that might mess with my radio mod too
Maybe you could report the bug to TIS
What's your radio mod ?
it's an unreleased expansion for a true music pack that adds music playing radio stations, with dialogue intermissions and stuff
damn
Haha oof you and Norby should team up
Very closely related goals... And he already got the obvious name haha
True Music Radio has been live awhile now
not for as long as this has been in development
yup
it was primarily written at the start of last year
old project
it's a collaborative project and there's been some computer issues and other such things holding back release
where can i see all the luaEventManager's events?
Fair enough, just observing that a merger of sorts might be valuable. Not sure if the code bases could benefit each other. I'm not involved with True Music Radio. Just an observation of possible purposeful alliance.
i had a quick look at the page a while back and it doesn't look like the features overlap all that much
Right forgot you had an updated list lol
Interesting... I mean adding music-playing radio stations is the only goal currently of TMR to my knowledge. Dialogue intermissions is unique. And then of course I know nothing of the differences implied by "stuff".
I guess we will have to wait and see!
Survivor Radio is such a banger tbf so having something like with True Music that would be amazing
basically there's a bunch of different radio stations each with their own announcers who speak between songs, usually just a 'that was... up next...' but with some rare longer dialogues
Damn so basically like Survivor Radio
i've never used it, so not sure
That sounds like an intense project for sure.
i'm quite proud of it, hopefully it sees release soon
Basically does what you said
Like different radio stations with themes for songs and announcers who will talk in between radios or have longer dialogues
But the way they do it makes it so when you fastfoward you desync the radio and it will cut a song before it can finish
Out of curiosity what did you plan to call it? (I would've totally planned to call it True Music Radio and been like shit when I saw Norby drop that in your position, lol)
While current True Music makes it so you can fast foward and the full song will still play
it was just an update for existing true music pack Music for the End of the World
Ohhhh so it'll be a submod of that?
how do i get the isoPlayer from a client script?
if it were a standalone release i wouldn't've named it after true music though, it technically doesn't really have anything to do with it
getPlayer()
Oh so it can load other music too?
it doesn't share any code with true music or use its api or anything
the only commonality is that it plays music
Wait it doesn't use True Music ?
it was pretty immediately obvious that hooking into true music would be a waste of time, it's not built for it and it didn't look like anything true music did would actually be beneficial to this usecase
Depends on the situation. It's good practice to try to identify the interacting player from context for split screen support, but for the KBM player or "player 1" in 2-player mode, "getPlayer()". Otherwise it could be self.character, self.playerObj, getSpecificPlayer(playerIndex), player itself, or any number of things. Context is everything here haha
TMRadio just pulls whatever True Music mod music you have and broadcasts it on stations. I plan on adding more to it, but the first stage is getting it stable. I figured out the ghost radios by tracking them on a tick... Once the radio was picked up, the tick continued...
The side effect is that I might be able to code an auto nuke of all invisible radios! Blasted monsters!
That sounds cool. Love the idea. I love the vinyls and cassettes of TM but I can see how they wouldn't be essential to a radio mod at all.
yeah, of course it shares sounds with true music but you can tell it to play whatever sound you want really
addHole(bloodBodyPartType, boolean1) Does anyone know what this mystery bool does?
it's user configurable although admittedly a little dense
everything is set up by script files so it searches Lua/ and other mods for them too
You're tempting me now. Now I want to make my own way of turning .ogg's into some new music item for non-TM .ogg's provided by expansions. We also don't use its API for much in TMJ.
Lol no must not do
Must live
Modding is a bad addiction
it had me tempted to make my own true music competitor but ultimately i couldn't see any benefit to end users
It's worse than all the drugs
Didn't knew you made the End of the World true music pack Albion
I can relate lol
I'm having so much fun modding rn
i'm not the original creator but i've helped with a lot of the lua and most of the lua in the forever upcoming update is my work
Yeah I think most people enjoy TM so I don't see it as necessary. But it's tempting. For people who perhaps want our jukebox capabilities but don't like TM for some reason.
I'd rather see a good sound api, any modder just sends a soundclip to a location with volume and it plays automatically to multiplayer sync...
True Music does a great job and the Cassette stuff just fits the game so well
i don't know how your mod works but i would think about what benefit you actually get from hooking into true music
idk how well made the mod is but eh
i didn't see true music doing anything for me that playSound() wouldn't so i avoided it, but a jukebox is closer to true music's original functionality so it may be more helpful there
I see two primary benefits: letting TM handle item management saves programming energy, and the large TM fanbase already wants to use all their TM packs, and it would feel a bit "aggressive" to tell people they could use TM packs without the TM dependency because I had written away any need for TM...
I love the jukebox, Burryaga made it godlike
does pz have/use the string library? (for lua)
Would feel almost mean lol, since TM is the reason all these great packs exist.
it's all about getting access to the music and playing it in a user friendly way
A nice twist would be pulling the TM music out of ambient and into the music channels...
Yeah would need to mute the game's default music though, unsure about that. Even better imo would be creating a unique volume slider for jukebox music. Might actually try to solve that but I'm unsure if Java would need to be involved
That would be my dream goal though
Convert all music played via jukebox to its own volume type
we didn't get around to implementing an actual setting for it but we have code configurable volume just by playing the sound quieter on the emitter
Well we can lower the volume on the emitter fine but it still ultimately plays through ambient... So if you mute ambient you also mute jukebox. Is there a way to make our volume ignore a slider?
Would we just need to change the sound's type master or something?
yep, and evidently a lot of people play with their ambient levels jacked up
do they lol ?
i either never tested that or considered it an acceptable drawback
Fair fair. I mean it is acceptable but still I can't help but dream of optimal
if you're gonna mute the game just play music on youtube 😭
took a while to figure out what was happening when people said the music was too loud on volume level 1
We offer a good range of volume that should work at most levels of ambient volume but I would still prefer to let people control e.g. footsteps separate from nearby music
yep, jukebox's own slider 🥹
Yeah I just haven't had time to even consider how a new slider and type could be modded in
complicated I bet
I don't fear complicated modding, I fear complicated installation
And users
They terrify me
Just in general
how do i change moodles cause i've been searching and i only see get methods (for the moodle class)
I think there is a mod that allows the easy add and remove of new moodles if that is what you are looking for
I'm looking for changing the 'amount' of unhappyness someone has
That's either in getStats() or getBodyDamage() iirc
In ISRadioInteractions.lua there is a list of many of the stats that can be changed
Javadoc Project Zomboid Modding API declaration: package: zombie.characters.BodyDamage, class: BodyDamage
I believe it's on a 0 to 1 scale ☝️
We don't talk about that
You can read how we edit a player's stats in True Music Jukebox if you want to understand how it can be done.
We have 1 sandbox page for Jukebox Therapy and one for Jukebox Nutrition
So that nothing about mood or nutrition will stop your friends from partying around a jukebox indefinitely (these settings are off by default, gotta enable them or it's just muzak).
@bright fog
Jukebox Nutrition ???
I mean listening to music reducing depression definitely should be a thing
(especially how easy your character can get depressed)
Haha it's all in the name of fun
I understand it's not the taste of everyone who plays Zomboid, but sometimes my friends just wanna dance until the zeds come, kill them, and repeat.
Being able to eat is fun, needing to eat is a chore
shrug
Haha that's why I didn't force those options in everyone lol I think 90% of Zomboid will leave Jukebox Nutrition off
But it does nothing when off so it's not gonna kill anyone
no 'listening to music makes you starve' option :(
Haha I actually considered it
If anyone ever asks in earnest I would probably make the adjustment
🤨 @bronze yoke @outer crypt @bright fog
Could it be so?
It's even automatically gamepad compatible... It feels too good to be true.
Oh sorry lol thought you were in on the volume chat
My bad I may have mixed people up
oh boy!
Apologies for frivolous ping
(I still haven't solved forcing the sounds to register on my volume channel or wired up anything really... it's just a phantom option.)
But adding the option on its own page is tempting...
I guess I wouldn't strictly need to change volume types. In theory I could use this option to simply adjust our volume directly so that people can max ambient and mute us if they want... Though that would require ambient be left on to hear us (as is already required). Still seems like a definite improvement
how do i reload a characters appearance?
Working in game, although I need to exit menu before the audio will update. @bronze yoke
local DOME = require("DOME")
local GameOption = DOME and DOME.require and DOME.require("GameOption")
local GameOptions = DOME and DOME.require and DOME.require("GameOptions")
if GameOption then
JukeboxSound.userVolume = 5
Jukebox.MainOptions = {}
Jukebox.MainOptions.create = MainOptions.create
function MainOptions:create()
-- I don't think this is actually necessary; it's protective.
local creation = Jukebox.MainOptions.create(self)
self:addPage("TRUE MUSIC JUKEBOX")
self.addY = 0
local y = 20;
local splitpoint = self:getWidth() / 3;
local comboWidth = 300
local control = self:addVolumeControl(splitpoint, y,
comboWidth, 20, "True Music Jukebox User Volume", 0)
local gameOption = GameOption:new('jukeboxVolume', control)
function gameOption:toUI()
local volume = math.min(10, math.max(0, JukeboxSound.userVolume))
self.control:setVolume(volume)
end
function gameOption:apply()
JukeboxSound.userVolume = self.control:getVolume()
end
function gameOption:onChange(control, volume)
JukeboxSound.userVolume = volume
end
self.gameOptions:add(gameOption)
return creation
end
end
(DOME is a WIP I'm going to release alongside our Sunday update.)
nice
Is anyone familiar with SendCommandToServer and if it's possible to intercept it ?
Has anyone made a trait similar to Cat's Eyes?
It's hard-coded so I don't know how to do it in Lua.
getPlayer():getBodyDamage():setOverallBodyHealth(0)
is there a specific name for fences? like if I want a function to destroy specifically fences and poles when they are hit with a vehicle
I have this one that will do trees, but wanna add poles and fences
#1211658917877260359 message
How long dose it take to learn LUA ?
btw how to learn making mod with LUA. Should first just watch video or should I ask ChatGPT to explain examples?
I'm not a programmer at all. But I use chat GPT allot to just kind of spitball functions, but usually have to change allot of it to get it to work. Coming up with new stuff from scratch is really difficult for me, but rewriting stuff or adding to stuff after I know how it works I can do
so you build everthing through ChatGPT ?
Yeah like I'll look at all the functions and kind of figure out what each one does based on like what its saying. Like if its spawning a burnt texture on the ground for instance and the mod spawns an explosion I know that is a related. So I'll as GPT like I want to do so and so to this explosion funtion and it'll pump out something
then I just go back and fourth until it work in debug mode
I personally do not recommend doing that if your intent is learning the language
(That was directed at Xille, since the question was asked)
So what do you recommended ?
I want to learn LUA First then Python
If you learn well via reading, I recommend reading through Programming in Lua (https://www.lua.org/pil/contents.html#P1). Otherwise, there might be a SoloLearn course (unsure) and there's certainly a LearnXInYMinutes that can show you the basics quicker
If reading isn't your thing, there are plenty of videos that teach stuff. Either way, the best way to learn is by using it
Also, minor nitpick: Lua, not LUA (see “What's in a name?” on https://www.lua.org/about.html)
Idk I just been poking around game code for a long time and reading it and messing with it and can just kinda see what different code does now based on the statements and math/variables used
@frank elbow is it true that this is easiest and the best for beginners (Lua)?
The answer to questions like that is always “it depends.” There are certainly measurable things that could make it easier—it's a scripting language, after all, and it's nowhere near as feature-rich as something like C#—but it's difficult to say whether it's the “easiest.” It's the second programming language I learned, though, and probably one of the easier ones
The only concept that might take some getting used to is metatables, but you don't need those for most use cases
Okay. Btw thank you for guide ( @frank elbow and @sage mantle ). Hopefully i'll be able to start making mods very soon.
one more thing: notepad++ or visual studio ?
I just use notepad++ but like I said I'm usually just editing whats already there or adding small functions here and there.
Do you open original files from game ? or just other mods ?
just other mods, I use the javadoc to look stuff up and ask on here what I cant find lol
hold on Zomboid is made in java not lua ?
possible
like most of it is java in the main files but theres allot of lua files that do different functions
but I literally just learned about the javadoc a few days ago lol
Speaking of which, is there a way to get the names of specific isometric objects in the game like fences and stuff?
try :getName() perhaps
yes, but the way to get it depends on the sprite /object type.
It'd be the fences and poles so an ISO object right?
hm nah I dont see it in the javadoc
oh theres one called gethoppable, I wonder if I did like a check to see if the square is hoppable and if so then just delete whatever is on the square
im trying to replace an item on the ground after a timed action, but i cant figure out how to actually make the mesh appear on the ground, i have this for now
local _item = sq:AddWorldInventoryItem("Base.UnusableWood", _x, _y, _z);
_item:getWorldItem():addToWorld();
self.floorcont:AddItem(_item);
--sq:transmitAddObjectToSquare(_item);
tried using transmit but it doesnt work, and it thows a phantom error w/o anything in the console
also, how does one get rid of that plunger icon 😄
you cant
awesome 😄
play in debug mode close to the thing you wanna identify and log everything about its square until you find the unique thing that identifies it.
Gotcha that sounds like the best way
well quickest way
safe way at least and works for pretty much everything 😄
should definetly work for fences and stuff I'd imagine
I have
It's called Darkvision
You're welcome to review and refactor my solution to your own ends.
I had to do it by moving a local-only light source along with the player everywhere they go
Idk any other ways
Oh, so it's just a work-around?
Basically
It's highly customizable so if your goal is a brighter or less effective Cat's Eyes, I suspect both would be possible
Damn, that looks quite complicated. I'll check it out tomorrow after work.
I have to sleep in a few minutes.
I prefer VS Code for writing Lua but Notepad++ has better innate management of translation files because it figures out encodings more correctly and lets you easily change them
i figured it out.. its because i was getting worldpos instead of square pos, is there a way to get the exact position of the item? looking through IsoWorldInventoryObject methods but nothing seems to return what i need
Hi, Are SandboxVars variables stored on the client side or is the server polled every time they are accessed from Lua code?
you can sum square x/y and the WorldInventoryItem relative x/y
World item relative are in offx offy offz right? i cant find a getter though
getOffsetX() and Y are there for isoobject but no z
z is probably on the item itself
cool thanks for the answer! ill get to work
Hiya, Im very new to modding the game and i was wondering if i could get some help with something im trying to do
Im trying to make a new addiction trait and item. I am currently going through the game code to find out how to do it but I can not find the code for how the smoker trait is implimented
I was wondering if anyone knows where i can find that since all I can find is the "MainCreationMethods" lua where it defines smoker but does not actually impliment the mechanics
Actually I may have just found it but I cant tell because it is unreadable and im not sure why
like i said im very new so if im going about this completely wrong i appritiate any guidence
That's a Java class, so isn't human readable without decompiling. Thankfully, decompiling Java is pretty simple: https://www.decompiler.com/
Online decompiler for Java, Android, Python and C#.
Most traits in-game is hard-coded into the Java source.
hmm is there a better way to go about implimenting this then
damn not the right file
I typically just look at mods that do a similar thing and see how they did it. For example, since you're talking about an addiction mod, there's several that add an Alcoholism trait. Would be pretty similar, I assume.
Got it ill look for that
My tutorial here uses trait creation as its example. Not an addiction trait but many similar principles would apply: https://github.com/Zendachi/Wookiee-Tutorial-Party-Animal
Contribute to Zendachi/Wookiee-Tutorial-Party-Animal development by creating an account on GitHub.
Is anyone familiar with SendCommandToServer and if it's possible to intercept it ?
what does intercept mean ?
I mean detect whenever SendCommandToServer is used
I'm trying to detect whenever zombies are deleted with RemoveZombies commands
And those are triggered with SendCommandToServer
I need to stop Emitters of zombies getting deleted or I end up with vocals of zombies still getting played where they were
Not exactly sure why that happens but it seems like the game doesn't reset their vocals
There's more detail in the PZ modding Discord coding channel
I have something for this at home that Tyrir showed me a long time ago if you only need to catch that call from Lua to Java
One example for the remove all is this which is ran from the lua
function DebugContextMenu.OnRemoveAllZombiesClient(zombie)
SendCommandToServer(string.format("/removezombies -remove true"))
end
I'll try to remember to send you that in a few hours if someone else doesn't beat me to it.
Although wait you need to access the Zombie?
Then you need to decorate the Lua function not the Java call
From looking at the lua and java
Whatever, just I need a way to detect zombies getting removed and be able to access their IsoZombie
DebugContextMenu is vanilla?
yea
That's the lua files
DebugContextMenu.lua
I guess I could rewrite that function to send my mod a command that triggers a function ?
The issue is accessing the zombies
And making sure my function is ran first before zombies are removed or I won't be able to get them
In the case of remove all zombies it's fairly easy I guess
Does this get added to an event
Make sure no Events.something.Add call associated with that function in vanilla
But assuming it's not already bound to an event you can decorate like this...
local SirJvlaModule = {}
SirJvlaModule.DebugContextMenu = {}
SirJvlaModule.DebugContextMenu.OnRemoveAllZombiesClient = DebugContextMenu.OnRemoveAllZombiesClient
function DebugContextMenu.OnRemoveAllZombiesClient(zombie)
SirJvlaModule.madeupFunction(zombie)
SirJvlaModule.DebugContextMenu.OnRemoveAllZombiesClient(zombie)
end```
Overrides old version but calls the original
So all vanilla stuff still happens
While also letting you operate on zombie first
But that would run two OnRemoveAllZombiesClient ?
Also, the zombie tag is unused
Doesn't retreive the zombie
Oh sounds like an odd function
Yeah idfk why they added that zombie tag
I will probably have to see it at home then
Literally doesn't do anything
To confirm how it's called
if isClient() then
subMenu:addOption("Remove All", obj, DebugContextMenu.OnRemoveAllZombiesClient)
else
subMenu:addOption("Remove All", obj, DebugContextMenu.OnRemoveAllZombies)
end
Might not work as a place to intervene if no access to Zombie object
That's the place where it's called
In the case of removing all zombies it's easy
I get the zombieList of getCell()
What is obj? That's what gets passed to it.
literally nothing
obj has nothing
In the case of the menu to spawn hordes, the remove zombies button it gets the zombies in the radius, haven't checked if I can access that info
Weird I'll have to look at the vanilla chain of events but it's very odd if they have a useless parameter in that signature.
I am not home unfortunately
Wrote the above on my phone
yeah np
This is the function that calls the remove all zombies function
The command sent to server in the java is supposed to stop all emitters but for some reason that part doesn't trigger when I manually changed the vocals of the zombies but when running the method myself to stopAll() getEmitter() it does stop sounds
👌
Looks like the obj is a relic of possibly having those lines of code lower down the function in original version
Since obj gets a definition 4 seconds after those calls
(okay immediately after, 4 seconds is a terrible figurative way of saying very fast in programming)
Probably used it before, but then they stopped
And possibly they need to add that obj argument in the command
empty or not
They do
Because of the order of params
I prefer do give a meaningless label in those contexts to indicate variable being passed is nothing, or nil if I'm feeling boring
obj is a bit misleading, as is catching a zombie in the params of the target function.
In almost all code tbh
yea
Ain't nobody got time to go back and fix everything they ever programmed
Oof
Maybe with a few extra lives.
But I haven't found any in our simulation yet.

I used remove all zombies in debug mode for testing, maybe there is something that happens out of sight that needs to be handled when that happens.
In the java yes
Sends a command to the java
Idk how the java detects the use of a command tho
But what I know is that once it receives it, it checks a bunch of stuff, gets the list of zombies in getCell() and remove them
Tho it's supposed to remove their emitters too
But doesn't seem to do so in my case for the zombies which I set the vocals manually
All the detail in coding channel of the modding Discord
emitter whack-a-mole sounds familiar...
watch a man as he decends into madness
You're calling this almost directly through Lua exposure of Java stuff https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#SendCommandToServer(java.lang.String)
declaration: package: zombie.Lua, class: LuaManager, class: GlobalObject
Goes through the metatable
yes ik that calls out the java, but what I found for the sendCommand is that it's not directly linked to a java or idfk it's weird shit
@outer crypt might have access to the patch function I was gonna share with you
I think it might be something that detects the chat messages and verifies if it's a command
Maybe a modder made a custom Events library that triggers on SendCommandToServer
We'll get you sorted. The call from Lua to Java can definitely be hooked if that's your goal
You'll have to do something else to get the zeds though
Yeah that's fine
Maybe I can find the code in chat with Norby...
My next idea is that I'm planning on creating a custom zombie spawning menu to spawn the zombie types the player choses to spawn and there will be a custom remove function in it too
But I won't remove the vanilla tools to spawn and remove zombies
I'll just add a custom menu exactly like Braven did with his zombie boss
But with different options to spawn the type of zombie the player choses to spawn
And a remove button too
Also seriously this emitter shit barely has shit to it
Like there's no fucking method to get the currently played vocal
To know what vocal is played
You need to run an IsPlaying(vocal name) to check vocals getting played
Doesn't the vanilla already have remove zombies on radius? Why reinventing the wheel?
It does
And I'm not reinventing it
Just creating a menu for spawning zombies types for my Zomboid Forge framework which allows modders to easily add zombie types with addons that work together
To spawn a specific zombie type you can't use the usual way because it will randomize it's zombie type based on its chances of spawning and other zombie types chances
So whenever I want to spawn a zombie type I need to do that:
https://streamable.com/j467kw
how do i modifiy what items a zombie spawns with?
Items in inventory ?
Or clothing ?
clothing
ok ty
Bcs it can be long
But basically there's multiple ways:
-change outfits (will take you ages if you plan adding a clothing to every zombies)
-make zombie a reanimated player but if you do that for every zombies you'll just lag the game
-change the visual of the items the zombie has
The best way is definitely the visual change
It's what I use in the mod I sent in the convo I just sent you
You can also change underwears but it's weird
if I do the visual change does it still update their drops?
like if I made a zombie wear a spiffo suit does it drop the spiffo suit?
It does yes
Hello, I wanted to ask for your help.
I'm looking to create a healing weapon to heal other players.
I managed to come up with this code using some examples, and the healing does work.
The problem is that with each hit (heal), the player ends up with wounds and bleeding.
Is there any way to make it work without the player getting these wounds?
NOTE: I don't want to use "bodyPart:RestoreToFullHealth()" because it heals fully.
One question, why do you rewrite the variables attacker and weapon ?
Don't use getDisplayName to verify the item
use...
give me a sec
HandWeapon:getFullType() == "Base.BareHands"
Because if you translate the DisplayName in other languages the code won't detect it
Perhaps you could make the damage of your staff be 0 in the script files to stop it from dealing wounds ?
It's because I used another code as an example and decided not to change it since it worked 😅
The weapon has 0 damage, but still causes bleeding and scratching.
It's working this way, the HP increases, but the wounds persist.
I don't have any more ideas on what to do.
You could keep track of the wounds of the player perhaps and remove the ones that are added after your wand hits
do you want any wounds to disappear or only for the health to restore without affecting current wounds at all?
The ideal would be to improve your life and heal your injuries. But if you have the option to improve your life without causing new injuries, it is also valid.
I've worked on a trait similar to Smoker for my traits mod in the past few days. I can brief you on it if you want.
Clickers!
yes :)
Going to be a full rewrite of the original mod
Tell me pls if someone knows where contains character`s sneeze code? Like sneeze sound range and text
I'm not using my PC right now since I'm getting ready for work but you should search for if the character is sick.
It has a "Cold" in it.
ok, thanks
Hi peeps, I'm a first time modder and trying to create a mod, but am getting a little stuck... would anyone be able to give some assistance?
It's a guitar wall hanging mod, any help would be greatly appreciated
Hey guys! I currently try adding a bunch (well... a ton) of items into the game - and I want them to be craftable.
I already got it working, but with roughly 1.6k recipees I feel like it is an absolute overkill. I wonder if there was a more elegant way.
Let me try and explain: My mod lets you craft one baseitem from vanilla stuff. This baseitem can then be altered into one of 80 different items. Each of those items then can be altered to use one of 20 different textures. Thats how I currently have 1.6k different items (example: Blue version is a specific item, Red version is a specific item, etc)
Can it somehow be done that maybe, instead of totally wrecking the crafting menu, those items might be altered via a rightclick menu? And is there maybe a more elegant way to make an item switch textures, without creating an extra item for each texture?
So you want to add guitars hanging on the wall as decorations?
Yes sir, I do
You can just make a script in Python or anything else that sets the recipes for you based on conditions
Also yes you can make them through a right click menu
For switch of texture I'm not too sure ngl I don't think I ever saw something like that in mods
I hate having collected all the guitars but they look crap on the floor, so why not hang them on the walls... 😄
Unless thats been done already...
have you read the wiki? It is pretty helpful. You will (afaik) have to add them as new tiles. It is not that hard, done it myself (and I am a noob too), but it can be tricky 😄
There's mods to hang items on walls but it's basically the placed on floor model and it's horizontal to the floor in the case of guitars so probably not what you want
@austere sequoia I have, but there's still a lot that it doesn't cover. I've watched a load of tutorials too
Yes, I used Python for the items. Without it a project of this scale would not be feasable. Do you happen to know how I add a rightclick menu? Or maybe know a simple mod that already has this, so I can look at how they did it? I am not sure I have seen such a mod yet, but maybe I just did not notice
@bright fog Yea, I'd like to use the 3d models so they rotate better, I tried with the image but it looks wonky
I've also looked for how light switches work, as I'd like the guitar mount to attach to the wall then with a right-click I can then attach guitar to the hanger
I was able to get the icon and static image thing in and it showed in the inventory and on the floor, but after making tiles so thet i can fix it onto the wall, it doesn't show on the floor lol
Oh jesus, that is beyond my limited abilities 😄 But If I understood everything right (happy to be corrected if wrong though), you need to add the guitar as a tile, and tiles are 2D Pixelarts, not 3D models.
Ideally, once I can get it onto the wall, I'd like to take the guitars 3dobject into blender to render an accurate tile... so they look correct on the wall
@austere sequoia 😄 yea mine too apparently! I tend to jump into the deep end when learning something new 
I copied the image from the wiki, but it looks wrong when I put it in place...
I tried looking for how the battery charger works, as in connecting a car battery to it has a similar mechanic to what Im after... but I dont know how to work out how it is all coded
you can use the OnFillInventoryObjectContextMenu event to get the context menu when an item is right clicked on, and add a button to it that calls your function
does Events.OnZombieDead also return the zombie container? (like the corpse)
no, the event fires a little bit before the zombie actually turns into a corpse
Me or Raffattack 😄 The answer could work for both of us, from our questions
you, but there's a similar event for world objects that raff could use
if you get the square the zombie dies then search for a corpse there I guess you can access the corpse ?
@bronze yoke I'd have to look that up, I guess that means i need to write a function? I was delaying that 😄
i'm not sure of the extent to which texture swapping is possible, if you're just swapping the colour of the icon that does work but i'm not sure if it'll remain after saving and loading, and i know swapping the texture of a 3d modelled item isn't possible
yes, i'm afraid you'll definitely need some lua for this
@bronze yoke darn! AI needs to hurry up so I can use it to write my code ...
Okay, that is an awesome answer, thank you! So it will be 1.6k separate items then, lol 😄 But If I can do this via rightclick menu, I probably can chop it down into smaller, more acceptable steps 🙂
You already do that but the issue is that there's no model that was trained to code for PZ
But technically you can already train a model to code in kahlua project zomboid
so I guess I've gotta figure out how to get my mount onto the wall first with the tiles i made
chat gpt at least is awesome for python, what can help a metric ton 🙂
can we get a pzbot in discord to code for us all? or is that too much?
then what will i do 😰
i've seen ai zomboid code posted here, it's always trolling you
yes.... it takes a lot of debating until the code it gives you is actually working 😄
how would I add to the drops a zombie corpse would have? would I just do this same method? Searching the tile the zombie dies on
you can grab the zombie's inventory on that event and it'll be transferred to the corpse when it is created
the zombies inventory being the return of :getItemContainer ?
To get an object from my inventory onto the wall, would i need a recipe for that or a function?
:getInventory() should be it
i.e. do I go the route of building a wall frame, then doing a multistage build like building the wall onto the frame?
my brain is already melting, I dont know how you all survive!
Building the wall onto the frame?
@austere sequoia yea, first a frame is built, then you right-click and select the wall/window from the context menu. Which is a multistage recipe, if I've read it right
like albion said
id love the help
Why make it so difficult? Just build the frame and make it wall attachable, like shelves, would that not be easier?
You would still need some kind of function that allows you to add and retrieve your guitar via rightclick
And of course tiles for every guitarmodel you want to add
@austere sequoia Yea I'm trying not to make it difficult, I guess I've learnt too much and am slightly confusing myself 🤣
It seems like it 😄 Treat it like a shelf - you dont build a shelf, then build a wall onto the shelf and then place the shelfwall. Instead just place the shelf on existing walls
The way I'm thinking of going is, I build the mount... attach it onto the wall (either by just placing it normally, likethe deer trophy)... then with guitar in inventory I rightclick the mount and attach the guitar
For the rightclick thing you will need lua, everything else is kinda simple and mostly depending on your pixelart skills
I've made a 3d model, done the icon and static model thing, and made the tiles/pack, but currently I can't actually put it onto the wall
Ahhh, you made your own guitar, so its not the vanilla guitars we are talking about?
sorry, ive made a 3d mount
But why?
I wanna take the vanilla model into blender
Tiles are 2D
i made the model to get renders of it to use as 2d images... but i need the guitar models to do proper 2d tiles of them when they're on the wall
again, I've bitten off way more than I can chew...
So instead of making 20 pixels in Gimp you made a whole 3D model? That is kind off awesome to be honest! But sounds like an overcomplication to me. And dont worry about biting and chewing, you just made your learning curve a bit steaper 🙂
hahah thanks
I'm use to blender, also I thought it would look cool if I could put it on a table and rotate it... but that's kinda stupid 🤣
You could totally do that - with an item. Items and tiles are two different things though
I think I have it as an item
Actually the item stuff is very simple when you already have the models. Did you add a guid?
I dont think so....?
thats is
Free Online GUID / UUID Generator
All your 3d model items need an exclusive guid, you can get one (or 1.6k, as I did....) from this generator
I haven't added the model yet or any of the fbx stuff, just using 2d images as the icon and static thing. It did show in my inventory and on the floor when I place it... yesterday...
3d models don't need guids, guids are just used for clothing
Oh kool thanks
Oh dang it! You are right, I mixed that up. My bad. Thats what happens when all you do is clothing for the day
I'm kind confused how to set up the sprite(?) correctly
this is my very basic model of it...
Awesome!
Dude, the best I can do is adding red stripes to the basic cube mesh, and I am already proud of that. So yes, from my perspective this is awesome
What have you changed since yesterday?
I made the tile sheet thing and pack maker thing and added the files into the folders. I then set the worldObjectSprite to the tile info
but i dont think my tilesheet worked
i'm just getting a question mark icon instead of the image now... at least i can craft it... i'll take that as a mini win!
Question: Does the DisplayCategory have to be a specific thing, or can I make one up?
Not too sure for that, there's the mod that adds more categories so eh
It's no biggie if it doesn't work, I'll categorise it as something standard
Could my tiledefinitions data be overwriting my item properties?
I don't get why this code fails errors
local function OnZombieDead(zombie)
local zombieInventory = zombie:getInventory()
local Items = zombieInventory:getItems()
print(Items)
print("each Item 1 by 1 \n")
for i , item in pairs(Items) do -- Error is here somehow
print(item:getName())
end
end
Events.OnZombieDead.Add(OnZombieDead)
Read errors
Items should be a java ArrayList which you loop by using size and get instead of pairs.
for index=0, known:size() -1 do
print(index, known:get(index))
end
https://github.com/FWolfe/Zomboid-Modding-Guide/tree/master/api#zomboids-lua-component
https://steamcommunity.com/sharedfiles/filedetails/?id=3170803277 thanks for the help guys! managed to finish
@digital osprey nice one dude! I knew hoarding scrap wood would be beneficial!
enjoy! tested it a little everything should be in order
Hi good evening, I know this question may seem quite ridiculous. But can anyone tell me if the mod
"crafting enchanted core"
Does it also allow me to use its function to make one of my tiles a workstation?https://steamcommunity.com/sharedfiles/filedetails/?id=2923979345&searchtext=crafting
I'm making a mod that uses precisely this mechanic involving tiles as workstations
Sure, I'll tell you when I get home from work.
Uhh, just a note: pairs() is used for key, value tables or dictionaries such as {"key" = value, key2 = value2} while ipairs() is used for lists or arrays like {"apple", "banana"}.
pairs() returns the key and value while ipairs() returns the index and value
pairs can be used for "lists" too, but the items might appear in different order.
It's just a good practice to use something for their intended purpose.
It's not a lua (Kahlua) table so it causes errors though.
Kahlua ipairs is also rather slow, loop with pairs or use the table size instead.
Yes
hey how does one overwrite a texture in the game with a mod? I found some mods that add custom zombie textures and I wanted to see if I could retexture some stuff in a mod for some friends and I
Hmm.
So you'd rather do for i=1, #table do end?
ipairs is just that with overhead
there's arguably never any reason to use ipairs
i don't personally use it at all
It's just cleaner in my opinion but if it's about performance then I'd like to optimize.
performance wise, it's numeric loop > ipairs > pairs
but pairs is often unavoidable whereas ipairs doesn't do anything unique
ipairs is faster than pairs?
yeah
my benchmarking found ipairs to be nearly 5 times slower than a numeric loop
and a correction, pairs is somehow faster than ipairs
to my knowledge this isn't the case in standard lua
it may be that one scales better or worse with table size, my testing used a very small table
Reason: Bad word usage
Well, that is a somewhat broad question. Could you maybe be more specific at what step you are having problems? The easiest thing you could do is look at the mods that do what you want to do and build your mod the same way
I think I figured it out, I was retexturing the trees (havent done it yet but I tihnk I know how to now)
Awesome! 🙂
hello i ask this at mod support
i want to create a server not today it will take some time i am gathering all mod i like and i have a question
i like at my server to take a mod from some1 and change some things inside the code i will give an example to understand
an easy example is using a mtealwork mod that can make weapons (in that mod to create a katana for example u need metalwork level 5)
i want to change that to level 8 for example
i know how but my question is i must change all recipes to desired level and report the mod at steam?
with all credits offcource to the person who made it
and say metalwork mod by ........ customisez for (my name server?)
i hope u can understand my question
and got this reply
Most likely all you would need to do is upload a mod that overrides the original recipe file with your own modded recipes and requires the original as a dependency. You would only need the recipe file in the right place with the right name and no other files from that mod. If you attempt this and need further help, mod_development is better. (edited)
if any1 can help me with an example or something i will be really gratefull so i can making my server as i like.....
and 1 more question will this not make mod conflict??? isnt it better to simply change their recipes level and upload their mod again but saying its a customize for my server?
sorry for the long message and ty for reading
I guess you already go the right answer dude. The easiest way would be to make a mod depending on the other mod and just add two or three textfiles in the right places. This should allow you to overwrite certain parts of the original mod without causing conflicts. The best way to learn this is by looking at mods that already do something similar.
And for the reuploading a whole mod with tiny custom changes: Not cool dude. At least not for me - maybe the creator of the mod you want to change sees this differently. But ask him beforehand
Hey guys! Another question: When I have all the materials for a recipe and rightclick on the materials in my inventory, I get the option to make the recipe in the rightclick-menu. Now I have a metric ton of recipes, all with the same materials, so when I rightclick on the material, I get a wall of options. Is there a way to add like a category in the rightclick-menu? So that it does not say "", but only says "Make Item" in the initial rightclick-menu, but gives me a submenu with "Make Item A - make Item B - Make Item C - make Item D - etc" (or even better... more submenus, lol) when I hover over it with the mouse?
a ok, I come from roblox where everything (I believe) is just another hidden form of a dictionary but yeah this clears it up a lot
Yeah, I'm not sure about using them in Project Zomboid modding though as the other people said, ipairs() is pretty slow.
anyone know much about radio stations? we're looking to try and get some custom stations working with repeating messages running pretty much all the time, however the XML files for it are pretty complex and im not sure how to keep a constant recurring broadcast
Just an update to the orphaned MP radio issues, some are not invisible... some just have no sprites or 3d model... and when trying to remove them (through every way I know) they no longer have a valid square to call. so sledgedestroy or remove from square fails... I was finally able to turn off the music I set on an invisible one, but now I need to track these others too.
Can someone point me to where/what the player body model files are? I'm poking around the game files rn but I'm not sure what I'm looking at
That's fucked up
What about looking at the part that fails to remove the radios from the world and patch it ?
Be it a lua or java function ?
Did you try to remove a radio (a visible one) with various methods and see if they do get removed ?
Perhaps you could do like I did to patch zombies not getting their emitters removed and do a patch that deletes the radio before actually having the java or lua part that handles that try to do it and fail it ?
edit: If a method has a bunch of mystery parameters, is there a way to find out what they do?
In my case,
addBlood(bloodBodyPartType, boolean1, boolean2, boolean3)
these 3 mystery bools appear in these configurations, in the vanilla game files:
steps.lua true, false false
scenario.lua true, true, false
ISHealthPanel.lua false, true, false
Hiya... does anyone know if/how .x files are opened/used? They are in the models(x) folders
For models you can simply use the scripts (Blender scripts) to open those, for animations you're fucked and need to go through hell
Finally made part 2, there most likely won't be a part 3, but feel free to ask questions in the comments.
==UPDATE==
-Tiles-
I have found a way to find all the tiles from the game, by going to the following link and pressing "Install" on the top right, you will have the Project Zomboid Modding Tools added to your steam library:
https://steamdb....
There's a small part in this tutorial on how to import .x in Blender
👀 aaahaaaa
(I tested it and those work)
shaweeeeet!!!
thank you!
So only finding this a few days ago and having limited MP test time, it takes a while for me to work through it. I was successful at shutting down my sound cache of emitters after detecting an orphaned one. At that time, the device no longer has a valid square so I can't sledge destroy or use any square removals on them. Can't remove them when they are first detected, because they are being used as glue to make MP sync on radios work... I have never seen any code that would point to their creation or destruction and expect it's in java... the non-sprite non-invisible versions do not act the same, so with testing today I may find a way to actually remove those after they are at end of life...
I'm talking about removing them yourself before the game removes it
Like actually go try and destroy an active, visible and non-bugged one
And see if that causes the same bug
I have destroyed them and it causes the original radio to bug, unable to destory them after the original radio is removed.
And whenever there is code that removes it in the java, lua or fucking paradise at this point you don't care: there is something that's handling the removal of the radio anyway when a player picks it, the radio burns or else and you can do like me a patch before the java or in the lua itself to run a code that destroys the radio before the game runs its own code to destroy the radio
Alright
Did you try every technics to remove the radio ?
and there is no one way to grab all the removal ways in one quick solution... from context inventory to context world pick up, grab, place, drop... there are so many different interactions.
Also as a temporary fix you can just remove a radio's sound, actually make it disappear even if it's technically still here invisible and stop manage that radio ?
The only ways I know right now are sledgedestroy and removal from square and the invisible ones no longer have a valid square to use for removal...
Well yes, and no it depends. There can be a general java function that handles the removal of tiles and even then if you really want to fix it you can do it it wouldn't take that long since you would just run a function before running theirs, do a decoration
I am using my list of emitters to mute and remove it after orphaned.
👌
if I can stop the emitters, I am fine with it until 42 patches these radio issues... IS said they have patched them internally...
Just wanted to get the word out to anyone with radio audio sync issues, they may be looking at a much more complicated issue with devices than they thought...
nothing like having another player pick up a radio and the audio left behind...
this to some extent is also the issue with duplicated radio text lines and text lines appearing where radios were removed
the game still registers the invisible and non-sprited radios as a place to spawn the text in Events.OnDeviceText.Add()
Going by this forum message from last year...
41.78.16 Multiplayer [Menu Hosted] No mods New save Reproduction Steps: Two lines bug: Place down 3D radio and listen to a broadcast Icon bug: Open device options on a TV or HAM radio, then open device options of a 3D radio HAM radios not working: Place down radio, place down ham radio, set to sa...
👌
- read the official javadocs on TIS's website, they include the names of parameters instead of 'boolean1'
- if that doesn't work, decompile and read the source
Wait there's a doc that says what things do and what to use for those ?
nvm then
I found it, thanks. https://projectzomboid.com/modding/
I don't know how to decompile + read the java. As far as following a tutorial, would you recommend
Tchernobill's guide https://steamcommunity.com/sharedfiles/filedetails/?id=2748451514
or Konijima's guide https://github.com/Konijima/PZ-Libraries
or something else?
This is a tool to help reverse-engineering Java code. It's meant to help with reversing the source code from the game Project Zomboid. - quarantin/beautiful-java
I used that
You need to use git bash
But it worked great for me
Just I had to understand how to use git bash but it wasn't that hard once I got the hang of it
definitely not the latter one
i haven't read tcherno's guide, he usually knows what he's talking about so that one may be better
but personally i just use beautiful java
konijima's guide is very old and uses some very outdated tools
Anyone knows how to leave a suggestion to devs?
I want to leave one about zomboid.socket being able to source Lua files directly to server environment or server itself having a server command that can source arbitrary Lua script. Something similar to reloadlua but sourcing it instead. That would enable advanced scripting based on bash, shell, python and whatever else without a need of a dedicated mod for that. Yeah I know how to source stuff anyways but its kinda a lame workaround.
Gimp question... I accidentally closed all the windows in the viewport, and cant select layers or anything.... the windows/dockable dialogues isnt doing anything.
Any ideas how to correct it?
put it up on the forums
Debugging someone else's mod, what's the difference between the distributionTable for a vehicle and the VehicleZoneDistribution? I see they've put the vehicle in a distributionTable, but the server console is still throwing the WARN for it not being in VehicleZoneDistribution
Have you tried restarting Gimp? Whenever I mess up the interface, I restart and its fine again
I tried that and still the same... i've just fixed it now though.... somehow "single window mode" was enabled

Another question is, could there be a good reason to not include a vehicle in VehicleZoneDistribution?
a possible reason for excluding a vehicle.... you ONLY want it to spawn in a "story"
I see, so that is another method of having a vehicle "spawn" into the map, via story. Are these stories typically defined within a given vehicle mod? Or are they usually included in a map mod or some standalone mod?
I was saying this in #pz_b42_chat, but I think the new animals coming in build 42 might provide a real chance of making a ridable horse mod that isn’t a goofy joke
I'm not sure, it was just a guess.
I know, for sure, there are a few vanilla vehicle stories
(car sitting there with no tires, jack, lugwrench, and tires on ground.)
(2 cop cars blocking the road, light-bars on, several zombie cops standing in the area)
but im sure you could define a custom story in a custom map, with a custom car.
new fire station, with a custom firestation story, which spawns a custom fire truck, etc
I think the first step would be figuring out how to allow a player to take control of an animal and move around in its body, as if they were the animal. That would be the baseline, I think
if taking control of them and moving them is possible, then I hopefully that will lead to the drivable RC car mod.
Say someone was able to figure out how to allow themselves to control a deer, since that’s kind of similar to a horse. Then it would be a matter of altering or replacing the model to be a horse, and slapping your character’s model on top in a rider’s position whenever they’re controlling it
To me that sounds like a pretty decent baseline for a ridable horse mod. From there it could possibly be expanded to allow you to to wield guns or melee weapons while riding, but that would be much more complex
You’d have to create completely new animations of your character aiming it’s gun, or swinging a weapon down on either side of the horse
I'm looking to patch YC Katana Legacy to work with the Katana Stance mod. According to the Stance creator the only thing needed is to add the parameter " isSword = true," to the weapons.
Is this the right way to go about it?
{
imports
{
Base,KatanaLegacy
}
item YCKatana
{
isSword = true,
}
}```
AFAIR YCKatana will be overwritten with your content completely, which just isSword
AH ok I misunderstood something I read then. Do I need to copy the whole item over to my patch or is there a way to append the parameters?
Just copy the original item script of Katana and place it in your code but add isSword = true
Anyone have any idea how to create a recipe that ignores drainable values and instead just destroys the item?
I wish to create a recipe involving breaking a Battery, however it instead just takes 1 unit of battery power.
When i used the Destroy tag around the battery, it seemingly removed the Battery from the recipe, and bugged it out, as if I had added a non-existent item as a recipe item.
Make the recipe use all the battery units ?
That would destroy the item, rather than just just drain the battery?
Apologies for the dumb questions if that's the case
Batteries disappear whenever you use all their charges I believe
At least you can't remove a drained battery from a flashlight or radio etc
Okay, to clarify, its a car Battery
Sorry for being awkward hahah! Thanks for the quick response though
so you want its condition to be reduced?
Recipes have on* events, when recipe is done it calls them.
You can set delta there.
Nope, i want to be completely removed disregarding, the drainable values completely.
So for for clarification, the recipe is about breaking open the Car Battery to remove the Sulfuric acid out of it, so it could have 0 condition and 0 power.
I just want to remove the Battery from the inventory and allow crafting at any value
Sorry I didnt explain this well
Remove the battery item, add new one with OnCreate function with whatever you like.
Thanks man!
Ill go try that
Where can I find the docs for the distributionTable/VehicleDistributions/VehicleZoneDistribution?
as an example, looking at the mod 1993lorevehicles, the logs tell me vehicle type "Base.84electra" isn't in VehicleZoneDistribution, and when I look in 1993VehicleLorePack/media/lua/server/Vehicles/1993lorevehicles.lua, I see distributionTable["84electra"] = distributionTable["CarNormal"] with local distributionTable = VehicleDistributions[1] defined at the top. So basically, I am trying to figure out the relationship between VehicleZoneDistribution, and the distributionTable that the mod is defining locally, and how this relates to the VehicleDistributions map/slice/thing
there's no docs. though, theres a bunch of comments at the top of VehicleZoneDefinition.lua, which is super cool.
I would look at how other mods added their custom cars to the distro.
Not a great answer, i know, but that's a start.
That's actually really helpful (re VehicleZoneDefinition.lua)
actually... I just opened my own console.txt, and theres 69 entries for "isn't in VehicleZoneDistribution". I'm currently using the 'Filibuster Rhymes' Used Cars!' mod
Is the mod author worried about the warning(s)?
I have no idea, searching the comments on Steam is such a pain.
For all I know it could be totally fine, I'm just trying to understand why/how
I think its fine. my own console.txt has tens of thousands of lines. countless warnings about crafting recipes, sounds, sound events, offsets, etc. etc. but everything is working as expected. the 84electra spawns, right? then it's working 😛
well, that's the thing, I don't know if the 84electra is spawning or not. I can definitely admin the vehicle in, but I am trying to figure out if this WARN is preventing the vehicle from naturally spawning
I would start a world in a custom sandbox with vehicles cranked to maximum, then teleport to maybe, louisville parking lots?
What I need to do is have a mod that just spits stuff out to console when a vehicle is spawned, and then I can grep for 84electra or whatever
Thus far I don't have a counterexample, where something isn't in VehicleZoneDistribution, but does naturally spawn on the map. Once I find that, I can safely ignore the WARN/ERROR and assume that the mod is somehow getting the vehicle into some table somewhere
nah, I was wrong. the 69 vehicles I currently have throwing WARN in my console were NOT added to the VehicleZoneDistribution, purposefully. they're all crashed/wrecked/burned up cars. which should not fill parking lots.
so the 84electra cannot spawn.
I did the logical thing and just asked the mod author whether this was intentional or not. Perhaps these vehicles are still under development or something, but he doesn't want to keep them partitioned off in a separate git branch, and instead delivers them to main but leave sthem unplugged from everything else.
eh, I dunno. likely the entire line would be commented out, like the 89seville
is it just the 84electra, out of curiosity, or a whole bunch of them?
Quite a few, lots of burned ones (those made sense), but there's a lot of otherwise fine vehicles that aren't included; it's not ALL of them, it's even the majority of them, but it's a substantial number
media/lua/server/vehicles/1993lorevehicles.lua -- what car is Normal/Sports/SUV
media/lua/shared/1993lorevehiclesSpawnlist.lua -- what car spawns in what parking spot
the 84electra is missing from the 2nd file
Right
so, like you said, probably purposeful. incomplete model, or texture, or whatever.
hello, I'm a programmer and I was thinking on create some mods just for trying out like adding the candles to be able to light a molotov or stuff like that, is there any official api or library for modding?
https://github.com/asledgehammer/Umbrella
Can help a bit too
really ty for answer reupload the mod sound simple for me that why i thought it and all picture and credits will be to him off cource i will not change picture poster or anything but you are right maybe some1 may get offended or something... i will try to find out how a new recipe can cancel an old 1 basically 2 things are a must for my server harder recipes(more metalwork level to create a weapon for example) and second i want to make all recipes for weapons cars etc 1 time read like magazines or book i will try find how ty
how do i reload the players character?
Reload the player character ?
like the visuals
For zombies I use that
zombie:resetModel()
so probably
player:resetModel()
Does anyone know how to check if an IsoObject is player built?
I might
I was looking at the Vanilla code, and it just specifies theObject.player = [...] but it's not saved or something, I can't access it.
I don't know if there's a direct method but recently I found out while working around zombie damaging structures that an already placed structure and a player built one doesn't output the same type of thumpTarget for the same kind of structures
Not sure how useful that will be to you tho
local thumped = zombie:getThumpTarget()
if not thumped then return end
if instanceof(thumped,"IsoThumpable") then
health = thumped:getHealth()
if thumped:isDoor() then
thumped:setHealth(health-200)
elseif thumped:isWindow() then
thumped:destroy()
else
thumped:setHealth(health-100)
end
elseif instanceof(thumped,"IsoDoor") then
health = thumped:getHealth()
thumped:setHealth(health-100)
elseif instanceof(thumped,"IsoWindow") then
thumped:smashWindow()
end
For example something I had to do is check the class of the thumpTarget of a zombie bcs player built ones aren't the same as doors and windows on the map
And structures built by the player overall are IsoThumpable from getThumpTarget()
(so walls, doors)
aint no player param to IsoObject nor IsoThumpable. Or am I missing something ?
iswoodenstairs isn't a java object
There must be a place in java code where Zombies decide to attack or not depending on something close to : is it build by player or not. I do not know where it is.
can anyone tell me what this is trying to tell me and how to potentially fix it? cheers. for reference, im attempting to make a main menu mod
you can add parameters to an item script through lua:lua local item = ScriptManager.instance:getItem("Module.Item") if item then item:DoParam("Parameter = Value") end this is the recommended way to make simple edits to items, copying the item script entirely will be problematic if the original mod updates and changes that script, since your edit will still be the older version```lua
local item = ScriptManager.instance:getItem("KatanaLegacyStancePatch.YCKatana")
if item then
item:DoParam("isSword = true")
end
Hello modders, im working on the wiki and trying to find the code related to the health of barricades. So far i cannot find it in the scripts, or lua folders, nor MultiStageBuilding or BarricadeAble java files.
Does anyone here happen to know or know where to look?
barricade health is set in the java methods IsoBarricade.addPlank, IsoBarricade.addMetalBar, IsoBarricade.addMetal
Found it, thank you so much
Nothing here in this case
You can click the play button to resume playing and if trying to debug and you errors you can click the error menu or look at them in the console file
Personally I don't know how to use the debug menu and never used it but for one or two things
You're probably better off looking at console.txt—you could hit “Errors” and step forward, but it's simpler to just read the log file imo
Chances are it's either something is nil or something is the wrong type
Uh I don't remember an addMetalBar thing
It's certainly there
I played a bunch with barricades 2 or 3 days ago and you set their health with setHealth()
For add planks yeah you can add new planks but I believe it requires the inventory of a player ?
Haven't done that tho, was just removing health mostly
my guess is you just pass nil for no player
typed null is kind of an issue with kahlua but there isn't any ambiguity here
I think you're thinking of the door rather than the barricades themselves
No it's both actually
give me a sec I'll find the java doc
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.objects, class: IsoThumpable
That's the thumpable target of a character
And you can retrieve the barricade
i don't think you're incorrect, it just doesn't look like the vanilla barricade health is sourced from there
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.objects, class: IsoBarricade
I should clarify, my "think you're thinking of" was because of the mention of setHealth, which IsoBarricade lacks
I'm pretty sure I did some setHealth on barricades the other day and I had issues with it wait I'll find it back on the modding discord
when the question was asked i quickly looked for the timed action for barricading, saw it sent a client command, checked the command handler, and it called those methods
Nevermind that was damageBarricade
so i quickly looked at the methods and they definitely set barricade health
Oh yeah didn't see them yeah I see them now
They set health ?
Or add health ?
Also considering they require an inventory item and an IsoGameCharacter not sure how you set those ?
Yeah no that doesn't health for addPlank, it actually adds a plank
I think the original asker was moreso looking for where the health is set (for the purpose of getting info), but yeah it looks like they just set it to the max per plank (well, based on condition)
I mean I guess it does sort of add health
See the plankHealth field
Yup
They set the health of planks
But it consumes plank per plank health
If I remember right
It looks like planks map to 1 of 4 numbers in the health array, so they have individual health. That's just at a glance though (so may not be entirely accurate as to how it works)
yup
Look at Thump
Then Damage
for(int var2 = 3; var2 >= 0; --var2) {
if (this.plankHealth[var2] > 0) {
int[] var10000 = this.plankHealth;
var10000[var2] -= var1;
if (this.plankHealth[var2] <= 0) {
this.plankHealth[var2] = 0;
this.chooseSprite();
}
break;
}
}
If I was to attach a vanilla items to something ive created, do I need new items in scripts for each item? or can I reference each item somehow?
i.e. putting different guitars on individual hangers... do I need to create a new item for each guitar (bass/acoustic/etc) when it's hung? sorry if the question is not clear
I've made a tile for the acoustic guitar on the wall, but im wondering if I need to set it as a new item
I think so yes but are those hangers tiles or items ?
Haaa so you want the player to be able to place the tile basically ?
Id like it as an item to collect/craft that gets attached to the wall, like a neon sign
im just a bit confused as to the best way to go
yea
Probably create a furniture item that the player transforms the guitar item into the furniture in their inventory
And then they can place that furniture
then with a guitar rightclick it and attach... but I dont know if once its attached to use the tile of it one the wall
had to restart it, now i gotta wait for it to throw an error again. lol
Id love it if I could reference the actual guitar model and place it upright against the wall... that would look a lot better
That's maybe possible but I'm not familiar with furniture and if you can open the furniture placement menu from an item
if its a tile, do I need to have it as an item?
No idea, I doubt it but I'll let someone who knows more about tiles and items answer further
I heard there was a gun mount somewhere in the game, that sounds like it has a similar mechanic, ie weaponobject attached to furniture , but no idea where that is or if its real
No that's not a thing
Did you read it ?
These are the two only info you need
The line you have an issue
And then "title of non-table: null"
I personally don't know what title is but non-table null means at your line 24 you try to access an empty (?) or non-existant table
this is line 23 and 24
title is the field it's attempting to index
Meaning one of those get calls is returning nil
i end up following a youtube guide and i somehow get a bug 
uuh ok so go read that first off please
https://github.com/FWolfe/Zomboid-Modding-Guide/tree/master/api#overview
And one thing they talk about is this:
if getPlayer():getInventory():contains("MyMod.MyItem") and getPlayer():getInventory():contains("MyMod.MyItem") then
is better written like this:
local inventory = getPlayer():getInventory()
if inventory:contains("MyMod.MyItem") and inventory:contains("MyMod.MyItem") then
Would make your code way easier to navigate for yourself and others
Then what Omar said
not my code, came from a YouTube video
Also you can't access fields like that ?
Agree with everything that was said above, but regarding this: compare with the vanilla MainScreen and you'll see there's a check that's missing here
What video ?
Quick tutorial on making a Menu Background replacement mod for Project Zomboid
I'll show you how to make custom image, logo and music for your mod.
Mod Template Download:
https://drive.google.com/file/d/1VzC2j_R7WHwXo47d_hQ5D78JeVLURCyN/view?usp=sharing
GitHub for the Menu music Lua:
https://github.com/Saymite/ZomboidMenuSongReplacer
...
If you're making a mod with it, you may want to take some time to understand what everything is doing—that'll help debugging
The check I'm referring to has to do with the size of the credits list (LuaList)
The vanilla code:
if self.credits:size() > self.creditsIndex then
if self.creditsIndex > 0 then
if self.credits:get(self.creditsIndex-1).title == self.credits:get(self.creditsIndex).title then
lastIsSameTitle = true;
end
end
-- .. excluding the rest of this block to illustrate the above
end
Since your code doesn't have that check, it can run when the size is (for example) 0, which would mean trying to get the value at 0 would fail
I'm guessing the intent of whoever originally made the code was to simplify it, but that check is important
So since he didn't include that check, it broke it?
Probably more complicated than that
The fact he didn't include it probably means the check is just overall useless if the code is written correctly and maybe it's impossible to have a case where this check doesn't pass
Didn't he include his file in the description of the video or something to use ?
yes
I find it weird to make a full tutorial to rewrite the entire file without just giving it ?
Are you using his file ?
basically yes.
Or are you writting it yourself ?
using the template he provided.
Also know that because there's an error at a certain line, doesn't mean it's specifically this line the issue
But like Omar said, I highly suggest you understand how things work, read some basics in lua if you don't know how to use it or learn some basic coding stuff if you're not too familiar with coding in general
The link I sent you above is a guide to all this in case you want to understand a bit more how lua works
Hi, do we have an in-game debug zombie heatmap? I'm looking for a way to check which area are the most populated, and run some code depending on how many zombies will be in that specific area.
Or, if that's not possible, how can I pull the zombie population ratio from a square using the LoadGridsquare event?
if you have an item in a bag, is it possible to get the x,y,z of the bag when its one the ground?
from the item
I think you can get the place where the item is stored
So if you store the item when you detected it then check it's place where it's stored
You can access the inventory datas
I'll answer you just to let you know I saw your question. I don't have the answer sadly and I'm not even sure if you can acess that data ?
is there any good tutorials for just getting a modded item to spawn in the game.~~ I followed this tutorial to the T and still not working. https://www.youtube.com/watch?v=N6tZujOPnD~~
i don't get any error messages in debug when loading the game so I assume it's liking the mod but maybe I'm not spawning it in right?
nevermind I got it working. Is there a tutorial somewhere I can put what I did to help others?
check pzwiki
thanks
I've been able to pull containers that aren't bags and outer most containers but not the bags themselves... So I have resorted to holding the last known when the bags are dropped.
rip
Watch out as those might not be saved and their IsoContainer (or whatever) might change after a game reload
not important, the info is kept client and scrubbed between sessions on purpose at this point.
I could always moddata it if needed.
Hello, is there a tutorial that teaches how to create (or change) moodles, interface when getting into a vehicle and things like that? I would appreciate any help
No idea about the moodles but getPlayer():getVehicle() will tell you if the player is in a vehicle
Any confirmation that B42 will add moddata to vehicle?
they already have it?
You can't add to vehicle, you can only add to the parts. Doesn't work for MP (the transmitModData isn't immediate like the part is). Only works reliably for SP.
Vehicle data is also persistent, just not often used.
What vehicle data are you referring to.?
I'm asking this again, in case some of the other modder didn't see this.
Hi, do we have an in-game debug zombie heatmap? I'm looking for a way to check which area are the most populated, and run some code depending on how many zombies will be in that specific area.
Or, if that's not possible, how can I pull the zombie population ratio from a square using the LoadGridsquare event?
I see you edited your message.
That's a very different issue that you will need to sync manually probably.
The game only provide transmitModData to sync the data, no?
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Use commands.md
One available guide to sending commands.
Thought so, a workaround implementation.
Is there any other way to mod PZ?

