#mod_development
1 messages ยท Page 244 of 1
also asking in mapping is better idea. some have idea here but not many
it is kinda dead. that's why i suggested the unofficial mapping discord
i will dm you the link
it's not dead there
pretty cool
I tried logging the character:getHealth but it always equates to 1 no matter the damage dealt to my character. Does it not return your current health? If it doesn't what is the correct way to do so? I just want to check if health is lesser than 50%
this is just an example from vanilla. it looks like you may need to add a condition to make sure that current health doesn't equal to previous health and compare to that maybe? someone may have a better suggestion but overall something similar should do the trick to make sure it updates first. I think albion wrote that sometimes it returns the hp value before the damage is actually applied and calculated to the health overall, from the health value of the bodyparts
if self.chr:getBodyDamage():getHealth() ~= self.previousHealth then
if self.previousHealth > self.chr:getBodyDamage():getHealth() then
self.healthIconOscillatorLevel = 1;
end
self.previousHealth = self.chr:getBodyDamage():getHealth()
end
@crisp fossil
not the best example but should hopefully make sense ๐
EDIT: nevermind. I think you understand how variable works
Well, anyone wanna make some money this summer on some commissions? Iโve got mods me and my partner jonny just canโt get to as quickly and was looking to maybe sub out development of them to maybe some early coders with a little bit of skill or some advanced ones who just want to make a buck real quick. Iโve got maps of some mods that range in levels of difficulty and price. Itโs not uncommon for me to spend 500usd+ on the right kind of mod. Currently feel free to pm me regarding it or ask in this chat I hate clogging it up cause normally you guys are having conversations we do have an active dev chat for modders we work with. Also side note the server contains zero Zombies and has a lot in common with something like FiveM/RedM/DarkRP so feel free to message me what your good at, UI, animation, Clothing, Art, modeling. And maybe we can work something out the main thing I need is UI work, a lot of the game is built around our custom UIโs. I have 3 major mods currently in our scope of what we need done and like 2/3 medium ones and 1 small one of the top of my head. Thanks guys.
Is there a more 'conventional' or 'official' way to check if Events.OnCreatePlayer() is creating the player object for the first time vs loading in an existing character on the save?
Currently just checking if getPlayer():getHoursSurvived() > 0 which seems to work fine, but seems scuffed lol
Started working on an icon replacement mod for SMUI but I have a few other mods I've written down to try and mess with because I have a few that I really like but really really wish had proper icons, thought I'd share some and get some opinions ^^
looks pretty fucking cool, your shading is on point. wich mod are these icons from?
Before and afters. The bottom right I've never actually found in game but is a 'Gulf War Novelty', I ended up finding the exact Bart Simpson with a gun shirt (because of course) that the original was taken from but it was way too much detail to fit into the small icon, so I decided to get creative. At first I was going to do Spiffy ofc, but then decided since I'm working on a little radio / TV station mod I'd make up a new character for a PZ Simpsons-knockoff, and I based the design off of Pim from Smiling Friends since I was just watching it today ๐
Thanks!! The ones on the left are from SMUI
Which will be the first mod I'll be replacing the icons of
Well there's a ton of icons in it, so I might do some and then start on a mod with a lot less items ^^
oh my bad you had already mentioned it, smui sounds like a modding tool or sum lol
Yeah its an odd name and an old mod, no worries lol. Sounds like some Fallout mod dedicated to fixing the menus or something.
hahah yeah
Events.OnNewGame is called when a new game starts afaik (not called when a game is loaded)
the pz wiki also has a page with a lua events and a brief description of them. just try google "pz wiki lua events" to find it.
Not quite what I need, it'd have to be an event that fires after creating a new character, regardless if it's in a new save or not. Events.OnNewGame only fires when a new world is initialized. Working on a mod that adds traits for starting injuries/challenge-esque scenarios, but to avoid applying said starting injury I need to know whether the created player object is new or has been in the world before.
On second thought I could also just remove the trait when the injuries get applied. Would probably be fine if Events.OnCreatePlayer() and checking getHoursSurvived() > 0 fails to suffice.
OnNewGame is fired for new characters
I know it's fired for new characters right when one is made via character creation, the issue I'm running into is it's also fired when the player object is loaded from a save it seems, unless what I tested was just wrong, which is also possible
most often you would use OnCreatePlayer and use moddata to check if your code has already run, a usually intentional side effect of that is that it will run for existing characters created before the mod was added, if you don't want that getHoursSurvived is a solid approach
Think I'll continue with what I've got now then, haven't dabbled with ModData or anything yet as nothing I've wrote & published has particularly needed it for persistency. Just wanted to see what other ways I could try, as I thought getSurvivedHours() wasn't quite 0 on spawn for whatever reason, pretty sure I just had a >= where there should've been a > though.
Couldn't you just check to see if your moddata table is there and then if not just assume it's a first time?
that's what i'd usually suggest, but if you want it to only run for *new* characters the moddata won't exist if you install the mod midgame
usually you actually want that behaviour so you can initialise things regardless, but for some cases you might really not want it
how would i randomly select a retail VHS and give it to my character?
replying to ask if you have figured out a way to do this or if someone has responded with an answer
cause i'm trying to do the same thing
well
a similar thing
trying to give myself 10 randomized retail vhs tapes
Nope, thats not possible from what I've seen. The VHS are randomly rolled from a table when looting normally and the admin spawned ones need to be assigned manually. Spawning VHS_Retail tapes will give give the players the unassigned tapes that players cant use.
I havent found a solution to it, so dropped the idea for a trait that gives the player one of my custom VHS tapes.
No problem mate๐ป
It is possible. You can create random tapes and add them in the player's inventory.
For a random tape
---@type InventoryItem
local vhsTape = InventoryItemFactory.CreateItem('Base.VHS_Retail'); -- or 'Base.VHS_Home' or 'Base.VHS'
local mediaList = getZomboidRadio():getRecordedMedia():getAllMediaForCategory(vhsTape:getScriptItem():getRecordedMediaCat());
local mediaData = mediaList:get(ZombRand(mediaList:size()-1));
if mediaData == nil then
vhsTape:setRecordedMediaIndexInteger(-1);
else
vhsTape:setRecordedMediaData(mediaData);
end
getPlayer():getInventory():AddItem(vhsTape)
For a specific tape
---@type InventoryItem
local vhsTape = InventoryItemFactory.CreateItem('Base.VHS_Home'); -- or 'Base.VHS_Retail' or 'Base.VHS'
-- id itemDisplayName spawning
local mediaData = MediaData.new("00a8b565-a566-44f3-b6d2-7a1ae2eafb0c", "RM_5929b5c4-1c65-4797-81b3-7963a55769c6", 0);
if mediaData == nil then
vhsTape:setRecordedMediaIndexInteger(-1);
else
vhsTape:setRecordedMediaData(mediaData);
end
getPlayer():getInventory():AddItem(vhsTape);
Oh damn thats pretty neat, creating own VHS item, getting the media list and then add the randomly assigned VHS tape to the inventory.
You can even get specific VHS tapes that way, real cool approach ๐ค
also how can i make code that makes it so i can eat every item? currently i have:
local function initLeadStomach()
local player = getPlayer();
TraitFactory.addTrait("leadstomach", getText("UI_trait_leadstomach"), 12, getText("UI_trait_leadstomach_desc"),false,false);
end
Events.OnGameBoot.Add(initLeadStomach)
local function makeItemEdible()
local player = getPlayer();
if player:HasTrait("LeadStomach") then
for _, item do
if item:IsInPlayerInventory() && !item:IsFood() then
item:setType("Food")
end
end
end
end
Events.OnPlayerUpdate.Add(initLeadStomach)```
You haven't applied the changes we already told you about in this code
Also you can make the code block in lua by doing
For _, item do is incorrect
Yeah we already told him all that but he hasn't applied the changes yet
for _, item do is incorrect ๐

Uhhh spoiler alert
How does one use OnConnectionStateChange? I don't know much but i can't seem to make it print anything so i guess it isn't being triggered?
Ah well, I should probably have put my question here... I guess.
If I create a map mod and the spawnpoints.lua doesn't have spawn points for a certain occupation, what spawn point is chosen? Like for example in all base maps I can't find a spawn definition for electrician, but still I can spawn as one. So which spawn points does the game use? unemployed?
guys anyone know how to fix that? trying to do some translation
Try encoding the text file in UTC 8
And paste the text again
You need to use specific encoding for each language.
For russian its CP1251 (Windows - 1251 in Notepad++)
https://pzwiki.net/wiki/Translations
Here is the list of the languages and their encoding type.
Use notepad++ for it, beware that if you make changes in another application the encoding will be overwritten
Is there any way to make a panel ignore mouse/keyboard interaction?
nm, I worked around it by making the parent panel 1x1 which seems to have accomplish what I was after
For is iterative, _ and item are variables being declared
Pairs() returns two sets of things
So you should have kept that
And given it an argument of a table
I think before you had no argument and got the error "need more arguments".
Also the table being the players items would make the isInPlayerInventory redundant. Side note, but I think that needs an argument too, to work.
In this case, it looks like your trying to iterate through the players inventory - so you'd actually not be using a table at all. Player inventory is an array I believe.
oh huh
You can see examples of this in the recipe.lua
alright
wait but i forgot how to use arrays lemme look it up
so im stupid how would i do this
anyone know if its possible to use DoSource("[Recipe.GetItemTypes.SewingNeedle]")? im trying and it seems to be adding black digital watches instead of items with the SewingNeedle tag and im kind of confused now
If I'm reading your intention correctly, you'd like the trait to allow the player to eat any item, right? Rather than setting the item type, it seems wiser to have handling to add a similar menu item for โeatingโ non-foods that would just delete them & have whatever effects you're going for. You could only include that in the menu if the player has the trait
that seems very complicated
how would i do that
i don't even know how to do custom menu items like that
is it CustomContextMenu under InventoryItem or whatever?
sorry under Item
Setting things as food would be performed on the script, which is more complicated ๐ you can look at existing menu code to get an idea of how to add context menu items; unfortunately not home to provide more detail, but searching the code or other mods that add menu items for OnFillInventoryObjectContextMenu may be helpful
what mod would do that?
Any mod that adds something to a context menu
good point
can you give me an example
wait i know one
true music: jukebox
adds the context menu for operating the jukebox
I should clarify that you'd want something that adds an inventory context menu item; I'm assuming that one is a world object. The base true music mod might add some though
oh ok
ill find out
brb
back
i figured out that true music (the base mod) has the inventory context menu but i can't figure out how it works
can i swap the model of vanilla backpacks?
sure, you do it in the models script (just make sure you dont forget the texture. Or you do it in the item script - worldstaticmodel)
Trying to add to a nil variable or some shit like that
Got to show us your code if you want better help bcs anything we can help you with is already said in that error
there is no OnUseItem event
Yeah

Not sure what you're trying to do here
ugh it's been a while since i last worked on making a zomboid mod, do I make the new mod folder in the Mods folder or the Workshop folder?
I completely forgot and I don't have old files to reference
you want to upload it? workshop. you want to create it and test it? mods
you will eventually need to move to workshop to upload your mod, but you can work from either one
ah okay thank you
there should at least be the examplemods in those folders, so you can check the basic structure ๐
tbh ive always found it easier to just copypasta the folder and edit the files as needed lol. at least for everything but the media folder which I end up purging lol
Yeah that does the job
Thats what I did at first too ๐ Now my mods folder is so absurdly flooded, that I copy mods that have the rough structure of what I want to do already
but yeah I'm looking to make a cooking QoL mod that allows you to make your own Baking Soda (and maybe other items related to cooking which can be a pain to find like yeast) without adding anything new besides intermediary items related to the crafting of the baking soda and yeast lol. I currently have one up on the workshop, but its old and I lost the files to it a while ago, so im starting from scratch as it seems that one had issues lol
you know you can download your own mods from the workshop as well? so you get the files ๐
i know, but also Id rather just start from scratch. just a preference lol
i'll still probably download it to peek through the old files, but it just feels better to work off a new mod file XD
just getting the working folder structure from the old mod can be a great help though - I have seen a metric tons of mods causing grey hair to their makers because of a random typo xD
lol
anyone know how to remove a source item from a recipe? ive figured out how to add a source but not i need to remove the old source. trying to find all recipes with the source Needle to change it to [Recipe.GetItemTypes.SewingNeedle]
you mean as in "an easy way to do this"? Use the replace function of text editor (ctrl + h)
i meant with lua code sorry
i wana change all the recipes that just use needle to the method that pulls all items with the needle tag
i think you can just remove it from the recipe's source arraylist
in your case it might be better to just edit the items in the existing source though
well im trying to change all the recipes i have loaded on my server to accept the [Recipe.GetItemTypes.SewingNeedle] instead of just Base.Needle. cuz i made a new type of needle for my server and its not included in a bunch of recipes we have cuz the modders just used Base.Needle
so was trying to write a function to just replace all the base.needle in recipes with [Recipe.GetItemTypes.SewingNeedle]
which im not even sure you can inject [Recipe.GetItemTypes.SewingNeedle] into a source with lua. cuz i can get an item injected into the recipes but [Recipe.GetItemTypes.SewingNeedle] doesnt seem to want to work
i'm unsure when those functions get processed, you might want to just call the function directly instead
those functions just add to the source's item arraylist when they get called so if you call it with that as an argument it's the same thing
is it possible to make a recipe only accept a rotten version of a food item? im looking to make a recipe for yeast and im going to use the rotting mechanic as a stand in for fermentation, but obviously I don't wanna have the player be able to extract the yeast from the connoction as soon as its crafted (when it would still have the fresh label)
You can create 2 items with the same display name but not the same name and transform on to the other with the OnRotten mechanic.
good to know, thanks! next question, how do I do that? like is there a page somewhere I can reference to see what I would need to write down?
The keyword in steamapps\common\ProjectZomboid\media\scripts txt files is ReplaceOnRotten
ah okay thank you
it is used by various sorts of IceCream in vanilla
oh yeah, when the ice cream becomes unfrozen for too long it becomes melted ice cream doesn't it
second question, how do I have something rot in less than a day? I want this thing to be fermented 1-2 hours mas, but im unsure if the measurement of time means I would need to convert from parts of an hour to a useable value or not
like I assume if I put down 0.5 in DaysFresh it would take 12 hours before it went stale
i figured out some code, i hopefully wrote something that will get the eat to appear, but i don't know how i would make the player actually EAT the item
local function ISInventoryMenuElements.ContextEatNonFood()
local self = ISMenuElement.new();
self.invMenu = ISContextManager.getInstance().getInventoryMenu();
function self.init()
end
function self.createMenu(_item)
if getCore():getGameMode("Tutorial") then
return;
end
if instanceof(object, "InventoryItem") then
_item = object:GetItem()
if _item then
if _item:getContainer() == self.invMenu.player:getInventory() then
self.invMenu.context:addOptionOnTop(getText("IGUI_Eat_Item"), self.invMenu, self.openPanel, _item )
end
end
end
end
function self.openPanel( _p, _item )
ISRadioWindow.activate( _p.player, _item );
end
return self;
end```
this is my current code
im looking for what to replace ISRadioWindow with
<@&671452400221159444> bitcoin miner
how do you know?
it's on github so i just checked its source, it's just a bitcoin mining script
thank ya
is it possible to have an rotting time of less than a day? or is that just impossible
Timed Actions
Anyone? ๐ฅบ
I already checked that. This is what i have on client script:
local function OnConnectionStateChanged(state, message, place)
print('MyMod: OnConnectionStateChanged triggered!!!')
print("MyMod: OnConnectionStateChanged--> state: ",state," / message: ",message)
end
if (isClient()) then
Events.OnConnectionStateChanged.Add(OnConnectionStateChanged)
end
I also tried with OnCreatePlayer and it works and i can see the print in the console, but with the above i don't.
Hey, thanks its works
It seems that this event is triggered when the player is placed in a queue on a server, the client version does not match the server version, client successfully connects to a server.
Im not sure if i understand. I tried it in a local server, do you mean that it is normal that it never triggered?
Hi, I've installed an old mod and when I try to spawn and item of that mod says that item "doesn't exist" and doesn't appear in the item list (admin panel) neither, but the mod is active. How can I fix this?
It's because is unlisted or that I changed the original ID?
i was planning to can every last SMUI reupload when the successor mod comes out but this is making me reconsider
<@&671452400221159444>
Thanks

Damn, that's like a 3rd one in 24 hours
These are nice ๐ฎ
Have you considered paid work?
Yeah these are good. As someone who's been paid for things, this is paid for things quality.
They're in the cortex command discord, not surprised haha.
Hey guys
Do someone already succeed to hide a spawnpoint from the selection into the game please ?
I want to force the spawnpoint for my mod ๐
you probably can do this by overriding SpawnRegionMgr.loadSpawnRegions from SpawnRegions.lua
Gonna try thanks for the tip
Looking for a way to lock a player in place as in no way at all for them to move. Gotten this far:
local sq = player:getSquare()
if sq then
-- Set X, Y, Z
player:setX(sq:getX())
player:setY(sq:getY())
player:setZ(sq:getZ())
-- Set Lx, Ly, Lz
player:setLx(sq:getX())
player:setLy(sq:getY())
player:setLz(sq:getZ())
-- Set uninteractable
player:setBlockMovement(true)
player:setGhostMode(true)
player:setInvisible(true)
player:setInvincible(true)
end
But I assume for it to work, it would need to be called OnTick which isn't recommended. Is there better alternatives?
you can just set it to OnPlayerMove
so if the player stands still it doesnt trigger
Oh that's true.. But wouldn't that needed to be called on the client? I can't use setInvisible etc. tmk on there. But perhaps send a msg to the server that player is trying to move and then do the above code?
Why wouldn't you be able to use that ?
There's a number of ways to stop a player from "moving", you should be specific about how many things should be locked. e.g. animation, turn...
setInvisible does run client side
As in if they were spectating but not being able to move out of their square. Not visible, not interactable, not moveable. It should completely limit all their actions
hmm interesting. Actually thought that wouldn't work
It's not the server that handles a player state
So anything that involves modifying a player is just done client side
I don't think the server can do it
That seems to be current discovery too. Thank you
What programing language does project zomboid use?
Since apparently I make evil mods now
I like Into the Water, but my girlfriend raised some realism concerns with it, in that it'd be a terrible idea and might taint the water
it would be neat if dumping enough corpses reduced fishing yields and caused a chance of infection when drinking from sources in that map cell...
So it doesn't use a text file sorry
๐
I'm not sure if there's a way to save per-map-chunk stuff like that though
also I'm unsure if I could make water collected from it also have a chance to cause infection
It should be straight forward and doable with lua.
hm, I'd have to check if water is part of the river or not though
Might have something to help with that
The problem is that it generalizes "Seawater" to any water tile
So eh
You cannot drink or fill containers at water tiles anymore.
Hm. That's sort of a dealbreaker.
That's very easy to do
I mean, at least it's doable and easier than you think
I think this mod works off of admin-defined zones, so I'd probably just have to do my own thing and mark specific map cells as being the river.
Yeah basically
Which wouldn't require the use of that mod
I mean idk
I think they don't define any fresh water tiles
@wicked crane can you give more detail on your mod ?
I didnt even know there was a successor mod coming, maybe I should hit pause? Are they redoing the icons? ๐
@sullen basin Thank you both!!! I don't actually consider myself an artist at all, just been a modder for so many games for so long that I've slid into it I guess, but if you think this sort of art is commission worthy then feel free to PM me and I'd be happy to discuss it ๐
they being me, yes
ill go ahead and just do the world reveal for the artwork while i am at it
Oh neat, big fan!! If you want any help with icons let me know ๐
i thought about it, but there is simply too many items to actually do pixel art for really
currently clocked at about 463 articles of clothing
this isnt mentioning guns
Some is better than none I'd say, but more than fair ๐
i am currently looking for a secondary programmer for a paid job, but at the moment thats about it
i wish pixel art could fill in more, but i just doubt it
I do know some code too ๐ though probably not as much as you'd want
that just depends on how familiar you are, really
Feel free to drop the details or PM them to me and I'll let you know
currently looking for a good way similar to VFE to transition through weapon variations
that'd be the start but ultimately it just goes from there but whoever i find for it it'd be an on and off gig
@teal slate
as stated in description:
Supported mods: Lost Province, Remnants of Kentucky
Add-on for Zone API that simulates Fresh and Salt water.
Turns all blends_natural_02 tiles to 'Seawater'.
You cannot drink or fill containers at water tiles anymore.
Create custom 'Fresh Water' zones using the admin Zone Editor.
Water Zones will work with other mods, you just won't have pre-defined Fresh water zones.
its for simulating sea water
Yeah but does it already set some areas to seawater and other to freshwater ?
Yes, for Lost Province has freshwater areas coded out of the box
otherwise they have to be added with ZoneAPI's admin zone editor, like safehouses (or with coordinates from worlded polygon tool.) they're very easy to add
kentucky is landlocked, it wouldn't make sense to use it on the default map anyway
Aaaah
is there a way to make variables in scripts? I'm making my own custom weight mod and want to use variables to rapidly adjust items but the game crashes every time I test it out
no
Im trrying to fix a mod thats halfbroken, how can I stop a item from spawning on zombies? (Modded item)
Remove it from the distribution
Unsure if this would be the correct place, but Iโm looking for a mod creator to commission?
theres no distribition files in the mod xd
it must add to distribution somewhere or it wouldn't spawn
Do you have other places where you've showcased art like twitter or artstation or something?
My art has been way too scattershot for anything like that so far ๐ I used to run the mod The New Order: Last Days of Europe for HOI4 and I'm the current lead of the mod Godherja for CK3 which are my most known things
Hopefully you'll have plenty of examples from Zomboid mods sooner than later though! ๐ thank you for the interest
Wouldn't hurt to have an artstation or something that lets you post and collate artworks. Yep, good luck on the mod front, I'm new myself. Just published my first one a few days ago.
There could be a Lua file that adds items when you kill a zombie too
Maybe! Like I said my art has always been tangential to whatever project I've been on, but not a bad idea to try and corral it all into one space eventually ๐
nope
it does not
thats the funky part
It must otherwise it wouldn't add. Are you have the right mod? What's it called?
i managed to fix the other issues it had but not the spawning of OP bags lul
https://steamcommunity.com/sharedfiles/filedetails/?id=3271303304
New Game-Night Add-On ๐ฎ
From what I can see the mod only changes vanilla item stats and tweaks some mod item stats. the spawning itself is done in vanilla itself /the mods themselves.
Anybody knows how to get InventoryItem translated string? I mean translated name
Translations are under lua/shared/translate
getDisplayName()
Yeah, but how cn i stop op bags getting spawned?
you only want them to stop from spawning on zombies? Then it is the clothing.xml under media/clothing. Search for the guid of the items you dont want to spawn and delete the coresponding lines
Yeah but its not vanilla items
what bag do you consider op?
the mod adds two OP baga that shouldnt spawn at all
They should only be avaliable with cheat menu
The packpack and bac of holding
So far it only seems to be the packpack that spawns on zombies though
Beyond that from my testing yesterday I seem to hve fixed the other issues it had xd
what was your mod called again?
You could make your own actual clothing item and reference that in the item scripts
as in a clothing .xml with own guid and the guidtable. No need for new models or textures
where do your OP bags spawn (mostly)?
I just assume mostly in containers in like houses?
ok ok. As said, make your own proper clothing items, and this should stop
Alright, how do I do that?
Thanks for the help man
No problem ๐
Reminfs me, how hard is it to make a weapon mod? Custom
Item, model, crafting recipe etc?
depends on how good you are in blender. When you have the model and the texture done, all the rest is just copy/paste/change
I dont use blender ๐
I use maya ๐ฎ
whatever gives you an .fbx that works for the game ๐
Pz uses FBX?
I just assumed blender, since its free and 99% of people here are using it
All good then lul
exactly ๐
check the pinned comments in #modeling , there you will find models of the male/female characters, so you have something to scale your models to
Cool thanks
Or follow the tutorial on the mod page
I what way
I'm working on a mod called outposts which would be outside of almost every city like a small quickly erected building with cages with some zombies in it a radio a small kitchen etc
anyone know how to set a specific bleeding time/deep wound time? i can get the deepwound/bleeding to trigger but its timer is 0 seconds so as soon as you bandage it goes away. ive been trying varius methods of getbleeding time/setbleeding time and nothings working.
local hasDeepWound = player:getBodyDamage():getBodyPart(Hand_L):deepWounded()
local isbleeding = player:getBodyDamage():getBodyPart(Hand_L):bleeding()
if not hasDeepWound then
hand_l:AddDamage(10);
hand_l:setBleeding(true);
hand_1:getBleedingTime():setBleedingTime(300);
hand_l:setDeepWounded(true);
hand_1:getDeepWoundTime():setDeepWoundTime(300);
player:SayShout("AAaagghh!!")```
thats the last thing i tried
Anyone know why my the trait im working on is not appearing on the trait selection page? :(
require('NPCs/MainCreationMethods');
Events.OnGameBoot.Add(Introvert)
MSTBaseGameCharacterDetails.DoTraits = function()
local function initIntrovert()
local Introvert = TraitFactory.addTrait("Introvert", getText("UI_trait_introvert"), 2, getText("UI_traitdesc_Introvert"), false, false);
end```
Hey I can use some help with getting a mod I'm making to work now do I need Lua to start?
You can use VS Code and then write lua
theres multiple options apart from Lua too
I'm using visual code studio @trim marlin
Go to the bottom right and you should be able to select your coding lenguage
Which should be Lua in this case
For making a mod because I'm trying to follow the video and I have no idea as they already have everything signed up
What mod are you trying to make?
I suggest you look at other mods and see how they do it
I'm trying to make a food mod but also crafting part of a mod
I'd suggest you download a simple food mod or look at the food items that are already in the game
See how they're coded
It's the best way to learn
Well I was going to make it where you can make it yourself if they don't already have it in game basically where you take beef or anything like bacon cut into strips and then you have the ability to set your oven on low and then cook it over a long period Of time making jerky and then making an add-on for that mod where you can take the rotten stuff through and make it into something that's usable although it will the grade over time
Is there anything that hurt me meaning to access the code to see how they coded it?
Nope, but if you're going to copy and paste it and just change a few things, it's better to ask the mod developer first or at least credit them
No I mean this accessing the main game files to see how food is categorized and etc
My apologies
Nope! If you just copy and paste the code into a seperate file and don't change the main files a lot then there is no harm! :)
I need some help with a code snippet for my Project Zomboid mod. How can I make it so that when the player's health drops below 15%, all wounds, fractures, bleeding, scratches, and bites on their body parts are instantly healed?
@bold yoke Are you trying to find the vanilla game files?
Well, there are plenty of ways that you can do that. Easiest would be to tie the function to a Lua event, something like OnPlayerUpdate, then check their health against your threshhold. If that check is true, then you run the list of things you'd need to update those different aspects. You'll find most of those things under BodyDamage in the Java Docs.
Here: https://www.projectzomboid.com/modding/zombie/characters/BodyDamage/BodyDamage.html
declaration: package: zombie.characters.BodyDamage, class: BodyDamage
Is there a reason why you alternate between Hand_l and Hand_1?
Seems like that could be your issue, since everything there seems to be referencing the same BodyPart Array. The only two instances of you using Hand_1 is in both your set time functions
Been awhile since I have messed with traits, but I think it is due to the naming of your function.
In your event call, you are asking it to look for a function named Introvert, but that variable is localized within the function initIntrovert. So I believe if you change the event call to look for the parent funtion, it should work. Like this: Events.OnGameBoot.Add(initIntrovert)
I implemented a script to heal my character in Project Zomboid when their health drops below 15%, but it doesn't seem to be working. Did I do it correctly? Here's my code:
Have you tried printing anything?
Or :Saying it?
No, I haven't tried printing anything yet. I'm new to coding and don't have much knowledge yet.
Say I wanted to put a barricade around a city or just along a defined path. What would be the best approach? Can ofc use the ingame brush tool, but that'll take quite a bit of time ๐
I want to cordon of certain cities and areas to build a progressing RP server.
I see some weapons mods specify only a crit chance and no crit modifier, does that make the weapon not do extra crit damage or does it like use some kind of default modifer?
Thanks! I'll try this after I get back home! :)
ah yeah that was a mistake. i didnt even noticed i did that lol. but i have tried various other methods since including this one
hand_l:AddDamage(10);
hand_l:setBleeding(true);
hand_l:setBleedingTime(300);
hand_l:setDeepWounded(true);
hand_l:setDeepWoundTime(300);
player:SayShout("AAaagghh!!")
elseif hasDeepWound and not isbleeding then
hand_l:setBleeding(true);
hand_l:setBleedingTime(300)
end
end```
where its actual l and not 1. and that doesnt work either
Food
Yes
media/scripts/items_food.txt
I'm trying to I went into the media folder which I still can't find as I'm going into the zomboid there's no media folder
steam/steamapps/common/ProjectZomboid/media/scripts
In whatever folder/drive you installed your steam
If you still cant find it: Go into your steam library, rightlick on PZ. Properties/Installed Files/Browse
thank you
np ๐
media then scripts?
exactly
i can only chuse one
que? One what? ๐
would you like to see?
this should not be nescessary. click on the media folder. then click on the scripts folder inside it. there you will find "items_food.txt"
its not there
the media folder?
The media folder is there it's just not showing it up
ok dude, share me your screen
try setting bleed time to 10
@austere sequoia thank you so much and also what went alcohol make classified as?
I am not 100% certain. I think the fooditem needs the line "Alcoholic = TRUE," do be recognized as an alcoholic item. (Anyone feel free to correct me).
Other than that alcohol and its effect is managed in the lua files (I think?)
thank you as im going to need that for part of my mod
No problem! Best way to get into modding is look for mods that do something similar you want to do, and look how they have done it
And when I work on a crafting recipe cuz I'm working on the item after it's done but I need help with the crafting making the item any thoughts
check the recipes.txt in the script folder
Thank you
The reason why it's cuz if there's no way of making jerky and project zomboid I was going to add that as a recipe also something to use all that rotten food
And I already checked the file by the way thank you
I am 99% certain someone already made a mod for smoking jerky, just recently ๐ค
Darn it
(doesnt mean you should not do yours!)
I was thinking maybe I could add my own version of the cannibalism mod or it takes more time but you learn first aid and cooking at the same time
that's a thing???? -w- (NVM I AM DUMB, IN A SMOKER NOT LIKE CIGARETTE LOL)
I mean irl lol
And I was thinking that you can take whatever rotten food you might have and turn it into some type of drinkable beverage cuz I'm the type of player who wouldn't want to waste anything
of course, how do you think jerky is made? ๐
As in making liquor from fermenting food? sounds fun ๐
Rotting fish can be turned into garam which is a Roman fish sauce and it would be good to if you can't get to a bar because the darn zombies are all in line waiting to get a drink
or surstroming. Make it smell so insanely bad, that the player gets sick, and half the map of zombies gets attracted xD
I'm trying to make it so that there's a mod to get rid of all that waste
I don't think zombies would have two king of a smell but ears they would also when I make it do I put it into the main loop
To be fair, composters exist, that turn rotten food into fertilizer and worms for fishing. plus on higher cooking levels you can use rotten ingredients without any harm. But having more to do with this stuff sounds nice!
Giving the player more ingredients to add to their food but I don't know how I should incorporate the beef jerky
How would I go about putting in a recipe for the jerky and then you just have to put it into a heat source for an hour or so and you got jerky it takes longer but you know what I mean for gameplay reasons?
So how should I go about the recipe do I need it in its own separate file?
Is there an addon for Inventory Tetris that lets you put containers inside trash bags? I feel like of all containers, those should allow nesting...
You can put multiple recipes in the same file (look at vanilla game's recipes.txt for example)
Thank you but if I had to start off making my own for it because for the start of the crafting recipe you need salt and beef strips or bacon strips soap for the beef strips then you have to put it in the oven for an end game hour
My apologies
Look how this dude made it (literally still on the workshops frontpage :D)
https://steamcommunity.com/sharedfiles/filedetails/?id=3266738501
Darn
Is the way that moodles are displayed on-screen hard-coded in Java?? It seems there is no Lua component calling getText for moodles, and since it has to be getting the translations somehow I can only assume it's doing it by calling the proper Java method.
If so, it's weird how they have a UI that is Lua but then use Java too?
I was hoping I was on something but like most things somebody I was all right on it
dont let that discourage you. You can do it differently, or better. ๐ Or you do what you feel is missing in the game and you cant find in mods
Quick question, if I made a mod changing the rarity of an items (for example dumbells) if I just made another file like this
ProceduralDistributions.list = {
CrateFitnessWeights = {
rolls = 4,
items = {
"DumbBell", 70,
"DumbBell", 60,
"BarBell", 60,
},
junk = {
rolls = 1,
items = {
"Mov_FitnessContraption", 100,
}
}
},
}```
would it automatically override the vanilla distribution for the dumbells?
no that wouldnt work, let me get the correct code in just a second
table.insert(ProceduralDistributions["list"]["CrateFitnessWeights"].items, "Base.Mov_FitnessContraption");
table.insert(ProceduralDistributions["list"]["CrateFitnessWeights"].items, 1.00);
@trim marlinthis should work, the probability is a factor and I'm unsure how it works exactly, something to do with weight, someone else can probably explain it better than me but yeah if you have any other questions regarding this code lmk
this has to be in the lua/server folder btw
Thanks! Seems a lot more complicated than I thought
once you got it down you can just copy and paste it and change the important stuff
working on a crafting resipy
does itemScript:DoParam cant programmatically applied mid game?
does anyone know how to check if theres a simple to way to check if the players is outdoors or indoors?
So kinda like just a simple if PlayerObj:(IsIndoors)
getCurrentSquare():isOutside()
So I could do
if not player.getCurrentSquare():IsOutside() to check if the player in inside? thanks
not exactly. that is more or less the idea but you need to learn lua syntax (google it) and respect the case.
Could I not do
if player.getCurrentSquare():isInARoom() ?
What would I need to do for a recipe that requires heat?
Something like those lines, depending on what you actually want (in the item script of said fooditem):
DangerousUncooked = TRUE,
IsCookable = TRUE,
MinutesToCook = 25,
MinutesToBurn = 70,
@bold yoke
Also, based on some previous things that you mentioned. Iโm pretty sure that changing the temp of an oven is just a multiplier effect on the โtime to cookโ & โtime to burnโ variables
There is probably a way to mess with that and make it work differently, but itโd likely be very complicated
Wellโฆ technically there are some trigger points you might be able to mess withโฆ but Iโm not sure the juice is worth the squeeze, depending on what you are trying to achieve
Thank you I'm sorry I'm trying to make it so that would take a long time cuz like I say I'm making a jerky mod but I also plan on somehow making it so that can ferment rotten food and alcohol for those who can't find any at any tavern and don't want to wait those potato seeds that they found or if they have one of those icebox fridges that they suddenly forget to put gas in their generator and loses all of its energy sorry
I thought that what might work because in a way it doesn't waste anything you can make Karen or fish sauce if you have salt and rotten fish or fish on the verge of spoiling
Oh no need to apologize! I have jumped into all sorts of different crazy mod projects before! ๐
There are a few mods that handle the idea of fermentation, and theyโve each got their own different ideas for implementation!
Is this your first attempt at modding?
I know it seems complicated for a first mod project I'm not that type of player who wants to spend having all that rotten food around and not having a compost then and having basically nothing to calm me down cuz I'm a character that has to sleep outdoors to avoid being panicked etc
I forgot: There also is the line
ReplaceOnCooked = YOURITEMNAMEGOESHERE
So your original item is replaced by a new item (your liquor? jerky?) when cooked fully
I thought of a simple evolved recipe yeast the rotten material of your choosing in sugar for a liquor and just salt and fish for garume
for a recipe you cant really use heat though, iirc. You could maybe make it that it must be crafted near an oven, but it still would just be crafted
I understand it was supposed to be almost like a smoker or at least what could be like a smoker I can't fire doing things that humans have done for ages
My first big mod project was a full drug mod with timed effects lmfao ๐ It took me a LONG time to get something I was remotely happy with, it was a LOT of banging my head against the wall trying to understand what I needed to do.
If you are willing to take some recommendations. I would suggest starting with some basic recipes, get at least a bit comfortable with how they work. That gives you a lot of leeway, since youll know their limitations and understand what you can or cant do without having to immediately venture into the world of Lua haha
Hi! Asking a technical question here, has anyone been trying to mod the VOIP in PZ? I've been trying to improve it for months already but it's very scarce in documentation
Basically there are a few elements I would like to work on :
- Stability (too many desyncs, mostly through walkies where you sometimes just don't hear a player if they haven't been loaded by your client)
- Quality (it's very hard to listen with 5+ players scenes)
- Variable range (whisper, talk, shout depending on an input)
Do you know anything about what is doable or not?
Other question, has anyone been trying to externalize the VOIP to another service (TS, Mumble..)? I've been thinking of a system but there are a lot of elements that could be very hard to implement (walkies for example)
I was going to say that I would think that the VOIP would be innacessable... But everything I am seeing in the Java Docs point to the voice manager being public
I do think you are going to run into an issue though. Any code that you are tacking on, modifying the existing VOIP system is likely going to add to any existing desync
You think that would create more desyncs?
That's why i'm thinking that externalizing the VOIP to mumble would be a better solution
but there are so many issues to tackle with regarding this solution
walkies and you can't use any mods that use the microphone like zombies hear microphone
Yeah, I mean you could externalize it. I am sure there must be some sort of way to do it internally, but it would likely be very complicated. Which then in-turn adds a lot of bloat to the VOIP
Because my objective right now is making the VOIP less likely to desync
Or maybe it's possible to keep zombies hearing microphone while having the external VOIP
i have an idea
keeping the mic active on the server but block voip communication in the server
so the mic would still trigger from voice but there won't be communication
The biggest issue is that VOIP is not an instantaneous effect, it is continuous. It is really easy to mess with thew text chat, since once a message is fired, it is a single instant string to change. The VOIP is that continuous running chain of info that might be limited by PZ, the player's IRL equipment, internet connection in general, ping between the players, etc etc etc
true
bc right now it's killing our servers
we have so many issues where players can't hear each other
mostly through walkies
Is it an RP server?
yes
I think it's because the client doesn't load players that are not close enough from you
so in the walkie you will not hear their voice
if they are on the other side of the map, or even an other city
i have tested a few times during the server uptime and it confims my theory
admins for example are less likely to be concerned by this issue
because they teleport around during the session so they are most likely to be loaded by all clients
I mean, I would consider trying Text RP. Personally love it, I cant even fathom the thought of going to back to VOIP now haha
But I understand the frustration... I'm just not 100% that there will be a satisfying approach
We can't use text for this project unfortunately
it's one of the core components of the server :x
bc to outsource voip i was thinking of this framework :
create a mod that gets the coordinates of every players and update this data every tick in the server
with Mumble API we create a bridge with the mod and mumble that would locate mumble users according to the coordinates in the server
we could even add a 3rd coordinate in the voip!!
Though.... If it is just a matter of wanting to load the other clients, there are tons of ways to do that. If you can identify whatever is loading when the players are within close enough range of each other to 'render' them, then you should be able to just force the game to do that on its own
How many players...?
around 50
and they're getting more and more every season
PLEASE do not make an OnTick funciton that transmits data from 50 independent players ๐ญ
yeah obviously haha
lmao
i was maybe thinking into having this mod player-side
so that the player's coordinate is sent to the server in a db
so the processing power is split among all players
Still, it'd be painful. Mods like immersive medicine are known to bog down clients do to the OnTick functions, even locally
yeah it's hard
maybe a solution would be to create a mod that load all clients together
so that we wouldn't have these desyncsq
Are people loading in and out regularly, or do they all play simultaneously
it's a session based server, it opens at a fixed hour and closes at a fixed hour
Players mostly login during the opening time however we have late players and also regular reconnections
so it really depends
Gotcha, yeah I feel like that is going to be difficult no matter what. The VOIP system was seemingly made in 2016 without significant(?) update since. May be wildly wrong on that tho lol
yeah that's one of the weakest point for PZ, i'm so sad to not see any love for VOIP
the only main update was the fix for walkies and radios which was a GAME CHANGER
but it's the only update we got in a few years basically
I would really have hoped to see some news about VOIP updates with the 42 updates
would be glad to see some when we will see a patch note, but don't have any expectations
Do you know if my theory is correct about the client not loading other players that spawned too far from them?
bc that could be a first step to find a solution
By the way has anyone tested this mod? https://steamcommunity.com/sharedfiles/filedetails/?id=3252822560
It's adding a KCP tunneling connection on top of the UDP used by PZ
if it works this would prevent desyncs
Yooo I'm struggling with a mod i'm working on. I want to display text by a player until they remove it - halo title is too short and fades away and the on render stuff I cant get it to stop flickering
And randomly got this one time but have no clue what i did - it was something around trying to make the halo title stay above the player instead of fading away
would be helpful if you share the code
One sec!
And im all good dropping this for the sake of learning, I have a ton more ideas. Just got stuck on what i thought would be simple has me super stumped!
This has been my best version to build off of - simply right clicking, setting your title from the menu, being able to remove your title:
-- TitleAssignmentsMain.lua
-- Function to set the player's title
function SetTitle(title)
local player = getPlayer()
player:setDisplayName(title)
player:Say("Title set to " .. title)
print("DEBUG: Title set to " .. title)
end
-- Function to remove the player's title
function RemoveTitle()
local player = getPlayer()
player:setDisplayName(player:getUsername())
player:Say("Title removed")
print("DEBUG: Title removed")
end
-- Function to create the context menu options
function CreateContextMenu(player, context, worldobjects, test)
local setTitleOption = context:addOption("Set Title", worldobjects, nil)
local subMenu = context:getNew(context)
context:addSubMenu(setTitleOption, subMenu)
subMenu:addOption("Survivor", nil, function() SetTitle("Survivor") end)
subMenu:addOption("Citizen", nil, function() SetTitle("Citizen") end)
context:addOption("Remove Title", worldobjects, function() RemoveTitle() end)
print("DEBUG: Context menu created")
end
-- Add the context menu option when the context menu is created
Events.OnFillWorldObjectContextMenu.Add(CreateContextMenu)
@ancient grail
Enclose the Lua code in these like this: ```lua
My Lua code
```
``
--code
``
-- TitleAssignmentsMain.lua
-- Function to set the player's title
function SetTitle(title)
local player = getPlayer()
player:setDisplayName(title)
player:Say("Title set to " .. title)
print("DEBUG: Title set to " .. title)
end
-- Function to remove the player's title
function RemoveTitle()
local player = getPlayer()
player:setDisplayName(player:getUsername())
player:Say("Title removed")
print("DEBUG: Title removed")
end
-- Function to create the context menu options
function CreateContextMenu(player, context, worldobjects, test)
local setTitleOption = context:addOption("Set Title", worldobjects, nil)
local subMenu = context:getNew(context)
context:addSubMenu(setTitleOption, subMenu)
subMenu:addOption("Survivor", nil, function() SetTitle("Survivor") end)
subMenu:addOption("Citizen", nil, function() SetTitle("Citizen") end)
context:addOption("Remove Title", worldobjects, function() RemoveTitle() end)
print("DEBUG: Context menu created")
end
-- Add the context menu option when the context menu is created
Events.OnFillWorldObjectContextMenu.Add(CreateContextMenu)
im confused you want to change the name?
No I just want to display another name that is seperate from the players name
Like I Malik set my title as Survivor so i'm Survivor Malik
for somereason it wont let me paste
print("DEBUG: Context menu created")
this will continuosly print btw since outside the option
i cant seem to send my code for some reason sorry you have to type it out, or maybe ill try file
here ya go
whatsup with the emoji?
Hey, I just want to get an opinion for this proof of concept I've slapped together yesterday for a mod handling all things translations. Basically, my main goal was to change translations at runtime whenever getText is called. It works but only for translations that are used on the Lua side (TIS pls expose more stuff to lua in b42 or java modding ๐, or let us use ASSEMBLY OR SOMETHING). Would anyone actually use this/is it worth developing? I am asking this because most of the times I have made proof-of-concepts in the past, either it's a useless idea or there's already a better way to do it. My ultimate goal for this is to provide translations that can change dynamically in the game instead of static from the translation file, but I guess you could really achieve the same thing pretty easily on a per-mod basis (although it gets annoying when say making dynamic translations for a separate mod without this little helper mod)
I came across 3 or languages for mods i was searching, i'm sure people would use it! That sounds insane - great idea
sorry got side tracked so this first lol on the main menu some how
this means you have the mod activated
But that did it!!!!!
Events.OnGameStart.Add(function()
--everything here
end)
this will prevent it from running outside the game
Uh oh hit errors going in - might have put it in the wrong spot? I just dropped in at the end right?
replace the
--everythinh
One sec
Oh wait no i did that! - trying again

then i hav eno idea why its still showing then,, i really dont activate any mods and i test using the host button
I'm having trouble compiling my game after making changes to a specific file. I need help resolving the errors that are occurring during the compilation process. I followed this tutorial to decompile https://github.com/Konijima/PZ-Libraries
There's some free code, once again i dont care if people upload but at least shout out Glytch3r
should I send in #mod_support ?
verify via steam
you mean asking in steam community?
sorry wasnt clear
what I'm trying to do is change a single value in the game files (a mod), but to do that I had to decompile the .class files to .java files. I've done that and changed the value i wanted, but now I have to compile it again to get the .class file to use as a mod on my game, and that's what I'm having trouble doing, compiling it again.
oh sorry if i misunderstood ya, ugghh you might have to wait for someone else to answer , i have no idea sorry
hopefully someone reads this. goodluck
thank you anyway
I think im gonna look at game codes later today and see if you can add weight of containers on a tile added to vehicle weight
Would be so nice if theres a way to do that for furnitures but... probably good starting point for container weight first
Wood fuel idea... probably after 42 relez
is it possible to change the AcceptItemFunction mid game?
Can you change it at all? I am looking at the Javadoc and I think that's a Java function. That means from the Lua side, you cannot edit the Java function; though you can still edit the global Lua function itself like a hook to implement a callback of sorts.
I think I have misunderstood your goal. Can you provide some more info?
I used to it like this scriptItem:DoParam("AcceptItemFunction = acceptItemOnly") on start, which works, but now I need to change it to scriptItem:DoParam("AcceptItemFunction = acceptAny") depends on my Mod Options
Btw I tried this command scriptItem:DoParam("DisplayName = Sample") and it doesn't work so I figured DoParam does not work mid game but I'm not entirely sure
You should look at how ItemTweakerAPI does it
Are there any sane people that use getText() on the server-side of lua? If so, why? I see the game does this too, but why would the server need to know translation data? Any info is good info!!!
I does not work on ModOptions saving. I think it only works on this Events.OnGameBoot the TweakItem function adds your item to the TweakItemData which is altogether updated using DoParam during OnGameBoot
that would make sense as I only ever used TweakItem in OnGameBoot event
if you use DoParam like they did and it doesn't work, I have no idea how else to do it sorry
hi so im making my own mod that depends on VFE and VFE case ejection and i havent completed it yet but ive tried loading it into the game and it gives me errors whenever i try to reload by pressing R, open map with M and i cant open the craft menu at all. Does anyone know what my issue is >.<
im new to modding if that helps ;-;
Can you share the console.txt file that is in your %UserProfile%\Zomboid folder?
That file holds the latest console log output so if you have played separate sessions in-between the time you had errors and now then it wouldn't hold any useful info though. (If this is the case, maybe you can try replicating the error in game and then posting the log file)
Also you probably want to run your game in debug mode whilst developing a mod (helps solve some errors better) among other useful features. To do that you can just specify the launch parameter -debug in Steam under Project Zomboid's game properties.
ya
I have nothing exact but Super Survivors may have caused it, so disable that to test. Also there are a lot of errors relating to UIManager.update which implies that either the vanilla game's UI or one of your mods' UI is causing error a lot.
I'd recommend verifying your game files in Steam just in-case as some vanilla files are causing errors (doesn't mean it is the cause specifically)
please lmk if the errors come back after verifying your files
ok ty!
i managed to get the item i added with the debug menu so thats a plus :D
yeah it's pretty helpful for testing mods
Also I am going to go on an unrelated rant (not about you) and say to everyone who prints debug stuff to the log: PUT A DEBUG MODE CHECK IN YOUR LOG FUNCTION FOR THE LOVE OF GOD
not every single regular user and the resulting person who has to read that log to potentially fix an error that a user had wants to see a message every tick saying "ontick" or something similar xd
so when i press M its giving me an issue in client/ISUI/Maps/ISWorldMap.lua
yeah thats a vanilla lua file which is not usually where errors come from
thats why I said verify files first because sometimes it just does that idk
but errors in vanilla files can be caused by mods too, it's just that the stacktrace doesn't tell me where the error really originated from
the closest thing I got from the stacktrace was that super survivors created player data and an error in a vanilla file was caused because of that somehow
ty for being so helpful im not the best at coding ๐ญ
also btw I've seen someone fix vanilla lua errors by just deleting the vanilla lua folder (in C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media) and then verifying the files again
the folder you delete named Lua will download back when verifying the files, it's only that sometimes Steam is weird when handling files like workshop mods and even game files
oh oki ill try that now verifying didnt fix it 
though if you don't have a lot of mods enabled, you can always disable one by one and see which one causes it
i think its mine cause it works fine without my mod :(
but if you have any mods changing the crafting ui or creating their own ui, one of those would probably be what causes these errors
wait, does your mod do anything with crafting recipe/crafting/anything ui related?
ummm my mod adds a crafting recipe idk if that would be it
sned recipe pls
gulp
that would probably be why
oki oki
I probably should have asked for your mod's purpose instead of assuming that you had no errors (which it is fine to have btw, everyone has to learn somehow)
i have no idea if i did this right i basically looked at other recipes from the games file and worked off that
btw do you use an ide for editing code
if not (or you don't know what ide is) use visual studio code
it will save you 1 billion headaches (well not that much but it helps especially for writing lua)
but its better than notepad
notepad++ is alright too but thats so old school today, I used to use notepad++ back in like 2011 lol and im not even that old
its the equivalent of comparing like a nokia to an iphone kinda sorta not really but my point still stands
are you planning on doing any lua related stuff?
ummm all i really want to do is add a few items and crafting recipes
and animation if i need to
okok
I assume the Recipe.GetItemTypes.SharpKnife function you have exists?
like does your or another mod define that?
ummm it was in the VFE recipes
im not actually quite sure whether you can reference to other mods' lua functions in your recipe
ohhhhhh
so idk if you can or can't do that
so do i re-write it with all the item types that can be used?
no its my own
ok nvm
wait sry the recipe.getitemtypes.sharpknife was in the game recipes
I think I've done like 2 recipes ever and I already forgot how I wrote them so I am trying to like recollect my skull
ok thats fine
๐ญ
so real
because I do lua more than recipe
thats no excuse for me tho!!!
python is really similar to lua and is actually a really great language for all the hate it gets lol
ye i thought it was similar
do you think the issue is do do with using matches in the recipe?
like cause they have an amount reamining bar?
idk if that would cause an issue
you dont have a comma after the keep line
I really hope thats not the issue LOL
LMAO
this is why vscode can be sometimes useful
if thats the issue i have no hope in finishing this mod ๐ญ
dont say that, you're at a natural disadvantage already for using notepad lol
its like playing hard mode but for developers
and the comma after result to
it took me a while!!
other than that, the only two issues I think can be (and im not even sure of them) are: possibly using module base could do something wacky, or the weird indentation of the recipe
to show you an example recipe from vanilla game:
recipe Make Stake
{
TreeBranch,
keep [Recipe.GetItemTypes.SharpKnife]/MeatCleaver,
Result:Stake,
Time:80.0,
Category:Survivalist,
OnGiveXP:Recipe.OnGiveXP.WoodWork5,
}
loool
๐ญ
in vscode, I'd recommend the zedscript extension for recipes
on the left side bar you can find the extensions menu
once you install that, go to the bottom right of vscode and click "Plain Text" which is the file type that vscode detects and change it to zedscript
it wont change the actual file extension but it will change the highlighting and syntax checking stuff that vscode does
also I did notice
your item has a space between it
use underscore or camelCase like item primerPowder or primer_powder
omg
and your result in this image is primer_powder
i use primer_powder somewhere else
ill try it now tysm!!!
niceee
also make sure you have a definition for the static model in your models_items file too
the game does it like this:
model PaintTinGreen_Ground
{
mesh = WorldItems/PaintTin,
texture = WorldItems/PaintTinGreen,
scale = 0.4,
}
im using the green paint can model as example
I couldn't help but giggle
๐ญ
ty wise code lady
IM NOT THAT OLD

i swear
Anything beyond 25 and you're old, just like me
I meant wise like smart ๐ญ
hehe im 18 so STILL NOT OLD
just because I used the equivalent of "back in my day" lol

I think being old is an achievement kinda even if it might suck because you're constantly reminiscing on when you were a child
its like "congrats you haven't been hit by a bus" or somethihng
lol
im teying to find a box of matches to test it

you can give yourself item in debug menu ๐
Very apt description
the cons are a separate list though
like you have to pay rent if you live on your own
oh ye
Yes
once again ty so much!
Don't get me started, we'll be here all day
no problemo, feel free to ask me anything thats hopefully not recipe related because I suck at recipe stuff but also im sure you'll be fine so long as you look at vanilla game stuff too
WIOOOO
also has anyone reworked the different ui elements yet? like crafting, moodles, etc
I am planning on writing a UI for moodles so I don't have to deal with the hardcoded Java moodle ui and it's trash (and so it works with another mod I am working on)
but I'll probably have to do it eventually to other uis ๐ฆ
icon time
ty โบ๏ธ
it's
ive made it so idk why its not there ๐ญ
whats the file name of the icon and where did you put it?
its item_primerpowder
and its in the same mod folder but in a different section called textures
yourModFolder/media/textures right?
yes
do i need .png at the end
I am not sure if the extension matters but I've only seen vanilla and other people use PNG
not there, no
hmmm
I thought you might need to put it in a texture .pack file but I was testing with icons on my first mod and I did it exactly like how you are doing it
does the item_ bit need a capital I?
Icon = Item_ToothbrushPink in the file and the file exists under mod_folder/media/textures/Item_ToothbrushPink.png
you can try it, thats what I did and what vanilla game does
oki oki
I'll be surprised if that is the issue but you can never know these days
sometimes it's like you think you have it figured out but no it's some random issue on the other side of your mod or something
Think both a moodle api mod and a modern ui mod exists
I did see spiffUI which is interesting
but most moodle ui changes aren't actually rewrites of the original but just a retexture of the moodle icons
I need to redo the whole thing using Lua for me to get translations working the way I want them to
but it is fine and I don't think it will take much to do that so I am not worried
didnt work but thats fine for now
rip sorry, I actually have no idea
oh wait I do have idea @simple patio
Remove item_ before the name of the texture in the item script file
so instead of Item = Item_SomeItem you have Item = SomeItem
oki
sorry I dont know why my brain up and left
this is my calling to sleep, but I will respond on my phone if I am pinged lol
here?
omg im sry if im keeping u up
no you aren't its fine, I drank a bucket load of coffee when I woke up lol
ty!
โ
TYYYYYYYY
@grizzled fulcrum Moodle Framework, UI mods are probably just retex. Apologies 
beat me to it
attempted index of non-table on line 21... can anyone help?
I would drop the events. prefix to see if it works without it
hey guys, does anyone know how to add custom animations when doing a recipe? (or, well, how to make a custom action with a certain outcome with a custom animation)
Good afternoon. I have a desire to make mods for this game, but I'm at a loss and don't know where to start. Can you tell me where is the best place to start on this path? Thank you in advance
If we take a look at recipe "Saw logs" it has : "AnimNode:SawLog," So youre intrested in this line, add it to your recipe, then if you were to look at where this Anim is by searching ctrl F on pz folder it would lead you to ProjectZomboid\media\AnimSets\player\actions, but i belive aything from AnimSet should work, but i dont really remember to just to make sure you could copy file youre intrested in and put it in actions folder in your mod (As im not sure if recipes are tied only to actions folder)
i... don't think i get it-
Thats how you would use already existing animations from game.
You want to add animation (you did not state if custom one so i assumed vanila one). You add line "AnimNode: animation of your choosing" to recipe
And you can find those in media>Animsets
Then you need to save custom animation in anims_X > Bob and create own XML file in animsets
Rest is the same
i think i get it... maybe
what about moodles? can we have moodles during a crafting recipe's time? (not when its finished but during the recipe, or upon activation of the recipe crafting)
I belive you could alter character stats with lua during crafting, unless you aim for custom moodle, then i have no idea since i've never touched those
Events.EveryTenMinutes.Add( function()
-- Your code
end)
Also you can ask the player object if its in a room directly
player:isInARoom()
You also should not check this against nil
isInARoom() returns a boolean, true or false, and neither of those equal nil, so that check will always be true.
anyone know if there is a way to reference a line guid from a recorded media file in lua. trying to make a vhs i created award exp for a custom skill i added to the game.
Does anyone know if there is a way to force a container's item list to update from the server to the clients?
Does anybody know how I could potentially replace the gas mask's model with a custom model?
I personally find the S10 not fitting for the timeframe and loacation
Im wamt M40 :3
Alright thanks!
Hello, I'm having some issue overriding the base game recipes. Is there something special I need to do? I've added the "obsolete:true,", and then added a new recipe with the same name with the "Override:true," and it doesn't seem to pick it up.
Also, is there a way to reload the script .txt files without restarting the game?
Hello, everyone needs help.
You need to write a simple test code that will be in the skills menu ( PerkFactory) and write 2 skills can you help?
error:
function: addNewSkills -- file: YourModName.lua line # 6 | MOD: MyNewSkillsMod java.lang.RuntimeException: Object tried to call nil in addNewSkills at se.krka.kahlua.vm.KahluaUtil.fail(KahluaUtil.java:82) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:973) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139) at zombie.Lua.Event.trigger(Event.java:64) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65) at zombie.GameWindow.enter(GameWindow.java:753) at zombie.GameWindow.mainThread(GameWindow.java:491) at java.base/java.lang.Thread.run(Unknown Source)
Github copilot just informed me that I stole my own code and provided links to every single modpack on github that contains Equipment UI 
๐ญ
lol what
Interesting to know Copilot does that
I've never used it
I think someone answered this at first,but you need to add the callback to the event like:
Events.EveryTenMinutes.Add(events.EveryTenMinutes)
Since you define your function in events table and not global space
hello fellow modders
I got it figured it out, but thanks!
Only thing I need help with now is making it so you get bored while outside... could anyone help?
you can get if player is outside by doing player:isOutside() I think
what I'd do is in an EveryOneMinute event callback, check if the player is outside and then if they are add some boredom
if isOutside doesn't work for some reason I guess you could do player:getCurrentBuilding() == nil or something
That's what I'm doing, I was curious if there was a way to slowly increase boredom instead of just +1 +1 +1, do I make sense?
Though I doubt I'll even get more than 10 downloads on my mod lol
wdym slowly increase?
if you want to increase boredom inbetween every in game minute, you could use OnTick event but I'd highly recommend NOT using it
if you want the boredom increase to be exponential you can do a lot of math stuff in Lua to calculate your new boredom value from your current one
Okay, guess Ill stick with EveryOneMinute then! Any reason why not to use OnTick?
it gets executed every in game tick. A tick iirc is usually one frame so onTick on the client end at 240 FPS is 240 times a second
where every in game minute is just one second irl I believe no matter your frame rate
I am probably wrong on some of that someone can correct me but that's what I believe, unless it's like minecraft where there is a static tick rate
tl;dr it's not worth the performance loss of constantly calling the functions to change boredom level in ontick event when you can do literally everything you would need for that in EveryOneMinute
doesnt a lot of funny stuff happen when you have fluctuating framerates and then you tie stuff like that to the framerate
hmm
still a lot of simple vars. i guess its not perfect
I am probably wrong and it's probably got a tickrate like minecraft
but still even if it does say 60 ticks per second, you're running your code 60 times a second for no valid reason
in his case, updating boredom 60 times a second which has 0% purpose
yeah i know most games usually tie it to physics
when you wonder why your mod isn't working and then you spend 30 minutes trying to debug only to realise you forgot to enable it 
Literally me, but with the live workshop version vs the dev version
you should set up a cachedir with your pz so you dont have to juggle both
thats what I do
Whats that?
I have cachedir for development so my mod is a symbolic link to the repository and then my main game (in %UserProfile%\Zomboid) has my mods that I play with normally that I also subscribe to my mods too
its basically a separate %UserProfile%\Zomboid for whatever you want it for
So I have 2 technically, one is the default one that is used by everyone and the other is for dev and it's in C:\dev\Zomboid and thats where I put my mods when developing stuff
you can use launch param -cachedir=C:\dev\Zomboid like that
Interesting, but my mods are all in the Steam workshop folder, so changing the Zomboid directory wouldn't really help me.
If I used /Zomboid/mods/ though, this would be a great tip
Anyone know why the game is telling me I should put an additional "end" somewhere in here?
else if
it's one keyword elseif
you're basically declaring a whole new if statement on that line with else if
and since else wants an end statement
Lua thinks you are doing this:
if blah then
bodyDamage:blah
else
if playerObj:hasTrait(blah) then
blah
end
-- no end here !!!
I hope that helps
Thanks! I learned something new today 
if it helps you, it helps me!
i wish someone could make a mod for superb survivors to work in multiplayer
does anyone know if the prefix in the translation is required to come first before anything else??
example:
IG_UI_EN = {
IGUI_health_Overall_Body_Status = "Overall Body Status",
TESTING_IGUI_health_Overall_Body_Status = "Testttt",
}
it seems the game cannot find the test translation but it does with the former one.
nvm the prefix is infact required to come first
does anyone know the differences with PlayerObj, Player and Character?
you mean like
playerObj:doSomething()
player:doSomething()
character:doSomething()
```?
yeah
if so, they are just variable names and the class of the variable is a IsoPlayer
My game breaks when using PlayerObj and Character to use the :HasTrait("Example") and with Player it just doesnt work
ramos I'd recommend using visual studio code (text editor/ide and is good for lua) and then install this: https://github.com/asledgehammer/Umbrella?tab=readme-ov-file#setup
I got VS Code, though ill get this extension!
Sorry ive just never had a coding class before and I just learn by people helping me or looking at others code
with this extension, it will show you like:
-- extension will show player variable as IsoPlayer
local player = getPlayer()
-- When you go to access player, it will show all it's methods like
player:[[highlighting will show here]]
what are the playerObj/player/character variables actually set to?
if you know, that is
Ill just share the code I have for one of my traits real quick
I changed the if character just now to try and see if it worked instead of player
Though I just noticed the "local player = get player()" just now whoops
maybe I should change that too
character here should be showing an error, make sure you have Lua Language Server extension by sumneko and the umbrella I showed above (the link I linked to will explain how to install it with vscode)
wait do oyu have character as a variable outside of that function anywhere??
but it should be player:HasTrait("trait") anyway
Is there seriously no way to add my own translation files like translate/EN/TEST_EN.txt?
I tried and I can't get it to work so I assume not, but thats so dumb if I have to override the vanilla files just to add any translations
I guess I could just shove it all into UI_EN.txt but I really hate that
Keeps giving me this error wheniver I try to use the command Lua: Open Addon manager :(
oh uh
you might need git?
https://gitforwindows.org/
if you already have it lmk
it's either git or for some reason node.js even though I don't have node.js and it works fine on my end lol
Nope, thanks!
Did you ever get your issue figured out?
wat issue
This one
no I don't think there's a way around it, so I just packed everything into one file
It's not like I have to look at the translations often thank god
ah project zomboid go and just hardcode everything grrrrrrr yet another UI I have to rework in Lua if I want to do anything productive :l
I hate how stupid coding makes me feel
I spend an entire 3 hours figuring out why my trait applied even though I didn't have it
It's because I forgot to check if the character actually had the trait
At least not everything is hardcoded in Java...
https://www.youtube.com/watch?v=sM2pw7T0QU0
local maxRange = weapon:getMaxRange()
local scopeRange = scope:getMaxRange()
local scriptRange = scriptItem:getMaxRange()
if (isShotgun(weapon)) and (maxRange ~= scriptRange) then -- NERF SHOTGUN RANGE
weapon:setMaxRange(scriptRange)
DebugSay(3,"Scope Disabled "..tostring(weapon:getMaxRange()))
-- elseif (not isShotgun(weapon)) and (maxRange < scriptRange) then -- RETURN IF RIFLE
elseif (not isShotgun(weapon)) and (maxRange < scriptRange) and (weapon:getModData().Trajectory ~= "CQB") then -- RETURN IF RIFLE, ADD CQB CHECK
weapon:setMaxRange(scriptRange)
DebugSay(3,"Scope Restored "..tostring(weapon:getMaxRange()))
end
elseif (scope == nil) and (isShotgun(weapon)) then -- RETURN SHOTGUN IF NO SCOPE
local maxRange = weapon:getMaxRange()
local scriptRange = scriptItem:getMaxRange()
if maxRange < scriptRange then
WeaponReloadScript(44)
DebugSay(3,"Reload Script")
end
end```
Hello guys, this one is from Gunfighter2.0, nerfing shotguns' range gain by scope.
but the problem is, when I attach choke and attach a dot sight on a shotgun, this script kills the range gain from choke.
so I'd like to modify this script in a reasonable way..
like, let the gain from choke maintained, and limiting range gain from scope to 1.
since full choke's range gain is 2, setting shotguns maxrange gain limit cap to 3 would be working I suppose?
the problem is how to do it with this script.
since I know nothing about lua, can you help me out?
one sec
so a sight increases range
and choke increases range too?
yup
so attaching only a choke works alright
but if I attach both, then due to this script, choke's range gain is deleted
I guess sights should rather increase aim speed and hitchance but it's gonna be too much of work to change all the numbers from every sight/scope in the mod
so I just wanna change the script and call it a day hahah
unironically this script doesnt use scopeRange anywhere in what you've posted so I assume either you didn't post the whole thing or they just left it in?
I have no clue how the mod works
I tried to check those factors from attachments section
but it's like this
item Sight_MicroDot
{
Type = WeaponPart,
DisplayCategory = WeaponPart,
DisplayName = Trijicon RMR-2,
Icon = Sight_MicroDot,
Weight = 0.28,
WorldStaticModel = W_Sight_MicroDot,
WeightModifier = 0.28,
HitChanceModifier = 4,
MaxRangeModifier = 0.4,
AimingTimeModifier = 6,
ReloadTimeModifier = 4,
AngleModifier = -0.002
can you show the item for a choke too?
item Choke_Full
{
Type = WeaponPart,
DisplayCategory = WeaponPart,
DisplayName = Choke (Full),
Icon = Choke_Full,
Weight = 0.05,
WorldStaticModel = W_Choke_Full,
WeightModifier = 0.05,
MaxRangeModifier = 2, /* TIGHTER PATTERN */
AngleModifier = 0.05, /* TIGHTER PATTERN */
DamageModifier = 0.5,
PartType = Canon,
Tooltip = Tooltip_Choke_Full,
MetalValue = 1,
missed this 3 lines
also can you send the whole file for where you got this code?
It's only that context matters
that is same file lol
I tried to do this with chat GPT lol
so the previous one has changed script
which wouldnt work in-game most likely
o
chat gpt's not that good yet unfortunately
this mod has like 8000 lines in one file
I'd die if I wrote this myself
yeah it def looks like a long work
it's not the contents of the file, it's that they put it all into one file ๐
eh hahah maybe they didnt want to make many .lua files? or
maybe they have been adding one by one and got massive in the end? not sure hahah
You could also inform the mod creator of the problem and see if they fix it
That way it fixes it for everyone else using it too
true that, I'll still write a fix real quick tho
ahh right, that's a good idea
but on the steam workshop page, the comment section is closed and I can't see a way/page to report something or post a suggestions tho
I honestly have no idea what the code is doing (it's so bad to read)
can you try modifying the first weapon:setMaxRange(scriptRange) to something rediculous like weapon:setMaxRange(scriptRange + 100)
uhh idk the line number but it's like this:
can I just put + 100 after the scriptrange like that?
techincally yes but I just want to see what happens
it will give me a better idea of what the hell setting this range does and if the range is scriptRange+100 even after putting on attachment
because there is a scope attachment check at the start
but no choke attachment check anywhere
okay I will check it in-game right away
hmm it does not change something
the shotgun's original range was 12, for the test
and after attaching a sight on it, the range became 10
ah actually
choke was attached before I attach a sight on it
so 10+2 -> 10
so the range doesn't change at all even if you use no attachments/only scope/only choke/scope and choke?
I mean it doesn't change like +100
although I think there is a range cap of 10 so that might be
yeah it didnt change the value at all
so 10 is the original range of that gun
and due to the script(that we are trying to change)
it can't be over 10 even if I attach a choke which has +2 range, while having a sight attached on the shotgun
I suppose the shotgun range nerf script rollbacks the range
if it was not a shotgun, the sight's range modifier will be applied
and right now, with this shotgun, the script overrides another attachment's stat(choke)
while having a sight on it
can you go into gunfighter options and change the debug log level mode whatever they call it to debug or whatever the lowest levle is
so just the shotgun, range = 10
shotgun w/ choke, range=12
shotgun w/ sight =10
shotgun w/ sight and choke =10
wait so the sight does nothing even on a shotgun?
that is inteded, I see
ok I understand
yeah but the prob is it kills the gain from choke hahah
btw, should I check this out?
yes
hmm I dunno what is debug log level mode..
should I start the game in a debug mode and take a look into gunfighter options?
probably not, it should be a dropdown in the options menu somewhere
idk what he calls it
like are there gunfire settings at all?
in your settings menu I think
wait do you have the name of the mod
ill just test it on my end real quick too
I think I found it
for this, you can find 2 mods in workshop
Brita's weapon mod, Arsenal's gunfighter mod 2.0 I think
dw you dont have to do anything, ill do some test on my end and hopefully figure out what is going on
Evening, anyone know if you can reload the script .txt files without having to restart PZ?
if you're in debug mode, doesn't reloading lua do that?
go to menu: click reload lua, wait and go back into game
Can you reload within the game?
Or do I have to drop back to the main menu and reset lua?
I believe so
Thanks.
Ok, can we override base game recipes?
I've used the Override:true and Obsolete:true properties on the recipes, but they don't seem to stick.
should be able to yeah
can you share an example?
Sure:
module Base
{
recipe Rip Clothing
{
[Recipe.GetItemTypes.RipClothing_Cotton],
Result:RippedSheets,
RemoveResultItem:true,
InSameInventory:true,
Sound:ClothesRipping,
Time:100.0,
AnimNode:RipSheets,
OnCreate:Recipe.OnCreate.RipClothing,
OnTest:Recipe.OnTest.IsNotWorn,
Obsolete:true,
}
recipe Rip Clothing
{
[Recipe.GetItemTypes.RipClothing_Denim],
keep [Recipe.GetItemTypes.Scissors]/[Recipe.GetItemTypes.SharpKnife],
Category:Survivalist,
Result:DenimStrips,
RemoveResultItem:true,
InSameInventory:true,
CanBeDoneFromFloor:true,
Sound:ClothesRipping,
Time:200.0,
AnimNode:RipSheets,
OnCreate:Recipe.OnCreate.RipClothing,
OnTest:Recipe.OnTest.IsNotWorn,
OnGiveXP:Recipe.OnGiveXP.Tailoring01,
Override:true,
}
}
I'm just trying to remove the Base Rip Clothing as test.
I load this file, and xp action doesn't get set, nor do I see it in the different category.
Correct.
I can get it to add the addxp via lua... but I'd rather just use a recipe than go the lua route.
Plus, I can't add new keeps via Lua from what I can tell.
wait which one
if you are removing it completely, I will have to find out why
if you are trying to replace vanilla one with your own, remove Obselete
oh wait you have 2
only include your one and have override:true but not obselete
Yeah, I've tried just using the second entry (the one with Override:true), but that doesn't work either.
huh
I will have to look at that more in a sec, rn im trying to fix another issue with someone else
@jaunty isle can you tell me how to attach teh sight/choke?
I must be doing it wrong lol
you need to have a screwdriver in inventory!
