#mod_development
1 messages · Page 546 of 1
interesting sound clip...

The sound is in .bank file, you don't need to mess with it.
Just create your own mod and the scripts will replace the sound for you.
yep
with the name of my file?
ofcourse
alright and what should i name this txt file?
never modded sounds before i just did items
same as your mod's name
Workshop\yourmod\Contents\mods\yourmod\media\scripts\yourmod.txt Workshop\yourmod\Contents\mods\yourmod\media\sound\yoursound.ogg
i see tysm man!
@ruby reef adjusts mp3 volume http://mp3gain.sourceforge.net/download.php
sound format converter - https://sector-seven.com/software/flicflac
audacity > mp3 > then converter to ogg
yeah guys dont use flicflac its broken
how?
first you need to select the format you want then drag and drop on the program and wait
yep i did
nvm found another program
and i cant record it it'll take a lot of time to upload
and is there anyway to trigger the jumpscare effect?
result @cosmic condor https://steamcommunity.com/sharedfiles/filedetails/?id=2823690360
cool
but the volume might be too high, should tune it down a bit
I'd suggest 85
I want to use the Mod Options mod with my mod so that users can tweak my mod's functionality within their in-game settings.
Mod Options: https://steamcommunity.com/workshop/filedetails/?id=2169435993
There doesn't seem to be much documentation / explanation on this mod's page and I have a few questions:
-
Can these options be seen by
.txtfiles in themedia/scriptsfolder or only the.luafiles in themedia/luafolder? -
The mod's page shows the options table being defined as a
localvariable. If I want them to be accessible from outside of the file they are being defined in, do I remove thelocalkeyword (and change the variable's name to something unique that won't clash)?
Thanks!
what are the parameters for player:getXp:AddXP()
Is this helps : player:getXp():AddXP(Perks.Doctor, 1)
Ive been looking into the source code of other mods to try and learn and I saw some mods have 2 or 3 additional boolean paramaters after those ones
I think we can get your answer here : https://zomboid-javadoc.com/41.65/zombie/characters/IsoGameCharacter.XP.html#getXP(zombie.characters.skills.PerkFactory.Perk)
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoGameCharacter, class: XP
Can you post some examples ? with some lines that calls for it ?
any hints ?
As an example I found this in this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2708582395&searchtext=
_player:getXp():AddXP(_perk, xpmod, false, false);
end;```
Sorry, I don't understand what those booleans are for...
Anyone know if we can get/set/reload SandboxOptions.Distribution in lua? I see Distribution in the API ref but having trouble actually getting to it.
Hey all, anyone figure out how to fully decode player data from the players.db?
I'm currently stuck with the following result; Which isn't exactly useful.
That's after converting the original data to a hex string, and decoding using latin-1
(Please toss me a ping if you've got an answer)
anyone know how to get the proper count of the result, for example i getas result 2x of thesame item but result:getCount() only displays 1
theres nothing to decode...
its an sql databse
The data field is in fact hex encoded
Not the rows themselves
ah its likely a java object converted into a byte array
How would that even work? 
Been playing with variants of this with no luck 😦
getSandboxOptions():getOptionByName("Distribution")
When your temporary text file has somehow picked up a non-displaying character that makes the debugger reject what you are typing 🤦
So this appears to work as expected...
getSandboxOptions():set("Distribution", 2)
print(getSandboxOptions():getOption("Distribution"):getValue())
Sadly this doesn't seem to actually have any effect on Zed distribution. Any thoughts??
so stoked to get this working, i was worried i would have to delete the old objects and create new ones but i managed to just modify the tiles directly and i feel so cool about it lol
Hi, I created a mod for a profession but when I die and create a new character I don't get the profession to grab it again, how do I solve this?
Have you try quit to main menu and load the game again?
Many mods break after your character dies.
If I know that that way can be fixed, but isn't there a way to fix it?
check some other mods for professions
there's a lot of them in workshop
How are folks doing their soft settings/config for their mods? A link to an example or tute would be great.
How does the RV Interior mod work? Does it teleport you to a separate zone somewhere?
Doomsday MotorHome?
Yeah
Hi, I'm a former b40 modder and I started to play & mod in b41. I have a first question : is there any change in recipes ? For instance, is there some kind of hardcoded function that you can call to check proximity when you craft : something like a "isNear:" ? If not, I'll have to rely on including in "onTest:" some old functions I got. Thanks.
"NearItem" should do it.
how can i add a brake light to a car texture?
Thanks. I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?
In m'y b40 mod i uses to check for textures with a dedicated function that was called by a onTest function.
Awsome !
holy shit thats amazing!
anybody an idea how to make a noisemake reset itself?
hi! i am currently working on a clothing mod and while play testing, the console.txt sometimes contains this: AnimatedModel$AnimatedModelInstanceRenderData.init> skinningData is null, matrixPalette may be invalid
my mod works fine so far (no red error boxes and it behaves as intended). however, i am curious what the console output means and whether this could lead to problems... any ideas?
Hello, do you where I cand find the moodles files ? Specially the hunger moodle ?
I think Java unfortunately.
"How are folks doing their soft settings/config for their mods? A link to an example or tute would be great."
A suggestion: When you wreck a vehicle or have been attacked and killed by zombies while in a vehicle ur corpse is automatically applied to the inventory of that seat of the vehicle. This would be an even better dev update but im sure someone out there can figure a mod to do it. Anyway would love to see this!
Hi guys, I'm trying to make a vehicle mod and then I found a 2018 tutorial on "theindestone.com", while following the steps I stopped and thought "is this tutorial good for creating mods nowadays?" I went into the PZ mods folder and took a look at the vehicle mods I downloaded, and they all seem to have this folder called ISUI, what is it and how to use it? (sorry if it's not understandable, i'm using google translate)
Thats where you define "Mechanics UI" its place where you define car part attach/detach menu.
🧍♂️
thx!
Anyone savvy know how to get IsoRegions to render the walls so that I can debug a build issue? It just shows shaded blue volumes currently with no distinction as to walls.
Fixed: Build at least 1 wall frame outside and IsoRegion should snap into wall render mode.
How do modders discover the game's source code? I was exploring the code of some mods I downloaded and they "Pull" things out of the game like variables etc. like, a code representing a location that such items will spawn, etc. I remember that a long time ago I used dnspy to do this with the worldbox, but apparently it doesn't work here, could someone clear this doubt for me?

Well in the absence of any feedback or thoughts whatsoever I guess I'll go down the "Mod Options" route...
alot of those things are visible in the lua side of the game. D:\Steam Library\steamapps\common\ProjectZomboid\media\lua, or where ever you have your steam library installed.
Thought I'd give modding a try but I am a bit confused right off the bat. What file extension do I use for scripts inside the media\scripts folder and is there any naming scheme I should follow?
The PZ modding repo mentions the game makes use of Java and Lua but doesn't exactly specify. I am assuming it's Lua?
hmm i have a weird question here hmm.. im kind of lazy when i making sprites and cought my self to just re use some of the some of the same texture in multiple rows in the mytexture,pack my question is does the pack self runs a dedup it self when you make it as a pack or do you need to delete the dublicates your self ?
dont really know where to place this question
I'd like to make a mod that adds a "Place in oven" button here whenever an oven is in range. Does anyone know of an addon that adds buttons to existing menus so that I can see how they're doing it?
You can check ISCraftingUI.lua > self.addIngredientButton
just add new button manually and override :render() func to set x/y/visible of one
Thank you very much!

@wooden falcon btw I think it will fast your work
local player_num
Events.OnCreatePlayer.Add(function(_player_num)
player_num = _player_num
local crafting_panel = getPlayerCraftingUI(player_num)
local text_width = getTextManager():MeasureStringX(UIFont.Small, getText("UI_blablabla"))
local new_button = ISButton:new(
crafting_panel.addIngredientButton:getRight() + 5,
1,
text_width,
25,
getText("UI_blablabla"),
crafting_panel,
callback_func
)
)
where does the server check if all client is sleeping check ?
java func
IsoPlayer.allPlayersAsleep
just found it as well hmm was hoping for it had another call hmm byt thx
do you have knowlagde about the tree growth tick also have problems with finding when that happen lol
I have no idea
Not in pz rn but u can try to check square after cut tree by square:getTree
There's :HasTree and :getTree but maybe in :HasTree checks :getTree and tree health (as I got health it's for chopping progress but I'm not sure) then maybe there's some way to get grow time
I gotta admit, taking on the older 2 in 1 npc mod, has been quite the task 
About NearItem :
I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?
In my b40 mod i used to check for textures with a dedicated function that was called by a "onTest" function.
pz modding moment
is it a translation txt ?
if it is you have to add the encoder in the file
cant beat em?, join em
just error craftingui and it broke roflan
it's fine
hi! have a question concerning those GUID strings which are for example used for identification of clothing items. example is such a thing: 20830c4a-bc1e-4b57-ad50-9521916ba9d0. can I use any string in the format 8-4-4-4-12 where the blocks are composed of random integers (between 0 and 9) and random lower case letters (from a to z)?
How do you overwrite a vanilla item with a mod? I’m trying to make a trait mod for food allergies, but overwriting the vanilla items to add an “on_eat” function is not working.
item tweaker
check the code, there are 20-30 lines of one, usually modders literally copy this into their mod and change name of file to don't create extra dependency
My mod’s GUID has: skinny-jeans-…etc. as the GUID. I don’t know how the GUIDs work, or if there is a way to create them, but making up my own one worked.
oh... ok. so i think they should be unique for each item at least...
in my case, i am working on a mod which might have a lot of clothing items and therefore i decided to write a little program which automatically generates the fileGuidTable and the respective .xml files to save work. one part of the program consists in generating enough of those GUID strings. therefore my question...
you can also get guid generators it’s quite a common use for unique ids, wiki actually says a lot about guid generation iirc
thanks. i'll have a look at it!
Reason: Bad word usage

GUID generator
Free Online GUID/UUID Generator
is it possible to make a character equip the welding mask to do a recipe?
keep only requires it, i'd like it to require being equipped
Any tips on doing a "silent noise event" to attract zeds to a given location. I know I've seen it in a mod but I cannot remember which one.
HordeNight mb
looking for someone to commission a pretty easy mod if you'd like
fixing Fix Rolling Pin
{
Require : RollingPin,
Fixer : Woodglue; Woodwork=1,
Fixer : DuctTape,
Fixer : Glue=2,
Fixer : Scotchtape=3,
}
Is it possible to set the "Potentially repairs #%" amount? I have a custom weapon in my mod with 4 different ways to repair them. One of them has a 20% repair, one has a 50%, and the other two have 10%. But I have no idea how those numbers were set because I didn't do them myself.
Take a look here: #mod_development message
cheers <3
could someone help me with adding a new spawn region for players to pick from (area on vanilla map near bases etc)
im talking specifically the spawn regions you can pick, i have a spawn point set currently and would like more options, thanks if you can help
subscribe to any spawn point mod and learn from their code
i did it right a while ago and wasnt putting them in the server files 😄 figured it out
I want to make a "clothing" item aka a hilt for the katana but don't want to put it as a "tail" item or smth like that. So how would i make a new section so it doesn't impare the ability to wear any other clothes
Also is there an easier way to do distribution than going through 9k lines of code-
Can someone help me with this problem I have (see photo) the gunfighter in sandbox is squished.
Would appreciate if someone has answers, been at this for 2days now
why is "Piercing=TRUE," not working on some guns?
some changes just won't really apply for some reason
even if I change the swing time, the attack speed of the melee doesnt change
you can try defining a new body location. depending on where you plan to display your new clothing item, note that there could be graphic glitches due to conflicts with other items
Is it possible to create a custom radio station and play custom music ? If it is, do you have some docmentation to give me ?
Thank you in advance
Clipping shouldn't be too much of a problem as i think most people don't mind it too much. And for those that do i could probably somehow find a way. One question tho. How would you even "define" a new body location. Because surely i can't just type a new name for it and done right?
to get an idea of how the code looks, you can have a look at the vanilla lua in media/lua/shared/NPCs/BodyLocations.lua. there the vanilla body locations are defined and you can do it the same way.
its sth like group:getOrCeateLocation("myNewLocation")
Thanks for the help man. I'll look into it once i'm done grilling
Weapon stats are saved in the save file so you have to make a new item or edit it like with debug mode.
Chainsaw retexture for the people that doesn't like the orange one. To replace it, download the texture, go to ProjectZomboid > Media > Textures, then do copypaste and replace it.
Here's a picture of how the chainsaw model looks with the new texture
About NearItem :
I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?
In my b40 mod i used to check for textures with a dedicated function that was called by a "onTest" function.
yeah, I basically made a new item and them copy paste the code for the melee weapon. but just changing the Item ID, DisplayName, then the swing time. I got the same weapon with the different name, but the swing speed is exactly the same
is workshop bugged rn? cant see my posted items etc like the panel is missing on the right
nevermind its working now just a min later
I put my mod in the mods folder and they didn't appear in the PZ mods menu, does anyone know how to solve it?
Now this time, for some stupid reasons with guns, I set the recoilDelay=0, then added FireMode = Auto,
The gun fuggging shoots like it has 100 RecoilDelay.
While another gun has exactly the same variables, and it works, it shoots full auto. What the F?
Make sure you have a mod info document
I meant a new instance of the same script item!
Swing speed is the same hmm I lack answers :|
so no matter I change swingtime, it doesnt matter?
If an item has a reach of 1 and your character has one, and you change its speed in the txt tile to 2 and reload your save, then that item's instance's reach is still 1, but if you add a second one of the same sort of item to your character then that has a reach of 2. Oh swingtime maybe that does not do anything anymore and it uses a different thing now. There are items with numbers that affect their swing speed.
yes, theoretically it should be working, right?
Now it worked! I had put it in the wrong folder
hey ppl been without my pc for 8 months now, just got a new gpu for playing today, so... i had a lot of mods before when i was playing on build 51
Should i just delete everything and do it from the start?
I immagine too much has changed to break everything right?
I would go with a clean install @misty lake
I'll probably just do that
Sir is there anyone who can help how can I install map mod like Raven Creek to the server with server hosting site -https://games.agilahost.com/
Just install it on a server you host via steam and copy paste the server ini file over
Prolly the easiest way
its there already but map wont load
@devout galleon thats what i got after
is that mchost
agila hosting
you're looking for #mod_support
is there a way to see the files that are downloaded when you download someone's mod? i am trying to work out the coordinates/tiles of someone's map
is there anything in the base lua files that handles zombie respawns? i'd like to make a mod that adds respawns/total population in certain cells, but i can't find anything to go on
I have a question that I'm sure has been asked a million times, but I haven't been able to find an answer to my particular idea. I'm making a mod for a .357 magnum revolver, but I'd like for it to be able to switch between .38 special and .357 magnum, and have different range and damage. Is there a fairly simple way to implement that? I don't want to add to much more to the game. I was just thinking of changing it in the inventory to have a drop down menu with an empty gun to switch between the two. I think I understand the basics of how to make a new gun and ammo type work, I was just wondering about that specific function.
You could use a recipe to change between the 2 ?
That's true!
you know what i would really like to see
im not sure if its actually planned
but
id really like to see tracers
or some kind of visual representation of bullets being fired
other then like, a light up around you
Reason: Bad word usage
So I made a bit of an update recently to the npc mod, and looking for feedback 
https://steamcommunity.com/sharedfiles/filedetails/?id=2821231605
Reason: Bad word usage
I've got some questions regarding clothing moddin'
I've been following that one clothing tutorial that's on both Github and Steam, though I've done it all in 2.79. Would that impact rigging at all? As in-game my jacket is a mangled mess!
Hmmm

Did you use a zomboid clothing model as the base?
Looks like a rigging issue?
I'm not a modeller so I'm like a dog trying to fly an airplane with this stuff?
I just like doing the anxious react.
Yeah, I used a base model. The base jacket
So this is just a retexture right?
Let me try exporting the FBX with what I use to export my Ravenfield content - maybe that'll resolve the issue
Sort of, though the model has been altered as well
Ah right
Ok, if it was just a retexture you could just point your lua at the vanilla mode lol
Model*
Darn, well unfortunately that didn't work. Though I guess those export settings I use are for Unity 2020 anyways lol so it was a long shot that they'd work here
GuiCOMGaMeS coming from the future with build 51
For Steam, all of the mods will be installed under \SteamLibrary\steamapps\workshop\content\108600, and separated into different directories
does it even matter if you put a lua file in the correct folder? i made something that i thought was being handled server side, so put it in the server folder, but it seems it works only trough the player client
@winter bolt what do you think has happened here? 😅
It must be a rigging bug right?
yes it does matter
hm, i'm very confused now. made a mod that sends out a servermsg at certain intervals to warn that the server is going down, but it seems to no longer work when i add if isClient() then return end at the top
isClient()
This returns true if you are the client in a multiplayer game, but false in a local game or if you are the server
isServer()
This returns true if you are the server in a multiplayer game, but false if you are client or local game
getWorld():getGameMode() == "Multiplayer"
This returns true if you are in MP
any chance SendCommandToServer() does not work from the server side?
why don't you just use rcon
making it a mod means everybody downloads it which leads to your issue here right
personally I have a cron job to restart server every 2 hours at X, and another cron job that runs RCON commands to send the server messages before X time
but to answer your question, I am not sure
because i haven't found clear instructions on how to set it up, so this seemed easier for me as its a server mod
https://steamcommunity.com/sharedfiles/filedetails/?id=2821744058 I made this might help
this works on dedicated server and doesn't require your own pc to be on?
exactly
set up the 2 cron jobs on the server itself if you can
if you are using a host then you would have a web panel that you can schedule server restarts in
and then just use rcon on your own pc or another one to send the commands
(if you don't have a VPS, its controlled by someone else)
i'll read that post, thanks
heh
Thanks for the tips for RCON, do you know if there is a RCON command to reboot the server ? I know "save" and "quit", but didn't find a "reboot" one. My dedicated server provider offers only 1 reboot per day setup, so I would try to setup a RCON job that would reboot the server more than once a day. Any idea or I just have to find another provider ?
Hi, I'm wondering how zomboid calculates interior temperatures for rooms/houses and such?
Looks like the weight paint is not done maybe?
No idea
Does anyone have a guide for adding things to the right click build menu?
(And world-object modding in general)
I've tried to reverse-engineer it from PZ's files but its a bit vague
feel free to zip up your project and send it over, I can take a look at what is going on
i think it might be a problem with exporting
I've exported it as an FBX, though the mod itself is part of a much bigger project so I'm not sure how well to go about it
I've also tried exporting it as a Direct X thingy, but that just makes it vanish entirely
Here's the .blend file if anybody wants to look at it
You would need another provider sadly you can only control reboots if you control the server this is why most hosts let you choose the schedule
Thanks. I can choose partially the daily reboot hour, but I cannot choose the frequency of it sadly.
:/ If you are fairly competent with computers and can follow step by step guides you could look into a simple Ubuntu VPS with a steamcmd zomboid server install guide, but Linux can be confusing to at first to learn for just a game server I guess
(VPS for <32 ppl, dedicated or something bare metal for above perhaps)
Sorry I don’t really know any good hosts..
try mod_support channel
Is there any effective way to make the shelves on the left to block vision like the one on the right? I'm quite technologically inept and cannot figure out for myself unfortunately
Anybody have a clue as to how I can move the Scrap Bench from the Scrap Mechanic mods?
Anyone know how to check in lua how many local players are currently playing?
Currently looking at using getSpecificPlayer() 0-3 in a loop
IsoPlayer.getPlayers()
Aw, its not working as expected. It still has multiple players in it after a reload despite only a single player being active.
Oh, its always length 4
in a vanilla lua, there is a function call where is function is called drawText, applied to self (i.e. self:drawText). now, the lua i am working in doesn't define that function and i also didn't find anything about drawText in the the javadoc (i.e. here: https://zomboid-javadoc.com/41.65/). anyone an idea where this "drawText" function is coming from? the lua where it is called is ISCharacterScreen.lua in client/XpSystem/ISUI.
how do i add custom animations to the game?
is Shark's (and Peach's) Military Uniform Improvements broken rn?
and no it isnt broken
oh I'm not asking for support I'm just curious if its the same for everyone, thank you though!
np
ah alright it might be the load order, the shemaugh keeps disappearing
does anyone know how can i port a mod from build 40 to build 41
without going too deep into explaining its in ISUIElement
thanks! i'll check the code there then!
its just a call to drawText on the UIElement java object anyway
what do you mean any recommendations?
what do you want to work on?
oh guys for fuck sake this is for developing mods
like that helped
Is there a mod that prevents the Alt+F4 thing or similar for servers? So that players can't just cheat their way out from death?
I think you're looking for this
ya. that's it! thanks! found it!
someone know way to get rotation of world item placed by player?
I tried: getWorldZRotation, worldZRotation, rotation, angles, getAngles, getAngleX, getAngleY, getAngleZ, getDirectionAngle, direction
no variables or functions
In base code I found nothing but setWorldZRotation 
I'm not a modder but I wanted to ask something:
Is there any way to simulate a push-start car in project zomboid? From what I know every car in the game has to have a key, but some of the vehicles you can mod into the game like humvees/military trucks are mostly push start and don't need a key. Any way to make it so in game? Only one I can think of is to have them spawn in hotwired, but I'm not sure if that's possible
Wait not push start as in you push the car but like you press a switch or smth
Whoever made the trolly mod needs to be sent a fruit bouquet
tried too and always gets N
same value in methods toAngle, ToVector
Is there a mod that allows createhorde command in console to specify a location instead of slamming a horde in a player's face?
the game updated and now the AIZ map pack is obsolete, I want to play again with a new map pack, any recomendations that are not buggy and lore friendly?
do a weight transfer from the vanilla jacket to your new mesh
Allright guys, I dont know if this is the right place to ask this, but anyone has an idea of what mod breaks placing campfire? Thanks in advance
Howdy! That didn't seem to do all too much, just reversed the direction of the distortion! Should I send you the .blend file so you can see if anything went wrong?
So I just noticed with True Music it has a bug with the boombox on the ground anyone got a fix for this?
I'm also creating a music pack for True Music. Wondering how I put my tapes into the loot tables
Does anyone know how PZ calculates indoors temperatures? I'm trying to make a propane space heater with similar functionality to the antique oven when power goes out.
-.- you have to love this game so much lol
i made weapon called "rubber axe" and i made a Categories called fakeAxe and becuase it contains Axe it work as a normal axe in the game on trees damn lovely contain they do xD lol
How do I set how many bullets a box of bullets contains?
I've tried looking on google and youtube but all I found was stuff on how to install ammo mods, not make them.
inventoryfemale = {
rolls = 1,
items = {
"items", 1,
}
},```
hello i have question
is this container treated as zombie corpse
or i am modyfing item pool of "already dead poeple"
?
This is for dead zombies / corpse that don't have a specific outfit table.
so for these you meet in events and such?
This is for when you kill a zombie.
Not sure, but events usually have specific items they add to corpses.
okay than you
Sorry to bother
how can i check if distribution works?
and second
do i need new world for that?
just increase chance to near 100%
better to do
okay thanks
I figured out a way to consistently change items on load - tie a function into the lua function that calls on inventory drawing
can anyone help me on doing distributions?
does anyone know when a cell actually loads on the server and when it unloads? i'm working on a mod that lets you add zombies to a certain location, but so far it only seems to work when im in that cell, so i'm curious when neighbour cells are being loaded and if its possible to load a cell through the server lua while noone is actually present there yet?
Random heads up. If you install Steam on Ubuntu using flatpak (because Steam from the official repository is a mess), the mods folder is in ~/.var/app/com.valvesoftware.Steam/Zomboid/mods/, not in ~/Zomboid/mods like the in-game message hint says in the mods screen.
I know there's an event called for loading individual squares - which you're better off tying your code into as a map can be loaded in chunks made up of two cells.
Just don't put any print message in loading squares cause it will crash your game unless you put a delay/spam control to it
Hm, so when you are standing on the crossroad of 4 cells, it doesn't load 4 whole cells?
Any mod that adjusts when dirt appears on the character? Kinda finding it silly that your char gets massive blotches of dirt when you have a total of "2" dirt.
Anyone have any ideas how to tell if a given tile is in/near an "urban" area? Or know of a mod that does this?
No, it will pull the squares in a range around the player - afaik it doesn't load the whole cell
thanks, thats good to know.
Hello, I want the character to attack with a knife with the left hand, how can I invert the animation or something?
Reason: Bad word usage
I am using the lua event "OnNewGame" to add stuff to the player's inventory. Is it save to put the respective .lua file to the shared folder? or does it belongs to client?
I don't know much about animations but if the game doesn't already have an animation for left hand attacks, you'll probably need to make one.
I'm interested in making a mod that adds a (moveable) button to the UI. Clicking this button will bring up a context menu with specific options (based on what items you have). (For example, "Smoke a cigarette", "Take a painkiller", etc.)
I have no idea where to begin though. Does anybody know of any mods that add a button to the UI, or add a button / hotkey for actions like those?
Cheers
Would you be able to give me an exple on how this would be done? I plan to add manga to my mod and I think you method would work really well in reducing the loot load.
I edited it without testing but this should work:
local ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
function ISInventoryPane:refreshContainer()
ISInventoryPane_refreshContainer(self)
local it = self.inventory:getItems()
for i = 0, it:size()-1 do
---@type InventoryItem
local item = it:get(i)
if item:getFullType()=="Base.Book" then
print("--debug-- item found")
end
end
end
I would be very careful with the if statement tho
make sure the item is only set once
local ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
function ISInventoryPane:refreshContainer()
ISInventoryPane_refreshContainer(self)
local it = self.inventory:getItems()
for i = 0, it:size()-1 do
---@type InventoryItem
local item = it:get(i)
if item:getFullType()=="Base.Book" then
print("--debug-- item found")
namedLit.applyTitle(item)
end
end
end
namedLit.setBooks = {}
---@param book HandWeapon | InventoryItem | IsoObject
function namedLit.applyTitle(book)
if not book then return end
--do stuff
namedLit.setBooks[book] = true
end
note: namedLit.setBooks usage
The item would have to be reset once a game session due to how items are loaded - but you can store your values in a modata
Like this:
namedLit.setBooks = {}
---@param book HandWeapon | InventoryItem | IsoObject
function namedLit.applyTitle(book)
if not book then return end
local title, author, year
local bookNameLitInfo = book:getModData()["namedLit"]
if not bookNameLitInfo then
book:getModData()["namedLit"] = {}
bookNameLitInfo = book:getModData()["namedLit"]
title, author, year = namedLit.getTitleAuthor()
if title then bookNameLitInfo["title"] = title end
if author then bookNameLitInfo["author"] = author end
if year then bookNameLitInfo["year"] = year end
end
if bookNameLitInfo then
title = bookNameLitInfo["title"]
book:setName(title)
local colorForTitle = namedLit.TITLES_color[title]
if colorForTitle then
book:setColor(Color.new(colorForTitle[1],colorForTitle[2],colorForTitle[3],1))
end
end
namedLit.setBooks[book] = true
end
Storing the values would avoid them being shuffled everytime
somethings don't need to be redone tho - afaik item names remain
condition might as well
Now my item won't be the vanilla book. My manga will be an entirely new item with separate model and everything. If I am understanding right I would just have to change if item:getFullyType()=="Base.Book" to Base.Manga
Dammit the code block didn't work on mobile
works
just not ' but `
👍
Hi, I'm trying to make a mod for use the boxing gloves as weapon, I would like to use the vanilla one (Gloves_BoxingRed), is it possible to create a new item that when is equiped it show you wearing the boxing gloves? thx
Yes that's right
I actually use a table of types as keys with values as true for quick checks - but if you're only dealing with 1 type it's ok to use what I pasted
Anyone familiar with setting colors onto items? I am setting it but the icon doesn't seem to change
maybe i'm too noob, but what you mean?
which icon you want to change the color? the item icon? you mean the texture?
which color you want?
It's random
no worries
@sour island sorry if I ask to you, but is it possible to make the player wear a clothing item when you are equipping a weapon? as I said before i'm trying to make an invisible weapon that when is equipped also make you wear the vanilla boxing gloves. the only way to do it is to make a new 3d model for the weapon? and there is any way to make the 3d model fit on both hand even if i'm using only one hand to fight?
Couldn't you just assign the weapon the clothing's model?
guys im not sure if i did this file correctly.. its for my gun mod
do i need to add the "imports" line ?? xD
if you have time can you tell me how to do it?
or point me where i can get the info, thx
try using a weapon script and giving it the boxing glove's models
taken from the boxing gloves scripts
no clue
anyone know what mod adds the ability to claim vehicles like a safehouse??
here
hello everyone. Im having issues with britas. i need help configuring the loot for a dedicated server. and the ingame admin settings cutoff halfway.
anyone know how to find or configure the files that could help me? possibly in voice if able to make teaching/communication better
im also using G-portal.com to host my server if that helps
do you know what mod could do the same but not require a mapwipe?
you need to make a gunfighter mod it doesn’t take too long
there’s intuitions on the gun fighter page
i tried going to the "info on loot idst." at the gunfighter workshop page but it just says they dont exist anymore
so i had an idea for a mod that makes listening to music (specifically CDs) decrease not just boredom but also your stress and unhappiness. any idea where i could start?
https://steamcommunity.com/sharedfiles/filedetails/?id=2823438384 I wanted the same thing as you so I tried to make it. I couldn't get the existing Boxing Glove clothing item to work as a weapon, but I was able to modify the mesh of it (made it just the right-hand glove) and use that as a weapon skin. It works decently well except that the way weapons "sit" in your hand doesnt' work particularly well with something that should go on your hand (like a glove). So I had to make the glove comically big (otherwise the glove either looked wrong while in idle position or while in aiming position; also if it wasn't big, the hand would phase through the glove).
I'm quite new to modding and this was my first mod ever for pz. I'm sure someone could have done a much better job. But feel free to take the existing code and modify it however you want.
Hi, yes, I tried to replace the original model of the vanilla gloves, but of course it doesn't fit in one hand, so right now i just used it as an invisible item, i wanted to use it in my server just for fun with my friends and maybe stage some fight club XD
Yeah, I don't know enough about textures / meshes / animations to have done a good job of it. The comically large glove was the best I could do. But I did add some custom sounds to the swing + hit animations for it that, imo, sound really good. And the baseball bat swing animation actually works decently well for a "punch".
ONE PUNCHHH
The punch animation was actually a glitch with the game thats hard to replicate so I sadly cant bestow the gift of punching to all of yall. Got it during one of my twitch streams. And recorded this series all in one go after!
Mods used
More Traits:
https://steamcommunity.com/sharedfiles/filedetails/?id=1299328280
Skateboard:
http...
If I want to "extend" an existing mod, what do I need to do to ensure that my extension mod loads after the existing mod? I think I read in the past that it is based on alphabetical order. If that's the case, which name specifically controls this?
i saw private lime did it but was a glitch
Yeah he posted a short clip of this on reddit and that's what inspired me in the first place xD.
Which mod would you recommend for stability, vainilla weapons expansion or britas weapon pack?
Are you trying to upload the mod for the first time or are you trying to update one you've already uploaded?
in mod.info add
require=id
player:getInventory():getFirstTypeRecurse("item_name")
will give me the first item of that name in my inventory. How can I get a full list of all the items of that name in my inventory instead of just the first one?
Edit: getAllTypeRecurse() seems to be what I needed.
Look up instructions on changing settings for brita it’s a pin to find but it should come up I’d send you the link if i still had it
Thinking about it again, you could probably implement some logic in your code where whenever you equip your "invisible glove" weapon, it spawns and equips the boxing gloves to your character. And then whenever you unequip the item, it deletes the boxing gloves from your character. This wouldn't allow you to wear other gloves in the game, but it would explicitly tie the weapon to the skin.
If I have a clothing item as item that I have already confirmed is in my inventory, what function do I use to equip it? I found ISInventoryPaneContextMenu.equipWeapon(...), but my item isn't a weapon.
Do you need to know Java to make mods? or is Lua enough?
probably a dumb question from me
Just lua is fine. Many of the objects that you will access / methods you will call are from the java code, but you invoke them in lua.
Oh amazing, thank you!
is there a mod that lets you wear clothing over the prisoner jumpsuit?
Just a quick question because I don't know how to word it for a proper search. I want to make a gun that can be crafted between two ammo types. I'll assume I have to make a second file for the gun for the second caliber, but will condition be shared between the two? Or is that another thing I have to figure out how to set up?
i need to help my guy out, he has like 20 errors when loading into his server and im trying to figure out how to read errors to help fix it....how do you get to the errors?
[SOLVED] anyone an idea where this problem comes from: i made a new body location which i put before all the vanilla body locations. however, rendering order is not correct. here is an example with a green skin i made:
the green skin intentional. T-shirt for example is not shown and instead is hidden under the green skin. the skirt is also not displayed correctly. as i said, i put the new body location (called "Skin") before all the vanilla locations.
seems to be the case that all clothing items which don't have a 3d model and are just textures are hidden under the skin but why?
[EDIT:] already solved (forgot to clear the vanilla body locations before i added a new one). anyway thanks! 😉 XDXD
anyone know if the Event OnTick runs 40x per second for all clients, or does that depend on the client's processor?
When adding a new map area, do I have to include them in the server mods? For example, the one in the photo below
Anyone know how to send messages like the "Server shutting down in..." message using LUA?
i.e., the big message in the middle of the screen
in case your problem is still open, you can try sth like this:
Ok maybe an easier question then... How do we get fields from objects in PZ lua?
For example, an IsoPlayer object has a float field called "runningTime". How do we get this value?
Also, how do we access packages (e.g., zombie.chat) in LUA?
if i'm not wrong you already can with admin powers, just press "add safehouse" in the admin panel
I would like to know too, I've been looking around but nothing
Feels like huge swathes of the API are unavailable to us because of this 😦
Appreciate it. This ended up working for me
ISInventoryPaneContextMenu.wearItem(item, player:getPlayerNum())
Quick Question...
How do you go about listing a mod as a dependency of another?
The scenario; I wish to package a base mod, and two optional "extensions" together. The base mod is done, the two extensions each add a recipe(s); both require the base mod active for their result/base to exist.
Additionally, would listing the base mod as a dependency ensure that they load after the base mod?
I believe that in the mod.info file for both extension mods, you need to have require=base_mod_id.
Awesome, I'll check that out. Thank you :3
That worked flawlessly! Thank you :3
hello. How do i make a custom gun repairable like vanilla ones??
find another gun mod and then search for a file that has "fixing" somewhere in the code of the file.
alright thanks man!
Is it possible to play global sounds on certain conditions (Player holding a radio) ?
Hello everyone! I am looking for a model viewer for Project Zomboid to take pictures/record animations of 3D characters
I don't know if it is possible
Can I add clothes to random zombies?
Hey I have a gtx gaming server that I modded and now I get no sound from firearms. I deleted all the mods and there is still no sound
Does anyone have experience with gtx servers who might be able to help?
I figure I have to repair the game files but there doesn’t seem to be an obvious way to accomplish this
Anyone familiar with custom sandbox options know if there's a possibility to categorize options so that some are required for others / faded out when false, etc?
yes
sorry
you have to put the name of the player on the top part
must be the correct nickname
here you have to put the player nickname
on the owner section
you are welcome
I'm trying to find a function that returns all the player indexes on a server. I've tried IsoPlayer.getPlayers() but that only returns local players.
Or if there's a way to acquire the server object as a client. As I know there's a getPlayers function for it as well
You should try to find the .wave or .ogg file in the game's directory under /media/sound and in your mod folder, have a .wav or .ogg file of the sound you want with the same name and same folder structure.
Essentially overwriting the vanilla death sound
Uhm, can I have the full explanation?
Ok so you need to know how to mod first is what you're telling me
You should start with this first then https://pzwiki.net/wiki/Modding It has useful tutorials and link to helpful content
Any chance it has to be done in workshop?
the mod doesn't need to be done for the workshop, but PZ has steam workshop integrated with their game so it's strongly advised
also i'm not sure you can change the death sound with a mod
SteamLibrary\steamapps\common\ProjectZomboid\media\sound\deathcrash.wav
this is where is the sound file
isn't that the sound when you have died?
what I meant was the sound whenever you kill a zombie.
the blood splatter one
it's not in sound.
the sound whenever you kill a zombie..
uhm, how do I put it, the sound you heard after you stomp one of them to death.
you hear the splatter
yea, I gotcha
This is just an idea, but custom fight music you can import
Like the new chase music for The Legion in Dead by Daylight could fit well imo
fuming frank tape combo 👌
and tbh just any dbd killer track since they all evolve, especially the gunslinger dudes track :D
Sounds like a dream
Does anyone know where the vanilla professions icons are stored?
So I finally finished a mod, and I think I did all the structures right, but I can't get it to show up in game under the mods to even test it. Does anyone have any idea why that would be? I looked up every conceivable way to do it but I'm stumped.
Hello, can you tell me how the "Attachment Type" affects a weapon?
If you don't see the list of mods, check how the path is structured, it should be: C:\Users###\Zomboid\Workshop\Mymod\Contents\mods\MYmod
Thanks. I managed to figure it out after a moment. Hopefully that's the last assistance I need for a while. Or at least a minute. XD
Aloha and salutations, I've still had a strange issue regarding my jacket and its rigging being all sorts of wack-a-doodle! I exported it as an FBX instead of an X, X just makes it transparent. Looking at the rigging, it all seems all right? It's just a modified version of the default jacket which then I transferred weights back to just to make sure. Attached is a blend file for anybody who might want to mess around with it, saved in Blender 2.79.
Jacket itself is a recreation of the 1895 waffenrock pertaining to IR. 22, I'm wanting to expand into 19th century uniforms and stuff, as well as weapons. Civil War, Indian Wars, etc. though want to mess around with this first. Possibly up to WWII, no idea though
Okay, so I got it to show up in the mods screen in game, but I can't spawn any of it to check how it looks. Can someone with experience dm me and take a look at it sometime to see if I did most things right, or if I bungled the entire thing. Either I did one thing wrong, or everything is wrong. I'm sure there's no in between. XD Also sorry if a request like this isn't allowed.
I'm trying to edit one of the texture from the base game, changing the image worked but I really don't want to reopen the game each time to check the effect. Can anyone give a hint about how to load the 3d model and paint on them?
You can get yourself Blender and then import the object the texture is on, might need a plugin since some stuff is saved as an .x in the PZ directory. Once the object is open, just create a material and slap your texture onto it via the image texture route. I'd suggest looking up some tutorials on basic Blender stuff, but it's not very complex
Dumb question, where in the debug menu can I find coordinates like this?
Particularly for modded maps
I get posX,posY,posZ but where does worldX/worldY come from?
How do I find the correct object model? I know the image file I am editing, and a GUID but couldn't find the model loading it.
Do you know what the texture is called or what it's for?
I can look around and see if maybe I can find it, and if it's a .x I'll convert it to FBX for you
for example Shirt_Denim
Hmm, that might be an actual texture overlay on the base character, but I'm not sure. Let me looksie
It actually seem so, because last time I forgot to turn off background and made it all white, which immediately covered the entire character
Ah yeah you'll probably just need the character model for that, there's the clothing guide out there which has a link to it:
https://steamcommunity.com/sharedfiles/filedetails/?id=2648115890
Unfortunately I've been having issues with my own jacket not being weighed properly and can't figure out what's wrong
Heh, yeah no worries
Anyone know how do we get fields from objects in PZ lua?
For example, an IsoPlayer object has a float field called "runningTime". How do we get this value?
thanks, it worked

looks a lot worse in blender, maybe I should improve my drawing
I believe that if you have the player as player then you can just do player.runningTime. I'm not sure if lua has public and private members though so it's possible that member would be private. In which case you may need to check to see if there is something like a IsoPlayer:getRunningTime() function. If there was, you could do player:getRunningTime().
Yaay my mod is almost done after a month of work :DD
Is "Makeshift" a good word for clothes that you can craft out of things that you can find laying around like curtains, sheets, trashbags etc... ? I couldn't find a better word for it and English is not my first language
I found "Make-Do" but "MakeShift" sounded better 🤔
Poggers
Yeah I specifically mean fields without a get/set. I tried dot notation on an assigned object in the debugger without any luck yesterday.
That looks great!
And yeah, makeshift is a perfectly fine word
Thanks for the answer ❤️
Can anyone give me some advice, Im trying to get the the HandTorch to be able to attach to a backpack using Noirs Attachments and also still be able to attach one to a belt using the better belts mod. So I created a new item called HandTorchBelt with the following recipe.
recipe Open Belt Clip
{
destroy HandTorch,
Result:HandTorchBelt,
Time:30,
OnTest:Recipe.OnTest.TorchBatteryRemoval,
OnCreate:Recipe.OnCreate.CST_OpenClip,
StopOnWalk:false,
}
Then I found some code from another mod and edited it some to try to keep the same battery life from item to item when crafted.
function Recipe.OnCreate.CST_OpenClip(items, result, player)
for i=1,items:size() do
local item = items:get(i-1)
if item:getType() == "HandTorch" then
if item:getUsedDelta() > 0 then
local HandTorchBelt = player:getInventory():AddItem("Base.HandTorchBelt")
if HandTorchBelt then
HandTorchBelt:setUsedDelta(item:getUsedDelta())
end
end
break
end
end
end
It is actually working but the problem I am having is that its creating 2 of the new flashlights one at the same Battery life as the original HandTorch and one at full battery life. Much appreciated if someone could help me out been trying for awhile now to get rid of the extra item.
ooga booga 😎
I'm baaaaaaaack lolz
Another quick question, hopefully...
Is there a way to specify in a single recipe, that it can use one of an array of items, and only require one?
As an example, say that I want to replicate the ability to disassemble radios. Must I specify a recipe for every type of radio, or can I specify an array of all of them, and a single recipe with that array?
Alternatively...
If I must make a recipe for each, is there a way to write a Lua script instead, that generates each based on an array of the item names? Mainly to help me future-proof the mod aha
(I know I can use Lua to insert into loot tables programmatically, but I don't have any idea how to do the same for recipes)
When you do release it, I would love a DM with a link to it! I'll use it on our community server. The idea sounds fantastic based on how you have described it above :3
Possibly tomorrow if I don’t get lazy to make the previews of the mod on Photoshop x) But yeah I’ll definitely share when it’s released 😄
If not then during the week
Awesome, thanks dear! :3 ❤️
- Does anyone know anything about the code that causes an item / container in the world to be highlighted?
- Does anyone know anything about how you get the information of which item you are currently mousing over in the inventory ui?
- If I want to change an existing mod slightly (without explicitly changing the mod's code), can I just have my mod define an identical function with the same signature and then have my differences within that function?
Edit: For 1, maybe IsoObject:setHighlighted(bool,bool); (haven't tested it tho). Not sure what the second bool is for, but it seems to be optional. Still not sure about question 2 or 3.
you need to place ur mod in order list after one that u want to override
and anyone who will download ur addon have to do same thing
for 1 u found function and didn't test but still sending this message I think almost 3 time.. just test it and check what will happen?
lul
for 3 I think should be somewhere in ISInventoryPage or ISInventoryPane
i want to write a mod that provides a hotkey for transferring whatever item you're currently mousing over from the container it's currently in to the one one that's open in the other pane. (for example, pressing T moves the whole stack and ctrl+T moves one of the items in the stack). need to get the info of what item is currently being moused over though. haven't been able to find something like that digging through the lua yet. will check the files you listed.
inventorypane:2454
this looks really promising thank you very much
👍
is it possible to overwrite this function, but still call the original function after my code runs? i would think no because by overwriting the function, trying to call the original function would just call my new function?
MyNewActions = MyNewActions or {}
MyNewActions.OldFunc = MyNewActions.OldFunc or Func
function Func(...)
MyNewActions.OldFunc(...)
...
end
there's more than single way cos func can be method or procedure
--#1
test = {}
--Original func
function test:Func()
end
--Override
MyNewActions = MyNewActions or {}
MyNewActions.OldFunc = MyNewActions.OldFunc or test.Func
function test:Func(...)
MyNewActions.OldFunc(self, ...)
--...
end
--#2
test = {}
--Original func
function test.Func()
end
--Override
MyNewActions = MyNewActions or {}
MyNewActions.OldFunc = MyNewActions.OldFunc or test.Func
function test.Func(...)
MyNewActions.OldFunc(...)
--...
end
I'm having a problem with my mod. I created a book that give 100 xp on the skill that you choose from the opening menu when it's read. the book works, but when I right click on it it gives me this error. is it enough to understand whats the problem?
thank you so much for your help <3
wrong item type somewhere
seems in ur recipe
if u even used it
yup
np
when you say "wrong item type" what do you mean? this is what I wrote for the book:
item 100XPTraining {
Weight = 0.30,
Type = Normal,
DisplayCategory = Literature,
DisplayName = Training Book,
Icon = 100XP,
WorldStaticModel = 100XP,
Tooltip = Tooltip_item_100XPTraining
check 2789 line and check from where error going
but mb just I could be wrong xp
britas weapon and armour not workin for me in server please help, im playing in ingame server host
is it possible to make a moodles icon change depending on its stage?
Is there anyone who I can ask a few questions in private about clothing modding?
I forgot to put and "end" to a function and fixed other things
thx for the hellp
here is the result
it's quite basic 😁 but I needed it for my server
but still need some testing
does anyone know in which files i can find this UI? been looking everywhere but can't seem to pinpoint it
ProjectZomboid\media\ui\ClockAssets here?
im looking for the lua file, so i can change its position
I wonder why there is no clock mod?
This is a shot in the dark but is it possible to add textures onto item's icons? Like decals on the item icon
Just occurred to me equipping adds one... I'll look there
Is it possible to create a recipe with no result? Or to just destroy an item without creating another?
check this
You can set recipes to remove their result
"RemoveResultItem"
"RemoveResultItem:true,"
check also, there is a mod that make the rubbish bin working, so you can delete the content
recipe Open Belt Clip
{
destroy HandTorch,
Result:HandTorchBelt,
Time:30,
OnTest:Recipe.OnTest.TorchBatteryRemoval,
OnCreate:Recipe.OnCreate.CST_OpenClip,
StopOnWalk:false,
RemoveResultItem:true
}
So like this?
Or does it need to be directly under the result: line
And thank you Chuck and kratos for your replies
I don't think the order matters
check Has Been Read mod
doesn't matter
seems done by java rofl
cool idea btw. I think it can be done by override all ways of access to clock via lua
need to try
what is that and how do I fix it
small question:
How to block mod to be used while is other mod activate ?
i know there is option require but that is if mod need other mod to be activated but how about to pretend mod to not be activated when is other mod active ?
I think they only appear in Debug Mode, outside of it you won't see them
alright, good to know

can't you require it and check if it exists in the require?
nah have just 3 version of mod and wanna to pretend users to use more than one version at same time... (due that will make glitch and crash)
I see, not sure but authentic z has that kind of thing going on with its extra backpack module that should be off when enabling the main one
see if they did it?
I am just guessing tho someone else might know the answer
do you have name of mod or link ?
So I got my mod to show up under the mod menu, but when I load in with debug mode to check it I get an error thing saying something along the lines of (my mods name) '=' is expected near base
I've referenced it against other similar mods and everything seems to be in order. So I'm super confused.
name=The Authentic Merch Pack
id=AP Merch
description= Get the Merch! No Microtransactions needed!
Currently adds 8 different Alice pack variations. It does not replace the orignial one.
Try to find the RJ one!
More to be added later.
poster=poster.png
there are none
of any other tags than name,descryption,id and poster
for others mods by that autor also doesn't have others tags...
so idk
how do you go about adding 'hood up/hood down' kinda functions to a piece of clothing where it can have two state you can toggle between?
Would OnCreate not work regarding rotten food? For instance, I'm making some knockoff Lunchables for my mod and an issue I've encountered with my other food items is that, even if the package reads rotten, you open them up and the food's still fresh
exactly in mod manager I think no way cos always see in mods like "Please active only 1 version of presented one"
u have to set rotted delta by original item
result:setRotten(item:getRotten())
:setRotten is just placeholder
I don't remember real function name
Hmm, I could browse the PZ files to find a function like that maybe. Any idea where something like that would be kept?
no idea
Ah darn
what're u talking about?
function withone will detect if is assigned mod ID= id1,id2,id3... and will force stop script with print on console (and logs) WARING YOU USE MORE THAN ONE VERSION OF SAME MOD!
and or it will spam error in console
or will crash game
not sure yet
i did a little test with the OnTick event and im counting about 39-40 ticks per seconds, does anyone know if thats thesame for everyone or does it depend on the players processor?
I think it will confuse ppl
mod manager even updates now? author is alive? xp
I think better to ask to add ur feature
hard to say due there is different way of tatting cores for AMD and INTEL
if u do it by urself and send to author will have more chances
well
it works
o.o
but not really as should
I meant here not just disable mods but do mod "unusable" as mod without mods by requirement
it block mod and pretend from load ... mess in console but game load without that and those in typed ID's ... problem is ... after back to menu mod also disappear from Mod list... and need to restart game to be able use it again ...
depends on processor performance
xp
I think worldX/worldY is the cell coordinates ? In one of my functions I used this to locate the player coordinates :
local x, y, z = player:getX(), player:getY(), player:getZ()
And then use my 3 variables x, y or z to compare it to different values to check where is the player
I use this in an "onTest" function in a recipe to allow craft only at defined coordinates.
I am looking for help to understand how NearItem works (and if it works, actually). Here my questions :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of an IsoObject like a oven what should I use ?
In my b40 mod I used to check for textures with a dedicated function that was called by a "onTest" function.
I get that but how on earth does one get those WorldX/WorldY values? I can get posX,posY,posZ pretty quickly in debug mode at the bottom right. But I haven't found a setting that shows the full coords yet
I'm not sure you need WorldX/WorldY because I think that player:getX(), player:getY(), player:getZ() gives you unique coordinates on the whole map, not coordinates by map cell. If I remember well my testing sessions when I wrote that part of my code
Can someone assist me with looking over my mod files to see what I'm doing wrong? The mod appears under the mod tab, but the only thing I can get to spawn is one part of it, and it doesn't use the icon I set for it. I can swear all the parts are there, it's just getting them to fall into place that's driving me insane.
Hey folks, I was looking for a way to expand on the Clothing Degradation (sandbox option, making it more customizable like some mods that allow for numerical changes in rates, multipliers, etc). Or at least simply tweak its numbers, especially for dirtyness and when (in x/100) their decals start showing in clothes in a global sense not per script (and on body if possible too). I'm no coder, but have done some small changes to mods myself and would like directions to see how far above my head this is.. So I was trying to find where those values are, not even sure if in a .lua, .class (how we open those?) or if i need to decode java libs or if it is baked in some other game file. Would someone have an idea which type of file would have those metrics (rate of degradation and, more specifically, when in the x/100 scale the decals start showing on clothes/body)? Or if there is a mod out there to that effect? (I couldn't find any, aside from hand washing tweaks which is nice but not quite what I'd like to change or make more customizable).
TL;DR: where's the code for WHEN (%) dirty decals start appearing on clothes and body?
Cheers!
(because having a huge brown smear appearing on the character/clothes after a 10-step jog in a clean base due to a 2/100 dirtyness just rubs me the wrong way... I agree with the concept, but not with the scales/rates)
anyone have experience with worldsoundmanager? i'm trying to pull in zombies from large distances, over 100. but many are not even responding, even when i put the radius to 200+, when my character teleports near them, then they seem to hear the noise, so i'm guessing they are not fully loaded cause noone is near them? is it possible to load a chunk without any player being in it, i think that might fix the issue
About to do some digging myself, but does anyone know (or even just have a general idea) of some functions that get called whenever you equip a weapon? I want to add a weapon that executes a custom function anytime the player equips it. (Maybe ISEquipWeaponAction. Maybe Events.OnEquipPrimary)
Edit: The Events one did the trick.
Hey, what would be the lua code to equip a player primary item to a gas can where gas can is
local gascans = inventory:getAllEvalRecurse(function(item, player)
return item:getType() == 'PetrolCan'
end, ArrayList.new())
?
you could try
ISInventoryPaneContextMenu.wearItem(gascan, player:getPlayerNum()).
that will work for clothing items. not sure if it'll work for weapons / items you equip in your primary / secondary though.
Hello there, could someone please tell me what the correct class name to call for First Aid skill is?
This one doesn't work and I can't find anything anywhere;
SkillRequired:FirstAid=10,
Please @ me or DM me, it's 6.30 AM and I'm heading to bed.
probably would be cleaner to have a UI pop up with text. alot of the time I get people coming with the red error/crash and they don't even bother to read/know how to read the console. so you would get alot less people commenting and complaining about the crash, if it is just an explicit pop up that makes it super obvious what the problem is.
SkillRequired:Doctor=6,
yo, anyone know how to make use of the NATO ammo from the brita's modpack??
like, can i just use 7.62x39 nato in an ak47??
o shit i guess that's 7.62x51 nato
also i can't figure out ammo crafting in the brita's pack :U i have the t-mag reloading press, some 12g hulls, some 00buckshot, some shotgun primers, some gunpowder, and i can't figure it out
i'm losing my mind lol
Does anyone know if it's possible to have custom animations on weapon swings? All the custom animations I can find in other mods are for actions that aren't a weapon swing. The only weapon swing animation choices I can find that are used in the vanilla code (SwingAnim) are Bat, Spear, Heavy, and Stab. I can find animation files and references in those files that use keywords like Bob_AttackBat01_CritHit and Bob_AttackBat01_Hit etc. but I can't find anywhere in the lua where those animation files actually get tied to the Bat keyword that is used when declaring a weapon's SwingAnim. So I don't know what I'd need to do in order to introduce an additional option for SwingAnim.
i dont see why you wouldn't be able to @wooden falcon , like.. there's already animation mods n' stuff, but idk... also... nice Vincent Adultman pfp.
agreed on thinking it'd be possible. my lack of success isn't indicative of it being impossible, but the fact that no other mods that I can find do it makes me skeptical. if it was possible, you'd think people would have done quite a bit with that by now =/
Yeah idk. i dont know anything about modding, i wasn't even sure if this was the right spot to ask my own questions 😆
i still laugh that my first experience with adding a mod to the game was "i wonder if there's a mod to add pot to the game" XD i always have jigga's mod installed now
Howdy howdy there all;
I’m looking to commission a mod for project zomboid; it’s going to be used in a server/modpack though as a first warning.
I was looking at seeing if someone could possible make a mod that allows you to hook up a metal barrel to a generator to increase its fuel tank size; or a upgrade system for a generator to improve its fuel capacity/efficiency
Just send me a DM or ping me and we can talk prices
there are any top/ranking mod for server? where can see top pvp killers or top time lived or zombies killed, anything?
If I make a mod that the entire logic is server logic, do multiplayer clients have to download it?
mod_support channel
This is because weapon custom animations are convoluted to make currently. There are no streamlined tools to make such a mod, so you will find yourself spend most of the time trying to reverse engineer the animation system instead of making the required animations.
Love you
https://steamcommunity.com/sharedfiles/filedetails/?id=2823274752&searchtext= check this one maybe
okayy, thank you, ill try
Thanks for the response. The animation I’m trying to use is a punch which actually already exists in the game. You can see it in the animation viewer in debug mode (something like Bob_Attack1Punch). You can also find the .X files for them. However, there are no accompanying .xml files and I’m unable to decipher exactly how the system works for the existing ones (spear, bat, heavy, stab). I’m guessing there is something in the Java files that connects it all. Hopefully in a future update they make the system more accessible.
Are there any basic QOL mods people would recommend?
I'm trying to have a slightly enhanced experience without adding a ton of new / crazy stuff.
does anyone know why the outer zombies are not being pulled in? i've tried both server and client wise to play a sound like this:
getWorldSoundManager():addSound(self.player, self.player:getX(), self.player:getY(), 0, 200, 200)
their distance from me is about 50 tiles
Imo, checkout the following:
- Eggon's Hotkeys & Hot Actions
- Bzouk Hotbar Mod B41
- Left Click Redux - Click To Act
- Fast Keys
- Unpack
- Health Bars (for build 41)
- Mod Options
- Has Been Read
- Minimal Display Bars # this one is similar to Health Bars, but gives more in depth information
- Weapon Condition Indicator [41.60+]
- Combat Text (B40+B41)
- Better Sorting
For some of them, I needed to tweak their settings to get them how I want. Feel free to DM me if you need help with any of them.
when working with lua events and the command Events.TheEvent.Add(function), what determines the order in which the added functions are executed? is there a way to manipulate the order manually, say having a specific function which should always be executed at last for example?
this is a good question and something I was wondering about yesterday. I suspect they are run in the order that you add them. it would be simple enough to test, however if it does behave in that way in the test, there's no guarantee that it will always behave that way (unless someone actually knows the answer).
my suggestion would be to do test where the first function you add takes a really long time (like a while loop that does nonsense for hundreds of thousands of iterations) before printing something. then the second function you add just prints something immediately. then see if the second function doesn't run until the first one finishes.
there might be some type of sleep / wait command you can use instead of the while loop. i dont think lua has one natively, but you might be able to use an OS specific option since it's just for testing purposes and not something you'll have other people downloading.
that would be a first good idea but problem is that it isn't even clear to me in what order the functions might be added. some luas contain the Events.TheEvent.Add(function) command not inside a function but just as a "global" command. Maybe those "global" commands get executed in the order the lua files are loaded but then i am not clear what determines this order...
I don't remember specifically where I read it, but I definitely read somewhere that the lua files are loaded in alphabetical order. I believe this meant the names of the files themselves and has nothing to do with the directories they are stored in. The one exception to this is that all mod files are loaded AFTER all vanilla files.
Forgot to tag you in the above reply.
I actually had a file that needed to be loaded after an existing mod's file. Initially, I was getting errors. After I changed my file's name to start with the letter 'z', the error went away. It's a tiny sample size and doesn't prove anything concretely, but that's the logic that I am working with at this time.
i'll try to work with your hypothesis and see what i get.
many thanks for the ideas
Hello, i'm looking for a mod that would allow me to queue up actions, especially like deconstructing furnitures to level up carpentry or metal working, does that exist ? i can't find anything on the workshop
In both my mod's workshop.txt and mod.info files, I have
require=eggonsHotkeys
require=Susceptible
But in-game, only Susceptible is required by my mod. Do I have the syntax wrong or is it not possible to require more than 1 mod? (Maybe I'm supposed to put them on one line with a comma or semi-colon between them? Will try that later when I can.)
Hi, I’m quite new to Lua and hope this isn’t too big of a bother.
I was hoping to add a skill level requirement for a mod used by a server I play on. Specifically using an item such as a bandage. Is it possible to add skill requirements to item usage?
I've been able to add skill requirements to crafting thanks to the extensive documentation by the community but skills for item usage hasn't been documented and I haven't been able to get anything to work.
For the 10 Years Later mod, I only have one choice when setting up a multiplayer server. For solo play, I can choose "no indoor, no roof, lower veg", but for multiplayer it seems like I only have the full vegetation option? Anybody know how to get the "no indoor, etc." option for multiplayer?
Do the other mods on the workshop advertising the lack of indoor grass not work with MP?
is there a list of the different hatcategory?
anyone knows whether the vanilla game also triggers lua events via its java code?
im looking for something that would mask the head entirely, not just nohairnobeard
also for some reason nohairnobeard doesn't seem to mask the beard.
checked with the vanilla balaclava and it also doesn't hide the beard :/
nohair and nobeard works separately tho.
Is this kind of thing valid/going to work as expected?
local XX_modData = getGameTime():getModData()
function myFunc1()
XX_modData.someVal=1
end
function myFunc2()
if XX_modData.someVal == 1 then
-- Do stuff
end
end
...
myFunc1()
...
myFunc2()
If there truly is mod data to be retrieved from the GameTime object, then yes. That's perfectly valid Lua (except for missing the parens on your invocation of myFunc2
Just checked the Javadoc (should've done that all of 20 seconds ago) and see that getModData() exists on the GameTime class, so with that set of parens added this looks fine.
what would I use to check the skill levels of a player? getSkills () ?
Thanks. Yes not sure how I dropped those parens. Edited them back in. It's nice that LUA can keep an object like that around so long as it's in scope. Helps make things a bit more readable.
I can't figure out how to delete bodies
local deferedDeadBodyChecks = {}
function HungryHordes.OnZombieKilled(zombie)
deferedDeadBodyChecks[#deferedDeadBodyChecks+1] = {
square = zombie:getCurrentSquare()
}
end
function HungryHordes.OnTick(ticks)
for i, posData in pairs(deferedDeadBodyChecks) do
local square = posData.square
local deadBodyList = square:getDeadBodys()
if deadBodyList ~= nil and deadBodyList:size() > 0 then
for i=0, deadBodyList:size() -1 do
local body = deadBodyList:get(i)
body:removeFromWorld()
body:removeFromSquare()
end
end
end
deferedDeadBodyChecks = {}
end
Events.OnTick.Add(HungryHordes.OnTick)
Events.OnZombieDead.Add(HungryHordes.OnZombieKilled)
does not work
but
local deferedDeadBodyChecks = {}
function HungryHordes.OnZombieKilled(zombie)
deferedDeadBodyChecks[#deferedDeadBodyChecks+1] = {
square = zombie:getCurrentSquare()
}
end
function HungryHordes.OnTick(ticks)
for i, posData in pairs(deferedDeadBodyChecks) do
local square = posData.square
local deadBodyList = square:getDeadBodys()
if deadBodyList ~= nil and deadBodyList:size() > 0 then
for i=0, deadBodyList:size() -1 do
local body = deadBodyList:get(i)
body:reanimate()
end
end
end
deferedDeadBodyChecks = {}
end
Events.OnTick.Add(HungryHordes.OnTick)
Events.OnZombieDead.Add(HungryHordes.OnZombieKilled)
works great
Im going insane 🦀
only difference between the two snippets is reanimating the body instead of deleting it
Looks like adding skill requirements to timed actions is a no go, but adding skill requirements to crafting recipes is easy. Might just have to go that route for now.
not sure which timed actions do you have in mind but if you are talking about actions which can be triggered by clicking some element/option of the ui, you could try to hide the respective ui element in case the player does not have the required skill
That...might just work, never seen it done before and I'm new to all this sadly...
I'm close to throwing in the towel and asking someone to do it for twenty bucks at this rate
ok... ui modding is quite hairy since it is difficult to understand the vanilla code but definitely possible and in my experience even possible without overwriting vanilla functions
i won't do this for you (even for 50 bucks 😉 ) but out of curiosity, what timed action is your problem about?
Well, I would be working on a mod already made, not vanilla sadly
Though, I'd be willing to work on a vanilla action first, probably smarter anyways....in that case the suture action
is that option only available in the health screen? by clicking some body part?
then i would have a look at the vanilla file lua/client/XpSystem/ISHealthPanel.lua
Thank you
i would then try to identify the function which generates your particular option for suture. the pz codes comes with some predefined java functions with which you can hide that option from the screen. very roughly speaking, it could be something like option.enable(false), option.setVisible(false) or panel.remove(option). I don't have the exact code in mind and don't know what exactly applies in your particular situation but that's the rough direction
One more question...where would I find these commands?
I imagine there's a compiled list somewhere, but my Google skills are lacking....I'm 22 going on 82 here
you can see here: https://zomboid-javadoc.com/41.65/
Javadoc Project Zomboid Modding API package index
Amazing...
problem is that the javadoc does not tell you what exactly the functions are doing but this can often be inferred from context and from the vanilla code
only safe way to delete corpses from server I think?
Game handles them super specially apparently 
I have completely given up on javadoc, it does not tell nearly enough. Decompiled vanilla code is way more useful
that's also a nice way! didn't even knew about it
at first i had also problems with the javadoc but now i am quite fine with it
a general question to the people here: i am working quite a lot with instances of objects which i create by sth like this: item=InventoryItemFactory.CreateItem("Base.MyItem"). the items can not directly be accessed by the players and are in a certain sense hidden from them. in case i don't need such an item anymore, is it necessary and is there an option to delete them somehow in the code? maybe some java method "item:deleteItem()"?
i am thinking about this since i don't know how and if the game/java/lua handles "stacks" somehow. saving all that stuff somewhere in the memory. now i am wondering whether the creation of those items could lead to performance/memory issues when done very often and not deleted properly.
Hello! Im having an issue right now only happening to me, Im host a server for friends with mods but some tiles are bugged out for me also im having tearing for some weird reason idk how to fix it
Idk how to fix it
Weapon stats are often (always?) defined in a .txt file within the media/scripts directory. Is it possible to have those stats modified by a .lua file in the media/lua directory? I'd like to use Mod Options with my mod to give the user control over the weapon stats, but I'm not sure how I would go about doing that (if it's even possible). For example, I'd like to be able to change fields such as:
ConditionMax
MaxRange
SwingAnim
CriticalChance
MinDamage
MaxDamage
BaseSpeed
if I remember correctly, files are loaded in vanilla then modded order, then in alphabetical order of the file name. you could always have print statements just before the event.add call, and that will show the order they were added
if the problem is caused by a mod i'd try to find out which mod causes the problem and then asking in the comments of the mod's steam page or here in the mod_support chat (in case the mod's creator is there).
maybe possible with this code:
oooo that looks promising thanks a lot
i just copied it from this guide: https://steamcommunity.com/sharedfiles/filedetails/?id=2350427678 never tried it but looks worth-a-try to me.
thanks for the suggestion! 🙂
but not really sure if that works in your case. could also be that this code changes the stats for a particular item but not for all...
oh ya true. i was about to test it anyway. will report back shortly.
you probably need to be using a comma to list multiple requirements. Im guessing the second line just entirely redeclares the require variable
yup, that was it. I should have edited my comment to say so when i tested it earlier. appreciate it though <3
you should be able to add skill requirements by modifying the isValid() method for the timedAction. if it returns false then the action should be canceled. and if you want to increase visibility, you could make you character say something, like "im not skilled enough to do this"
Thanks, I'm tired but I'll check it out this weekend. 
this actually works 🥳 . funny enough, it works in the opposite way you were worried about. it doesn't change items that are already in your inventory, but it does change the stats of the "future" items. (so it changes the weapon class, but doesn't change the actual weapon objects).
ok! great!
I had to do a similiar thing before. and to solve that, I just had an function in the OnEquipPrimary lua event, which would check what the weapon being equipt was, then would make the necessary modifications based on the mod option. this way they could modify existing items as well. technically, if you never unequipped the weapon, the mod option wouldn't apply, but I figured that would be a rare case.
yeah definitely thats a good idea. i dont have any issue with it only affecting future items. your solution would be more complete though.
if i get things right and the only problem is that it doesn't affect the items in the player's inventory, you could also additionally iterate through the player's inventory and apply your modifiations to those items as well
Making progress with help...wanted to ask what exactly PerkFactory.Perk is doing?
Is that necessary to have to get the level of a perk?
that would be a good solution that catches all cases. however you should also consider the performance, as if you dont find a nice trigger for when to check and filter what items to check, it can start to have a performance impact. because If you have no trigger for iterating the inv, you need to do it regularly, and with no filter on what items to check, you are checking them all. 1 function doing this won't kill your cpu, but if you continue that philosophy for how you check items, it starts to stack up. obvs you can do whatever you like, but that is part of the reasoning why I decided to just do the OnequipPrimary, because it catches practically all usecases except one unique case. and also its minimum performance impact, by only checking when a weapon is equipped rather than every tick/minute and only that one item rather than the entire inventory. you could actually make a check of all your inventory be triggered by the modification of the modoption which could be a nice compromise. that way it does the more intensive inventory check, but only once.
if self.character:getPerkLevel(Perks.Doctor) > 1 then
return false
should that be
if self.character:getPerkLevel:PerkFactory.Perk Doctor > 1 then
return false
?
I think perkfactory is for making custom perks. you dont need to use it in your case if you are just querying a existing perk from the player obj
Hmmm weird, I was searching through the java doc and it was associated with Doctor, Blacksmith, etc.
Good to know, thanks again....gonna need a list of notes if I'm going to keep modding in this game.
ya... i also had in mind that this is only done when the stats have actually been changed (maybe on game start or during game when basics wants the player to be able to make the change somehow during gameplay). not necessary to do this more often. don't think that this will result in performance issues (except you are using another mod which allows you to have 10000s of items in your inventory. 😉 )
and instead of iterating... there are even methods to directly access an inventory item which will probably increase computation time a bit more.
there are alot of light items like thread which and you can easily be holding 200~300 items. on a crappy laptop and badly optimized code it can have an impact. I've mostly learned to lean that way from experience of people complaining about performance issues
just wanted to point out that it is something to think about to try to do things more smartly like with the method you just mentioned, rather than just going the simple and easier way of doing things
that's definitely a good idea! 🙂
when you do something like getPlayer():getInventory():FindAndReturn(item_name), do you have any idea if this is iterating through the entire inventory and checking names or is there a map / hash based lookup that is a lot more efficient than brute forcing it?
is there an option to find out whether the actual game takes place in multiplayer or singleplayer?
if getWorld():getGameMode() == "Multiplayer" then from lua/client/OptionScreens/CharacterCreationProfession.lua
forgot to make the above a reply
great! thanks!
Hello! Is it possible to commission modders?
Our dev is unfortunately not available anymore for private reasons et we are looking for a dev to help us develop a mod
It is a custom VOIP radio announcement system
a mod that plays sound files on specific Radio channels (for example 102.0 MHz) at specific time (timed announce for lore) and plays random files (like music or fluff announces)
iirc voip isnt exposed to modding
what in particular are you trying to do
it really isnt it just requires understanding lua and its interaction with java
if object isnt referenced by anything it gets garbage collected
if you simply created an object and didnt add it to anything its just that an object itll get garbage collected
regardless dont see much of a reason to create items that way
I meant a mod that plays sound files on specific Radio channels (for example 102.0 MHz) at specific time (timed announce for lore) and plays random files (like music or fluff announces)
require=eggonsHotkey,Susceptible
maybe ... but the mod i am working on requires this 😉
Make suturing take first aid level 1 to perform
Hey… could I use the code from books?
As in, certain books require a certain skill level to read? Could I not transplant that with some slight modifications to make this work?
thats quite simple to do
Yep, think I’m pretty close
if self.character:getPerkLevel(Perks.Doctor) > 1 then
return false
could just plug that in I assume
local oldISStitch_isValid = ISStitch.isValid
function ISStitch:isValid()
return self.character:getPerkLevel(Perks.Doctor) > 0 and oldISStitch_isValid(self)
end
Oh? That's different what is so important about the "and" there?
Would that also work for suturing others?
nothing special just calling the previous logic to maintain it
and if its the same action then yes
Gotcha, and thus necessary...I overlooked that
Hmm, so when performing it on others it just checks for extra requirements such as player movement with the same action...gotcha...sweet, thanks.
What is the method to make a player move to a square?
module MODNAME
{
recipe Make ITEM
{
Thread=3,
Sheet=2,
Glue=2,
RippedSheets=6,
keep Needle,
Result:ITEM,
Time:20000,
Category:Tailoring,
OnGiveXP:Recipe.OnGiveXP.Tailoring10,
}
}```
anyone can help how to add experience after doing recepie?
its that at the bottom. the OnGiveXP.Tailoring10. that is a lua function that adds xp to the player
it is, but it doesn't work this way
like i don't get xp
can't remember the name of the function rn, but you can find it by looking at the timed actions for mechanics stuff if I remember correctly.
oh i see, I assumed that was a copy paste from an existing recipe. there is no existing vanilla function for tailoring specifically
how can i fix it?
you need to then actually create the function that it can be called by the recipe. it isn't enough to just rename the function
you can see them in recipe.lua file
function Recipe.OnGiveXP.WoodWork5(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Woodwork, 5);
end
you need to make a new one for tailoring, then declare that one to be used in the OnGiveXP of the recipe
so i need to create new lua file for that?
yes
Hello guys, I remade the tutorial on how to use capsid for making mod with IntelliJ.
https://github.com/Konijima/PZ-Libraries
Anyone wanting to make their own clothing sets for the survivors mod is now in testing
https://steamcommunity.com/sharedfiles/filedetails/?id=2828423670&searchtext=
General question about making a mod compatible with other mods, what would be the best way if any to override a lua file/local function from another mod?
its more because tailoring doesn't use the recipe system. xp is given in differently
overwrite as small of a scope as possible. meaning dont overwrite a file if you can simply overwrite a function. dont entirely overwrite a function if you can just monkeypatch it. then remember to use require statements to ensure it loads after whatever you are overwriting
thats also a thing i may have overlooked
player:getXp():AddXP(Perks.Tailoring, 15);
end
Give15TailoringXP = AZRecipe.OnGiveXP.Tailoring15
This is the function I use in reference to XP gained through a recipe
recipe Upgrade School Bag
{
Bag_Schoolbag_Tier_2,
keep Scissors,
keep Needle/SutureNeedle,
Thread=3,
LeatherStrips/DenimStrips=3,
OnCreate:PleaseKeepColor,
Result:Bag_Schoolbag_Tier_3,
OnGiveXP:Give15TailoringXP,
Time:300.0,
AnimNode:Disassemble,
SkillRequired:Tailoring=2,
Category:Tailoring,
Tooltip:Tooltip_AttachBackpackTier3,
}
I then use it with the OnGiveXP tag
^
your mod must be loaded after the one where you want to overwrite something. if you want to overwrite a function of the mod with a new function, you must then give it the same name. but i would then consider the post Robot ex140 and trying to find a workout and not directly overwriting stuff.
@small topaz @shadow geyser alrighty, I appreciate the tips! Will see what I can conjure lol
I'm looking for a way to have players spawns with a specific item of my mod, without asking for the admins to change the servertest.ini file. Is there an event like 'when player spawns" that I could use to call a function that adds an item in the inventory of the new player ? Or is there a way to have the mod force SpawnItems=MyMod.MyStartingItem to be added in servertest.ini file ?
Events.OnGameStart.Add(function() -- make sure our player is setup on game start
local player = getPlayer()
end)
wtf
Responding to Asilar lol
local player
ah yes
Is it only when a player creates a new character, or when he starts the game/load his character from a previous play session ?
if u make mod then better to create global table with unique name to save variables there and don't create global variables like PLAYER bruh
it's literally meta of current player
I'm new to modding and want to make an item that makes nearby people sad. Are there other items or mods that have done that (that I could use a template)?
not sure**
now where i see maxwell218's example for adding stuff to the inventory via event OnGameStart... does this belongs to the client folder or to shared? i know it doesn't matter in singleplayer but clould be a thing in multiplayer...
client works for my setup
if u want add it into player inventory or add on floor (world) then clientside is fine
when you would want it in sever side ?
thanks for the info!
according to the pz wiki, OnGameStart should work on a new game as well as when you load a game
but never tried and confirmed by myself. just read it here: https://pzwiki.net/wiki/Modding:Lua_Event/OnGameStart
Wait how do I look at the timed action stuff for mechanics?
I'm new in pz and goes from gmod where is game have clear boundaries of client/shared/server but by my current experience functions with item can work on client always except ones that uses inventory of other players
wdym?
Where do mods get placed when you download them from steam workshop?
\steamapps\workshop\content\108600\
would this will work :
function AddStartingItem ()
local player = getPlayer()
local pData = player:getModData()
if pData.FirstTimeItem == nil then
player:getInventory():AddItem(MyMod.MyStartingItem)
pData.FirstTimeItem = 1
end
else return
end
Events.OnGameStart.Add(AddStartingItem)
u fkd up with if structure
and better use anonymous function
cos u will use this one only once
Events.OnGameStart.Add(function()
local player = getPlayer()
local pData = player:getModData()
if not pData.FirstTimeItem then
player:getInventory():AddItem(MyMod.MyStartingItem)
pData.FirstTimeItem = 1
end
end)
fixed ver
if not pData.FirstTimeItem then
or
if pData.FirstTimeItem == nil then
use as you see fit but first looks better as I think
thanks a lot !
and don't use everywhere
else return
it needs only if u don't want to code execute after some line (in "big" functions). here's just 1 "if" structure so no necessary > looks clearly
hey, I have a question, can I somehow get the number of players on the server using python?(I do not know which of the chats to write with this question, I'm sorry if it's offtop)
thank you for the help and tips ! I get it 🙂
I've been on servers that use a discord bot for this
I can ask and see but I doubt they will say how they managed it, was a bit of a drag apparently
I understand, I'll try to figure it out, thanks for the advice
is there any way to optimize the crafting menu? server im on is running a lot of mods and opening specific parts of the crafting menu soft locks your game
to the point that if you want to fix it you have to relog
You can't directly access this 😢
Is there a way or key to hot reload files (in particular .fbx files) in game whilst in debug mode? Have to do some small changes and relaunching every time is a bit time consuming to say the least lol
Fbx should just update in-game live when the file is being modified. Do they not?
Yes they do, just realized that lol. Do you know if there is a way for other files?
I don't think so. But I'd like to be proven wrong on that.
Darn, oh well at least fbx is still quite useful
Hi everyone. I'm currently looking to make a mod that adds permanent night to the game. The "The Sun Has Been Vanquished" mod sort of touches on the concept, but it heavily relies on turning fog the color black, so using a flashlight ultimately turns out to be completely ineffective. I know absolutely nothing about lua, but would definitely be willing to work with someone in trying to figure out a way to alter the way the day-and-night cycle works so that it's actually true darkness like it would be during peak night darkness.
I think I have an idea as to what needs to be changed, but I'm not entirely sure. In the ClimateMain.lua file, there appears to be different values for what color should be present both in the interiors and exteriors during dawn, day, and dusk
Hello zomboid modders!
I am working on a mod that should inactive zombies at a specific time. So far, I am using the OnZombieUpdate callback and a simple function like this:
local function setZombieInactive(zombie)
if isNight() then
zombie:makeInactive(true)
return
end
end
Events.OnZombieUpdate(setZombieInactive)
It works well when playing in SOLO/Single Player. But it doesn't work well in MP. Looks like that only zombies loaded in the player chunk are getting inactived, while all other zombies keep moving as usual. If I move to another chunk, the zombies are not getting updated. Does anyone have some ideas why this happens? Any workaround? 👀
hey can any modder create an electric floor heater mod, like those electric radiator heaters?
like this
have it "connect to local electricity" like how a generator can connect to your house, and lift the heating function from vehicles and give it the timer functionality of a stove/microwave. Maybe a temperature setting as well?
Do you know if it is possible to create a mod like survivor radio but only with our own custom radio?
Do you mean zombies outside of the loaded chunk still enter your chunk and then freeze?
Or that some players see frozen zombies while others do not?
Cause zombies outside of the loaded chunk are simulated
they don't even truly pathfind afaik - they just draw a line to the attraction source and update over time.
so you'll have to find where that's called and see if you can tap into it - but I would have assumed makeInactive would turn that off too.
Hi @sour island , after further tests, looks like that the OnZombieUpdate is not even called for these zombies.
But only in MP?
Yes, only in MP. In SP everything is working as expected
Are you running this code under client, server, or shared?
The code is running under the server folder. I can link the mod page if you want to see the code.
Nah, that's all I got - my custom zombie stuff is under server.
Probably has something to do with something MP specific and unloaded zombies - so that's out of my wheelhouse
Yes, thanks for your help btw! 👏 I am gonna try replace the OnZombieUpdate with something else.
You could try to force each client to do it - if it works in SP, then that might work
Should be as easy as moving the code to client
worst case scenario you'll have to force data back and forth using commands
Oh, I see, and then the server will be synced automatically?
I'm honestly not too sure how the MP stuff works exactly - but I was told the server code doesn't get ran per client in MP
Oh, ok 😄 I'll try this way
if you want the game world to do something specific put it in server, but then you'll have to update the connected clients
since you're not telling the zombies to be somewhere or do something that requires syncing - you're just flipping a boolean to true - should be fine
That's probably the issue! Thanks a lot Chuck! ❤️
Oh, no, actually is a custom mod
Ah nice
Hi @sour island , I had some time to make this change, move the lua script to the client folder, and unfortunately it didn't solve the issue. I start to believe there is something "broken" with the OnZombieUpdate event. For some reason the callback is not even called for zombies that are loaded outside the cell where the player spawn.
The zombies don't exist there
But if I move with the player, on that cell, I expect the OnZombieUpdate to be called, but nothing happen 🤔 Or am I missing something? 👀
I think there is, the combat text mod decided against using it and instead opted for playerdamage instead; do you have alternatives? time based perhaps? what are you trying to do
Yes, I want to switch zombies to inactive when a specific time is reached. I am trying out with the OnTick event
Yes, using the OnTick and iterate over all the zombies present on a cell seems to work:
local zombies = getCell()::getZombieList()
for i = 0, zombies:size() -1 do
local zombie = zombies:get(i)
-- do all my magic with the zombie
end
try not to use ontick though
its very expensive
its called 40-50 times a second or so
function Recipe.OnCreate.Magazine556(items, result, player)
player:getInventory():AddItem("556Clip");
end
how to create a quantity of that item"556Clip" i want to have 10 "556Clip" but how?
function Recipe.OnCreate.Magazine556(items, result, player)
player:getInventory():AddItems("556Clip", 10);
end
Yes, I run the function every 100 ticks (almost 1 second)
@frosty falcon I am just in the process of finding a good amount of ticks 🙂
there is everytenminutes
thats ingame minutes
but yea that might work, just returning until you reach 100 ticks or w/e
thanks man!
Just wanted to say thanks to @sour island and @frosty falcon for the help. Using Tick instead of OnZombieUpdate solved the issue 👏 You are awesome! 🌟
I’m wondering, is there a way to control how the zombies look, restrict them to certain sets of clothing and physical appearances, for example make all my zombies wear baseball caps with cornrow hair and be skin tone 3 just for the sake of a hypothetical
Two questions and some context. I've done a lot of interesting things using the exposed OpenUrl from the Lua engine (can loop readbyte exposed by the java engine to do arbitrary sidecar communication to/from lua). Having done that I know there is a big problem in server hosting with the client and server mod update timings. What I have been considering is creating a mod loader mod streaming the server announced mods into a contextually bound server mod folder to basically allow mod version consistency between client and server without interrupting standard mod handling in single player. In looking through I think I can accomplish the mod reload part (though theoretical at this point) what I really want to know is. 1) I'm pretty sure this isn't an intended use of OpenUrl and I'm not sure if the exposure of ReadByte is intended or if that will be patched out at some point and 2) would this mod syncing method be frowned on?
not sure if I entirely understand what you are trying to do, but if this is meant to be a solution to the problem with servers having a older versions of the mod due to not updating while they are running, there already is kind of a solution. there are already mods that can detect when an active mod has been updated on steam which would then close the server. Then setting the server to restart itself when shutdown would then bring the server back after updating the mods, so that the server would then be updated to the latest versions, which clients would have when trying to join, keeping all mods synced.
This is more an effort to control that timing. The workshop is a wild west of deployment schedules. Essentially it would be running a single mod that leverages the OpenUrl method to communicate with a mod manager on the server side. Basically to allow a "vendor version lock" type functionality. The issue with the current solutions is mod publishing essentially can kick players at arbitrary times. And the problem scales with the number of mods applied. Instead, if I can load the mods using this method into a server bound folder on the client side and load the additional mods from there I get that vendor lock until the server decides it's time to update.
would still have the timing issue with the single mod but that's much easier to put deployment schedules around.
it somewhat goes against the "established mod mechanisms" mentioned which is where my main concern is. I don't want to push against the community direction.
the first question around OpenUrl is mainly because I didn't want to put a lot of work into doing it on my own servers if that method isn't intended to be exposed (it's not easy to tease out so it didn't feel intentional)
This might work, but you might want to test with a super high zombie population to make sure it's not eating fps.
Iterating in lua is not as fast as java since it's lua interpreted by java
yeah I keep it to a minimum in my other uses due to the cost. Mostly use it to communicate out world and player information to a database
with the mod loading it would be once at start
I'll push through on my server mod as PoC and come back 🙂 thanks everyone
oh and anyone who looks to do that also with OpenUrl, do it server side, don't do it client side. trigger events client side but have the server do the heavy lifting.
(in my usage, OpenUrl is only called server side in response to client messages on the bus)
disclaimer: I apologize for my broken English, as it is a lot of text I chose to use a translator to avoid delay in writing
summary of my problem: I recently decided to study about creating and modifying addons for project zomboid, however I don't have much knowledge and experience as a programmer, but I decided to try to create a modification for the game anyway
addon idea the mod would be summarized in the possibility of players being able to watch/listen to audios or videos directly from youtube/twitch/soundcloud through a media player integrated into the game's TVs and radios where everyone within range could listen/watch without the need to download
using the streaming idea from the above sites (very short explanation)
Can anyone tell if this is possible?
I don't think it's possible, audio lib doesn't provide a way of streaming from the internet.
Wouldn't it be possible to make a way to bear it? using lua language
Yes, but I don't think you can without modifying Java side.
Zomboid uses a whitelist of stuff you can access on the Java side, and I doubt networking is on there. So you would need to modify Java side to add a whitelisted networking component, which isn't possible using only a workshop mod.
Is it possible for a crafting recipe to have a random output?
Yes check how OnCreate works for the other recipes.
\media\lua\server\recipecode.lua
You would want to make your own function and the random logic into it
Might also want to add RemoveResultItem:true to the recipe script to prevent the default result item to be given
Awesome!
Anybody know if there is a lua function to modify the repair recipe of an item? (More info: If you have an item defined in media/scripts/myitem.txt:
module Base {
item myItem
{
attribute1: ..,
attribute2: ..,
etc.
}
fixing Fix my Item
{
Require : myItem,
ConditionModifier : 20,
Fixer : repairMaterial1=2,
ConditionModifier : 50,
Fixer : repairMaterial2=3
}
}
I can change the item's attributes with a call like
item = ScriptManager.instance:getItem("Base.myItem")
item:DoParam("attribute1= new attribute value")
But I'm not sure how to modify the repair recipes for the item.)
recipe have a Override:true property but fixer doesn't seem to have one, maybe just try to overwrite it completely.
Could you elaborate on what you mean by
try to overwrite it completely
(maybe with some quick code based on my above example)?
well copy the original fixer script and in your mod script.txt add it back but with the modified fields inside
not sure if that would work i never really messed around fixer
Ah okay. So I'm trying to make it so that users can change my weapon's attributes + repair recipes through their in-game settings.
So that's why I need the lua to do it.
<3
Real quick i dont see anything that would let us edit one.
Are you trying to edit existing fixer, cause otherwise you could make your own context menu and logic

