#mod_development
1 messages · Page 364 of 1
Mod for the version
Show a screenshot please
And try launching your game with -nosteam as a launch argument
Identical in the other
in 42.13 works
when I remove 42.0 it works aka doesn't display it
Only when 42.0 folder is in it dies
pretty sure I already did that
Why are you using two different IDs ?
Yeah nothing changed
Changed that to see if that was the issue
Before they were identical
When 42.13 works, your mod is already loaded right ?
If you swap to 42.12 then your game tries to load a mod that doesn't exist
No, becuse I reload it
fuck it I remove 42.13

In your mod.info file, remove everything and only keep an ID (the same for both versioning folders) and a name
Also can you tell me which file this is please ? I'm going to make a suggestion to the devs
Because this is a common issue that keeps appearing and it could EASILY be avoided with proper error handling
And after removing everything but id from mod info it doesn't see the mod
You need a name too
It detects it doesn't have a name
hm now it worked
I cahnged nothing
One second
When I added rest of the file in now it fails
And its this file
Oh god
It was complaing about this
😅
becuse version MIn was 42
Instead of 42.0
Told you it was something shitty
How in the fuck that makes the Mod ID fail
Because they don't make proper checks for mod.info files
So if something is wrong, it keeps throwing errors on the mod selector file
And it literally doesn't tell you what is wrong, or if it does it throws it anywhere
Do you think you could send me your whole console file of the issue appearing please ?
Ah already replaced it becuse I restarted the game
Yea figured no worries
BUt this was the whole thing
I want to check the whole console file to see if they throw earliers errors actually
I mean before the selector file error
Yeah, there was one, btu I just couldn't find it in the console
WAs thinking it was the issue, but I just couldn't find the error
Despite it throwing it me in the little box below
Anyway I need to test if the mod works now, it is easy to recreate it tough, just make the version whole number instead of a float
You made it 42.0 no ?
Or 42 ?
42.0 works 42 doesn't
Yeah I said you need to amke a it a whole number to recreate the error
Ah ok
But god dammit, if it can't read version minimum a thing that is a optional value it should just ignore it instead of crashing
the mod selector
I think so
Yup, that why that system is so shit rn
Bcs every single time you have something wrong with your mod.info file it'll throw an error there
so how should I fix it? Should I use another function instead of this one?
You could wait one frame
It actually existed, but for some reason a wrong minversion deleted it
By doesn't exist I mean the variable was nil
“attempted index y of non-table: null” = you're trying to do x.y where x is nil
Yeah, I get that, the issue was just completly unrelated
I knew the problem was with the mod.info
Or suspected it was with the game not reading it
Modding wiki summary for december of 2025
So I want to make a mod that changes the player behaviour similar to the panic mechanic. Which guides and tutorials should I consult?
I‘ve made a few java mods for Minecraft and know a decent amount of python, so I‘m no beginner to coding
ups
What's your goal exactly ?
Based on what you're trying to do it might not require the same tools
As for guides and tutorials, I suggest starting with the modding wiki (check pinned messages)
Ah thx for that
Well our fried group was messing around with ideas that it would be really funny if non-smokers were affected if a smoker uses a cig around them
And they don’t know that I know my way with a bit of code
So coughing, which may lead to slower movement, sprint/run interruption, item dropping etc
Aciidental shooting
You should be able to do fairly easily actually
Yea those are easy to do
What I suggest you do if you haven't already, is take a peak at the following wiki pages:
- Modding - links to a bunch of resources
- Lua (API) - general Lua Java interface
- Networking - explains how to network player interactions
- JavaDocs - lists available functions
Also for your code environment for PZ, the following wiki pages:
- Visual Studio Code
- Umbrella (modding)
Thank you, will do
apparently im wrong so im not actually sure what the error is
maybe check if item is nil as well?
I have a feeling this is user error but can't check atm—seems like it's not a mod.info issue but a directory name mismatch given the code. But maybe this was covered in the discussion, in which case disregard
Would've noted that earlier but I was making food 😄
afaik it's not a general issue with mod.info, most errors are handled
it's persistently always versionmin causing this issue
and it's exactly this mistake every time
I‘ve read the pages you recommended, but I am still confused on how the file structure works. Could you help me out?
I know there’s the template thingy, but I don’t know what files to add and/or remove
Have you read the Mod structure page ?
Anyone got suggestions on vanilla base functions I could use to draw "zones?" (rectangle ones like vanilla allows to draw animal zones) ? Everything I found about keyword "Zone" relates to some model concept while I just want the display client side. "Overlay" seems not the right keyword either.
do you need these areas marked for some purpose or just the visual?
the animal zones are built on top of a framework for adding new zone types but i don't know how moddable it actually is since obviously the game only actually has one type
just a visual feedback client side, I can add /remove anytime (never persists on delog). mostly 2D at character level and possibly 3D if that exists (but I'll handle it some otherway if not)
I think of a colored overlay to apply to a tile, with some alpha if possible, extendable to any tile.
If I create an event in the client folder with a local function that performs a check every hour—for example, adding a trait to the player over time—and once this player has gotten the trait, they no longer need this check event. Can I remove this event? Will it continue to run for other players? This is client-side, right? Or does it not work that way?!
addAreaHighlightForPlayer from LuaManager
Read it again just now, but I'm still confused as to waht file I need. Probably a lua script, right?
Is it possible to set an icon for a recipe that shows the "?" icon?
You need to use Lua yes
Hi guys, stupid question.
I want use setCustomPages(HashMap<Integer, String>) of Literature item, but with this kind of map, java complains because is a kahluatableimpl object, not a HashMap:
local pages = {
[1] = "Day 1: Some text",
[2] = "Day 2: Some text",
[3] = "Day 3: Some text"
}
How could I convert the lua table to HashMap?
I tried to configure the 3 pages of text with this alternative code:
item:addPage(1, "Day 1: Some text")
item:addPage(2, "Day 2: Some text")
item:addPage(3, "Day 3: Some text")
But only the first page is shown, probably an error in my item definition?
item Document
{
ItemType = Normal,
DisplayCategory = Memento,
DisplayName = Document,
Icon = Notebook,
Weight = 0.2,
Pages = 5,
CanBeWrite = true,
}
So I want to start a function once a player uses an item, in my case a cig. how do I do that? there's a lot of events in the Lua docs, but I could't find one that triggers on item use
You'll have to hook to timed actions
Actions by players are handled with timed actions
No these are scripts, so a bit different
Hello wastelanders 
I want to ask when could i expect, in a rough ballpark, how much commissioning a modder would typically range? I have something that i have been wanting for a while, and i have recently started jotting down ideas.
It completely depends on what you're asking
That makes sense. It would probably be just a bunch of items. No modals, or atleast they could all be the same tiny 3d modal.
Here is the first bit i have written down:
I have been wanting to commission a mod for a while. Implants and cybernetics.
some notes in no order:
-made with electronics skill
low tier cybernetics level ~5
can be found in military zeds and poi
High tier only craftable level ~9Perhaps some pros and cons for each implant. Or only for the low tier ones.
banging my head on the skillbook update... The recipes work and the book loads but it does not show the recipes in the book nor can you learn from it. Do the recipes and the book need to be registered?
Oh yeah, I'll drop these here. Notes I made to help me get started modding.
I am trying to make a video series, but it's a lot and take a long time. 🙂
By the way, the context is that I was researching how to make a mod that will allow me to turn all metal into an "iron" item, and then use that iron item to make all metal things. So I needed recipes to smelt (deconstruct) items and to smith (construct) items. I got the idea when I realized we had the Advanced Crafting Core mod, but it just adds the ability to use these tables for more modding, they themselves don't have a use.
That was really cool by that modder. https://steamcommunity.com/sharedfiles/filedetails/?id=2923979345&searchtext=advanced+crafting+core
@wraith fable thx so much!! ❤️
You're welcome!
Those are for B41 tho ?
Also if you don't know about it, check out the modding wiki and the Scripts page
If you want to contribute with some information, feel free to add those there
how can I get the first stage of the overweight (from items in inventory) moodle? (meaning a check for its presence)
playerObj:getMoodles():getMoodleLevel(MoodleType.HEAVY_LOAD)
sorry guys, what would be the folder to save a custom json file? common/media/name_of_folder?
figured it out, teached has become learned... LearnedRecipes... the testmod example still shows teached.
Oh yeah, I only mod for 41. I'm not going to try anything 42 until it's stable. hahaha I run a server and make new mods for them
A json file ? What for ?
Probably the umbrella config
Was wondering about the same, but it automatically suggests a local file path
Anyone know of any reason that I shouldn't "override" a vanilla occupation like this: character_profession_definition base:burgerflipper { CharacterProfession = base:burgerflipper, Cost = 0, UIName = UI_prof_cannibal, UIDescription = UI_profdesc_cannibal, IconPathName = prof_cannibal, }
It works, just wondering if anyone could think of any unintended consequences
I think it should be fine ?
I'm working in a narrative quest mod, this an example of json what I need to config the scenario:
{
"id": "campaign_0001",
"title": "The Disappearance",
"description": "Your sister has stopped answering.",
"steps": [
{
"id": "step_1",
"type": "note",
"text": "The laboratory was evacuated last night."
}
]
}
I want load it with getModFileReader("NarrativeCampaigns", "media/campaigns/campaign_0001.json", false) but the engine can not find it
looks right to me, it might not like the leading /?
sorry, my mistake, my code does not include it
oh, build 42? your mod id needs to be prefixed with \\
Oh, thx! I'll try 🙂
thx @bronze yoke !! that fixed the error! 🙂
hi, do u know how in b42 i can do something like that:
craftRecipe ChmTakeBloodForNextWork {
LabSyringe/LabSyringeReusable=1,
AlcoholedCottonBalls,
Result:CmpSyringeWithBlood=1,
RemoveResultItem:true,
Sound:zReVAC2_Mixing_D_2,
Time:120.0,
Category:Chemistry,
CanBeDoneFromFloor:False,
NeedToBeLearn:True,
OnCreate:LabRecipes_ProcessBloodForAnalysis,
OnGiveXP:LabRecipes_GiveXP_Doctor_1,
}
like RemoveResultItem:true?
or now i can't predicate result item?
just don't add a result
adding item from OnCreate?
outputs are optional in craft recipes, if you don't want a output just don't specify one
whats new on OnCreate in function arguments?
like in old function LabRecipes_CreateBloodTestResult(items, result, player) we have items result player.
ah, don't need it
can u help me with this stuff:
craftRecipe FireHardenSpear
{
time = 100,
NeedToBeLearn = true,
OnCreate = RecipeCodeOnCreate.fireHardenSpear,
OnTest = RecipeCodeOnTest.openFire,
Tooltip = Tooltip_Recipe_OpenFire,
Tags = InHandCraft;Survivalist,
category = Weaponry,
timedAction = SharpenStakeWood,
AutoLearnAny = Spear:6,
xpAward = Carving:5,
inputs
{
item 1 [Base.SpearCrafted] flags[Prop2],
item 1 tags[base:sharpknife;base:meatcleaver] mode:keep flags[Prop1;IsNotDull;MayDegradeLight],
}
outputs
{
item 1 Base.SpearCraftedFireHardened,
}
}
i can't find RecipeCodeOnTest.openFire
can u send it from java?
If I were making a mod and needing assistance, would this be the right channel or would #mod_support be more appropriate?
this is the place but i don't know if i should be helping the cogs
my honest reaction
Hi guys, first time modder here!
I'm trying to make a Nailgun tool/weapon for B42.13.
So far i got it to shoot and i registered nails as a new AmmoType, but as soon as i shoot, i get an error, the game turns back and puts me at the main menu.
i tried looking at console.txt and other log files but i cant really find any errors
try searching for STACK TRACE
yea there is none this time
it seems...
before i was able to fix the issues by looking at the error...but this time im kinda stumped
try 'exception'?
''ERROR: General f:2344, t:1767585517351> ExceptionLogger.logException> Exception thrown
java.lang.NullPointerException: Cannot read field "projectileRed" because "isoBulletTracerEffectsConfigOption" is null at IsoBulletTracerEffects.createEffect(IsoBulletTracerEffects.java:204).''
that'll be it, i remember someone talking about this before but i don't remember what the solution was
it was either here or the modding discord
i'll have a look here
found someone mentioning this projectileRed field, but no solution
what files should i look through if i wanna find the source of the error?
no matter what i do....
i have even tried looking at other structures and still it wont work
is the new version [42] workshop uplaoder bugged?
@broken fulcrum I had a similar issue, I recall that I just moved the mod.info around until it worked lmao
Lemme check someth rq
thank you and i have tried so many ways and areas of moving it
@broken fulcrum Make sure you've got your mod.info in your Common and 42.12 file as well (or 42.13 if you're developing for MP as well)
So in short;
Zomboid/Workshop/Contents/mods/[MOD NAME HERE]
then you would have;
common/(Your main folder, required)- all the other versions for B42
Make sure you have a mod.info in your common and alternative builds
to be more specific, it needs to be in either common or all of your version folders, both is redundant and the one in common won't be used
thanks, but you're probably thinking of sim, he wrote the majority of the modding stuff on the wiki
is there a way to stop a player from dropping/transferring an item from inventory? trying to make a mod where an item needs to stay on the player
if you've done any work on item pages, lore, or anything trivia, you've definitely helped :)
I think marking it as favourite prevents that, so if you somehow force that, it could work
you can set ishidden = true in the item's script if you need it to be hidden in the inventory
Hi! 👋 what is the most effective way to reset lua scripts & items without exit to the main menu?
📖📖📖 Hi everyone -- I'm trying to mod in some custom literature -- I take it a lot of say magazines titles are made with ItemCodeOnCreate.onCreateSubjectMagazine -- unfortunately I can't find the details of this function -- Ideally I would like to make my own book subject -- and within that subject set a bunch of randomly defined titles/descriptions etc
By going to the main menu
Check the Java
thx!
You can hot reload scripts but I'm not sure how good it is, and you can hot reload Lua but it involves writting your code by respecting some rules
Do you mean decompiling the game code?
Yeah
public static void onCreateSubjectMagazine(InventoryItem item) {
Magazine magazine = item.getMagazineSubjects().isEmpty() ? (Magazine)Rand.Next(Registries.MAGAZINE.values()) : (Magazine)Rand.Next(Magazine.getMagazineBySubject(item));
setMagazineName(item, magazine.translationKey(), Translator.getText(magazine.translationKey()), getDate(item, item.hasTag(ItemTag.NEW) ? 1993 : 1970));
}``` from scripting/logic/ItemCodeOnCreate.java
Ah ok -- I think the functionality I am after is bit too low level for my comfort -- I don't suppose its possible to patch an equivelant "e.g. onCreateSubjectFantasyNovel" at the higher lua level?
I don't know about creating custom literature, but that seems to be the function triggered by OnCreate of the item, so you can just create similar function in lua and call it the same way. Have you checked if you actually need a new fuction for it, or can you just add them using the vanilla system?
im having this same issue, no matter what i do the mod.info file isn't detected despite recognizing it when i first uploaded the mod to the workshop :(( originally i had to move the info file in and out of the common folder for it to work, however even doing that now it's still seen as being missing
is there something wrong with my branching? each and every version file has the same contents as the one shown in the third screenshot
sorry if im missing something obvious!!!!! <3 i'd appreciate any help
That 42.12 and other version folder is wrong, has to be like common in you folkpunkpz
thank you! i was able to update it now but it still doesn’t appear in the ingame mod manager, ive subscribed to it on the steam workshop and have restarted both the steam client and pz entirely
im currently on 42.13.1, the 42.13 folder should work this version right?
Yes
add a folder to the folder that had the builds titled “common”
leave it empty and restart
its 2:15 AM over here, i hope my idea works @summer osprey otherwise you are welcome to slay me in my sleep
returning that it's missing a mod.info file now 😔
is there a list on how to write item and crafting definations?
Yes
You shouldn't sub to your own mod
I invite you to read carefully the Mod structure wiki page if you haven't
im going based off of this, am i missing something?
Reread carefully the top folders in the provided example
Your versioning folders are in the wrong folder, and also you're missing a common folder
It's mandatory
oh thanks! i didn't see that the versions folders were supposed to go in the mod folder, it works now :3
Is there a way to post a message from the system or server so that the discord bot will pick it up? Bonus points: even when a player isn't logged in? Use case is for posting about server restarts which may happen even if there isn't a user on
I mean you could hook a cron job on server if you have remote access, are restarts scheduled at specific times?
Or a script that does the same thing on restarts. Create a webhook in one of the channels and trigger it from there.
I was looking for a way to send a "system" message via the vanilla built in bot, but I think it will only pick up what is typed into /all by a player.
Ah mb
nw, appreciate it 😄
what's mean mode:mixture into craftRecipes?
-fluid 0.75 categories[Water] mode:mixture,
https://discord.com/channels/136501320340209664/1186494285588222104 I don't think it's possible, not sure if this changed recently
I uhh, have literally no idea what is going wrong here
I am trying to add some items into the game with a mod, but it is not working
I then open the item spawning, this menu pops up instead
Seems the mod is not updated to 42.13 and have its Type changed to Itemtype?
Its your mod OR already existing mod
existing, apparently it does not work for some reason, and it is fairly small
Hell yes it worked! thankks!
HI! does anyone know anymods where you can set starting items or like kits? im trying to find one and really dont want to build one if theres already one out there
There’s a sandbox setting for that!
If you mean the starter kit option, that just enables a starter kit with fixed items whereas it sounds like they want a customizable one
Ah right, SpawnItems—I thought something like that existed too but I couldn't remember
I am not sure if this is the right channel (or even discord) to ask, but is there a good place to ask someone to help/make a rather specific but easy mod for B41?
Anyone know where I can find the projectzomboid.jar? I've been trying to compile one of my java scripts but I cannot for the life of me find it.
Same folder as the zombie folder
It's not in there at all for me
Bearing in mind, I'm on B41 so I'm not sure it's actually here?
So I can't compile java scripts in B41?
Does anyone here have that jar?
I'll even take a B42 one at this point, I just want to compile this java
Pretty sure that won't work lol ?
I'm spit balling ideas rn 😂
The Zomboid Decompiler creates that jar I believe actually
It does?
I think so yea
mine didn't seem to do that when I ran it, just said it couldn't find the jar
Uh ?
The decompiler ?
Yeah...
The Zomboid Decompiler ?
You can use an older version of ZomboidDecompiler
Check the README on the GitHub page
If you're just trying to compile idt you necessarily need to decompile, although I'm curious as to what you're doing if you wrote Java without having decompiled first
I'm hoping to be able to show it off very soon!
The game won't have a way to just load it unless you tell it to, which is its own thing unless you're using a loader
Alright, I'll trust you know what you're doing then lol
The unofficial modding discord has a process for commissions; the link is on the wiki somewhere I believe
What, if anything, needs to be included in a mod in order to add a crafting recipe other than a script for the recipe itself?
Nothing
Besides custom items if that's what you want to make
Nope, just trying to add a new recipe to take apart a common item. Is it better to make a separate script file for the new recipe or just append it to the existing recipes.txt?
You shouldn't do anything like that, you should always make your file
Okay, I figured as much. Thanks!
Hello everyone, I've only made one mod and it's just a zombie texture. Needing help on where to get started on making modded outfits.
I just need to make zombies, or a vast majority, spawn without clothes. It's for a 28 years later modpack I'm making.
I decided to overwrite the challenge scenario for the last stand accumulator and just ignore the fact that vanilla saves won't be able to do anything with it
however now i am presented with the challenge of what weapons i want to make available for purchase, and what levels i should make the skills so it's more fun than killing 64 zombies with level 3 axe
might want to check how this mod does it
https://steamcommunity.com/sharedfiles/filedetails/?id=3281144566
im assuming it removes the outfit tables but ive not looked at the code
actually i just looked at the mod its based on which replaces all of the zones manually but this might work instead
for zoneName, zoneTable in ZombiesZoneDefinition do
ZombiesZoneDefinition[zoneName] = {{name = "YourOutfit", chance=100}}
end
save this as a .lua file with a unique name in media/lua/shared in your mod
and then you'll also have to make the outfit in clothing.xml
https://pzwiki.net/wiki/Clothing.xml
Thank you for the help, it's very much appreciated!
For the clothing.xml file would that also be in the shared folder?
no it should be media/clothing/clothing.xml
with that exact name
Okay, so this is what I added to my clothing.xml file, I'm just testing it with females zombies atm:
<m_FemaleOutfits>
<m_Name>28Years</m_Name>
<m_Guid>eb2209fa-81d3-4083-95f2-449ab185b682</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
</m_FemaleOutfits>
Loaded into game and the females appear to still be clothed, is there a part of the code where I have to specify no clothing?
put the outfit name in this
idk if the code actually works though
I found the mistake, I didn't rename the .lua file to ZombiesZoneDefinition, I gave it a random name mistakingly.
Loaded back in, both the male and female zombies are spawning in missing a lot and sometimes all of their clothing, but a majority are still wearing random shirts, underwear, bras, etc
No your code did work, it was my bad. I'm wondering if there is a special GUID for no clothes at all.
As of now, this is how they're spawning
There's a few mods that allow all of that
I found one called Custom Zombie Outfits [B42+] but the zombies in that one spawn with underwear/bras on.
Regardless, I still want to make an independent mod that would pair up with my 28 years later texture pack.
there's a separate script that spawns underwear but idk why there are clothes zombies in that screenshot
<m_MaleOutfits>
<m_Name>Naked</m_Name>
<m_Guid>836531ac-7e02-4ede-8545-5ac987df51ba</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
</m_MaleOutfits>
<m_FemaleOutfits>
<m_Name>Naked</m_Name>
<m_Guid>836531ac-7e02-4ede-8545-5ac987df51ba</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
</m_FemaleOutfits>
It's just a regular outfit with no clothes in it.
But! there is also this in Java...
Look into media/lua/shared/Definitions/UnderwearDefinitions.lua and decompiled java zombie/characters/UnderderwearDefinition.java to fiugure out what is going on and if you can modify the UnderwearDefinition lua table to get rid of underpants. Might be enough to just do
UnderwearDefinition.baseChance = 0
I will paste this into my clothing.xml and let you know what happens!
no no no
Oh
don't paste that into your clothing xml, it's already a vanilla outfit
If you want naked zombies, you can spawn those
But underwear gets added separately, so make a lua file in a shared with just
require "Definitions/UnderwearDefinitions"
UnderwearDefinition.baseChance = 0
and see if that stops underear items from being added. (it will throw an error if it loads before the vanilla definition file, butthe require line shoudl avoid that.)
I got the underwear working thankfully
I do have a code I'm trying to use to make it only spawn naked zombies from vanilla like you said but it doesn't seem to be working
this is what I have
1 moment
for zoneName, zoneTable in ZombiesZoneDefinition do
ZombiesZoneDefinition[zoneName] = {{name = "naked", chance=100}}
end
This is in my ZombiesZoneDefinition.lua
So you want to remove everything in the vanilla table and just have naked zombies?
Yes sir/ma'am
Sadly the above code did not appear to work. Having tested just now, about 60-70% of zombies were fully naked, but I still got a lot of shirts/pants/occasionally whole outfits on my zombies.
For reference. Progress has definitely been made though.
I think your lua is slightly wrong and is no replacing teh table entries properly, just a minute...
I can't test anything because my half-update broken mod is killing the entire game...
But I think you want to do for i,v in ipairs(table) to start...
This is actually one of the situations where Chat GPT is good. Tell it "I have a lua table like this (paste sample) and I want to iterate through and change teh content of every entry to this (paste example location with 100% naked)
It might not understand zomboid, but it's learned a lot of basic syntax for common languages. (And I assume any other LLM will do a simialr thing)
Thank you! I will update on what GPT says.
I was trying to use Gemini earlier to make all zombies spawn with specific hair models but unfortunately that went nowhere.
Hi guys! 👋 I'm trying use i18n, but it seems not work. I have a media/lua/shared/Translate/EN folder, with a Campaign0001_EN.txt file with this content:
Campaign0001_EN = {
Campaign0001_Step001.Scene001.say = "Where is Emma?"
}
And try to use it with: player:Say(getText("Campaign0001_Step001.Scene001.say")), but translate not work and Campaign0001_Step001.Scene001 is said instead
Probably I'm using it in a wrong way :/
looks like '.' is not a valid character for translation keys. the game tends to use '_' for separation.
I'll try!
I tried with this key: Campaign0001_title = "The Disappearance" and this sentece: player:Say(getText("Campaign0001_title")) but it doesn't work 😕
may be player not determined
player is telling: "Campaign0001_title" on screen, insted "The Disappearance", seen something about translation 🧐
try change translation file Campaign0001_EN.txt => IG_UI_EN.txt
and contain
IGUI_EN = {
IGUI_Campaign0001_title = "The Disappearance"
}
@tropic cypress IGUI_Campaign0001_title = "The Disappearance"
Damm it 😓
That's my structure:
└───Contents
└───mods
└───NarrativeCampaigns
├───42
│ └───media
│ ├───campaigns
│ ├───lua
│ │ ├───client
│ │ ├───server
│ │ └───shared
│ │ └───Translate
│ │ ├───EN
│ │ └───ES
│ └───scripts
└───common
└───media
└───campaigns
And IGUI_EN.txt:
IGUI_EN = {
IGUI_Campaign0001_title = "The Disappearance"
}
and IGUI_ES.txt:
IGUI_ES = {
IGUI_Campaign0001_title = "The Disappearance"
}
And the sentence: player:Say(getText("IGUI_Campaign0001_title"))
LUA reset from main menu
i'm going to try with game reload
IG_UI_EN.txt
IG_UI_ES.txt
only contain IGUI_EN IGUI_ES
idk why but its working
ah, okay, lua reload dont reload translation
no! it doesn't work!! omg :/
vanilla files
another try!
it works!!!!!
THANKS @verbal yew !
I would like use more than one translation file, one per campaign, but this is a fantastic point to study how, thanks! ❤️
Dear modders. Is it possible to make a mod where the player can control thier zombie self when they die? Or.. a way for an admin (or something) to become a playable zombie.
Not asking for someone take on this endeavor bug has anyone ever tried? Is this an impossibility?
I think I've seen a mod like this before
yeah, Tchernobill https://steamcommunity.com/sharedfiles/filedetails/?id=2991010328
cant do ipairs because its a dictionary
wait im stupid i forgot about pairs
mb lmaoo
for zoneName, zoneTable in pairs(ZombiesZoneDefinition) do
ZombiesZoneDefinition[zoneName] = {{name = "naked", chance=100}}
end
this should actually work
Something like that, but I'm in "stupid tired and should be in bed instead of stubbornly trying to fix this mod for multuiplayer" mode and lua array quirks annoy me when I'm well rested.
yeah i just did some python coding the last few weeks so i forgot how lua table loops work
actually make sure you rename this as well so it doesnt conflict with anything
My ChatGPT is full of stupidly easy questions like "how do I iterate through this thing in pythin" because I know there is an easy way to do it but damned if I can remember the syntax
Oh sick. A little different than what I was thinking but this could be fun... I assume it's ot updated for 42 or 13.1...or MP lol
I modded Zomboid so much that all it does now is plays Ping-Pong.
I feel like giving up on making this stupid thing work in multiplayer and just renaming it "multiplayer Ping-Pong roguelike"
Sounds like you need to address your mods addiction lol
Ah unfortunately not updated. Bummer. This would be a lot of fun on my RP server as an admin
Your question was "is it possible?", here is your answer.
This is mod_development, so the default assumption is people here are wanting to develop mods.
Which affects the way questions like "is X possible" get responded to
@silent zealot I got it to work, thank you for all of your help!
Hooray! Naked people! Hundreds of them, all coming to hug me!
Like 1 in 20 zombies will spawn with a shirt but honestly that's fine. I like to think those infected are "more fresh"
Or they had better quality shirts.
Now I need to make a mod that modifies the zombies' sounds 😈
Make those shirts the currency on your multiplayer server.
lol I might have to
@bronze yoke Since all that time, I follow blindly that thread's advices. Do you validate those ? https://discord.com/channels/136501320340209664/1085414352271716402
You'll want to modify item visuals
It's the best method
It's the one I use in TLOU Infected and it works amazingly
Will this construct work?
function LabRecipes_LabResearchToVaccineTo2lvl(craftRecipeData, player)
local result = craftRecipeData:getAllCreatedItems():get(0);
remove(result)
end
I have three outputs
{
item 1 zReLabItems.bkNotebookVaccine2,
item 2 zReLabItems.LabFlaskDirty,
item 1 mapper:itemType,
}
and want to delete the first one and use the function to add another item, depending on the conditions
hello, i need help finding the current textures in project zomboid, where can i currently find all of them?
i found a few in media/textures, but not all of them
No you'd just be removing your reference
Aren't those your own recipes ?
That returns an array list
So you need to use array list functions to remove an entry
declaration: module: java.base, package: java.util, class: ArrayList
yes, these are mostly accurate: i would note however that some of these are very small performance saves are only worth using in very performance sensitive code as they reduce readability
the only one i think is wrong is the concatenation one due to flawed testing method, a .. b .. c .. d .. e .. f may be faster in performance tests, but it creates a new string for each .., which will all end up needing to be garbage collected, so it may actually make performance worse but since garbage collection happens at a random time later, the impact of this does not usually appear in performance tests. string.format and table.concat both avoid this: use string.format if the number of strings concatenated is the same every time, use table.concat if you would otherwise need to use a loop. use .. when you don't care or you're only concatenating one string
also since it doesn't mention this: while table.insert should not be used to add to the end of a table (even the lua manual recommends against this), when you need to insert into the middle of a table and shift elements up, it is the fastest way to do this
in particular, these are the ones i don't find worthwhile except when absolutely necessary to save performance:
- caching class functions: this hurts readability, you call them very differently to usual, it is a very small performance save
- caching globals: honestly there is no downside to doing this, but i don't bother because it's a very small performance save
- both of these save around 20% of the cost of the call, but calls are very cheap, so it's 20% of a very small number. if you call the same function many many times (such as in a loop) then it may add up to a decent performance improvement, but generally it doesn't end up making any real impact
math.powwastes performance for no reason and is straight up deprecated, butx ^ 2vsx * xdoes not have a significant performance difference and the former usually conveys intent better
basically, do not waste your time micro-optimising code that does not need it, all you will be left with is harder to read code that doesn't actually behave differently. performance issues are usually caused by poor design and not small inefficiencies like these
I listed some performance tips on the wiki back then if you need
like
function LabRecipes_LabResearchToVaccineTo2lvl(craftRecipeData, player)
local result = craftRecipeData:getAllCreatedItems();
result:remove(0)
end
?
how about if im use in header:
local zMathPow = math.pow
local zMathFloor = math.floor
local zStringFind = string.find
local zMathCeil = math.ceil
You should not do that
if it's worth that level of microoptimisation
hmm... thanks
why
Bcs everytime it runs, you're going to remove your first item
yes, it's what i need
i don't think that's true
CraftRecipeData represents data for that particular time crafting
you use it to identify the specific items that were spawned, how could it not be a copy
it's mean all ok?
yea mb
okay, thanks
can someone help me find the textures of the items?
i think its just remove one line from result list, not like item
function LabRecipes_LabResearchToVaccineTo2lvl(craftRecipeData, player)
local result = craftRecipeData:getAllCreatedItems():get(0);
result:getContainer():DoRemoveItem(result)
end
WIP peek at next week's new Coco's Domestics & Imports car.
good day all. I'm looking into building a mod that will create a local websocket server that can be accessed by another locally running service. Is this something that is possible without having to crack open the jar file?
Is there an option in recipe script like the old Obsolete=true, on the 42?
this directory maybe? .steam/steam/steamapps/common/ProjectZomboid/projectzomboid/media/textures
how to get my mod to show in the select mods menu? I need to test it and make sure it looks good, it's just a clothing mod if that helps
I'd expect you'd have to package a lua webservice in your mod folder, and then run it independently
A quick Google shows pegasus and milua as rest apis to work with in lua. 🤷♂️
I guess the real question is, what kind of data are you looking to get or interact with?
To note, I'm new to modding PZ, and anything I say or suggest is speculation
I'm new to modding PZ as well and not familiar with Lau. I want to build an admin server to be able to interact remotely. Like Rcon on steroids
I looked at extending Rcon but it's closed off to Lua so I would need to patch the java class
Are you making your mod for b42?
am getting this error for my mod for when attempting to craft on a DS test server(it crafts fine on singleplayer) but cannot determine what is going on, everything seems to be fine
wait, does the recipe module has to be "Base" ?
That could be it
nope that did not wor
Oh yeah that's the one im using, I cant find the 5.56 ammo box texture though
.steam/steam/steamapps/common/ProjectZomboid/projectzomboid/media/textures/Clothes/Bag/AmmoBox.png
could it be in world items?
Major Update: fixed the issue
the crafting recipe must be in Base Module. and not importing anything (items can be in its own module)
any items that are used in the crafting would need to have the custom module name as the prefix.
Heres what i was using in B42.12, likely still works:
function replaceRecipeOutput(recipeName,targetLine,newLine)
local recipe = getScriptManager():getCraftRecipe(recipeName)
if recipe == nil then
DebugLog.log("Could not find recipe " .. recipeName);
return
end
local outputs = recipe:getOutputs()
local foundLine = false;
for i=0, outputs:size()-1 do
local output = outputs:get(i)
if string.find(output:getOriginalLine(), targetLine) then
outputs:remove(output)
foundLine = true
recipe:Load(recipe:getName(), "{ outputs { ".. newLine .. " } }")
break
end
end
if not foundLine then
DebugLog.log("Could not find targetLine " .. targetLine);
end
end
it was called like: replaceRecipeOutput("MakeImprovisedGasMask","Base.Hat_ImprovisedGasMask_nofilter","item 1 Base.Hat_ImprovisedGasMask,");
(you can delete the recipe:Load line to have it delete instead of replace)
RemoveResultItems is a tag?
Oh, so it shows a result in the recipe.
but thats not what you get, neat.
but it what i need
RemoveResultItems simply is not a thing in b42, the new recipes are designed to avoid the usecases for it
or actually i see a recipe that uses it so i guess it is a thing
but this vanilla recipe that has a random result (most similar thing to what you're doing) just doesn't have an output at all:```
craftRecipe OpenUnlabeledCan
{
time = 80,
timedAction = OpenTinCan,
OnCreate = RecipeCodeOnCreate.openMysteryCan,
Tags = InHandCraft;Cooking;CanBeDoneInDark,
category = Cooking,
inputs
{
item 1 tags[base:canopener] mode:keep flags[MayDegradeLight],
item 1 [Base.MysteryCan] flags[Prop2;DontPutBack],
}
outputs
{
}
}
yeah, i know, but i want to see result
craftRecipe RipDenimClothing
{
timedAction = CutClothing,
time = 80,
Tags = InHandCraft;RemoveResultItems,
OnCreate = RecipeCodeOnCreate.ripClothing,
inputs
yeah, i hope
yeah i found code for it, don't worry should work
I think you created a subtopic about working with clothing slots, in terms of adding new ones.
Any tips? links?
You mean to add a new clothing slot?
yep yep
that adds a new slot, then changes an existing item to use it. You could also add a new item using the new slot.
If display order matters, BodyLocationGroups:moveLocationToIndex() is the way to move a slot to a specific position.
(Assuming B42.13+)
That's not exactly it—there were conditions and prerequisites for rendering.
It seems like a specific slot could be assigned to a specific position.
Check if such a slot already exists; if it does, don't create a new one, but use the existing one.
O!
For layered textures, that's the secret.
It was done differently pre-42.13.1 but now you can add a new slot for clothing and move it via an API command instead of getting an ArrayList and manipulating it directly.
it's what i want to learn
Learn which - pre 42.13, 42.13 or 42.13+?
42.13+
Definitely better than old methods!
there's no need to learn the 42.13.0 method anymore, you can't downgrade to that version easily
That's the java function (javadocs are not updated for 42.13.1)
I can see people staying on 42.12.X to avoid losing their current save, but I doubt anyone has a reason to stay on 42.13
well 42.13.1 wiped saves too, but there's no steam beta for 42.13.0 to return to and 42.13.1 didn't break mods
if group:getOrCreateLocation(ItemBodyLocation.SHOULDERPAD_LEFT) then -- true
--nothing
else
group:getOrCreateLocation(ItemBodyLocation.SHOULDERPAD_LEFT)
end
?
so as not to create duplicates or it doesn't matter?
ah, yea
I'm trying to make zombies spawn exclusively with a certain amount of hair/beard types but I don't appear to be having any luck, not sure if I put the code in correctly:
local zoneKeys = {}
-- Collect all zone names safely
for zoneName in pairs(ZombiesZoneDefinition) do
zoneKeys[#zoneKeys + 1] = zoneName
end-- Replace spawn lists
for i = 1, #zoneKeys do
ZombiesZoneDefinition[zoneKeys[i]] = {
{ name = "naked", chance = 100, beardStyles="Long:20;Chops:10;Goatee:10;Moustache:10;Full:10;BeardOnly:10", maleHairStyles="Bald:10;BaldSpot:5;Donny:10;Fabian:10; Grungey:10; LongBraids:10; LongerBraids:15; MohawkFlat:10; Mullet:10" }
}
end
For the number values next to the styles, could I make all of them 100 to guarantee their spawns?
does the rest of the code work and its just the hairstyles stuff breaking?
because im not sure if lua table iterators work like this for zoneName in pairs(ZombiesZoneDefinition) do
just looked at the decompiled java code and it looks like setting them to 100 would mean that only the first hairstyle you put would ever spawn
so i guess just make sure they all add up to 100
95% of zombies spawn naked yeah so that part works. I'll make them all add up to 100.
oh i guess that does work then lol
i cant really find any info on it but i guess that format still works and just gives you the key then
I made the values all equal 100 and they're still not spawning with the proper beards/hair
I'm honestly confused because I used another mod for reference and framed the code the same way they did.
But the naked part of the code appears to be working properly.
maybe the spaces after the ; in some of them is messing it up?
yeah i looked again and it seems like the space in the names would mess it up
maleHairStyles="Bald:10;BaldSpot:5;Donny:10;Fabian:10;Grungey:10;LongBraids:10;LongerBraids:15;MohawkFlat:10;Mullet:10"
should work i think?
tbh this hair and beard outfit stuff has always been mega scuffed to me so im not surprised its breaking but i dont see anything else that would cause it
@marble marten after looking more im fairly sure the spaces are the issue
the game will try to assign the hair name with the space at the start to the zombie, find that the name doesnt exist in the hairstyles list, and then use a random hairstyle instead
Got rid of the spaces and still no luck it seems.
I'm wondering- do I need to delete the space between the " and the } at the end?
-- Replace spawn lists
for i = 1, #zoneKeys do
ZombiesZoneDefinition[zoneKeys[i]] = {
{ name = "naked", chance = 100, beardStyles="Long:30;Chops:10;Goatee:20;Moustache:10;Full:20;BeardOnly:10", maleHairStyles="Bald:10;BaldSpot:10;Donny:10;Fabian:15;Grungey:10;LongBraids:10;LongerBraids:15;MohawkFlat:10;Mullet:10" }
}
end
I'm wondering if replacing the ; with commas would fix it
no it specifically uses ;
and the space after " doesnt matter
im not sure why its breaking then
if you try it with just one hairstyle set to 100 does it still break?
I can give it a shot
maleHairStyles="Bald:100;BaldSpot:0;Donny:0;Fabian:0;Grungey:0;LongBraids:0;LongerBraids:0;MohawkFlat:0;Mullet:0" }
Zombies still spawning with various hairstyles. So I'm wondering if I need to put this code somewhere else possibly?
I was trying to use ChapGPT to fix the issue last night and it made it worse- the code it gave me made my game crash but thankfully I made a backup of my original script.
How do armor elements work currently? Is it javacoded?
Or can this be checked somewhere in Lua?
I just don't see any "durability" characteristics in the protective clothing parameters...
they break when a zombie pierces them, they don't have durability
they're either broken or not
it uses regular clothing holes, if it rolls a block, nothing happens, otherwise it gains a hole in that location and the next piece of clothing rolls
Wait, they have some kind of safety margin, they don't break with one bite.
or not?!
So you're saying that a metal breastplate is a stupid, useless, one-time-use thing that only lasts for one bite?
no, it depends on the protection value
if it's 100% it'll never break
if it's 95% it'll break 5% of the time (so it could break on the first bite, but on average will last a bunch)
if CanHaveHoles = true
In short, nothing has changed since build 41. The armor is still useless.
no adequate system of durability, protection class (relative to bites, scratches, hits from other players, shots from other players)
i mean remove everything except fabian or something and put it at 100 just to see if its actually doing anything
thats the right place to put the code i just dont understand why its not doing anything
so like do maleHairStyles="Fabian:100" instead
in a bit i'll test it myself and see if i can figure out anything
Testing now, one moment
maleHairStyles="Fabian:100" }
Didn't appear to work either
dumping Lua stack trace Callframe at: getOrCreateLocation function: zReVAC2_BodyLocations.lua -- file: zReVAC2_BodyLocations.lua line # 12 | MOD: zRe Vaccine 3.0 ReMod by kERHUS
whats wrong here?
11 line load fine
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:58)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:194)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:184)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:183)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:793)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:167)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1756)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1560)
at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:69)
at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:109)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:1334)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:1288)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:1277)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:1179)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:1099)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:1215)
at zombie.GameWindow.init(GameWindow.java:1182)
at zombie.GameWindow.mainThreadInit(GameWindow.java:690)
at zombie.GameWindow.mainThreadStart(GameWindow.java:560)
at zombie.MainThread.mainLoop(MainThread.java:58)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because "this.id" is null
at zombie.characters.WornItems.BodyLocation.isId(BodyLocation.java:69)
at zombie.characters.WornItems.BodyLocationGroup.getLocation(BodyLocationGroup.java:32)
at zombie.characters.WornItems.BodyLocationGroup.setExclusive(BodyLocationGroup.java:71)
... 23 more
`
in registries.lua copy what you did for the charactertrait and do it for the itembodylocations
and then access them in the bodylocation script by doing zReVAC2.ItemBodyLocation.SHOULDER_LEFT
so
zReVAC2.ItemBodyLocation = {}
zReVAC2.ItemBodyLocation.SHOULDER_LEFT = ItemBodyLocation.register("zre:shoulderleft")
Does anyone know how to fix build 42.13 mods
For example Guns maps and vehicles clothes
Pinned messages, read tis guides first
guys did someone make a mod what allows you to hug/kiss another player with his consent? and if not is it a good idea for the mod to create?
Does anyone know how this number is changed/calculated for the UI? it seems to be changing when i change the power of the car in my script, but it's gone from 360 to 330 when i've changed the actual engine from 3600 to 1300.
try this.
zReVAC2BodyLocation = {}
zReVAC2BodyLocation.ItemBodyLocation = {}
zReVAC2BodyLocation.ItemBodyLocation.ZREVAC2SHOULDER_LEFT = ItemBodyLocation.register("zrevac2bodylocation:ZREVAC2SHOULDER_LEFT")
zReVAC2BodyLocation.ItemBodyLocation.ZREVAC2SHOULDER_RIGHT = ItemBodyLocation.register("zrevac2bodylocation:ZREVAC2SHOULDER_RIGHT")
--zReVAC2_BodyLocations.lua
require "BodyLocations"
local group = BodyLocations.getGroup("Human")
group:getOrCreateLocation(zReVAC2BodyLocation.ItemBodyLocation.ZREVAC2SHOULDER_LEFT)
group:getOrCreateLocation(zReVAC2BodyLocation.ItemBodyLocation.ZREVAC2SHOULDER_RIGHT)```
I'm not aware of such a more, but it is a good idea. For roleplaying purposes having interactions between two characters (hug, high five, pat shoulder, shake hands, etc) would be a nice addition.
Someone will make a sex addon for it 5 minutes later. 😂
ill try to make a mod like that someday, never tried modding on project zomboid :D
could be me from alt account
Just do it from your main account, but make it a seperate steam workshop mod and leave hidden because they get really weird and the stupidest things
I had a mod removed because it added nipples as an option to spongies character creator, apparently that violates the "project Zombie Community Standards"
i know its was a joke about being from alt account but ill keep it in mind :D
is there any way i can add custom anims to project zomboid?
Oh no, not 2 slightly darker pixels! it will warp kids fragile little minds to see the thing that fed them for the first year of their life.
Men's nipples are fine though.
yo guys can anyone help me pls? i try to upload a mod to workshop via pz and it says it cant find an mod.info file
i used modtemplate to do everything as it should be but nothing really works
First: B41 or B42, And does the mod show up in your modlist and work for you?
b42 and it doesnt show up on modlist, i put it in zomboid/mods and it doesnt show up
and i cant test this mod in sp cause its mp only
You wanted to show woman nipples? Nipples, on a woman? Somebody put this guy in prison
I'd recommend giving this a read: https://pzwiki.net/wiki/Mod_structure
Hello, i'm Trying to fix my mod made for 42, It was working nice but visibly broke since 42.13 : I got a lot (in thousands) of
java.lang.NullPointerException: Cannot invoke "java.io.File.getAbsoluteFile()" because "file" is null at ZomboidFileSystem$PZFolder.set(ZomboidFileSystem.java:67).
I don't know if it refer to a missing "code source file" or if it triggered by one of my getTexture("media/textures/GUI/X.png")
my code didn't change since may
I tried an ugly copy pasta 42 > 42.13 directory, put my media/ inside common etc and i'm pretty lost 😅
Is there something specific who change during this update ?
I got side tracked from developing my new car and ordered some Spiffo's instead.
Hello there, anyone knows why IsoGridSquare.HasNoCharacters checks for barricades ? ```java
boolean HasNoCharacters() {
for (int n = 0; n < this.movingObjects.size(); n++) {
if (this.movingObjects.get(n) instanceof IsoGameCharacter) {
return false;
}
}
for (int nx = 0; nx < this.specialObjects.size(); nx++) {
if (this.specialObjects.get(nx) instanceof IsoBarricade) {
return false;
}
}
return true;
}
Hello, i would like to know how can i create the distribution script for my mod, i'm new to modding and i'm not sure to understande the pz wiki
If you had any script files then you'll need to update.any custom things like tags or traits need to be added to a registry file. Recipes arent really touched. Some lua functions changed names.
You want to add an item to the loot spawn?
hey does anyone know if it's possible to have the corpses accessible through the recipes or is the only way to interact then through the context menu with lua?
I want to make a mod to harvest bones from the zombies but I can't get the Corpse Item to work, this is the recipe I'm trying:
module Base
{
craftRecipe Harvest Bones
{
time = 100,
Tags = InHandCraft;CanBeDoneFromFloor,
xpAward = Butchering:10,
category = Miscellaneous,
inputs
{
item 1 tags[base:sharpknife;base:meatcleaver] mode:keep flags[Prop1;IsNotDull;MayDegradeLight],
item 1 [Base.CorpseMale;Base.CorpseFemale],
}
outputs
{
item 1 Base.SmallAnimalBone,
item 1 Base.AnimalBone,
item 1 Base.LargeAnimalBone,
}
}
}
I can get the recipe working ingame but the Corpse Item just returns empty no matter if I have the corpse near me or if I'm carrying it
Yes i want to add items to loot spawn i've done thing like that:
require 'Items/ProceduralDistributions'
require 'Items/Distributions'
-- On accède à la table existante sans l'effacer
ProceduralDistributions.list.ZazaSeeds = {
rolls = 1,
items = {
"NLK.SativaSeed_Debug", 100,
},
junk = {
rolls = 1,
items = {
}
}
}
local locations = {
{ "kitchen", "crate" },
{ "shed", "shelves" },
{ "garagestorage", "crate" },
{ "farming", "counter" },
}
for _, data in pairs(seedsLocations) do
local roomName = data[1]
local containerName = data[2]
-- On récupère la définition de la pièce dans le jeu
local roomDef = Distributions[roomName]
-- Si la pièce existe ET que le conteneur existe dedans...
if roomDef and roomDef[containerName] then
-- ... Alors on insère !
table.insert(roomDef[containerName].procList,
{ name = "ZazaSeeds", min = 0, max = 1, weightChance = 10 })
end
end
I think they've hidden the corpse item from the dead bodies. This may require extra steps in lua to make work
damm sad, will see what I can do then, thanks
I think you over did this. If you're looking at the wiki you just need to add your item and roll chance to proceduraldistributions.list.somelocation. You created your own table to the list which can be done but isn't necessary
Hey, quick B42 MP question:
what’s the correct server-side way to add an item to a player’s inventory so it appears immediately on the client?
Right now the item does exist server-side and shows up after a reconnect, but doesn’t appear live in the inventory UI.
Thanks
player:sendObjectChange("addItem", item)
player:sendObjectChange("updateItem", item)
inv:setDrawDirty(true)
What am i missing here?
Okay thanks and what is weightChance?
That is the chance of the item spawning
0 to 100 ?
Yea but it's not an exact thing, being weighted means more of a likelihood of spawning so 100 will not spawn 100% of the time it'll just spawn more often than items set less than 100
You're doing this server side?
Yes
I would think setdrawdirty would need to be done by that client
sendAddItemToContainer(inventory, item) after adding the item
I'm trying to use lunajson in my mod but requiring the module is failing my mod layout is:
modId
- Main.lua
- lib
- lunajson.lua
should the import be require 'modId.lib.lunajson' ?
require("lib/lunajson")
all mods share the same namespace for files so please use unique names, such as creating a modId directory modId/lib/lunajson
otherwise when you use generic names such as main.lua you're risking a hard conflict with any mod that also uses that name
thank you! another chatGPT fail 
hey, does b42 file structure allow me to make a b41 version of a mod? like can i have a 41 folder, or should i rather put a b41 version in common and then a b42 version in a 42 folder? or do i gotta just make a separate mod
Thank you!
technically no, but because the 42 structure is deeper than the 41 structure, they can coexist
41:
MyMod/mod.info
MyMod/media/...
42:
MyMod/42/mod.info
MyMod/42/media/...
MyMod/common/media/...
alright, thank you
I checked and it is given by TIS as an independent tool and therefore very modable. Here is a simple rectangle selection exemple based on ```lua
addAreaHighlightForPlayer(self.playerNum, minX, minY, maxX+1, maxY+1, refZ, r, g, b, alpha)
Uploaded video speed is x3 so you do not waste your time.
https://steamcommunity.com/sharedfiles/filedetails/?id=3629755641
Create blueprints. Build from blueprints. Share blueprints.
You can create blueprints from original map buildings.
You can create blueprints from any map rectangle.
You can clear areas.
oh nice! that'll be really handy
project strategoid
anyone know how I would be able to set off a firebomb on top of a player?
Hello everyone, is there a way to add "component FluidContainer" to an item at lua level?
I think so yea
You can do it for tiles at the very least
So surely you can do it for items
I'd suggest looking into the debug context menu of adding a fluid component to a tile
do you want to add a fluid container to an instance of an item or a type of item?
I guess that's important too yea
tho the definition itself, like it's been edited in script . txt files
I attempted this:
local function editItem2(name, field)
field =
[[{
component FluidContainer
{
ContainerName = WHATEVER,
capacity = WHATEVER,
InitialPercentMin = WHATEVER,
InitialPercentMax = WHATEVER,
CustomDrinkSound = WHATEVER,
Fluids
{
fluid = WHATEVER:1.0,
}
}
}]]
local item = ScriptManager.instance:getItem(name)
if item then
item:Load(name, field)
end
end
Like would do to recipes and apparently works
component FluidContainer
But yea I was wondering iff that method would work for sub script blocks
That's good to know
yeah this works
Good to know
Protip: Don't reuse variable names
(field is passed into the function and redeclared inside as a local)
Yeah i know, i just reused it for showing what was going on
What about removing/hiding/deactivating a recipe? is that even possible to some degree?
only behind a book i imagine
Try ScriptManager:getAllCraftRecipes() to get an ArrayList of CraftRecipes and then deleting an item. I'm not certain that will work, but it's worth a go.
That looks powerful. I wonder what happens when it occurs after some InventoryItems have already been instanciated without that field.
How to translate this?
💡
I need a wizard that can tell me why setting a clothing tint works in mp, but turns the clothing white in sp. I am losing hair.
local color2 = ImmutableColor.new(self.r, self.g, self.b, 1)
self.item:getVisual():setTint(color2)
self.item:synchWithVisual()```
Need more context here I feel like
it was a timed action and those three lines were all that are in the complete(), but I figured it out. synchWithVisual was unneeded. it was causing issues in sp, and possibly doing nothing in mp.
Tested in SP, if that same item was in the inventory without "component FluidContainer" once applied at lua level, the item effectively gets the property and shows fluid and amount, is also interesting noting that if i remove the code and load the game the item keeps its FluidContainer property, new items will not have FluidContainer
i believe that the same is valid for "component Durability" and "component ContextMenuConfig"
Interesting
I have a mod suggestion for b42 if anyone is interested:
I love the climb mod and I love having night sprinters, but what I dislike is that climbing onto a roof is safe, but jumping off of it always leads to some sort of injury. I was wandering if anyone could make a mod that decreases injury rate/increases fall recovery from 1 floor drop with every fitness level.
im trying to make a little quest mod and as a reward for completing it i want to reset your negative moodles, i have no idea how to do that
I would start by looking on how to modify the moodles first
I believe that would be the easiest piece to accomplish
how would i go about doing that
you would need to create a lua script. I would start here if you haven't read already: https://pzwiki.net/wiki/Getting_started_with_modding
for single player (i would start there first) look at:
local player = getPlayer()
player:getStats()
and CharacterStat
when I play sounds from lua with with the 3 Sound Volume / Music Volume / Jump-scare sfx volume to minimum, the vanilla sound is not played but the modded sound is played at max volume. If I turn up the Sound Volume, I can hear both. ```lua
isoZombie:playSound('MSR788Shoot')--vanilla sound
isoZombiezSquare:playSound('mysterious_stranger'..ZombRand(1,3))--modded sound
i think you can add a category to the sound script that i assumed is tied to volume but i have no idea
ain't no sound script 
How do I ensure x/y is a float in lua when x = 1 and y = 1 ? it seems the java part does not find the "right" function to call because it thinks it is an integer.
you can't
this is an issue i've experienced too, it's a hard limitation of kahlua's method invoker
it deduces type by value so if the value could be interpreted as two different types it's quite literally random* which one is picked
(*the same one is always picked until you restart the game)
i had this issue when passing nil as null is an acceptable value for literally every non-primitive java type
i can't remember the exact method but i wanted (IsoObject) null and was sometimes getting the (IsoGridSquare) null overload instead
I'm trying to create a custom item that uses the player name (Like an ID) but the translation name doesn't appear to be working. I suspect it's something to do with the name of the character name overwriting the translation file?
I suspect I gotta rewrite the OnCreate hook
Alright, I'm pretty lost on what I'm doing wrong 😭
I can't for the life of me use my own module and translation file instead of Base. Does anyone see what I'm doing wrong? B42.13.1
-# media/lua/shared/Translate/EN/PostMortem_EN.txt:
PostMortem_EN = {
ItemName_Base.Alive_Player_Dogtag = "Cool Dog Tags!",
}
-# media/scripts/Items.txt:
module PostMortem
{
item Player_Dogtag
{
DisplayCategory = Memento,
ItemType = base:clothing,
Weight = 0.0,
Icon = Necklace_Dogtags,
BodyLocation = base:necklace,
ClothingItem = Necklace_DogTag,
Cosmetic = true,
WorldStaticModel = Necklace_Dogtags_Ground,
Tags = base:hasmetal,
}
}
not how translation files work
you must match the exact filename of the matching vanilla file
Does that mean I'm forced to use Base? Or is there something I'm not seeing
no, your translation file just isn't being read at all because the name is wrong
it wouldn't matter what module it's in
This is of concern though, no?
Wait ignore
I'm stupid
That's why this section is marked as needing to be moved
Finally got it working, thank you guys :D
I'll come back to that, but do you have a concrete example of that, I'd like to do it
Yeah modded sounds are completely separated from the vanilla sound controls unfortunately... It's a real pain in the ass.
You can make your own volume control, but you have to use the emitter.
So you'd do something like:
local sound = emitter:playSound('mysterious_stranger')
emitter:setVolume(sound, float)
You can use getCore():getOptionSoundVolume() to get the sound volume used in the vanilla sound options, and then feed that into your setVolume call.
Just note that setVolume is from 0-1 and getOptionSoundVolume is 0-10, so just do * 0.1
That category does jack shit 🙁 It's all very annoying tbh, any mod that needs to play custom sounds needs a fully custom sound system set up to control the volume
Depreciated, except it still works so people will still use it in mods and one day they will disable it and everyone will have broken translations for every modded item.
I don't know how to control the volume the player hears, but I do know if you want zombies to hear itt there is an entirely different thing for simulating sounds in the world: getSoundManager():PlayWorldSound()
thats why im trynna get ahead of the curve 🙂↕️🙂↕️
thankfully i fixed the issue, but i gotta figure out how to put the characters name on the item like an ID
ill figure that out later though, its way past my bedtime 😭😭
You can just do item:setName("Whatever you want")
I'm not sure if this item:setCustomName(true) is needed, but I use it and it works so I'm not touching shit lol
this is how im thinking ill probably do it, but considering that PZ already has some functionality to give the player a correctly named ID on spawn, i might see if theres a way to use that same method
otherwise, ill just rename on create or someth similar
-- apply the character name if they have a DogTag
local dogTag = playerObj:getInventory():getFirstTagRecurse(ItemTag.DOG_TAG) or playerObj:getInventory():getFirstTypeRecurse("Necklace_DogTag");
if dogTag then
dogTag:nameAfterDescriptor(playerObj:getDescriptor())
end
From spawnitems.lua
Super simple
Literaly "that's just setName() with extra steps"
I am currently trying to send player modData from server to client using
if isServer() then -- if code is executed by server, sync player's modData from server to client
local data = player:getModData()
sendServerCommand(player, "myMod", "syncModData", data.MyModData)
end
end```
However, the data are not properly send to the client (they are nil on client also they aren't nil on server). Is there something I am missing when putting the data to args of the sendServerCommand?
why not player:transmitModData() ?
If I get things right, this will transmit all modData from all mods which are active. I'd prefer to only send data coming from my mod (although your command would definitely be a quick and dirty solution...).
that is the point of mod data. if some modders put in there stuff that should not be saved, they should store it in local tables instead.
I'd still prefer sending only my modData 😉
point is that my mod has to sync modData quite often so I would like to have more control on what is send to not break other mods and keep performance cost low
the args look right, what does the client portion look like?
should add that my mod data are a table consisting of strings
data.MyModData.data1 = "a", data.MyModData.data2 = "b", ...
On client I have this
if mod == "myMod" then
if command == "syncModData" then
local player = getPlayer()
local data = player:getModData()
print("TEST OUTPUT ", args.data1) -- gives non-table: null error
data.MyMod = args
end
end
end
Events.OnServerCommand.Add(onServerCommand)```
these are not the right parameters for OnServerCommand
nonPlayer is getting the args table
so you mean onServerCommand(mod, command, args, nonPlayer) ??
it has different ordering from Events.OnClientCommand??
XD ok... get it.
So, initially, I just expected without good reason that the argument structure of Events.OnClientCommand and Events.OnServerCommand are the same and so I though the latter also has a player argument (but I already noticed that it is not the same "player" as it is on server and so I just called it "nonPlayer"). 😅
does anyone know how to make multi-colored tooltips for items? i had a look online, and it seems its a modded feature, but unfortunately the only files i can see are B41 or older
nvm, got it! found the tooltip script and it seems easy enough to overwrite
Did they again chaned smth on their print commands so that it now only prints the name of the variable? For me,
print("TEST OUTPUT ", args.data1)
now simply gives "TEST OUTPUT MyMod.data1" where MyMod is the name of the table in args... Not possible anymore to print the actual content (which is a string in my case)?
also tried this with DebugLog.log with the same result
EDIT: no problem at all. I was just confused.
that doesn't sound possible
ah no. ignore. I was just confused. everything right in my code and the output.
sorry here XD
hello everyone, working on mod, and struggling with some PZ quirks, when im using teleport Player:teleportTo(teleportX, teleportY, teleportZ)
game doesnt recognize player made structures (enclosed roofed building) as propper building
and does some weird things with roofs (floor tiles on z+1)
for example i have enclosed roofed area at place i want teleport to
after doing so, game decide that its better to render floor tiles from second flor instead of making it transparent
if i exit game, and load it, then it rendered propperly
first image what it is looks like after i teleport
second image, if i restart game (exit/load)
does anyone have ideas what i can do to fix this?
Where can I find the list of places to spawn my items? Is there a website for that?
Yeah, click on the "Show" here https://pzwiki.net/wiki/Procedural_distributions#Distributions
Thanks !
Hello. Is there any way to "turn on" a newly installed street lamp? Without walking back and forth. I saw something about RecalcAllWithNeighbours(true)
If you teleport next to the room and then walk in does it work properly, or if you walk out and back in? They may be some code about walking into a new "room" (as Zomboid uses the term) that is skipped when you teleport.
How did you "install" it?
i think zomboid in essence is not developed for teleportation to work properly, besides cutaway systems that starting to work weird, game even fogoten that there was player built rooms, unles you restart game
had to do some tricky things to find rooms in meta grid data, hard-reasign them, and refresh cutaway on floor tiles to refresh renderig to work propperly
i think to teleport i've done player:setX,Y,Z and also last x,y,z player:setLx,Ly,Lz and i dont remember issues but i havent messed with it for a while
teleport itself work fine, no complains, problem is with things around player after teleport
structures (building->rooms) for some reason no longer considered by game as buildings and rooms, and lots of features in zomboid is tied to structure being recognized as room, even cutaway system
only those structures that was been built by player, buildings that part of map - fine
RV Interiors manages to do it, check to see if they have a special trick.
Is the building at the destination pre-made (a map mod) or player made?
That may also be a big difference.
When playtesting mods in MP via the host button, can I use the debug menu's item spawner to spawn items to the player inventory? Or will those items not work in MP due to the new server-side item handling system?
i thought they wouldnt work but they actually did work for me
I am trying to get my timedActions to work in MP but they currently don't work. To test them, I use debug mode to spawn items needed for the action. So my first idea was that the problem are the items from the debug spawn menu. But possible that there is a different issue then.
Btw the Actions work fine in SP and in MP, they don't throw any error. I also tried to code them according to the new 42.13 timedAction system.
cheated in items shouldn't cause issues
Hello, so where do I start to make custom trait in pz?
Offhand question I haven't put much thought into; I know you can create sounds, but do we have options to do math on how that sound... travels? Like Can I do sound in a cone, or do some math make a sound come from the edge of say a circle inward, to draw zombies out to the edge of it?
no
the attraction event is separate from the audible sound so you might be able to hack something together that does things like that, but i think it'd be really tricky to get it working properly
With a plan: what is the trait, what speciifc things will it actually do?
If the trait just adds skills when selected at character creation it's very easy to do, with B42.13+ having very different syntax to earlier versions
If the trait does something in game you have to work out how to hook in to that thing and add code, like hooking into the the function that eats food to add "If player has trait ShellfishAllergy and food contains one of {Lobster, mussels, Oysters} player:dies"
I delete "my" Street Lamp and replace it with the vanilla one. The replacement happens, but for the light to work, you need to move away/come back or re-enter.
I don't follow... what commands or in-game actions are you using to do this? And what do you mean by "my" street lamp?
like increase movement speed, or increase xp take or increase melee damage
In my PZ Mod, I give an item to the player via the Events.OnCreatePlayer.Add() event, which works flawlessly in SP. However, in B42.13.1, the item does show in the inventory but cannot be dropped. As well, Admins cannot see the item when inspecting a players inventory.
Am I missing an event/check to send that data to the server, or do I need another event?
so its not adding the lamppost when placed? there is a check in java for it if the tile has light properties it should add it. this is done in isoObject:addToWorld(). i would try triggering that fuction when your lamppost is added
Just found the OnClientCommand event, will have another lookie
Can anyone help me make an Instant item transfer edit/mod. I can't seem to find a way to edit the Dexterous trait which seems like it'd be the simplest solution. Just change the "50% inventory transferring time." to like 0% or 1%. The other 2 options I'm eyeing is by editing the ISInventoryTransferAction.lua directly or via a mod. I don't have a whole lot of knowledge so I'm looking at Neely's Player Changes mod that edits ISInventoryTransferAction. ATM I'm trying to loot at his edit and the base game file to see if I can just change a value or two and be done. Kinda doubt its that easy.
look at function ISInventoryTransferAction:new, all you should need to do is change time which is set as the max time. so hook into this function with your own version and set its time if they have the dexterous trait
what does your function do in that event?
Gonna post here and in a few mod comments so ppl can make the simple edit if they want instant item transfers.
Step #1 - Navigate to ProjectZomboid\media\lua\client\TimedActions and open ISInventoryTransferAction.lua with Notepad
Step #2 - Search for ""TradeUI" and srcContainer:getType()" and in the line below it change "o.maxTime = 120" to "o.maxTime = 1"
Step #3 - Search for "self.item:setJobType("Putting in container")" and in the line below it change "o.maxTime = 50" to "o.maxTime = 1"
Step #4 - Search for "self.item:setJobType("Taking from container")" and in the line below it change "o.maxTime = 50" to "o.maxTime = 1"
The 3rd and 4th change seem super obvious, but i don't know if the 2nd step does anything in particular.
That seemed to make items transfer instantly. Only tested it in a new game and in the house i started in. Maybe the 2nd step is for when you do things via crafting?
God I hate how discord doesn't auto-hide the rest of the file grr
looks mostly good. i dont think you need to transmit player moddata doesnt look like you do anything with it
id try changing the event you use
theres load orderd to them i cant remember
you might want to use OnNewGame because that fires when a new character is created so itll only add once and every time someone dies and makes a new character
-
By "my" streetlight, I mean a custom tile definition (same sprite, but with IsMoveable and without the streetlight flag).
I use a context menu action to swap them via Lua. Here is the logic I use:-
Remove my custom object
square:transmitRemoveItemFromSquare(customObj)
square:RemoveTileObject (customObj) -
Create the vanilla object
local vanillaLight = IsoLightSwitch.new(cell, square, vanillaSprite, -1)
square:AddSpecialObject(vanillaLight)
-
-
"My" streetlights (.pack, .tiles) are vanilla streetlights, but with the parameter (IsMoveable) and without (Streetlight).
Hello everyone, I've got a question.
I have used AcceptItemFunction for items within scripts to allow certain items within certain containers, and it works great.
I am wondering if their is a way to hook into the same kind of functionality within Lua to check when an item is dragged/placed into a player's container, and then run code off of that?
I would like to run a script that consolidates stacks of items when someone drags it into a bag/container, and am not sure exactly where to look to find if this is possible.
B41MP is the use case for this.
Thanks in advance if anyone knows!
No, the tile change is working fine, but the lighting isn't updating and I have to manually reload the area by moving back and forth. I'll take a look, thank you.
Guys, how do I get this script to work?
I'm calling it on the server, trying to send it to the client via sendServerCommand, but nothing happens, as if...
HaloTextHelper.addTextWithArrow(player, getText("UI_trait_zReAntibodies"), false, HaloTextHelper.getColorGreen())
getSoundManager():PlaySound("GainExperienceLevel", false, 0):setVolume(0.50)
Look at the Project Zomboid API for Inventory Items PDF - will be on forums or in a sticky. It covers how adding itesm works with the B42.13 multiplayer changes
ooooo, I'll take a lookie
I think the server needs to send a command to the client with SendClientCommand(). the client then needs a listener on teh event for command received that sees that command and runs the client-specific stuff. But there are other modders here with far more PZ MP experience, so if they know better listen to them not me. 😛
Bingo, found it. Here it is for future reference for yourself or anyone else lurking :)
HaloTextHelper and sound not work
Add a print statement to see if the code is being executed.
If not, you probably need to do something liek print everythingg teh cleint gets and try to find out if the server is not sending teh command OR teh client is not recieving it OR the client g ets it but for some reason it does not match the conditionals
I had a similar issue where I needed to send a sound to every player upon a big serverwide 'Event', and it required a ping pong from Player > Server > Player to get it to function correctly.
Like DrStalker said, I'd run a print and see if it's even being ran Server Side, and Client Side, and then go from there.
As far as I've tested, Sound Manager should run a sound if it's declared in a script file somewhere, as long as it's called correctly. It' should run just local to the player if I recall.
Jesus... just need disable invisible in debug mode...
Well, there is always that.. haha I've made that mistake and spent hours trying to figure out something that was never a bug to begin with.
I've been looking at the new B42 API for creating items and giving them to the player. Unfortunately, I'm lost at what's supposed to go where. Does anyone have a mod example?
are you just looking for a basic item like adding a ball ?
in B42.13, ingame vanilla map is not updated with vanilla landscape changes, I used to hike and rest in Doe Valley Forest isolated pond. the pond is replaced by a sweet river. The ingame map still shows a pond. 
Don't you worry no more, brothers and sisters, as the day is near where troubles will be no more: https://www.youtube.com/watch?v=osSUvcHID5s
Steam Is Saving Your Broken Mods
#steam #valve #gaming
Valve is fundamentally changing how the Steam Workshop handles game updates by introducing a revolutionary version control system that aims to end the era of broken mods. This video explores the new Workshop Item Versioning system, which allows mod authors to host multiple versions of the...
Nail on the head with that opening. Exactly what the situation I was in. Latest unstable patch broke everything, but auto-updated. Then mods started updating. Just a complete mess. Will be nice when steam doesn't auto-update literally everything.
That's a nice change
whats problem can be:
sendClientCommand dont work from TimedAction (preform or complete), nothing send in log where i set print to module and command on serverside
I do not know what you wanna do, but you can skip the sendClientCommand by applying the effect directly from complete method as it is strictly server side.
Which part of the timed action? There some weird "some parts are on the client, some parts are on the server"
its perform (client) -> complete (server) i think?
dont know about the rest but those are the two that run at the end
Thanks!
Is there a way to find tomato plant texture as png file in game ? or is there a resources web site for it ?
Tho TIS needs to activate it apparently
Is it normal i can't extract images from pack files via TileZed ?
Yeah, just imagine something super mundane
Just to be clear, not having an issue with putting the item inti the game, but i don’t know how to give said item to the player via the new api. The documentation doesn’t make too much sense to me rn
in what capacity are you trying to give it to them , as an admin, via loot tables,
or maybe you want to create a crafting recipe to let them make it for themselves
can you link the api you talking about
@thorn bane
I want to give it to them on character spawn, first time loading into the game. I’ll tag you in the API
@boreal pawn stickied on the pz forums
i know in settings under INI - Players you can add item ids
Not what I’m after, it’s a custom mod item that requires its own function to run to do the things it needs to do
i gotcha ill check it out
The key to making it work correctly is rewriting the functionality to give the player items, which seems to only come from this document
I can’t understand it though, I don’t think it’s clear enough in what needs to go where, and some context is missing in a few areas
I’ll peep it again tomorrow, eepy time for now
Anyone rocking a mod to fix the nutrition system? Shedding weight like a mad man and im stuffing my face full of venison.
There isn’t enough cool items you can make with metal working
I wonder what cool items I can add with metal working
u mean i can work with body damage from it?
I do no know for body damage specificaly. If it is server side, yes. If it is not server side, sendClientCommand is not the right tool either.
I seriously guess it is server side though, you can probably take exemple on Project Zomboid_ API for Inventory Items.pdf "add item to inventory" process
CLIENT LUA:
Events.EveryOneMinute.Add(function()
local player = getPlayer()
if not player then return end
local clientResult = player:getBodyDamage():isInfected()
print("[CLIENT] isInfected: " .. tostring(clientResult))
print("[CLIENT] Infection progress: " .. player:getStats():get(CharacterStat.ZOMBIE_INFECTION))
sendClientCommand(player, 'zReTest', 'zRecheck', {})
end)
SERVER LUA:
Events.EveryOneMinute.Add(function()
local player = getPlayer()
if not player then return end
local serverResult = player:getBodyDamage():isInfected()
print("[SERVER] isInfected: " .. tostring(serverResult))
print("[SERVER] Infection progress: " .. player:getStats():get(CharacterStat.ZOMBIE_INFECTION))
end)
Events.OnClientCommand.Add(function(module, command, player, args)
if module == 'zReTest' and command == 'zRecheck' then
local bd = player:getBodyDamage()
local callResult = bd:isInfected()
print("[SERVER from client call] isInfected(): " .. tostring(callResult)) --- ТРУ
print("[SERVER from client call] Infection progress: " .. player:getStats():get(CharacterStat.ZOMBIE_INFECTION)) -- ТУТ ВСЕ КАК НАДО
end
end)
LOGS:
-- DEBUG LOG
[09-01-26 02:39:10.889] LOG : Lua [CLIENT] isInfected: false.
[09-01-26 02:39:10.889] LOG : Lua [CLIENT] Infection progress: 0.3549680709838867.
[09-01-26 02:39:10.890] LOG : Lua [SERVER] isInfected: false.
[09-01-26 02:39:10.890] LOG : Lua [SERVER] Infection progress: 0.3549680709838867.
-- SERVER LOG
[09-01-26 02:39:10.277] LOG : Lua [SERVER from client call] isInfected(): true.
[09-01-26 02:39:10.277] LOG : Lua [SERVER from client call] Infection progress: 0.3226982355117798.
real - player is infected
you realize I was replying to that of your post, referencing complete method of a timed action right ? #mod_development message
nah, 5 min
so in your complete action, after the action that induces isInfected = true server side, you need to propagate the effect to the clients
i mean, i should try to do it, just cut my func and put in :prefer()
without sendClientCommand
yep?
put pack into complete and (if server: propagate to clients).
okay, need to test it
you can probably force the update of body damage server side with that trick player:getDamageFromHitByACar(0.);
maybe use this instead: sendDamage(player)
if command == 'zRePojalustaRabotaySuka' then
local serverPlayer = getPlayerByOnlineID(args.playerID)
print("[DEBUG] serverPlayer: " .. serverPlayer:getUsername())
local body = serverPlayer:getBodyDamage()
local health = body:getOverallBodyHealth()
print("[DEBUG] health: " .. health)
local newHealth = health + 14
if newHealth > 100 then newHealth = 100 end
body:setOverallBodyHealth(newHealth)
print("[DEBUG] newHealth: " .. newHealth)
local pMod = serverPlayer:getModData()
local infected = body:isInfected()
local albuminDoses = pMod.AlbuminDoses or 0
print("[DEBUG] infected=" .. tostring(infected) ..
", AlbuminDoses=" .. albuminDoses ..
", infectionRate=" .. (LabRecipes_InfectionRate(serverPlayer) or 0))
if infected and albuminDoses > 0 then
print("[DEBUG] ok")
local rate = zMathCeil((LabRecipes_InfectionRate(serverPlayer)*100-14)/7)
print("[DEBUG] rate=" .. rate .. ", albuminEff[rate]=" .. tostring(albuminEff and albuminEff[rate]))
if albuminEff and albuminEff[rate] then
body:setInfectionTime(body:getInfectionTime() +
body:getInfectionMortalityDuration() * albuminEff[rate] / 100)
end
pMod.AlbuminDoses = albuminDoses - 1
print("[DEBUG] new AlbuminDoses: " .. pMod.AlbuminDoses)
serverPlayer:transmitModData()
print("[DEBUG] ModData sync")
else
print("[DEBUG] not ok: infected=" .. tostring(infected) ..
", doses=" .. albuminDoses)
end
elseif command == 'zReRecess' then
---- bla bla bla
I need to get this part of the code working. I have three or four commands from a client, only the first one does not work.
In ":complete()" too. Couldn't work with BodyDamage. Even the character's ModData doesn't change...
For some reason, debugging information is not output to the log file...
putting this code in ":complete()" with a reference to self.character did nothing.
call sendDamage after your last transmitModData
Hi! I currently have some problems executing my TimedActions in MP properly. Here is a code snipped of one of my Actioned:
if self.character:isTimedActionInstant() then
return 1
end
return 300
end
function shaveStubbleAction:new(character, item)
local o = ISBaseTimedAction.new(self, character)
o.stopOnWalk = true
o.stopOnRun = true
o.item = item
o.maxTime = o:getDuration()
return o
end```
Is there anything obviously wrong with it which I am simply too dumb to see?
i don't see an issue in this snippet
doesn't work
I must be off all along then, sorry
what the hell do you mean people are trying to vibe code mods
what do you mean it is bad enough to warrent its own section in the docs LMAO
Can someone tell me if my understanding is wrong?
The Indie Stone removed the use of property DisplayName in favor of using translation files based on the object base name. Right?
yeah, to my understanding
Roger that, I'm trying to fix a mod I haven't worked in a while and noticed some changes from TIS.
Thanks @hallow grotto
The game be like:
I'm tired boss...
im just change DebugOptions and relog
pray to the ommisah and light incense
BRUH
im just forgot [ ] for inputs in CraftRecipe
breaking the launch of the game in the debug with two parentheses in the script and getting a crash with an empty log is a favorite
Yes, that was already what you were meant to use anyway
That parameter was always a very odd one that tough modders to do things wrongly
Thanks. I just found some time to fix some stuff that many users requested and my oh my, sometimes feels quite overwhelming.
craftRecipe:isCanWalk() getting this from craftRecipe tags or isCanWalk = true?
like
timedAction = Making,
SkillRequired = Doctor:1,
xpAward = Doctor:10,
Tags = AnySurfaceCraft;isCanWalk,
or
isCanWalk = true,
Still trying to make my TimedActions work in multiplayer. Problem seems to be that the server does not recognize my new() function. Here is the output from the coop-console.txt:
ERROR: General f:1246, t:1767990687532, st:39,246,502> LuaManager.getFunctionObject > no such function "shaveBodyHairAction.new"
Some relevant code of my TimedAction from the shared folder is here:
if self.character:isTimedActionInstant() then
return 1
end
return 300
end
function shaveBodyHairAction:new(character, choice, bodyLocation, item)
local o = ISBaseTimedAction.new(self, character)
o.stopOnWalk = true
o.stopOnRun = true
o.item = item
o.choice = choice
o.bodyLocation = bodyLocation
o.maxTime = o:getDuration()
return o
end
return shaveBodyHairAction```
This works fine in single player. Is there some special new procedure I need to use to make the server recognize the `new()` function? Or is it not possible to define this a local module only using
```local shaveBodyHairAction = ISBaseTimedAction:derive("shaveBodyHairAction")```
in my action code's header?
Also, in the client folder, I am putting my TimedAction in the TimedAction queque, as in pre 42.13 versions. Is this not possible anymore?
your timed action must be global
i usually do this:```lua
local myAction = ISBaseTimedAction:derive("MyMod_MyAction")
...
_G[myAction.Type] = myAction
_G[myAction.Type] = myAction what is this??
when you start an action, the client sends the action's Type (by default, the string you passed to derive()) and the server looks for and calls _G[Type].new() to recreate the action on its side
by doing _G[myAction.Type] = myAction i can have a Type that is reasonably unique (as it will be a global) without having an ugly variable name in the rest of my code
of course, just removing the local keyword does work too
Yeah... I only have 2 timedActions and there is only one place in my code where I call them. So I guess I go for the classical ugly and long unique name. 😅 It's ugly but easy.
did you try to call update on your new lightswitch after adding it?
The level of my admiration
It possible to use the command
player:setWornItem(bodyLocation, clothingItem)
In single player, this will only equip the clothing item and display it in the game but it won't put it in the inventory.
When I would like to do a similar thing in MP (only equipping the item an making it visible but not putting it to the inventory), is it safe to do this on client -side or better on server-side?

So when I just do it client-side, I can see the item properly equipped when playtesting via the host button but I am wondering whether other player will see it too (which I don't know how to test)
My suspicion is that it would be safer to do it on server side. I am just afraid that for my mod, the server's workload might get to high if there are a lot of player are in the game.
Just testing it alone seems to be fine though...
i would assume that other players would not see anything done client side
ya... I am afraid too 🙁
I think modder spongie mentioned somehow that this trick won't work on client-side but I am not 100% if I understood correctly...
Good day everyone, what are your tips on reducing the size of your mod that is heavily using pngs? my photos are mainly portraits so its 512x512, I prefer not downscale its resolution to preserve more quality, my mod even reach 110mb and that's why reluctantly downscale it to 256x256 and now its not crisp anymore. This is ny WIP mod looks like to give a scale about the photo size https://youtu.be/FudyfaW9hrM?si=YpDB78kfnBQyVg3X&t=29
I made this for this exact purpose: https://github.com/katupia/TextureOptimizer But I think recent softwares already do it natively. So it may have 0 impact depending on how you created those png. Beware not applying it to animations.
nice. what software did you make them pngs with ?
I have noticed a very weird fact in MP, i tried to add a recipe like this in media/scripts/recipes/file.txt:
module Base
{
craftRecipe RefillLighterFluidTin
{
timedAction = Making,
time = 30,
OnCreate = RecipeCodeOnCreate.refillLighterFluidTin,
Tags = InHandCraft,
inputs
{
item 1 [Base.LighterFluid] mode:destroy flags[ItemCount],
item 1 [*],
-fluid 0.04 [Petrol;Alcohol;Cologne;Perfume],
}
outputs
{
item 1 Base.LighterFluid
}
}
}
In MP always fails to work, fluid is consumed but the new LighterFluid is not added to the inventory, tried even with mode:keep and no set output like this:
module Base
{
craftRecipe RefillLighterFluidTin
{
timedAction = Making,
time = 30,
OnCreate = RecipeCodeOnCreate.refillLighterFluidTin,
Tags = InHandCraft,
inputs
{
item 1 [Base.LighterFluid] mode:keepflags[ItemCount],
item 1 [*],
-fluid 0.04 [Petrol;Alcohol;Cologne;Perfume],
}
outputs
{
}
}
}
and then both with and without setCurrentFloat(1)in media/lua/server/file.lua within RecipeCodeOnCreate.refillLighterFluidTin
I really am at a loss here
missing comma on your output
in the second example, missing space after mode:keep likely borks both the mode and the flag
that's a typo from pasting, not actually in the code
i'll give the comma a try, did not realise that
still i don't get why the second way won't work
What is the recipe supposed to do ?
Refill LighterFluid bottle
Ok and what does your OnCreate do here ?
Because you showed the recipe but it doesn't look like this is the important part of your whole issue here
It's the OnCreate that actually refills the lighter right ?
Here's the code i was trying to get working originally:
-- media/lua/shared
local function editRecipe(recipeName, field)
local recipe = getScriptManager():getCraftRecipe(recipeName)
recipe:getInputs():clear()
recipe:Load(recipeName, field)
end
local function editRecipeRefillLighter()
local field =
[[{
inputs
{
item 1 [Base.Lighter] mode:keep flags[NotFull;ItemCount],
item 1 [*],
-fluid 0.005 [Petrol;Alcohol;Cologne;Perfume],
}
}]]
editRecipe("RefillLighter", field)
end
Events.OnGameBoot.Add(editRecipeRefillLighter())
-- media/lua/server
local function getInputs(craftRecipeData, character)
local fuelStats =
{
["Petrol"] = {distance=5, strength=1.2, delta=0.35},
["Alcohol"] = {distance=5, strength=0.6, delta=0.25},
["Cologne"] = {distance=4, strength=0.4, delta=0.3},
["Perfume"] = {distance=4, strength=0.2, delta=0.5},
}
local inputItem = false
local fuelType = false
local items = craftRecipeData:getAllConsumedItems()
items:addAll(craftRecipeData:getAllKeepInputItems())
for i = 0, items:size() - 1 do
local item = items:get(i)
if item then
if item:hasTag(ItemTag.LIGHTER) then inputItem = item end
if item:getFluidContainer() and item:getFluidContainer():getPrimaryFluid() then
local candidate = item:getFluidContainer():getPrimaryFluid():getFluidTypeString()
if fuelStats[candidate] then fuelType = candidate end
end
end
end
return {inputItem, fuelType, fuelStats}
end
local function refillLighter(craftRecipeData, character)
local inputs = getInputs(craftRecipeData, character)
local lighter = inputs[1]
local fuelType = inputs[2]
local fuelStats = inputs[3]
if not lighter then return end
if not fuelType then return end
if lighter:getCurrentUsesFloat() == 0 then lighter:setActivated(false) end
-- lighter:setLightDistance(fuelStats[fuelType].distance)
-- lighter:setLightStrength(fuelStats[fuelType].strength)
-- lighter:setUseDelta(fuelStats[fuelType].delta)
lighter:setCurrentUsesFloat(1)
print("LIGHTER REFILLED")
end
RecipeCodeOnCreate.refillLighter = refillLighter
do you see LIGHTER REFILLED in multiplayer?
try calling sendItemStats(lighter) after setting the uses
Someone knows something about the following vehicle masking problem since early B42 ?I see KI5 has the same problem. masking problem demo: https://youtu.be/dLDJIGFUX38
This started with first version of B42 afaik.
Apparently it KIND of works with sendItemStats(lighter), now the lighter gets refilled but it only works with a LighterFluid tin filled with whathever fuel i stated, i have the feeling that for that specific recipe there is something going on at java level
Trying to get my head around the new B42 Item API, why does this code work in SP but not when hosting MP?
client
local MOD_MODULE = "PostMortem"
local function onCreatePlayer(playerIndex, player)
sendClientCommand("PostMortem","RetrieveSpawnID", {})
end
Events.OnCreatePlayer.Add(onCreatePlayer)
Server
local MOD_MODULE = "PostMortem"
local function giveSpawnID(player, fullType)
local inv = player:getInventory()
local spawnID = instanceItem(fullType)
if spawnID then
inv:AddItem(spawnID)
sendAddItemToContainer(inv, spawnID) -- sync to clients
end
end
local function OnClientCommand(module, command, player, args)
if module ~= MOD_MODULE or command ~= "RetrieveSpawnID" then return end
giveSpawnID(player, "PostMortem.Alive_Player_Dogtag")
end
Events.OnClientCommand.Add(OnClientCommand)
Added some prints to the OnClientCommand on the server, it appears correctly on SP but not on MP. I suspect it's a quirk within the in-game hosting functionality?
@bronze yoke hate to pester, but is the modding place undergoing renovations or something? If you know?
Nevermind
Do you mean I should try :update()?
in mp they print to coop-console.txt
TIL, it seems to be printing fine then, but still no dice when it comes to actually retrieving the item
No difference when on a dedi server. No idea what I'm doing wrong 
yep. or maybe try setActive() after adding it. something to force an update immediately instead of waiting for the cell to update
Hello, I am trying to have some Lua code run when someone drags an item into a container. Does anybody know where I could find the vanilla code for this to tie into and run my code off of?
I currently use the item's AcceptItemFunction option to allow only certain items into the container, but I don't believe I can use that to do what I'm planning.
I would like the 'stackable' items I have to be automatically consolidated when dragged into a certain container. I have the consolidation code working manually with a context menu, but was hoping to have it automated any time someone drags an applicable item into the container.
Does anybody have an ideas? Trying to avoid having to override any vanilla code, and just hook into a function for this, but not sure where to look.
Thanks!
maybe the OnRefreshInventoryWindowContainers event
https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md#onrefreshinventorywindowcontainers
Hey, fellas... I am wanting to get into modding.. For my first mod, I was just wanting to add some IRL comics in game to find and collect. I made the basic mod folder structure. I was looking at how the in game comics are generated as a reference but I have some questions.. If anyone is willing to help, please let me know. Thanks
OnRefreshInventoryWindowContainers
(Client) OnRefreshInventoryWindowContainers: Fires when the available containers in the inventory UI change.
Does this mean when the container's contents are updated? Or just when the container is equipped/unequipped?
i think it's any time the ui is redrawn, so even more frequently than that
Hmm.. That may be too much overhead if I'm trying to just do a drag/drop of an item into a container to run a function once..
I didn't know it was called that often
i think it's any time the list of available containers could change (not necessarily that it did change, just something happened that *might* change it, which is basically any item transfer, certain objects spawning in or being built, moving, etc)
My main question I guess is, would it be easier to just create each comic as a new item? Because it seems PZ just generates an item "ComicBook" and then generates a random name and issue from a list. Keeping the same model and icon. I would want to have different models, icons, and names for each individual comic
if they're that unique then yes individual items makes more sense
It shows inventoryPage(ISInventoryPage), and reason(string) as parameters for it. I haven't messed with inventory stuff much, so I'm not sure what to look for. I suppose I could check if "reason" and inventoryPage were of a certain type, but no clue what is available? Do you know if a list of these things? Or is it buried in Java code somewhere possibly?
it's probably lua, but i don't remember if i ever collected anything about it
have a look in ISInventoryPage.lua, at the refreshBackpacks code I believe. There's a few reasons it fires, which fire at different times during that function. the ISInventoryPage is the inventory page object
Say I have a custom container, lets call it "specialbag", is there a way to determine from ISInventoryPage, if it belongs to that container?
JBLogging.Storage.OnRefreshContainers = function(inventoryPage, state)
if state ~= "end" then return end
if inventoryPage.onCharacter then return end
local containers = inventoryPage.backpacks
if not containers then return end
for _, backpack in ipairs(containers) do
local container = backpack.inventory
if container and container:getParent() then
local object = container:getParent()
local modData = object:getModData()
if modData and modData.JB_AutoLogStorage then
container:setAcceptItemFunction("JBLogging.Storage.Accept")
JBLogging.Storage.UpdateSprite(object)
end
end
end
end```
So inventorypage in this case, would be the players main inventory window?
if not inventoryPage.onCharacter then it's a loot window
Alright, interesting. Thanks for the help! I'll get to digging at things and see if I can get it to work.
By chance, do you know of a way to stop an 'unauthorized' player from accessing a container/items in a container? Say, only accessible to an admin, or to someone tagged as the owner with moddata? Is there a function for this? Or do I have to override vanilla stuff for that?
OnCreate = SpecialLootSpawns.OnCreateComicBook,
Does the OnCreate determine how it is generated within the world?
not sure if isLockedToCharacter will do what you want. The only way I've ever done it is the blasphemous way
The blasphemous way?.. 😉 lol
yep, vanilla function for that is in the java
Oh wait.. nvm... I think I get it. The OnCreate is what creates the different variations of "ComicBook" before throwing them in to the distrubution pool?
how to set this trigger to craftRecipe?
isCanWalk = true, dont work
into tags same
when a comic book spawns, it calls this function to randomise its name etc
Right.. I think I got it now.. Thank you!
Do you know if isLockedToCharacter is usuable on a bag/player container, and not just an isoThumpable world container?
okay, it's CanWalk = true, but something works wrong
like, u just can spin around
I think so but I'm not entirely sure. Might check refresh backpacks and see how it's used there
I'm checking in the code right now, it seems to trigger the event you posted directly.
triggerEvent("OnRefreshInventoryWindowContainers", self, "begin")
Just found it and some others, so snooping around and seeing if anything will work for my situation.
What was your 'blasphemous' method of container locking, if you don't mind me asking?
Lets goooo
It looks like I may be able to override the 'addContainerButton` function, to completely hide the item's inventory from an unauthorized player in this case. Even if they equip it, it won't show them the container button to click on. Hmm..
What you're doing, you probably want 'end' when everything is done
My blasphemy involved overwriting the entire refreshBackpacks code, but it was only used in a controlled modlist, so I could be super lazy about it
I just used moddata to check if it should be shown or not
Thanks for the advice, I'll give it a go.
I basically have a special player only container with personal items I want to be able to isolate from other players in case a player dies, or whatnot. So the player can come back and retreive their stuff without lotting things. Also, the convenience of consolidating important/common used items when they drag them into that special container. I've got a lot of it working the way I want, but these last few things I'm trying to do are giving me some issues. I'd prefer not to have to override anything major, or at least run my code and let the original run if my checks aren't valid.
What about ISInventoryTransferAction. Is this something that can be used for my first use case of Item Consolidation?
Does anyone know how I can make a raw item still give unhappiness on consumption after being cooked?
I've been scratching my head for the better part of an hour right now. Does anyone know why this code returns Object tried to call nil in giveSpawnID on idData:transmitModData()?
If I recall, items with modData don't need to be transmitted, as it's done automatically.
So I got the comic into the game. I am wanting to swap the "ComicBook_01" texture with the same png comic cover that I added. Both 64x64 png. Would that work? If I put texture = "my_png.png"? model ComicBookGround { mesh = WorldItems/MagazineOpen, texture = WorldItems/ComicBook_01, scale = 0.3, attachment world { offset = 0.0 0.0 -0.605, rotate = 0.0 0.0 0.0, } }
since the item didn't exist before this, you don't need to do anything to send its mod data
item:transmitModData() does not exist so the error is accurate
for reference you would use syncItemModData(player, item)
Thats good to know moving forward. still in B41 land for now
This is so that when you place the comic into the world, you see the cover png I added instead of the default png for comicbooks
albion i hope both sides of your pillow are cool tonight, that resolved the issue
thank you sm :)
module Base { item Infinity_Gauntlet_001 { DisplayName = Infinity Gauntlet (1991) #1 DisplayCategory = Literature, Type = Literature, Weight = 0.4, Icon = Infinity_Gauntlet_001, BoredomChange = -30, StressChange = -20, UnhappyChange = -20, StaticModel = InfinityGauntlet001, WorldStaticModel = InfinityGauntlet001Ground, Tags = Picturebook, } }
` model InfinityGauntlet001
{
mesh = Magazine_Open,
texture = ComicBook_Open,
scale = 1.0,
attachment Bip01_Prop2
{
offset = 0.0 0.0 0.0,
rotate = 90.0 0.0 180.0,
scale = 0.125,
}
}
model InfinityGauntlet001Ground
{
mesh = WorldItems/MagazineOpen,
texture = Infinity_Gauntlet_001,
scale = 0.3,
attachment world
{
offset = 0.0 0.0 -0.605,
rotate = 0.0 0.0 0.0,
}
}`
So.. it pops up as just a big PNG when I do that lol
when the icon appears in world like that, it usually means it can't find your model script at all
is that the full file? it should be in a module block if it isn't
but why
local spawnID = instanceItem("PostMortem.Alive_Player_Dogtag")
local idItem = inv:AddItem(spawnID)
local idData = idItem:getModData()
just do it like
local spawnID = instanceItem("PostMortem.Alive_Player_Dogtag")
local idData = spawnID :getModData()
work with mod data
inv:AddItem(spawnID )
?!
without any transmit, nope?!
Oh... RIP. Stand by
that was a leftover of troubleshooting, whoops
i have a cold right now and I'm not thinking at 100% capacity lmaoo
local cmpTestTubeWithInfectedBlood = InventoryItemFactory.CreateItem("LabItems.CmpTestTubeWithInfectedBlood");
local iMod = cmpTestTubeWithInfectedBlood:getModData();
iMod.IsInfected = player:isInfected();
player:getInventory():AddItem(cmpTestTubeWithInfectedBlood)
is there a way to suppress body wetness?
Oh, it's too bad, good health to you!
getPlayer():getStats():get(CharacterStat.WETNESS)
Trying my best @.@
Right now it's just a case of figuring out how to get the script to work in MP, but I'll burn that bridge later
Okay.. module block is fixed. However.. I am getting no texture. I assume this is because it cant find it? The PNG works with the icon. Dont know if I need to include file path or not?
getPlayer():getStats():set(CharacterStat.WETNESS, 0) -- set it to 0 :D
antoher deal with math
i think the texture path starts from media/textures/ and does not include the extension
so this would be looking for media/textures/Infinity_Gauntlet_001.png
I think i saw something like this in the drymyself lua 😄 will take a look at it, thank you
local currentWetness = player:getStats():get(CharacterStat.WETNESS)
local delta = 0.8
local changer = currentWetness * delta
if changer < 0 then changer = 0 end
player:getStats():set(CharacterStat.WETNESS, changer)
model InfinityGauntlet001Ground { mesh = WorldItems/MagazineOpen, texture = textures/Infinity_Gauntlet_001, scale = 0.3, attachment world { offset = 0.0 0.0 -0.605, rotate = 0.0 0.0 0.0, } }
what folder is your texture in?
So I have tried with texture = textures/Infinity_Gauntlet_001 and texture = Infinity_Gauntlet_001
Thank you 🙂
in a folder called "textures"

