#mod_development
1 messages ยท Page 205 of 1
what would I rename though
wouldn't renaming these files prevent the mod from even working since it needs to read from a particular folder?
as long as they're in the folder they will be read, you're expected to rename them
the folder or the files?
the files, but the folder would work too as long as it's not a base folder (client/shared/server)
renaming files now after release is kind of a nightmare though
yea
i'd rather just have 2 separate versions of my mod
it takes up space on my computer but its all good
lol
Anybody know if it's possible to draw a 2D element like an image or text in a square location? Like 3D to 2D? You know, like how the forage system adds that little icon on the ground when you're near something
You need to render near some square?
I actually want to draw a text in a 3D position yes. Or at least, close to it I guess.
You can create UI element and draw text near coords. To find where to render - check how to set pos of ui element of forage icon ISBaseIcon:updatePinIconPosition()
Thank you! 
I will check now, maybe will be easier way ๐
If anyone can take a look at this one would be appreciated, I would imagine it's not super hard to mod but I know next to nothing about PZ modding atm unless someone got some leads for resources to send my way. Either way anything would be appreciated 
what doesn't work with this mod?
nvm saw the comments
yea its just a bit buggy and no longer being supported by the original mod author
I believe most of the bugs are happening in MP I remember using it in SP but haven't tested it since to see the bugs for myself, but I also don't wanna get it added to the MP server and people running into problems with it
i'll take a look but no promises, i'm a baby modder
thank you 
BravenDrawData = {}
BravenDrawData.plNum = nil
BravenDrawData.isSquareSet = false
BravenDrawData.text = "Aiteron is a birb!"
-- TEST FUNC --
local function OnKeyPressed(key)
if getPlayer() ~= nil and key == Keyboard.KEY_Z then
local square = getPlayer():getSquare()
BravenDrawData.sqX = square:getX()
BravenDrawData.sqY = square:getY()
BravenDrawData.sqZ = square:getZ()
BravenDrawData.plNum = getPlayer():getPlayerNum()
BravenDrawData.isSquareSet = true
end
end
Events.OnKeyPressed.Add(OnKeyPressed)
-- TEST FUNC END --
function BravenDrawData.OnPostUIDraw()
if BravenDrawData.isSquareSet then
local x = isoToScreenX(BravenDrawData.plNum, BravenDrawData.sqX, BravenDrawData.sqY, BravenDrawData.sqZ) - getPlayerScreenLeft(BravenDrawData.plNum)
local y = isoToScreenY(BravenDrawData.plNum, BravenDrawData.sqX, BravenDrawData.sqY, BravenDrawData.sqZ) - getPlayerScreenTop(BravenDrawData.plNum)
getTextManager():DrawStringCentre(UIFont.Large, x, y, BravenDrawData.text, 0.5, 0.5, 1, 0.9)
end
end
Events.OnPostUIDraw.Add(BravenDrawData.OnPostUIDraw)
is there a way I can add my script that I'm testing without making a whole mod file for it?
This is perfect! Thank you so much, you're the best!
I tested it with a friend in MP to figure out what the errors are, we had 0 errors.
Sound was completely fine too, I believe the comments and whatever problems you had might be about their load order
Since this mod overwrites filibuster's it has to be loaded after those

Interesting, that's good to know then! So you can fill the tanker and fill the smaller propane canisters without any problem?
yep
i clipped some videos too if you wanna see
this my friend testing it in my hosted server to make sure sound works properly and there are no errors here either
we checked the numbers of the tank and tried canceling actions too, all working fine
i'd say you check it in a seperate server with your current modlist in the correct order before adding it to your main dedicated server if that's the final goal
some mods overwrite propane tanks, that also might be a problem with some of the comments

Sweet! I'll keep that in mind, thank you for the preliminary test @formal rain โค๏ธ
i hope it works out for you too
baby modder 
im baby modder 
speaking of, ive been checking some farming mods to figure out how to code new stuff
where exactly are the farming tiles (the visual stuff: .pack) are tied to the items/results?
it's confusing me so much 
dont know, im not work with this part 

~~Does anyone has idea how to properly use zomboid.socket? ~~
It does seem like server does create it but it never listens to what's written to it?
nvm there was some tomfuckery with socket that was left behind.
Socket?
Is it possible to change the character's turning speed while running or sprinting? The OnTick event does not work, its value is always set to 0.8 and 0.65 while the player is running or sprinting
Is there a way of checking whether or not the the player is holding a weapon? Currently, I have this set up:
player:setHealth(0)
end```
However, I'd prefer checking if the item is a weapon instead of manually checking individual types
player:getPrimaryHandItem():IsWeapon()
Thank you very much ๐
yours too, i just saw it and it's way bigger than mine, a lot of the same songs though
for me i just grabbed my personal playlist
threw out the stuff that goes beyond 1993
and made a mod
how did you get the file size down that much? what did you compress the songs to
for me i did 22050kHz and that took off like half the size or more
but it's still pretty good quality
Is it possible to change the character's turning speed while running or sprinting? The OnTick event does not work, its value is always set to 0.8 and 0.65 while the player is running or sprinting
I'm not sure if there's a way to change the character's turning speed while running or sprinting, I can only see a way to change the character's turning speed when they're walking
Started working on my first ever mod today, a pretty simple one called Morphine that removes all pain for 24 hours, and makes you deathly ill if you take more than one within 24 hours. Only issue, is that my mod icon isn't showing up. It's 400x400, and a .png file, and is also linked correctly in my .info file. Any help would be nice.
found my issue
Are you not using the converter it came with? Supposed to be able to convert to ogg then delete the mp3 files afterwards
well, somewhere in the game the value of the turning speed changes when the character starts running, right?
I made a post on the subreddit, but would someone be willing to help make a super simple workshop mod? Im unsure if this is the right channel to ask.
trying to move the object to where the tile is highlighted but i cant figure out how to move the origin of the object
nvm i got it i forgot i needed to close out of the game completely for it to reset
Hi! What is wrong with this ? ๐ฆ
require "Items/SuburbsDistributions"
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Money")
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100)
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.SpecialMoney")
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 0.01)
Is it possible to implement so that zombies, when the player is sleeping, do not just approach, but attack and kill the player? If such a mod already exists, please send me the link.
hello guys, is there a way to check what fish is being created while the player is fishing? my goal is to get info if the player is catching 118cm fish and turn it into a "reward item"
media/lua/client/Fishing/TimedActions/ISFishingAction.lua
Is the timed action, you can safely store the original and call on a modified overwritten version of specific functions.
thanks bro, i already read that lua, but still no clue how to do like you said, haha, im a newbie
New to Lua and programming?
i have been self learing for sometime while making private mod for pz. but now kinda stuck to how to call the function in ISFishingAction.lua to get the info that player is fishing. like what event should be used to trigger the funcion when the player is fishing?
So to get started you just need to understand two basic things: @trim skiff
require "original file"
---To call on/load a file before the current file
local storedFunction = originalObject.Function
---If the `originalObject.Function` uses `originalObject:Function` you'll need to call `storedFunction` with (self,arg1,arg2,etc)
function originalObject.Function(arg1, arg2, etc)
---do stuff before
storedFunction(arg1, arg2, etc)
---do stuff after
end
function originalObject:Function(arg1, arg2, etc)
---do stuff before
storedFunction(self, arg1, arg2, etc)
---do stuff after
end
The require and the stuff itself has to match the vanilla file in terms of directory. So:
media/lua/client/Fishing/TimedActions/ISFishingAction.lua - require calls should be made in client (or shared)
require "Fishing/TimedActions/ISFishingAction"
local originalGetFish = ISFishingAction.getFish
function ISFishingAction:getFish()
local fishGotten = originalGetFish(self)
end
If you're looking to manipulate or do something with the getting fish event, it actually (and fortunately) returns the fish in question - so it should be easy enough to do stuff there
wow, thanks man. this is precious knowledge. ๐
I am interested with this too. Did you get some answer?
Is it possible to implement so that zombies, when the player is sleeping, do not just approach, but attack and kill the player? If such a mod already exists, please send me the link.
Mr Chuckleberry, its seems the data returned from lua ISFishingAction:getFish() is didnt contain the length of the fish. the length of the fish is recorded in the name of the fish when the fish is created.
i was trying to call lua ISFishingAction:createFish() since its return the data i need, but its error, because i was calling createfish function without any proper parameter.
and i kinda stuck again now haha.
Hi everyone! Got question about .getModData(). I added custom status to corpse with that method:
function Recipe.OnCreate.ADBandaging(items, result, player)
local item
local corpseStatus = {};
table.insert(corpseStatus, "IsBandaged");
for i=0, items:size() - 1 do
item = items:get(i)
print("OnCreate item=", item, " item type=", item:getType())
if item:getType() == "CorpseMale" or item:getType() == "CorpseFemale" then
item:getModData().corpseStatus = corpseStatus;
print("OnCreate Added Status item=", item, " corpseStatus=", item:getModData().corpseStatus)
end
end
end
but if I put it out of my inventory - it change it itemID or something, and no longer got that .getModData.corpseStatus
How you check moddata from corpse after you put it out from inv ?
I get it back in inventory and try to do my stuff. I got OnTest function:
function Recipe.OnTest.ADBandaging(sourceItem, result)
local statuses = sourceItem:getModData().corpseStatus
print("OnTest item=", sourceItem, " corpseStatus=", statuses)
if statuses ~= nil then
print("OnTest !!!ITEM WITH CORPSESTATUS FOUND!!!")
for i=1, #statuses do
if statuses[i] == "IsBandaged" then return false end
end
end
return true
end
so, as long as it in my inventory after craft - it got that modDataStatus
but when I put it out of my inventory and get it back - it change it comboitem name and no longer got that Status I made
Is there a way to save that status for that corpse?
how can I deal damage to a player, like a hit from a zombie, well, for example, at the end of the action the player receives a hit from a zombie or how you can add a bite to a selected part of the body?
Only way - is try to manually transfer moddata from item to corpse when it do transfer item action
Hello all,
i'm working on a mod for simulating some "anomaly" like in Stalker Anomaly game.
So i used the "AttachAnim" method for adding "smoke" animation onto a tile square.
local smoke = IsoObject.new(square, "floors_burnt_01_0", "anomaly", true)
smoke:AttachAnim("Smoke", "02", 1, frameSpeed, 0, 12, true, 0, false, 0.7, color)
square:AddTileObject(smoke)
So the tile display a smoke, it's good, but the smoke is not animated.
Does someone know why please ?
not sure, but it seems you use animation with 1 frame?
yeah i tried by replace the 1 frame by 4, but the result is the same :/
it seems that animation is only played with IsoFire object
Does anybody know how a user is assigned their online ID?
I'm assuming it's based on when they join and how many players are online at the time?
and they are assigned the ID based on the index?
I know AttachAnim works for players and zombies too in the current version (manual mp sync). Other objects might need manual update every tick.
yeah i discovered that too ๐ thanks for your help, it's too bad to use the onTick for animating sprite imho. But well, i'll look deeper in the java code
That sounds right, it increases for every new login connection. Every connection can have 4 IDs which match to the local player number on the client instance.
If I wanted to attract zombies at the player position, would this be done with the addSound() function and be done server-side?
I figured it out
I'm relatively new to dealing with item distributions from mods. I would like to edit them, but I need help with a critical issue. Changing the item distribution file of a mod causes checksum errors for clients.
If I manually edit a mod distribution, every user must manually install the revised distribution for the given mod. This is an issue for obvious reasons.
My question would be: Is there a way to overwrite mod item distributions simply on the server side? If not, then the follow-up would be, if that's not possible, would it be possible to make a mod to overwrite another mod's distribution? Or is my only choice to try and re-pack the mod itself?
Anyone's insight would be greatly appreciated.
you can use setAggroTarget
example of use :
for i=1,getNumActivePlayers() do
local playerObj = getSpecificPlayer(i-1)
if playerObj and not playerObj:isDead() then
setAggroTarget(i-1, playerObj:getX(), playerObj:getY())
playerObj:getStats():setHunger(0.0)
playerObj:getStats():setThirst(0.0)
playerObj:getStats():setFatigue(0.0)
end
end
how can I deal damage to a player, like a hit from a zombie, well, for example, at the end of the action the player receives a hit from a zombie or how you can add a bite to a selected part of the body?
Hello buddys, how do I spawn with the clothes of a certain profession? I'm doing a customized profession
I'm using already MainCreationMethods.lua to get the examples, but i didin't found any .lua that can i choose the clothes
no you can't have files with differents checksum between server and client, or you must deactivate the checksum verification but it's very dangerous.
The best way is to override with your own mod
is there like a mod for safehouse management? Like so admin can change X,Y without fully releasing and replacing it?
Players could toggle to see their own safehouse area like admin tool does?
Because if there is none its about time to do one.
launch with debug mode, enable health cheats and when you check the player's health like you'd normally do there will be a more detailed menu
it allows you to right click on any body part and add any kind of injury of any severity
well respect that you scroll whole year xD โ 04/01/2023
and nah i don't found working one that what are on workshop are lagging server or half works ...
do custom items automatically added to zed loot table? I dont want it to spawn in zeds yet zeds have them anyway while I even didnt touch loot tables etc.
ps : not replacing a vanilla item
I thought that it wont spawn as long as I dont edit the zed loot distros
wdym by half works
they run but sometimes? :p
i did but the total size of all the .ogg files was really big
because the songs were in great quality
so i had to compress them
to reduce size
How can I check whether or not the player is on a multiplayer server?
Where can I see that part of code? I am new to coding and project zomboid modding
I meant method, but thanks
I'm not sure what events you are looking for, but you can damage body parts by getting the part. For example:
local playerHead = player:getBodyDamage():getBodyPart(BodyPartType.Head)
and then you can do something like playerHead:setCut(true) etc for damaging that specific bodypart
This is from memory, so I'm not entirely sure if that's the correct way
thanks
declaration: package: zombie.characters.BodyDamage, class: BodyPart
That should have every method you need
thanks
nah they you have some options what works rest make nothing or bulk of errors
Anybody know what could be causing my mod to not work in multiplayer when downloaded through steam workshop?
Only works in singleplayer
does it work in multiplayer when not downloaded through steam?
Yeah
When it's in my mods folder it works in multiplayer, but doesn't when it's in the workshop folder
that steam places it
is the mod private on steam?
Unlisted
hey, can you respond to my dm when you have a minute?
Checking the debugger, the multiplayer server doesn't even seem to load the mod
very strange
did you add the mod to both the workshop and mods tabs?
I removed it from the mods tab and am just using the one downloaded through workshop
i mean in the server config
the workshop tab chooses which workshop items to download, the mod tab chooses which modids to activate
the mod needs to be in both
otherwise it'll be downloaded but not activated or vice versa
Does anyone know if it is possible to search for a sound emitter in a square? I know how to search for objects and sprites but is there a way to identify an emitter that has set coordinates? I found a getFreeEmitter(x, y, z) but I don't think that looks for emitters that are playing. The intent is to remove all the audio playing from a known square.
You're awesome, thank you ๐
That was the issue
Is it possible to create a bag without a model? I just want a backpack to be invisible on back when worn
yeah should be pretty easy actually
since you don't need a model
and that's like the most time consuming part
i might try to make that mod
I've been trying to do that, but its not working xD
I tried making a ClothingITem .xml file with just a GUID id and also put that in fileGuidTable.xml but that didnt work
And removing ClothingItem from the item script will make the bag not spawn at all
Hey sorry to interject into this conversation just got a quick question was hoping you guys might be able to answer it for me? Since I imagine you all have spent a bit of time in this game and I am just starting... I'm looking for a mod that makes it so I can see a zombies in situations where they should have been able to be seen but aren't. Anyone know of a mod for that?
i think i know how to do it, i'll let you know soon
if i do it i will upload the mod for you and the others to use
Does anyone know - do the standard (unmodded) loot rarity multipliers affect the chances of backpacks/hikingbags/etc. appearing on zombies?
Can someone help me?
You might do better to ask in mod_support - this group is for coding/development, not really general mod-finding questions. Might want to rethink the phrasing a bit too... it's not all that clear what you're actually asking for... in what particular situations should a zombie be able to be seen but isn't?
What is the max damage on weapon you can put?
Like in game you see a bar, what is the max of it?
You'll want to use :getConditionMax() on a weapon, it'll be different for each.
Can u explain?
ConditionMax is durability, he ask about max damage
I'm not sure - he's mentioning a bar ingame... that sounds like condition - "damage" to the weapon itself. There's no bar showing damage output.
I meant the damage bar
Hmm, unless I'm forgetting...
You can see how much dmg the weapon do
I got it working, I made .fbx file without anything in it and a texture without anything and that actually worked lol, only problem is the preview of the character is completely gone, I have to unequip that bag and reequip it in the clothing selection when creating the character
after that my character shows up
Weird
Oh, okay... sorry, I forgot there's a damage output visualization. Not sure what the equation is for the length of it.
There's not one single damage value for weapons, there's a MinDamage and MaxDamage. I assume you could set them to anything you wanted, and it would just cap the ingame bar at some point.
yeah that's what i got so far too
i think i know how to solve the other issue though
Strange why the character preview goes away like that
Well, the Machete is min 2.0, max 3.0 - which is very high. The Katana is min 8.0 and max 8.0, which is pretty much insane.
around 8.0 the damage bar hits the max, thats for sure
Most weapons clock in somewhere more in the min 0.5 to max 1.0 range
hey lads
Maybe I'll let the character spawn with the bag item instead of being able to select it from the Clothing Menu
having small issue
tried to update my mod
as my friend updated model
nothing changed
but model
and now it doesn't spawn
does adding nods to .fbx is going to make model unusable
?
I fixed it, made so the player spawns with the bag and have it be already equiped
sorry i had to go afk for a big while and forgot to tell you that i finished the mod
and it works without having to spawn with it
i'm gonna publish it in a minute and you can get it
๐
This may be beyond what I'm capable of, but I'm trying to make a sub mod to change the distribution files for a couple mods on my server.
The actual changes to the distribution are easy enough, but I'm pretty lost when it comes to actually implimenting them into a mod. On paper all it has to do is overwrite specific distributions. Any suggestions?
I never wrote a sub mod but it uses the same mod file right? So the distribution files would all be in the shared directories. You can call a simple test to see if a mod is loaded and look for the submod. Let me find the code I have on that.
Here is a snip from the distro I use that looks for other mods and adds more distros for them
you can just use getActivatedMods():contains("ModID"), your isFriendlyModEnabled function is much slower
Nice! I knew there was another shorter way but I couldn't find it in my notes. I will mark that down for the next rewrite.
Can one create a server side only mod that doesn't require installation on the client?
yes but no
the game enforces client and server having the same mods, but you could create a mod that loads code stored on the server and doesn't do anything on the client
But the client would still need to have the "mod" registered to join the dedicated server?
yeah
there's no way to get around the server making sure the client has the same mods enabled, and that it has the exact same copies of every mod
but if you wanted to do this to keep a mod private to one server for example, this could be done with a loader mod like that
I just want to have code on the server that collects game data info and writes it to a file on the server.
if security/secrecy isn't a concern i wouldn't really bother doing anything special like that
you can instruct your code not to run on clients, but unfortunately installing at least something to the client side isn't avoidable
Any modders available here for hire?
A mod idea I think some people might be interested in, currently there is no small vehicles like battery powered golf carts (or gocarts), it would make driving short distances more interesting I think and useful for larger base compound. Pros: better acceleration and faster handling, small. Cons: low top speed, no defenses against zombies, fragile, only two seats.
I will have a go at this, though this would require modeling and i'm not sure i have enough experience in that to make this.
Maybe I can get the models somewhere though.
Perhaps another modder who is more knowledgeable with modeling can help you make a custom one and yall can credit each other. Either way I wish you all the luck in the endeavor and looking forward to checking out any progress ๐
i found a free model on the internet
gonna try it when i get home
hello all,
Does someone have a link for documentation/tutorial or anything "clear" to explain "SGlobalObject" and "SGlobalObjectSystem" mechanism please ?
Because this mechanism is quite complicated to understand, even ChatGPT gets a little lost ๐
Thanks you
it's just lua tables with modData
I'm trying to addBlood at a dead player's location on every client, how can I pass through the player's square?
Currently I'm passing this
commandArgs.y = player:getCurrentSquare():getY()
commandArgs.z = player:getCurrentSquare():getZ()```
but I need to pass an object as the param for addBlood(), is it possible to get the IsoGridSquare at these coordinates?
getSquare(x,y,z) is used to get the square.
works for loaded chunks
thanks ๐
Greetings PZ Modders, i've added a Vortex mod manager support for PZ. This means that non-steam users can now just download straight from nexus without needing to install mods manually.
i've added GOG support but i haven't tested the GOG version because i don't own the GOG version of the game.
@dreamy geode @bronze yoke - actually you could have a server side only mod and have it be entirely Lua -- the only thing that would need be in the workshop is something pulling text into a loadstring call.
And have the "string" Lua code be stored on the server
One could make their mods exclusive in this way, but it would be a massive packet to send on connect if you need clients to have any of the code- unless the mod is entirely serverside than you're in the clear.
Hello Everybody,
I'm working on a mod, and i have some trouble about adding IsoFire on square.
I want to have a "perpetual smoke" on IsoGridSquare, so i coded this :
addSmoke = function(square, cellTag)
---@type IsoFire
local smokeOnSquare = AnomalyZoneFactory.isSmokePresent(square)
local colorRarity = AnomalyZoneFactory.getColorForZone(cellTag)
local frameCount = 4
local frameSpeed = 0.1
local color = ColorInfo.new(colorRarity.r, colorRarity.g, colorRarity.b, .5)
if smokeOnSquare == false then
AnomalyZoneFactory.writeLog("addSmoke - No Square Smoke found")
-- check if square already have a smoke TileObject
local cell = square:getCell()
---@type IsoFire
local smoke = IsoFire.new(cell, square, true, 500000, 500000, true)
smoke:AttachAnim("Smoke", "02", frameCount, frameSpeed, -16, -78, true, 0, false, 0.7, color)
square:getProperties():Set(IsoFlagType.smoke)
square:AddTileObject(smoke)
else
AnomalyZoneFactory.writeLog("addSmoke - Square Smoke found and anim attached")
smokeOnSquare:AttachAnim("Smoke", "02", frameCount, frameSpeed, -16, -78, true, 0, false, 0.7, color)
end
end,
Everything working well : the smoke is perpetual and added on the grid square.
BUT when i teleport on the map, and i come back where the IsoFire should be, nothing appear, the grid square is empty, IsoFire is missing...
Someone have an idea please ?
yeah it's not going to work, but i'm gonna try making my own model of a go-kart
can't be that hard
i mean it's just a go-kart
that's what i said ๐
So you did, sorry. Mobile only showed the first comment. ๐
And I misread that anyway
AttachedAnimSprite (the sprite you attached by AttachAnim() method) disappears when the sqaure is reloaded.
Hmm. I'm trying to mess around with crafting modding for shits and giggles but I can't find any of the recipes that relate to placing objects in the world, like adding sheet to windows and doors or placing carpentry walls, etc. Any tips as to where I can find that stuff so I can mess with it a bit?
I'm at least looking at the media folder inside the Zomboid directory and there is some stuff, but definitely not all.
Thank you for your answer, do you have an idea to how can i prevent disappear please ? i tried to listen "LoadGridsquare" event but without success ๐ข
turns out it is, i mean not really if i put some time into it but i don't have much time rn and i found this already, so use that i guess:
https://steamcommunity.com/sharedfiles/filedetails/?id=2768119296
@shadow leaf
@thorn brook pog, its cool doe, I've been there before with STALKER modding, takes a lot of time, thx though hopefully you get to check into again when you have the chance. I still like golfcarts over gocarts but these are pretty nifty too!
https://www.youtube.com/watch?v=0fC6_b5ww6w
that's how i be rolling in them go-karts
Any resources on creating UI?
For example, rendering text centre screen
I've found a valuable resource, for anyone who may be interested in the future
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md
I have a very similar question to ask. I found a mod that I like, but I just had to have a look at the code after complaints in the comment section about performance. Turns out we do some pretty heavy lifting every. single. tick.
So I want to overwrite the lua function of one particular mod. Can I use "require" to make sure it is loaded before my mod?
yeah, any file you require will be loaded at the point require is called if it hasn't been loaded already, regardless of mod load order
For curiousitys sake, does it also prevent the mod from being loaded again later?
VS Code makes it sound like it just loads it in at require, but no more "checks" are done
yeah, require won't load the same file twice
Ty ๐
Anybody know how I can create a 5 second timer before removing UI from display?
So I'm using RemoveLoot function to remove vanilla firearms and items with a mod I'm working on. This works fine for single player, but when testing the mod in multiplayer, I still find vanilla firearms spawning. When I open lootZed, I can't see them on the list, yet they still spawn, but only in multiplayer.
your code might be running too late, or not on the server
the lootzed discreprancy is because lootzed reads directly from the lua tables, but the actual loot logic uses a version the itempicker caches at a certain point in world loading
Maybe I need to do something else, still learning lua, but I have "Events.OnPreDistributionMerge.Add(modifyAllLootTables)" at the end of the script. Would something else be better?
that should be good, which folder is your file in? as long as it's not client it should be okay
Client. I'm guessing the obvious thing is I should have it in server.
as long as it's not client, i would recommend server yeah
hey, could you help me make a distribution file for my clothing mod? it just adds one hawaiian shirt for now, and i want it to be able to spawn in normal places you would expect a normal shirt like that to spawn (clothing stores, wardrobes etc.)
i only got it to spawn once
somehow
Should it be in server/items, or just the server folder fine?
just the server folder, everything else is just for organisation
require 'Items/ProceduralDistributions'
table.insert(ProceduralDistributions.list["ClothingStoresShirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresShirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresOvershirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresOvershirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStorageAllShirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStorageAllShirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClosetShelfGeneric"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClosetShelfGeneric"].items, 1.0);
table.insert(ProceduralDistributions.list["BedroomDresser"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["BedroomDresser"].items, 1.0);
table.insert(ProceduralDistributions.list["CrateClothesRandom"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["CrateClothesRandom"].items, 1.0);
table.insert(ProceduralDistributions.list["WardrobeWoman"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["WardrobeWoman"].items, 1.0);
table.insert(ProceduralDistributions.list["DresserGeneric"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["DresserGeneric"].items, 1.0);
table.insert(ProceduralDistributions.list["WardrobeMan"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["WardrobeMan"].items, 1.0);
table.insert(ProceduralDistributions.list["GymLockers"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["GymLockers"].items, 1.0);
table.insert(ProceduralDistributions.list["Locker"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["Locker"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresSummer"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresSummer"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresSport"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresSport"].items, 1.0);
i tried setting the spawn rate to 1.0
so a 100%
but it wasn't there again
looks fine, 1.0 isn't 100%
Thank you. Feel like that should of been obvious.
it's technically out of 100 but default loot settings are 40% of 'normal' so it's more like out of 250
so i should set it to a 100 for testing?
1 is actually a 0.4% chance of spawning
i actually thought it was way higher than that, like for example in my true music addon
i got the spawn rates set to 0.02
and it still spawns
pretty often
what % chance is that?
how do you calculate this?
you can just do your number * 0.4
the reason for that is because the spawn chances aren't weighted, every single item is rolled individually, so if you have 1000 rare items like that, it's still pretty likely at least one of them will spawn
that's why cassettes get so out of hand in big true music packs
so what's the spawn rate i should set for that shirt? so it's still pretty common, but it doesn't spawn too much you know
also are those all the places where a shirt like that could spawn? am i missing something?
i'd look through the vanilla file to see what the default clothing is like
i'm not sure, this is what i found in the ProceduralDistrubutions.lua file
also this
that's more like the chance, but definitely way too low for my item
so 60 would be 24% chance to spawn? i guess that's pretty fair
i'll try
only thing to watch out for is some containers have multiple rolls
e.g. the one you just posted has 4 rolls, the chance per roll is 24% but after 4 rolls the chance that at least one has spawned is ~67%
yeah actually about that, how do i set the max number of items that can spawn in a container? in Distributions.lua i think it's done like this, right?
how would i do it here though
that's something different, there is no item limit
that's for the game picking which item list a container should use
e.g. in this situation it randomly picks between a shirts list, dress list, etc, so the items don't seem completely random as a clothing shop would usually organise things
guess i'm gonna lower it a bit then
maybe to 45
so it's gonna be 18%
nope i went to a clothing store and that's way too much
these numbers are not exact, at 80 I had ~100 chance to spawn item per roll
i think the best is to just base it off of vanilla values
it's way too difficult to visualise what these numbers actually mean
are those the vanilla values?
is 10 the chance?
yeah
after setting it to 10
i found 8 of them in the barg-n-clothes store
to be fair the store is pretty big
but isn't that still too much?
think i'm gonna set it to like 7
The whole distro thing is a mess
Specially with mods... and most people use a ton of mods
Best bet is to open the game with Debug mode on, activate loot zed and individually check the containers you assigned your item to
It'll show the spawn % of each item, including yours.
So then you have a decent idea of how it'll be like
hey, so I've created a new wild food item in items_food, could anyone point me to where the world spawning for items is configured? I can see something that looks relevant in lua/shared/forageDefinitions.lua ?
I'm not sure if this is the right chat for this, but I've been working on a tool that'll streamline map mod management by automating a spreadsheet that details what mods your using and their incompatibilities. Here's the functionality thus far. When it runs, it it gives you a list of mods that have a maps folder in media organizing them and grouping them by their steam id. It also generates an excel file with currently 2 pages. The first is just a version of the list the program gui gives you when you run it with the steam page hyperlinked and requirements listed in mod.info commented. The second page is where incompatibilities are laid out. The first section just lets you know which mods are incompatible with what. The border formatting is meant to be a visual indicator of mods with the same steam id since those could potentially just be variations of the same map. The next section lays out the actual incompatibilities on a individual cell basis. That one is still WIP, but I wanted some alternative perspectives before I continue. This tool has been laying in the dust for a few months and I just now got the motivation to finish it up, but I haven't actually played or messed with map management in a while so I'm not sure if some other formatting would be more convenient or if there is a particular functionality that would be beneficial to add. If you guys have any recommendations or ideas, please let me know.
Can we use these with in our own mods & make our own Perks?
Is there any good mods examples where i can find how to insert items into foraging?
Snake's Le Gourmet Revolution
Thanks
Hi @median mantle , thanks for your help, do you know how to prevent that please ?
maybe by using GlobalObject & GlobalObjectSystem with "a custom rotating sprite onTick function" ?
Hello!
I cannot figure out one thing, i want to add new OnCreate function in a separate mod file, but when i load the mod, it's showing a lot of errors
ERROR: General , 1700226026100> RecipeManager.LoadedAfterLua> no such function LuaGiveXP = "Recipe.OnGiveXP.Blacksmith25" in recipe "Make Shovel"
for all the recipies even my new one.
How can i properly import new func into the game?
My code looks like this
function Recipe.OnCreate.ScrapVehiclePart(items, result, player, selectedItem)
local success = 50 + (player:getPerkLevel(Perks.MetalWelding)*5);
if ZombRand(0,80)<success then
player:getInventory():AddItem("Base.UnusableMetal");
end
if ZombRand(80,100)<success then
player:getInventory():AddItem("Base.UnusableMetal");
player:getInventory():AddItem("Base.UnusableMetal");
end
end```
Also, without the "Require", error is:
```java.lang.RuntimeException: attempted index of non-table
P.S. The problem was with the selectedItem param.
Where is a good place to go and get the details on the interface exposed by the game that mods can access? I am seeing a huge gap in some role playing aspects and I think I know why, but wanted to verify...
https://pzwiki.net/wiki/Modding
https://github.com/FWolfe/Zomboid-Modding-Guide
https://projectzomboid.com/modding/
You can also check the game files. Not exposed are mainly the java classes, with some exceptions. You can see most exposed classes in the LuaManager class.
I just found out that some weapons from Brita's Weaon Pack have negative chances of spawning in the loot tables. Anyone knows why ?
Question is their away to get Mod Options to to work with Procedural Distributions file, say i want Item A to spawn but not Item B when first setting up a world or say down the track.
Now i have the Custom Mod options working with in the World settings and able to toggle the tick box but just don't understand how to get the Procedural Distributions to work with it?
it happened to me when it could not fit anymore in the container.
mod options is used for client specific options, this would only be a good option for single player.
How to make a mod using profession framework?
Actually how to make a mod
Wait wrong channel
I am aware of that, as my mod is made only for singleplayer.
'custom rotating sprite onTick function' would work. I also did same thing in my mod.
Add IsoObject and change its sprite on OnTick event.
But, you should keep in mind that the interval btw ticks varies from player to player depending on its computer performance.
So I recommend to use 'getGameTime():getMultiplier()'
Thanks you so much for your help ! ๐
Does anyone know how to remove result after crafting?
player:getInventory():Remove(result); doesnt do shit
The idea is to make the recipe dynamic, so it will give you the result that depends from your skill, but i cannot remove the recipe result from inventory, no matter how hard i try
P.S. Found the solution (RemoveResultItem in recipe config)
@bronze yoke hey, check your dms when you have a moment
Can we use PlayAnim(") from within the isozombie class?
Where does Zomboid store their item icon images? I want to find the Petrol.png for Petrol Can
nvm found it from the wiki lol
Hi I'm new here and I'm trying to learn how to mod this game, at moment I'm playing around with vehicle modding and I need help with how to make the storage area of a car have the green highlight (I've managed to define the storage area and although it seems to extend beyond the area I set?), is there anyone that can help me with this because my knowledge of lua/scripts is very limited. cheers
Quick sanity check - getPlayer() called on a multiplayer client script should return whichever player that client is controlling, right?
yeah
Thanks muchly!
hi, i'm trying to use TileZed and it gets stuck loading a .pack file - any ideas what is wrong?
hey guys, please let me ask a question... is it possible to get a random valid xyz position or square from lua even if there are custom maps added from mods? I dont need to preload or load that chunk at all if its not loaded, but I need a valid random xyz position which is guaranteed its not outside of a playable map area... my last idea is to generate random number between 0,0,0 and 19799,15799 in a loop until getWorld():getMetaGrid():isValidChunk returns with true 
Ideally need the size of the world for this, could create a function pretty easily if it was a rectangle?
literally
function getRandomCoordinateInRectangle(x1, y1, x2, y2)
local randomX = ZombRand(x1, x2)
local randomY = ZombRand(y1, y2)
return randomX, randomY
end
Here's an idea, draw a few rectangles, note down their corners so that you basically have a few rectangles defined with their x1, y1, x2, y2 etc. you could pretty much cover the entire map, little bit of busy work but this will work 100%
-- Function to get a random coordinate within a rectangle
function getRandomCoordinateInRectangle(x1, y1, x2, y2)
local randomX = ZombRand(x1, x2)
local randomY = ZombRand(y1, y2)
return randomX, randomY
end
-- Table to store rectangles
local rectangles = {
{ x1 = 10, y1 = 20, x2 = 30, y2 = 40 }, -- Rectangle 1
{ x1 = 40, y1 = 50, x2 = 60, y2 = 70 }, -- Rectangle 2
{ x1 = 70, y1 = 80, x2 = 90, y2 = 100 }, -- Rectangle 3
{ x1 = 110, y1 = 120, x2 = 130, y2 = 140 }-- Rectangle 4
}
-- Function to get a random rectangle from the table
function getRandomRectangle(rectangles)
local randomIndex = ZombRand(1, #rectangles)
return rectangles[randomIndex]
end
-- Get a random rectangle from the table
local randomRectangle = getRandomRectangle(rectangles)
-- Get a random coordinate within the chosen rectangle
local randomX, randomY = getRandomCoordinateInRectangle(randomRectangle.x1, randomRectangle.y1, randomRectangle.x2, randomRectangle.y2)
I implemented a stuff doing this for Battle Royal mod. it needs map specific data.
Thanks @rich void & @mellow frigate
I went this way, seems like its working. I assume that the metaGrid maxX and maxY gives back correct data even if someone using a custom map
function Test:rnd()
local w = getWorld()
local metaGrid = w:getMetaGrid()
local rX = ZombRand(0, metaGrid:getMaxX() * 300)
local rY = ZombRand(0, metaGrid:getMaxY() * 300)
local isValidChunk = metaGrid:isValidChunk(rX / 10, rY / 10)
local isValidSquare = w:isValidSquare(rX, rY, 0)
print(string.format("random square: %s,%s,0 isValidChunk=%s, isValidSquare=%s", tostring(rX), tostring(rY), tostring(isValidChunk), tostring(isValidSquare)))
end
as I can see on the official map there is a zone around the useful area of the map so tbh the rand would be better if x is between 15-45 and y is between 5-45
but it applies only to the official map, so I think i will calc with getMax[X|Y]
I will check your mod btw, ty for the reference
check BattleRoyaleValidPosition.lua server side.
How do I re-add a muzzle flash to my mod gun? I deleted it but re-adding it doesn't seem to work
does anyone know how to see all the cells in a world? im trying to make a random spawn position thing but it doesnt seem like there is a way to access all the cells in the map or positions of them (i dont want to write them all down)
wait shoot
is this thing righht above like
literally the answer lol
it is, wow thats convenient. hope im not treading on someone elses ground
Would anyone appreciate a mod that makes it so that when you die, you don't have to re-read all the skill books, as long as your previous character has read them?
I think it would help make the game less tedious, but I'm looking for feedback.
personally i think i like the lore of you died and therefore your a new guy whos coming and taking the old ones stuff
it sucks that you lose all your knowledge and it really isnt always that fun but
if you could find a more lore friendlyish way to implement it maybe
as the author of a skill book mod i've kind of come to the conclusion that skill books are an inherently tedious mechanic
'you only have to do it once' is a bit more convenient but it doesn't really attack the core issue
if it wasnt a scroll bar and had some sort of input or skill? behind it maybe?
but its not like you can put a minigame in a book its just sort of reading it wouldnt make sense
Well, I was only planning to making it less tedious
It's working quite well in my private PZ server
(Ignore the respawn UI, that's not ready yet)
Ah, and minor spoiler about my Inventory UI update ๐
By chance is that container list going to be compatible with Inventory Tetris?
Because as someone who renames containers a lot, that would be amazing but I use Tetris in every playthrough now
i know this is dumb but like, just how do i do this? im not the biggest lua user ever
PZMath.lerp(fearDarkStress, fearDarkStressDest, 0.1)
Is there a way to make a water container use up more of a water unit for watering crops? like for example make it so that the watering can can water plants even better than jug of water or large water bottle but without making it straight up being able to store more water, making it heavy and clumsy to use every time you want to water a buncha plants by hand.
Anyone suggest an event for registering a zombie zone definition for MP?
media/lua/client/CM_Zones.lua:
local function OnRegisterZone()
--Cedar Hill
getWorld():registerZone("CedarHill", "ZombiesType", 4805, 5703, 0, 300, 322)
end
I've tried these three and no dice:
Events.OnGameStart.Add(OnRegisterZone)
Events.OnLoadedMapZones.Add(OnRegisterZone)
Events.OnServerStarted.Add(OnRegisterZone)
This is my media/lua/shared/NPCs/CM_ZombieZoneDefinition.lua:
require 'NPCs/ZombiesZoneDefinition'
CM_ZombiesZoneDefinition = ZombiesZoneDefinition or {};
ZombiesZoneDefinition.CedarHill = {
Santa = {
name="Santa",
chance=20,
},
}
Nvm, I should have been using media/lua/server/ rather than media/lua/client/
some ideas why the tube is invisable at some angles?
its not normals, allready checked that 1000 times
wierdes thing is, from the front its just fully invisable
is it because it's a 2d texture?
2d texture?
its like flat
sorry I cant follow you
is the model flat or is it actually a cylinder?
I wonder if it's just straight up clipping through your character
dont think so, cause the thing is infront of the head
it connects to like the gas mask
I think I see a little bit of it here
I also noticed that even from behind some of it appears to not fully render, maybe it's just due to the reder not being able to pick up very thin texture at certain angle
hmmm
that would be a explanation
guess Il have to run some more tests on it
thanks tho :D
Is there anyway I can make my new gas can item compatible with fuel tankers? Its tsar common library that deals with that code
You can take a look at this mod, it deals with adding and removing propane from those tankers, but maybe you can make it work with gasoline as well https://steamcommunity.com/sharedfiles/filedetails/?id=2732647029&searchtext=propane
If the guy who made that mod stops making his mod a pain in the ass to be compatible with sure lol.
But It will be challenging
Ok I'm losing my mind here. I'm new to modding here and I'm messing with crafting. Trying to get my recipe to give tailoring xp and I just can't make it work.
I have this in lua/server
function OHC_Tailoring10XP(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Tailoring, 10);
end
and then this in my crafting recipe
OnGiveXP:OHC_Tailoring10XP,
But it just won't give any xp at all. I had a look at different crafting mods and it seems to be the same idea there, so I'm not sure what I'm going wrong.
what you share here is correct.
when messing with scripts if you are not familiar with the various files reloading rules, restart the game after each change.
ensure there is no error in your logs that could tell you what is going south.
during your tests you can slightly change your recipe name on each reload to know when a reload is correctly taken into account.
I doubt that would work, because Tsar Common Library code checks for Base.PetrolCan, and since my new gas can is named something different it will never work.
I think the only way is to modify the code in Tsar Common Library, unless one can make that piece of code a requirement and make my changes
Is there a way to make a trait that increases the capacity of all gas cans? You see my mod is a trait that just gives you a new gas can that has more more fuel capacity, but a much better way would be if I could actually increase the capacity of all gas cans with a trait rather than give a new gas can item with larger capacity
a trait you can choose?
because if so how would a trait magically add more capacity for a gas can?
unless the mod is not centered in realism
The mod wouldnt be centered in realism obviously, a more realistic approuch would be to have a bigger model of a gas can and give it larger fuel capacity and let the player start with it if having the trait, but since I can't model that goes out of the window xD
the game already has traits that magically change the size of containers
Pretty chuffed with the progress made on these, really been stepping out of my comfort zone and learned a hell of a lot in the process, none of it possible without the help of this awesome modding community ๐
Brace yourself for intense battles in a Bloodsucker Village! ๐ฅ Experience the adrenaline-pumping combat in this Project Zomboid mod showcase. Can you survive the Bloodsucker Apocalypse? ๐งโโ๏ธ๐ฅ #ProjectZomboid #Bloodsuckers #stalkeronline #stalker #stalkerrp
What mod would that be?
You mean Organized? ๐
OKAY I've had this issue a lot and I've had to restart multiple models because of it, and honestly I just want to know if this is an engine limitation or something I can fix in the future. When I delete a vertex on an outer limb in blender on a player model, for some reason that vertex likes to snap to the cursor in game. How do I get the vertex to just stay in its position relative to the in game model
example
Okay more accurately: They always snap to the center of the screen
Already checked the weights, they're all good
There probably is a small part without weight painted on it.
At least in my case it usually is.
guys, im trying to add sandbox setting to increase weapons durability in my mod, but after exit the game and load game again, durability reset. anyone know why?
local SOMWSbvars = SandboxVars.SOMW;
local function SOMWCondLowerChanceMultiplier()
local items = getAllItems();
for i = 0, items:size() - 1, 1 do
local item = items:get(i);
local CondLowerChance = item:getConditionLowerChance()
if item:getTypeString() == "Weapon" and not item:isRanged() then -- and CondLowerChance ~= nil
SOMWAdjuster(item:getFullName(),"ConditionLowerChanceOneIn", CondLowerChance * SOMWSbvars.CondLowerChanceMultiplier);
end
end
end
Events.OnGameStart.Add(SOMWCondLowerChanceMultiplier)
Events.OnGameBoot.Add(SOMWCondLowerChanceMultiplier)```
when OnGameBoot fires, sandbox options haven't been set so it uses the default values
OnGameStart does have the 'real' sandbox option values, but that fires after the first chunks have been loaded so the items there are set to the default values
so there any real suggestion for it?
try making your changes OnInitGlobalModData
this is the earliest event where sandbox options are available, but it might still be too late
well
seems like it works
at least when I enter the game, my crowbar have new condition lower chance
and newly added also have new data
seems like working
๐
thank u
how can i add a line for the % chance of success in my script?
^to increase 95% to 100%
I read somewhere that if I wanted to make my own category in the crafting gui, all I have to do is rename "General" or something else. Is that correct?
yes
Hey hey friends, I am using the More Traits mod and have the perk with the antique items. Now I found the Maul, an antique Sledgehammer. The problem is that the right click menu does not present the option "destroy". My question is: How can I edit the Maul's file (which I already found) or what do I have to add to it to give me that option?
Finding the vanilla Sledgehammer file is proving weirdly difficult for me, but seeing how the items are written I assume I have to add the line "Tags = ..." with ... being the sledge right click destroy trait. What is that one called?
Edit: Eh, just found the answer on the wiki out of all the places. I'll leave this here for anyone else having trouble. Solution is to add "Tags = Sledgehammer," at the end of the Maul's entry.
Question about Events; if I have two mods, mod1 and mod2, and both add a function called testFunc to Events.OnTick, if either mod then calls Events.OnTick.Remove(testFunc), does it remove the function that was added by the mod that called Events.OnTick.Remove, or does it remove both functions from the event?
I'd like to make a compatibility patch for my mod and Working Seatbelts, but I'm paranoid about removing an OnTick event that Working Seatbelts has, and potentially removing a function from a completely different mod.. Can anyone offer some wisdom here? Would getting in touch with the mod author and asking them to implement a WorkingSeatbelt.enable() and WorkingSeatbelt.disable() function I could use instead to toggle their event on and off be more wise?
it removes the function that the variable currently points to
the name doesn't matter, it doesn't even know the function's name, just the actual underlying function reference
hi, i just release my first mod for custom letter and number tiles. Feel free to use them in your mods/map https://steamcommunity.com/sharedfiles/filedetails/?id=3088346476
if there is a name clash then it'll be whichever loaded last
Well, that's mildly disappointing, I was hoping I was being dumb. Which I guess is still an option ๐ I tried to check if the recipe updates by changing the results each time or changing the time it takes to make, so I'm fairly certain it reads my newest updates. Just wont dish out that sweet XP.
I'll just keep messing with it. Thanks for the answer!
hey boys anyone wanna play?
player:getModData().MHStats = {}
player:getModData().MHStats[1] = {
Secim = {},
SpawnKoordinati = {x = 123, y = 321},
RolStatlari = {},
IliskiPuanlari = {},
GorevListesi = {}
}
-- Fill Tables
MHStats = player:getModData().MHStats
MHStats.IliskiPuanlari = {} -- HERE?
for k,v in pairs(Birlikler) do
if not MHStats.IliskiPuanlari[v.name] then
MHStats.IliskiPuanlari[v.name] = {IliskiDurumu = 0, TamamlananGorev = 0}
end
end
Hi, If I do not define the table again before the for loop(at "-- HERE?"), the loop does not work. I wonder why there is a need to define table again when it has already been defined above? Is there something wrong with the MHStats table I created above?
you're mixing MHStats and MHStats[1]
eehhhh 
Hey guys ๐
Looking for a way to wipe all vehicles saved into the vehicle.db into the singleplayer save game folder by using the lua code.
Objective is to improve the wipe function of the EFK project mod.
Does anyone knows if it's possible ? manipulate this db file seems to be complicated... ๐ฌ
You should probably report to the More Traits devs so they can fix it
Planning to do so
๐
Hey! I made this roll command, /roll s (s being the number of sides on the die), and I'd like it to override the vanilla /roll command. Currently it activates both simultaneously and it's very ugly.
How could I do this?
I tried switching the command to /lroll instead of /roll (arbitrary letter just to make it different) and it fixed the conflict, but it outputs an unknown command message after... which is an issue I'm unsure how to fix.
Do we have a vanilla-ish way of saving lua tables to file?
I can't use GlobalModData, as I need to read this data before a save file has loaded
Hello! I am trying to make a potion mod for project zomboid lol. Im starting small (or so I thought) by making a basic health potion but im having trouble figuring out what string of code Id need to make the item restore a lump some of HP when drank. I thought I had all my code figured out last night but when I tried to load it up, the items didnt even show up in game despite the mod being on the list not sure what I did wrong. ):
Fixed this, I left in the function that sends the command to the server from a previous version by accident.
Have you checked the modding guide? https://github.com/FWolfe/Zomboid-Modding-Guide/tree/master
It sounds like you might have some files that are not formatted/written how the game wants you to
I havent! Just following along with some tutorials and trying to decode their code like hyrogliphics lol I'll check this out ๐ โค๏ธ
If you want, I have some spare time and I can give you a hand in VC
sure im down lemmy just check a few things quickly
Sure no rush, I'll make a VC channel in the server
Ight, I'm at the bottom of the VC channels
Bumping this. Didn't get a response last time. Any ideas?
Are you doing this by manually updating the .txt files? Or via .lua?
Manual .txt file update. I haven't sat down to learn .lua, but there's a pretty decent list of features that people have requested that require it (mod compatibility, no perishing only in powered freezers), so learning lua is slowly moving up my list of free time activities.
I got free time, and as I mentioned the guy above, I can probably give you a hand with this too by using lua
Sure. You want to start a DM? I've got a decent amount of free time over the upcoming holiday break.
Cause via .txt it will be a pain to maintain on the long run
It is. I ended up writing a .py script that does it automatically, because the hand updates were getting very annoying.
Sure, I also made a VC, feel free to hop by and i could guide with this. -> https://discord.com/channels/136501320340209664/1175901074394190006
That's very smart, good job
Unable to VC currently, have some company over. Asynchronous DM would be preferable, if that works for you. It's your free time you're offering, so I can try to accomodate otherwise.
Sure, let's DM then
sorry taking me a little bit lol my friend plugged my code into chatgpt and it fixed a few things so Imma try to run that code and see if it fixes it
Feast action of "infected player" mod is doing that: restoring health. in addition to removing wounds.
anyone know if there is a guide for how you would go about making full model outfit mods using models from other games similar to the COS mods?
Check #modeling
I only really saw animation stuff and the clothing guide in the pins there
Try this: #mod_development message
I know playermodel replacements use clothing as the base so that's part of what I need but i'm more stumped on configuring the model for pz
i think gametime does have a time of day setter
but be wary
bad things Might happen
Huh weird
getGameTime():setTimeOfDay() worked but am making a challenge and the Vanilla code calls that by default and it doesn't work there ๐ค
I might need need a bit of help making sure I understand how to overwrite vanilla functions correctly
The way I understand it, you would write it like
function vanillafunction:new(var1, var2)
if not condition then
--function stuff
else
return original_function(self, var1, var2)
end
end```
Do I need to include the 'self' variable in the original_function table?
What about triggering a storm, anybody know how to?
getClimateManager():transmitTriggerStorm() doesn't seem to work in SP
Trying getClimateManager():triggerCustomWeatherStage() but it always triggers snow
Does anyone know how the game replaces the water bucket with a full water bucket on the ground when it rains? I want to use the same method to turn one item into another item on the ground/in inventories but can't find the code for it anywhere in the codebase. Or just how to replace an item on the ground with another item in general?
Why does this happend?
{
DisplayCategory = SkillBook,
NumberOfPages = 220,
Weight = 0.8,
Type = Literature,
DisplayName = BookAiming1
Icon = ABBookgun,
SkillTrained = Aiming,
LvlSkillTrained = 1,
NumLevelsTrained = 2,
StaticModel = Book,
WorldStaticModel = BookClosedGrey_Ground,
}
item BookAiming2
{
DisplayCategory = SkillBook,
NumberOfPages = 260,
Weight = 0.8,
Type = Literature,
DisplayName = BookAiming2,
Icon = ABBookgun,
SkillTrained = Aiming,
LvlSkillTrained = 3,
NumLevelsTrained = 2,
StaticModel = Book,
WorldStaticModel = BookClosedGrey_Ground,
}
item BookAiming3
{
DisplayCategory = SkillBook,
NumberOfPages = 300,
Weight = 0.8,
Type = Literature,
DisplayName = BookAiming3,
Icon = ABBookgun,
SkillTrained = Aiming,
LvlSkillTrained = 5,
NumLevelsTrained = 2,
StaticModel = Book,
WorldStaticModel = BookClosedGrey_Ground,
}```
I have no clue why this is happening, super strange, I've checked everything, tried everything, its always the same, the first aiming book icon dosnt show up lol
might be the missing , after the display name on book 1
lol, I've done that one a few times, got pretty good at catching it
AddWorldInventoryItem() seems to work to add the item to the world, but it causes strange duplication bugs when used in multiplayer servers. Is there another method I can use that literally just swaps one item with another and takes into account the rotation and location of the old item?
Hello! Any Idea why it's not working?
OnWeaponHitCharacter(weilder, character, handWeapon, damage)
if instanceof(character, "IsoPlayer")
character:getBodyDamage():getBodyPart(BodyPartType.UpperLeg_L):setScratched(true, true)
end
end
No errors and stuff
enemy does not get scratched on that body part?
Any chance changing "weilder" to "wielder" helps?
Nope... but found out that I switched a value, it's a dog mod so if the attacker is wearing a dog then it should bite the enemy.. somehow I got it altered.. now whenever someone attacks the owner the dog bites the owner too ๐ญ ๐
any event that fires when player gets hurt by zombies?
still can't get these to work... is it because I placed it in client folder? should it be in server or shared folder?
also adding
character:setHealth(character:getHealth() - damage * 0.15)
if character:getHealth() <= 0 then
character:update()
end
seems to just make the other player go dead in animations in my screen but is still normal, alive and well in their screen .. no additional damage too 
their client is authoritative over their own health, changing their health from your side doesn't actually affect them
how about the wounds? ๐ฆ
i don't think any health changes will transmit over
Thanks! no available work arounds?
Thanks! got an idea why not check if the attacker is the one attacking and check if he has the right conditions ๐
sorry, late response, no worries, and yeah that stuff can be hard to spot and it's a pretty common mistake

Yea, I know about that part I'm more so stuck on configuring the the model to work with PZ the one I've got has a lot of different pieces, isn't posed properly and could ideally use a reduction in poly count.
hi guys, newbie here, i just wanna know if there is a function code or a way to know if a zombie is close to the player?
Hi I was curious if PZ voip could be improved
I was thinking in using tokovoip (gta rp) and use it to externalize PZ voip to TS3
It would need to communicate playerโs coordinates to work
It would also have to listen to Walkies frequencies, state (on/off) and mic status (on/off)
I donโt know if some people already had this idea before?
Anyone an easy way to play sounds that can only be heard by one player? instead of player:playsound which is heard by all around them?
Task Force Arrowhead Radio :)
I've been thinking about this for a long time but... I won't tackle it :') I still have some hair left
ah oui tu penses?
c'est un enfer ร mettre en place un projet pareil tu penses?
Hey ^^ regarde le nombre de contributeurs sur Task force Arrowhead Radio.. le nombre de langages utilisรฉs et n'oublie pas que tu tentes de faire รงa sur pz ๐ mais รงa serait tellement bien
We know if TIS is going to improve VOIP for 42?
because there is no point to work on such tool if they are going to overhaul everything with b42
hello guys, i have question, whats the difference between
tracker = {}
tracker = ModData.getOrCreate("tracker")
with
if getSpecificPlayer(0):getModData().tracker == nil then
getSpecificPlayer(0):getModData().tracker = {}
end
what the effect in multiplayer enviroment?
Hi guys.
Is anyone able to make Tiles for a commission? I would love to get a tile of a M2 Browning Machine gun on a tripod, with the tripod as a container and the MG as a overlay that can be removed.
If not, would anyone be able to make a set of 3d sprites in ISO perspective facing all four directions of the same thing?
Thanks
Reference Images Below:
Hello! So I am looking through the Debug log to figure out an error with my mod thats causing it to keep the game from launching but im not really sure what im looking for in here
Ive fixed the issue ๐
so been a while
but I remember somewhere on the pz wiki there was a list with the file names of places where clothing items could spawn
does anyone have a link there?
where the names of the different containers were like ArmyStorageOutfit
never mind found it
Why the hell does RoomDef:getObjects() return a "MetaObject"? It has barely any info at all to top it off.
it's a definition not an actual room, it doesn't store 'real' objects
I am practically giving up on my biggest mod yet just because this stupid game won't let me fetch a SQUARE
Literally trying everything right now, and it just won't fetch stuff.
Then I try to forcefully fetch a square using LoadGridsquare... and the game crashes
X:getBuilding() returns true instead of the building. Fetching a room using building:getRandomRoom() returns some bugged object that I can't interact with, because literally any relevant method like getID, getObjects, even get its position, returns errors.
getRandomFreeSquare() won't cut it either
I manually fetch the square, yet the game refuses to send me any data whatsoever
Starting to think rosewood prison is just completely broken
which object is getBuilding returning true on? i can't see a getBuilding that should be able to return a boolean
local prisonSq = getCell():getGridSquare(7641, 11855, 0)
local prison = prisonSq:getBuilding()
It will return the building... Until I try to get a room from it. Then somehow, it magically becomes a boolean because who cares about logic
No idea how, where or when it does it but it just happens
I am sooooo frustrated right now ๐ฆ
I've been at this for hours
public IsoBuilding getBuilding() {
IsoRoom room = this.getRoom();
return room != null ? room.getBuilding() : null;
}
```odd...
i think i've used it successfully in the past too
Hi, I just started developing my first mod, and I have difficulties.
Finally figured out how to create a project using the "pzstudio" tool from GitHub and I successfully ran my first mod.
The problem is the lack of the documentations and courses or tutorials.
I'm really struggling to find the right API for what I need.
Do you know any resources I can use?
I have not seen anything even close to a full tutorial for modding. There is a video about changing the color of crates and there are a couple of youtubers that have released things in pieces. If you are looking for a map mod there is daddy dirkie dirks videos. There is the forum, but answers are usually found here faster if you get the right audience. There is the project zomboid index where you can search for commands to use for programming but no real description of them. Realistically most learn by reading through other modder's code to see how they did it.
I find most of this to be try and pray and if you are lucky enough to know they right question to ask, you might find the right answer.
Uhmm ๐ค, this is a huge problem here not having an official docs, man I came from dart, using docs all the time, I don't know if I can be patient with this situation, this makes me bored unfortunately
For instance, I'm looking into making an item that can dry the wetness from a player character. There are only two that I know of, the bath towel and the dish towel. Completely copy that original code and only change the name and you get an item but not one that dries.
No documentation anywhere on how that works. the forum reveals nothing, the index shows nothing useful. The code shows a dry self command, but I have no idea how they link together. And that's what the majority of my code time is, trying to figure out how to get from once play to another.
Its not horrible, just not efficient.
And there are a few people here that really know the system.
The reason I decided to learn modding is that i used to play a game called "TLS: Dead Zone", it's shutdown now.
I was wondering if I could create a hard coded mod to behave like it.
Okay, is dead zone an old mod or a completely different game?
Different game
Gotcha, never played it, but there are a few mods that completely alter the way this game works.
I would start out small, like... I wanted to make a soda fountain but started with a popcorn machine. It was a simpler option to learn how to effect the code as I never coded in Lua before either.
That's cool
Slowly building up skills and adding things to the list. Then eventually learning my older code is crap and rewriting it again. I seems the evolution of all programming.
I think because the game is still under development, the devs are not ready to provide a good resources
If the changes you want to make are map changes, you can check out for dirkie dirk's videos. There are others too that will help get a map made. I found the map making completely different that making new objects or coding interactions with sprites in the world. Each has it's own knowledge base.
i sort of suspect their own documentation is just lacking
That is true, the code of the base game is still not fully fleshed out, so all the knowledge we have today may be different after the next patch.
the lua is barely commented and the java api site seems to use comments from the code when they exist, which implies that they just don't exist for the vast majority of it
And you ahve helped me out a few times, Albion. Much appreciated.
The tough part is even if someone makes a full blown tutorial, it will need updates. The mapping tutorials are already out of date to an extent.
the big block of lua documentation is nice but if it was like a wiki where it could be edited by users, personally id like to be able to just write some stuff in that i find out. since itd help for everyone else next in line to me trying to find out the same problem
Heck sometimes I dig into code, takes me hours to understand how it works and if I don't leave myself a note to explain it, I have to relearn it.
This is scary, breaking changes will definitely break me apart
I can only imagine how many things I am actually using "wrong", moddata is still elusive to me. But I finally coded something that spoke from client to server and back again successfully. I just don't know if I am reinventing code that already exists and I am just not using it right.
The next big update will probably bring some changes that we'll need to correct mods for. But that growth is needed.
Exactly, practicing is good
Two words of advice, do this for yourself, make it a passion and never be slave to the code. If you don't love it, you won't do it for long and if you do it for yourself, it never matters how many others enjoy it.
Most of what I have made was because I wanted it. And people who also like it suggest things and I change it for them so they can like it too.
Well, good luck norby, I hope you find your way making good things for you to enjoy and for others.
I appreciate your advice.
And when I can give back, I do because I have been stumped too and know how it feels to be rudderless.
So focus on some small part and if I can help I will.
there are tools in development that will allow for thorough documentation
i'm not sure on the progress but i will do my part when they're ready
Maybe I'll come back later when it's officially stable
well we'll see you in about fifteen years then
It's actually stable just growing like all of us.
they do generally avoid breaking changes (excessively in my opinion) but when entire systems are redone it's not avoidable for them
i have no idea what's going to happen with them rewriting crafting entirely, it could easily break half the mods on the workshop
yeah and modders patch things pretty quickly in between. It is one of the most stable bug free early access games I have seen.
Oh yeah, I wonder about this all the time. Map mods too.
oh, all map mods will be broken, that's been stated
supposedly in most cases they'll simply need to be re-exported, but if original creators aren't around it's not going to happen
Good reason for me not to update my map mod until after, besides I lost my original files and will need to remake it all over again because I am pretty sure I can't extract from the mod final files.
yeah, i know someone has a tool to decompile maps but i think they're keeping it private, which is probably for the best
Guys, does it support just-in-time development?
I didn't go further in this, but I watched a video where the dev restarting the game after fixing a bug?!!
Years ago I was coding on a mud and they made a conversion utility to convert coded bits automatically because a manual system was going to be insane. Just hoping there will be some conversion process if it gets to that point.
something like that could certainly be seen for recipes
not sure about that terminology but I rewrite my mods and drop into the game to test the changes immediately before uploading anything to the workshop.
Often I can use the same save with the new code
you can reload scripts in debug
although some stuff you might need to make a new save since its already too far gone
Oh, I seee
yeah, modders don't need to compile anything generally
That reminds me, I need to clean out my save folder...
one of the main reasons i started using a separate cache for debug is just so i would easily know which saves were safe to delete ๐
3Gb of local saves since Oct 17th.
I just nuke them all and often start new saves for testing. I use mod manager to load only the mods I want to test together when I test.
oh, i always tested my mods in complete isolation, i just didn't want to accidentally delete a save i actually played on
it's also nice to be able to join servers without having inconsistency issues because of unfinished updates
My play time is restricted to a server we have that is saved in the multiplayer folder and duck's server.
plus while it does add a bit of tedium to testing certain mods being able to cut it off from the workshop entirely and not worry about weird issues coming from there is nice
more than a couple times it's loaded a file from the live version of my mod instead of the local version
i learned to just unsub to my mods when i'm working on them but it's still tedious
Yeah, you have to test in isolation and maybe with a compatible mod that you work with. That way to you see the console errors easier
i'm sure it also improves loading times a fair bit
yep, especially since the server loadout is over 200 mods.
make sure you have an M.2 drive. LOL!
the toughest is testing multiplayer things... Eventually I have to wait for a friend to help there.
I think I spent a week working on a multiplayer audio piece just to watch it self destruct in about 15 minutes in multiplayer once I could test it.
not horrible, just inefficient
you can run multiple clients locally to test things out
I have not tried multiboxing with this yet
But I do have a dedicated server just to blow up
as long as you're in -nosteam it won't have any issues with running multiple instances
oh good tip, ty!
also if you mod doesn't need zombie interaction it sure does speed up to load with no zombies
i wonder how much a tiny debug map could help too
Good evening!
Does anyone know where in the game files the code for this little pop up window is when you hover over a skill?
I think i found it: \media\lua\shared\Translate\EN\IG_UI_EN.txt
Seems to have most of the text you can find in common UI elements
though it seems to be just templating that's being used for the final output somewhere else so i'm at a loss again 
media/lua/client/XpSystem/ISUI/ISSkillProgressBar.lua
primarily in the updateTooltip function
thanks so much!
Is there a way to access a specific save game global mod data, before the save game has been loaded?
is it from your own mod?
im not sure if there is an EASY way to do it but i dont see why you couldnt write some code to save the data in the mod folder assigned to the save?
but that might not be what your looking for
yeah, if you're the one writing the data it'd be easiest to just go around global mod data
At the moment I'm saving data in a JSON file, but I was looking for a more PZ vanilla solution
i'm going to have to check my info but i *think* there's a way to get into the save folder and then you could just parse the mod data binary
That would be helpfull, if you have time please take a look
i wasn't able to find it, must've misremembered something
That's okay, thank you anyway ๐
hi i gave a name to a zombie on server side , how to pass that name to client? getModeData() seems not work
does anyone have experience with adding controller support to mod?
ZombieModData does not behave the same as other object's. I believe the ID for the zombie is consistent.
You could create a table of IDs. But you'd need to use server/client commands to send this information.
Furthermore, some objects respect IDs when you use them as arguments in commands-- I know players and items do this, I don't know if zombies do as well but it may be worth looking into.
Hello Everyone, I need a hero.
First, does someone know how to update the PZ wiki?
https://pzwiki.net/wiki/Lua_Events/OnDeviceText Is outdated.
This is for version 41.69
The current version (41.78) of on device text is
OnDeviceText( guid, interactCodes, x, y, z, line)
Proof attached
Second, and the reason for this post.
in my mod Voiced Radios and TVs
I need access to the radio device that says the line. I solved this issue by searching for it with the coordinates, and this works fine in single player
I get the radio coordinates in single player.
However, in multiplayer, for some reason for the radios I get (-1,-1,-1) as if the radio was a walkie talkie instead of a real world object
this only happens with radios, not tvs, and only in multiplayer
does anybody have an idea as to what may be the issue?
getting this error after attempting to create custom clothing mod
I have created a fileGuidTable, a script, and the clothingItem XMLs, though I still get this error
I do not have a clothing.XML however, I didnt think you needed one to spawn them
Are you using custom 3d models or vanilla?
A fileGuidTable, script and clothing.xml are all you need if you are relying on vanilla models
im reusing the vanilla suit models refrencing them from their locations how you normally would
i tried to resolve it by copy pasting another clothing mod script and xmls, though the issue persists
Are the guid in the fileGuidTable and in clothing.xml the same?
no, I didnt think it needed to be
It's an ID, they have to be the same and unique
Use a randomly generated one and paste it in both files
Alright thanks, ill post here again if it dosnt work
if player:HasTrait("AdrenalineJunkie") then
if player:IsRunning() == true or player:isSprinting() == true and player:getStats():getPanic() > 89 then
SpeedFramework.SetPlayerSpeed(player, 2.25)
end
end
end```
Trying to make so I get the speed boost when extremely panic and running or sprinting, but it dosnt seem to work, the moment I run or sprint, the speed activates even if I dont have panic lol
in lua the operator precedence means that this says if isRunning or (isSprinting and panic > 89) then
using brackets
if (player:IsRunning() == true or player:isSprinting() == true) and player:getStats():getPanic() > 89 then would avoid this
thanks I will try it ^^
It worked perfectly
I just need to adjust the panic value, 89 seems to still be extremely panic
Hey guys, a quick question
What's the best way to override a local function from another mod?
you can't
you can overwrite the entire file or in some cases you might be able to overwrite whatever calls the local function, but you can't access locals from another scope/file
thanks. A bit suboptimal, but file isn't very big thankfully. How can I properly overwrite a file?
I managed to release my first mod today! Couldn't have done it without the help i got from here so i wanna say thank you! 
if anyone knows, please tell me which method is responsible for the character's viewing angle
@keen silo can you link the mod? I'm curious
Whats the mod?
this is the biggest coincidence, but i'm literally installing it as you posted this
Thank you
if anyone knows, please tell me which method is responsible for the character's viewing angle
It's called "Skills and Traits Explained" and shows information about traits and each of the skills in their respetive tooltips in the character window. So now i can at a glance figure out how to level a skill without having to look it up 
Cool!
I managed to fix it btw, turns out there is a 7th parameter that is the device
So i dont have to search for it with the x y coordinates
Does anyone know the distance of OnGridLoad()? Is it a static number of squares or based more on the map chunks loaded?
What is the data type of ingredients in the following code: function Recipe.OnGiveXP.Default(recipe, ingredients, result, player)
it's an arraylist of inventoryitems
Does anyone know if game time 4x is actually 4x or
Like the speed control thing at the top right
I always wondered the same thing. If it was just 4x why is the icon so different 
iirc they're actually 1x, 2x, 20x and 40x
definitely a lot higher than 4x
Yeah sounds like it's 1x = 1, 2x = almost but not entirely 5? 3x = 20 and last = 40x
and wrong thread rip.
if anyone knows, please tell me which method is responsible for the character's viewing angle
when overriding Glue to be a part of some EvolvedRecipes like this, its always showing up in the context menu for Create Stew and Create Soup as Glue (0) no matter how many are in my inventory
module Base {
item Glue
{
DisplayCategory = Item,
HungerChange = -1,
Weight = 0.1,
Type = Food,
EvolvedRecipe = Omelette:10;Soup:10;Stew:10;Pie:10;Stir fry;PastaPot:10;PastaPan:10;Taco:10;Burrito:10,
DisplayName = Glue,
Icon = Glue,
FoodType = NoExplicit,
Carbohydrates = 0,
Proteins = 0,
Lipids = 0,
Calories = 1,
StaticModel = Glue,
WorldStaticModel = Glue,
EvolvedRecipeName = Glue,
Tags = MinorIngredient;Glue,
}
}
Looking at definitions for other food items I don't see anything different, am I missing something about how food objects are handled elsewhere?
To be clear it does work, but it only uses 1 Glue regardless of the count set in EvolvedRecipe
Even weirder is that if I override Worm to be usable in a Stew for example, regardless of the amount in inventory/the quantity set in EvolvedRecipe it will always display the quantity as Worm (1) in the Create Stew context tree
Any items that already have Type = Food but no EvolvedRecipe definition in the base class (like Cockroaches) work fine when made usable in recipes. The abnormal behavior doesn't change if the definitions are identical except for the item name, so I'm guessing the issue must be elsewhere
Or would anyone be able to point me to where I can find the actual code for evolved recipes?
If you're in debug mode setting the game speed changes the speed slider in the debug panel for game stuff.
How does one access the base game sandbox variables in a Lua script? Like in mods you it's typically SandboxVars.<ModName>.<ModVariable>. What would be the middle part for the core game if any?
for i=1,SFarmingSystem.instance:getLuaObjectCount() do
local plant = SFarmingSystem.instance:getLuaObjectByIndex(i);
local square = getWorld():getCell():getOrCreateGridSquare(plant.x, plant.y, plant.z);
local isoObj = SFarmingSystem.instance:getIsoObjectOnSquare(square);
end
Why is the isoobject always null when away from the square even though the square itself is properly loaded by this?
Just check media/lua/shared/Sandbox/Apocalypse.lua or wherever for examples of the ids, e.g SandboxVars.MultiHitZombies
Hi @bronze yoke , thank you for this comment!
If I may ask, can I do something similar with a zombie? If I have a square that is occupied by a zombie, e.g. zombieSquare, I can run zombieSquare:getLightLevel(..) but requires a playerIndex - Shouldn't that be irrelevant ? Is the LightLevel relevant to the Player ? I am attempting to get how much light is at the square that the zombie is to modify its behavior.
Apart from the packages overview that contains the function signatures etc, is there any more details about the functionality of all these or is it trial-and-error ? Thank you!
the player number is required because the light level is player specific, for example traits can change the lighting
Thank you for your answer, I really appreciate it - so light level is subjective after all. Do you know if lightlevel is a number between 0-1 or 0-100 or anything else ? Do you know if there is a more "objective" way to get the light level of a square ? ๐
Tried getObjectAt and some other functions as well, in addition to iterating through the object list:
for i=1,square:getObjects():size() do
local obj = square:getObjects():get(i-1)
if SFarmingSystem.instance:isValidIsoObject(obj) then
isoObj = obj;
break
end
end
Everything I try returns null, what is the trick to getting an IsoObject object on an unloaded cell? I can get the square fine along with the other data I want on it, the lua object itself is easy to retrieve, but after I update the lua object, I thought I would be best off doing what the vanilla code does for netcode (not sure if necessary):
if isServer() then
isoObj:sendObjectChange('health')
end
plant:toModData(isoObj:getModData())
isoObj:transmitModData()
Except I can't manage to retrieve the isoObject ๐ค
you cannot
that's the point of the global object system, you can read and write to the lua object and it'll synchronise when it is actually loaded
That explains it, so I only need to write to the lua object when it's unloaded anyway, and only need to transmit mod data when the object/cell is actually loaded?
that's right
Thanks ๐ that clears up a lot for me with more than just this
Hey, I want to add a patch to a mod that has this fun weapon that can't be put onto the hotbar. Would I be able to simply add an attachment to the weapon which will allow it to be hotbar'd, or would I need to create a separate version of the weapon that is holster-able?
Apologies if my request isn't entirely clear, im new to modding and im still trying to figure out how things fit together
I would like to ask a question about vehicle mods.
Is there any way to make the wheel stay still?
I don't want it to spin; I want it to remain stationary and only move left and right when the player turns the steering wheel.
Thank you very much for your attention!
https://github.com/Konijima/PZ-Libraries
Trying to decompile, follwing this. B) pre setup step 2. JDK version 17 is not available. Downloaded and selected it.
- Installing Capsid with build.gradle
Once the project is set, it should automatically open build.gradle.
Add this line to the plugins table
id 'io.pzstorm.capsid' version '0.4.2'
Get following errors:
Failed to query the value of task ':compileGroovy' property 'javaLauncher'.
No matching toolchains found for requested specification: {languageVersion=8, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
No locally installed toolchains match and toolchain download repositories have not been configured.
????????????????
i wouldn't use this, it's very outdated
if you need the libraries it generates, umbrella does the job, if you need to decompile, beautiful-java actually works without downloading an old version of idea
ok thanks
For umbrella:
Setup
Vscode installed.
Lua Language Server extension installed.
Create new project.
Clone the repository into a folder.
clone which repository into a folder? How do I do this?
the umbrella repo, you can just download and unzip the release now though https://github.com/asledgehammer/Umbrella/releases
I've only done some basic networking java course, I'm not really familiar with Github and all these programs. Umbrella exposes the typings to intellisense through the emmyluas which I just downloaded and extracted. What do I do with beautiful java to use the emmyluas I extracted?
I looked through these but they don't seem to have the proper namespace for them. I tried using SandboxVars.XpMultiplier for what I needed in my mod, and it didn't return anything for that part. So there seems to be something missing i.e.) SandboxVars.<namespace>.XpMultiplier
Looks like restarting my game made it take affect, so the SandboxVars.XpMultiplier by itself works. It's just using the Sandbox in game to change it doesn't update in the code
How do I integrate umbrella and beautiful java?
What do you mean using the sandbox in-game to change it, as in if you change sandbox settings while the world is loaded? If so, it's normal to have to reload for sandbox settings to reinitialise. You can maybe force it to reinit through getSandboxOptions():load() either in your mod or the debug mode console.
SandboxVars is just a table for lua use, in cases where the java needs them they aren't read from there
first time modder here. no idea how any of this works. anyone know how easy it would be to add custom vhs tapes into the game? (i.e. unique items each with their own custom text & whatnot)
also, whatโs the limit for how long/big(?) vhs text can run for? if iโm putting 23 minutes worth of a showโs dialogue into it, would that work?
I can't even work out how to decompile the code properly lol
aw dang
I was using the change sandbox option mod to update values. Still pretty new to modding and figuring this all out ๐ Good to know about that command there
I was wondering if anyone knew the string of code that makes the player invisible when they enter ghost mode? And or where it might be in the files?
does anyone know if its possible to override something in package zombie? trying to fix someone elses mod but to do it I need to make a change to the vanilla climate manager at zombie.iso.weather.ClimateManager
never had to override vanilla functions before
As far as I know, there's no way to do it in lua. You should upload modified .class file and let players change the file themselves.
really just need to add two lines to GetAirTemperatureForSquare:
if (var8 > var4) {
var8 = var4
...
to check if its negative and += instead if so
dang
I was trying to fix a mod for multiplayer so that wouldn't really work
the climate manager is pretty weird, it doesn't allow for cooling sources, only heat sources, so to make air conditioners work in multiplayer would require adding that functionality via GetAirTemperatureForSquare
its very annoying that the original class is only 1 if statement from adding that functionality
only other way to accomplish it without breaking workshop install server join i guess is to make the modification on server side and then remove temperature function from digital watches so player cant see the temperature going insane as its overidden by server packets
How does brita's weapon pack handle the rpg? When I try to use the code to make my own rpg the firebomb spawns on player location instead of the zombie you shoot at, where can I find the lua that handles this?
does anyone know if you can change the size of entities? (Players, Zombies, 3D objects)
yes 3d objects with Scale
idk about players or zombies
Scale being property of object and not function
anyone here whoโs experienced in modeling, texturing and maybe rigging?
Hello people who mod the game, I have zero idea what I'm getting myself into, but I would really like a mod that changes the skill ui to look like the Runescape skill UI.
I'm committed to making sure a thing, but I'm wondering if anyone here can point me in the right direction of what to do, if this is possible?
documentation on the signatures and call conditions of every script parameter function https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/ScriptFunctions.md
Hey there, Superstar!
As a special operations operative, drop into the Knox quarantine zone and wipe out all the incriminating evidence of the shadow organization you work for! Or die trying.
Download the Mod!
https://steamcommunity.com/sharedfiles/filedetails/?id=3092341555
My Socials!
https://ko-fi.com/bitbraven
https://patreon.com/BitBraven...
Love this! Quests and other activities that give you a goal in the late game is exactly what this game needs ๐
I've had the best time in SP playing challenges, this seems like a good addition ๐
clicking on recipes oncreate takes you to items oncreate ๐คทโโ๏ธ
unlucky, id is different between client and server. but persistentOutfitID is unique and consistent
.
is there a way to lock a recipe to be only craftable by a profession . for example if i want somethin only a electriction can craft
Option a) make it need to be learned and teach the recipe to the players with that profession
Option b) add an OnCanPerform function that checks if the player has this profession.
amazing thanks
Hey guys! I recently discovered the game and started gaming a lot on it. I'm currently working on a mod that put an item back in the storage it was after the player uses it (because having to put it back manually is annoying) and I was wondering if it already exist? I didn't found anything on the workshop, but I'd like to prevent scripting something that's existing to focus on nice stuff people would like to see in the workshop
A number of vanilla mechanics do this. You need to save the previous container and then move the item back.
I already see how I'll make it work but I was mostly wondering if someone already did something like that on the workshop, to prevent duplicates
But yeah store the storage in a tmp var then run player action to put the stuff in the storage back
I guess there's a OnPlayerUse hook or something like that
With parameters like where the item comes from, and the id of the item
You said there is an action, if it has a lua table then it can be saved there. Move it back when the action ends.
is it possible to use Ai to help creating a mod?
If you provide them with all the context it needs it could, but otherwise only asks him about logic or about lua
But it's very unlikely that it would cook a ready to use code for you
yeah, i mean put all pz lua function, object, events and class, and we just need to send question for ai to generate the lua code.
You could but theres so many files to feed to the AI and your inputs should match the sources variables like if you say something like: "Make the user sick" and in the sources it's player theres a likelyhood that he will make stuff up because he won't make a link between a user and a player
AI is a great tool to improve your logic and stuff but shouldn't replace your code knowledge
Thats like using StackOverflow
The good prompt gets you to the good thread and hopefully you'll have the answer to your question, sometimes it takes a bit of rework because the code isn't to use as is in your project context
Been looking to make a barricade mod that just gives plank barricades a zillion health but a bug remains that putting 2 planks on will delete both and bug out the tile into thinking there is still one there preventing opening of doors/windows. Tried out editing other barricade editing mods to high values and it creates the same issue, is this just a limitation of the game?
I lol'd
Thatโs the name of the challenge scenario
Not so much the correct channel but I believe this might be the best place to ask. With the discord integrations is it possible to link certain radio chatter instead of only /ALL https://theindiestone.com/forums/index.php?/topic/24509-new-chat-system/
New Chat System In prior versions of the game, Project Zomboidโs chat system treated messages as though they all came from a single source. Now, in build 40, chat is separated into a variety of streams. These streams can be customized on the server. Chat Streams Chat streams can be turned on or o...
anyone got a link to the clothing assets pz uses?
im after the fedora model UV's, which arnt in this tutorials commonly shared file
fixed ๐
Helloooo so I am struggling hard in attempting to make a mod
(For a bit of background to explain my potential stupidity I have never made mods for anything)
I've roughly followed a tutorial and then did my own thing and am currently stuck at trying to boot up the game only to be met by this
(Specifically happens if I enable the mod)
Basically just trying to add a mask into the game
So yeah I have no clue what happened where
make sure your script file doesn't conflict with a vanilla one
if it has the same name and directory (e.g. scripts/items.txt) it'll override the vanilla one, causing these missing items
I see
How would I make the mod add things to the vanilla ones then? Just need to copy everything from it and slot mine in somewhere?
make your own script file:
scripts/myitems.txt
I seee
Appreciated, thank you both
I shall try this
Status report
It has not crashed this time
However now as far as I'm aware it is not showing in the Items list in debug
Okay that problem has been fixed
Now onto the next...
I have gotten to the stage of it existing as an item, having stats however not having the model being visible nor an item description (I have no clue where to even begin on that)
Ookay the stats working deceived me
They infact do not
maybe they do? I don't even know LOL
I have yet to fix this
I have also figured out that dropping the item makes like 50% of things invisible
unsure how items really work, but just from a guess, could it be that the only reason you don't actually see the item is because it is so extremely large in comparison to everything else?
Potentially? I downloaded a welding goggles mod off of the workshop and swapped out my .fbx's with its to see if that would change anything though it resulted in little change
Judged by that I'm assuming it's probably not an issue with the model but something somewhere else I have no clue about
Does it utilize the scale = ...
field in it's model items script, whereas in your own you may not?
Nnnope, though looking at it again they are attached to the eyes rather, hm.
Changing to Eyes changed nothing
if anyone knows, please tell me which method is responsible for the character's viewing angle
im pretty sure its https://projectzomboid.com/modding/zombie/characters/IsoPlayer.html#getLastAngle()
declaration: package: zombie.characters, class: IsoPlayer
If I understand correctly, method what you writed shows the characterโs gaze vector (along x and y coordinates), but I need the characterโs angle in degrees, that cone of vision that decreases with accumulation of fatigue and increases with the eagle eyed trait, simply put, I need to know the character's cone of vision in degrees
I don't mean to flood channels about this issue but im having a hard time figuring out how to load my 3d model for an item into the game. When the item is placed on the ground its invisible. As far as I know everything is formatted correctly, faces are in the right direction, code looks okay but for whatever reason the model wont show.
I think you can translate that to an angle with some math
Not at my computer right now but project zomboid Vector2 class on that same website has a convert to angle from direction of another vector2 in there somewhere
Itโs in radians tho not degrees
Youโll need to make a function to convert it to degrees since I tried personally to find one available already and couldnโt get it
can anyone just tell me how i do this in lua? I'm not looking to play the syntax game for the next hour
oops didnt mean to reply
sorry Mence
Are those screenshots of Java?
The second one I am not familiar with in Lua, but I think it works in Java and C++ or something. Idk.
new is a keyword in C# but I don't know if you can put a function call after it.
:o
i come to lua and its like
where the heck did the arrays go
why is there no continue?
(I learned Python from ChatGPT)
Instead of continue you can use goto in Lua, but PZ uses Kahlua for Java integration which doesn't have goto ๐
Is OnceEvery a Lua class or something else like a "Lua event" or something in Java?
here
declaration: package: zombie.core.utils, class: OnceEvery
im trying to get this
i need to check something every second but thats not an event
and this lets you set a custom time check thingy
If that's available to Lua you could do something = OnceEvery(somethingelse)
edit: apprently not :d
Also in Lua you don't need ; if you use newline. Also I think you might not need either also...
yea its kinda just habit
i figure i should probably stop doing it since its lua not C anymore
but im too far gone now
i think your thing worked btw? i have to check if i can run stuff from it
im assuming not?
im not sure tho i just know lua likes to pretend like its working and you got farther when you really didnt
bare with me i havent been forced to encounter classes yet in lua lol
doesn't seem to be exposed
You could try printing cryCheck right after. It would probably print nil or null (whichever)
bummerr
well thanks for the help
im assuming that means i cant do nothing wiht it btw
this would be OnceEvery.new(2)
If it didn't fail when you tried calling OnceEvery and only failed when you tried to treat what it returned as a table then maybe it is exposed to lua?
well from what i barely know classes in lua are only like half real, and everything is a table so i couldnt tell you, my guess is it got SOME value and then pretended like it was good to go
but it wasnt really the class or anything so i wasnt getting a function out of it
it's very odd for it to continue past the initial call if it isn't exposed
you should get an attempted to index null error
that is what i got in the second screenshot
yeah, but you should've got it on the new() call too
No that when u do check on it eeee
it's strange that you didn't
thats why i think lua was playing tricks on me lol
i tried this and it got past that line
but then errors when i tried to run the check on it
y u no print(cryCheck)?
`โ`โ`lua
--no spaces between
`โ`โ`
request to post the file or snippet instead of images
(Also you don't need to restart the game to reload the lua)
sure thing
its not much else besides this
i know everything below it works since i tried it first with ticks
sorry hit character limit had to cut my stuff down
there is more below that but couldnt fit it
thanks btw didnt know how to do this
this does run every player update but that shouldnt change anything
There is getGameTime():getTimeDelta()
if that works as long as i can get some number not related to the fps
im sorta invested in finding out how to do this now but
i probably shouldve thought to look if there was just a delta thing before all this huh lol
got tunnel visioned into one method, yea this works thanks guys!
Hello @quasi geode
I want to ask you if it's okay to fork your Zomboid-Modding-Guide repo and create my own guide?
consider contributing to the original guide, there's still quite a few empty sections 
I saw the last commit was on Jan 22. So I concern about the updates
is there a guide to teach me how to create new crafting recipes 
https://youtu.be/-yrmCAwzTbY?si=ZUXKQZgfYRhGoog3 Watch that video, this lad goes over how to make a crafting recipe.
1:11 Step 1 - Know your file locations
4:06 Step 2 - Storyboard your ideas out
9:03 Step 3 - Get your files from the game or other mods
11:47 Step 4 - Build your mod files
1:01:54 Step 5 - Create the textures (mislabeled in the video, oops)
1:19:45 Step 6 - Put your mod files in the right structure
1:30:37 Step 7 - Test your mod (please back up ...
appriciated!
Yeah all good, we gotta learn some how.
I wish there was an easier way to identify where an issue is, currently struggling to figure out why my model doesn't show up in-game. Unsure if it's a directory issue, a script issue or an issue with the model itself
This being my first experience with modding and programming altogether is contributing greatly lol
Guys do we have any common error in this patch or something about things placed on the ground being duplicated? Some users of my mod are saying that a water container is being duplicated but im unable to reproduce the error or find an error in the code
Advice from programmer in the wild: If the user can not provide a reproducible scenario... the bug doesn't exist... even if the bug exists it doesnt exist.... and 99% of the time, it never existed.
Apparently one of the users on my server managed to replicate it, but it seems like it's just visual
I have no idea how to solve this since the item is supposed to be super simple
I don't know if it could have something to do with the weight of the container being 40 full and the game bugs when you try to place it or something like that
If it's only a visual bug under certain conditions i wouldn't bother about it toooo much personally
I have question about loot tables.
If I adding new items via table insert it increases amount of loot or replacing it in game?
Ping me if you have the exact answer, please. ๐งก
This is just my speculation but i would assume that the amount of items in a loot table does not affect the amount of items the game spawns in, but rather just increases the pool of items it picks from.,,
I assume so. But maybe someone knows it exactly
Well... Still not an answer. "rolls" is complicated as this pic saying
yeah i'm afraid that's as detailed an answer as we're gonna find
Seems like it more loot in general. If all items in the list are rolled twice.
Hello, I was making the machete mod and an error occurred that I could not solve and I need your help. I just started modding and I wanted to add a machete to the game, and when I added it, the problem was that the machete did not appear in the character's hand and there was a question mark on the icon. All other functions work, I can attack, I can wear it on my back.
There may be some reasons why it doesn't work, If everything is ok with the 3d model || (transform ,position , etc) || generally the model not appearing is the item's path that is wrong.
The icon not appearing is definitely a pathing problem, when you added the texture, did you remember to put Item_ before the texture name? for example Item_Machete
as in this example, in the code it is "icon = Katana" but the texture in the folder is called "Item_Katana"
Would this design pattern help with avoiding zomboid lua crashes? And the famous "tried to index value from nil"
I'm tempted to add this to my utils, but I would like the opinion of other experienced pz modders
Programming often relies on combining functions in data pipelines. The monad is a design pattern which makes pipelines with effect much easier to write and maintain.
Monads are often explained using haskell in complicated ways but I tried here to simply explain the pattern with javascript to build an intuition of them.
Is this where I ask about commisions?

