#mod_development
1 messages ยท Page 358 of 1
Maybe we should add credits on the Modding project pages on the wiki
when 'i' update the luadocs i actually just click a button after omar has done all the work on the data ๐
I really was just poking fun at the message lol, I don't mind not getting credit
Yes, if it uses the online workshop version of your mod
The lua stubgen code is secretly a mess so the less people know about it the better ๐
I know but it does matter to me to properly credit people for their work
nah my code doesnt work for some reason
and it should
server doesnt recieve client commands
thanks boss
Sorry I forgot to answer you after being on the phone with someone, but the translation files don't really use -- comments like @frank elbow explained, I believe the reason this works is simply because if a line doesn't have the right format it is ignored
Usually we attribute to translation files the same format as scripts
So really, i could just type a sentence, and as long as it doesnt contain syntax cues, it should work?
So what I suggest actually using are Java comments
Basically
The reason I suggest Java comments, is that you can use the PZ Script highlight extension available on VSCode to make scripts more easily readable, which works really really well for translation files too
For translation files, there actually is a specific carve-out for -- that other scripts don't have
Interesting
I believe the PZ Script highlight extension doesn't recognize those tho, let me try
Also anything after the last quote on a line is ignored, so if you wanted to get wild you could do UI_string = "translation" // java-style comment
i think the translation files must have actually been lua tables in some build before 41, they're too weird otherwise
Missing comma 
That'd make sense, with the loose Lua-like syntax
Comma isn't actually needed for these
Actually yes
We love separate parsers for different script types
Nah, true for other scripts but not translations
I could've sworn they didn't, let me check
It is also a very recurring mistake of translations
i do seem to remember this coming up but i might be thinking of people forgetting to put commas on the script lines that reference the translations (specifically in sandbox options)
There's no check for commas in the translation file parser
I was unaware this was a thing, time to download it
It certainly is true for other scripts
it is a viable strategy to just.. copy the way the game does things and implement it into your own mod?
im looking at foraging definition files right now for 42.13, would it be wise to just c&p them and substitute in my own items, and/or is there anything else to look out for when implementing foraging for items from your own mod
I swear to god translation files caused issues with commas before and I had already told people the reason their translation don't work is because of commas
I'd just write a translation file just to confirm but I moved all my translations to Fluent & can't be bothered
java.lang.RuntimeException: invalid or missing VERSION at CustomPerks.parse(CustomPerks.java:115).
Stack trace:
zombie.characters.skills.CustomPerks.parse(CustomPerks.java:115)
zombie.characters.skills.CustomPerks.readFile(CustomPerks.java:94)
zombie.characters.skills.CustomPerks.init(CustomPerks.java:36)
zombie.GameWindow.initShared(GameWindow.java:207)
zombie.GameWindow.init(GameWindow.java:1179)
zombie.GameWindow.mainThreadInit(GameWindow.java:690)
zombie.GameWindow.mainThreadStart(GameWindow.java:560)
zombie.MainThread.mainLoop(MainThread.java:58)
java.base/java.lang.Thread.run(Unknown Source)```Anyone know what might be causing this? it's not throwing an error specific to my mod so Idk
Also here's what that extension does with the formatting of translation files, way easier to read that way
Or is this just a base game error?
And comments
what omar said
Invalid or missing VERSION means it expects a VERSION field and didn't find one
So you have some script (from context, a perk) that should be setting VERSION to a value
I'll test sec
Fwiw I remember having missed commas & them working fine too
Ok interesting, so I guess commas are no longer mandatory for translation files, but I swear to god they were needed
I always included them anyway because force of habit
At least as of b41 they weren't needed, idr before that
I guess I'm missremembering, I arrived at the last B41 version
hello, can someone help me?
even fi I dont have custom perks the file cant just be empty?
you might have been thinking of people forgetting to put commas on the translation line of sandbox options
i remember that coming up multiple times for some reason
i am gaving a problem with my code... honestly, with anything that have "player:" in it
No, if you have the file you'll have to add VERSION = 1,
TIS and their freaking custom text based data ๐
this mod is suposed to track if you are holding an item with blood on it, but it bitches about it everytime i try to use... It worked fine before 42.13
"function BloodyHands.evaluateProtection(player)
local hazmatSuit = BloodyHands.getHazmatSuit(player)
local hasHazmat = false
local protectionLevel = "none" -- "none", "fingerless", "damaged", "good", "hazmat"
local gloveHoles = 0
local isFingerless = false
if not player or not player.getWornItem then
return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
if hazmatSuit then
local holes = hazmatSuit.getHolesNumber and hazmatSuit:getHolesNumber() or 0
if holes <= 0 then
hasHazmat = true
protectionLevel = "hazmat"
return hasHazmat, protectionLevel, 0, false
else
protectionLevel = "hazmat_damaged"
return hasHazmat, protectionLevel, holes, false
end
else
local glove = player:getWornItem("Hands")
if glove then
local fullType = glove.getFullType and glove:getFullType() or nil
isFingerless = fullType and FINGERLESS_GLOVE_TYPES[fullType] or false
gloveHoles = glove.getHolesNumber and glove:getHolesNumber() or 0
if isFingerless then
if gloveHoles > 0 then
protectionLevel = "fingerless_damaged"
else
protectionLevel = "fingerless"
end
else
if gloveHoles >= MAX_CALC_HOLES then
protectionLevel = "damaged"
elseif gloveHoles > 0 then
protectionLevel = "damaged"
else
protectionLevel = "good"
end
end
else
protectionLevel = "none"
end
end
return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
"
how did that work out? i always thought the vanilla translations looked underwhelming but i'm too monolingual to be making decisions about that
Society if they had just used an existing format: ๐ซ๐ ๐
Can someone help?
Yea ๐ญ
Pretty well, using the new listFilesInModDirectory to read .ftl files from media/ftl/LOCALE (and media/ftl/mod_id/locale, because habit from having folders per-mod)
okay, thanks
Fluent allows custom functions so I also added a function for determining the correct Korean particle to use for the given text (before it had to be ์/๋ฅผ, now it's smart enough to pick)
So, asymmetric translation example:
# in en:
# @param $name string The name of the player who drew a card. This may include rich text formatting.
# @param $card string The full name of the card that was drawn.
# @param $rawName? string The name of the player who drew a card, without formatting.
# @param $space? string The rich text space to include after the name, or an empty string if not rich text.
command-card = { $name }{ $space } draws { $card }
# in kr
command-card = { $name }{ KR_PARTICLE($rawName, type: "subj") }
{ KR_WITH_PARTICLE($card, type: "obj", numeral: "sino") } ๋ฝ์์ต๋๋ค
I feel like I picked a shit time to try to learn to mod.
Can you wrap this in a code block? Three backticks, lua, then three backticks at the end, e.g.,
```lua
-- code here
```
Why that ?
-_- so everything now needs in a content folder lol
Not sure what you mean but that's not new, you need a Contents folder to upload mods
but not to just slap it in the mods foler?
Every existing mod that I could use as a reference is also broken, lol.
Wdym ?
Workshop mods have always required Contents
let me try that
The mods folder is a separate thing
Nah, it's just there's some changes to script handling with the need of registries
local hazmatSuit = BloodyHands.getHazmatSuit(player)
local hasHazmat = false
local protectionLevel = "none" -- "none", "fingerless", "damaged", "good", "hazmat"
local gloveHoles = 0
local isFingerless = false
if not player or not player.getWornItem then
return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
if hazmatSuit then
local holes = hazmatSuit.getHolesNumber and hazmatSuit:getHolesNumber() or 0
if holes <= 0 then
hasHazmat = true
protectionLevel = "hazmat"
return hasHazmat, protectionLevel, 0, false
else
protectionLevel = "hazmat_damaged"
return hasHazmat, protectionLevel, holes, false
end
else
local glove = player:getWornItem("Hands")
if glove then
local fullType = glove.getFullType and glove:getFullType() or nil
isFingerless = fullType and FINGERLESS_GLOVE_TYPES[fullType] or false
gloveHoles = glove.getHolesNumber and glove:getHolesNumber() or 0
if isFingerless then
if gloveHoles > 0 then
protectionLevel = "fingerless_damaged"
else
protectionLevel = "fingerless"
end
else
if gloveHoles >= MAX_CALC_HOLES then
protectionLevel = "damaged"
elseif gloveHoles > 0 then
protectionLevel = "damaged"
else
protectionLevel = "good"
end
end
else
protectionLevel = "none"
end
end
return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
lua formatted please
really cool! i may look into that when i get a chance, but my language learning is not coming along how i'd like and i certainly don't have any translators dedicated enough to ask for something like this
i am sorry, not very educated in sharing this on discord... isn't in lua?
Just modify your messages
Thanks ๐ If it were more polished I'd probably publish it as its own thing, but currently the NumberFormat analogue is pretty barebones. It lives in my library mod that I'm planning on publishing this or next week, if you want to check out the implementation
That way you don't constantly repost your message
-- function BloodyHands.evaluateProtection(player)
local hazmatSuit = BloodyHands.getHazmatSuit(player)
local hasHazmat = false
local protectionLevel = "none" -- "none", "fingerless", "damaged", "good", "hazmat"
local gloveHoles = 0
local isFingerless = false
if not player or not player.getWornItem then
return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
if hazmatSuit then
local holes = hazmatSuit.getHolesNumber and hazmatSuit:getHolesNumber() or 0
if holes <= 0 then
hasHazmat = true
protectionLevel = "hazmat"
return hasHazmat, protectionLevel, 0, false
else
protectionLevel = "hazmat_damaged"
return hasHazmat, protectionLevel, holes, false
end
else
local glove = player:getWornItem("Hands")
if glove then
local fullType = glove.getFullType and glove:getFullType() or nil
isFingerless = fullType and FINGERLESS_GLOVE_TYPES[fullType] or false
gloveHoles = glove.getHolesNumber and glove:getHolesNumber() or 0
if isFingerless then
if gloveHoles > 0 then
protectionLevel = "fingerless_damaged"
else
protectionLevel = "fingerless"
end
else
if gloveHoles >= MAX_CALC_HOLES then
protectionLevel = "damaged"
elseif gloveHoles > 0 then
protectionLevel = "damaged"
else
protectionLevel = "good"
end
end
else
protectionLevel = "none"
end
end
way too long
this part is the end
-- return hasHazmat, protectionLevel, gloveHoles, isFingerless
end
It'd also be helpful to know what the error is (or errors are)
A lot changed in 42.13
Do ping me when you do so I can document it on the wiki
I don't know if it's really good enough to warrant a spot among the greats lol, but will do
basically, for what i can tell, player returns nill... (i guess)
this worked just fine before the update
What is line 7
There's plenty of other shitty libs and projects lmao
everything that uses "player:" don't work
If that makes it better for you
let me send you that
i'm definitely interested to see what's in your library
The objective is to document technical modding projects made for modders
I'll let y'all know when it's out, but it really is just an eclectic collection of stuff I'll use in other mods + some UI stuff
A lot of those projects never see actual use, but if someone wants to work on something that doesn't X Y Z, they can easily find other projects similar
so is starlit ๐คซ
That's a lie
i dress it up but it's just 'i needed this for a mod so i made it'
๐
this code only have more than 1000 lines
Line 7 of GlovesInventoryTransfer.lua
it is one of the codes that is giving me the same problem
That's that file?
yeah...
Gosh I need to write that guide for errors
yes
but it have like... a lot
that shares the same problem.
can i send it here?
is itempicker necessary for distributions in 42
No idea what that is
Items/ItemPicker
ive seen it on some mods distributions before
sorry if the comments are in portuguese
anyway, this whole project is tied to a "database" called ModState
it saves icons and only work if the right icon is on
so you probably won't be able to use it if you try
but still... about the problem
i guess something change with the way you use the code like that one i just shared here
i see, im trying to figure out distributions again since i made an attempt to convert a mod from b41 to b42. my main issue is with changes to distribution, sandbox options and foraging syntax
sendclientcommand doesnt seem to work
i think i could figure things out with pzwiki, the javadocs and the game files as examples
but if im confused ill ask
nothing has really changed about the syntax for distributions
a couple container/room names changed but that's mostly it for breaking changes
was that for me?
no don't worry
well i had a complaint from a user of one of my mods who said distributions werent working with it. ill drop the lua file in here
ok
i just added itempicker just incase
there are sandbox options and i looked at them, nothing seems off when comparing the pzwiki syntax and the sandbox options txt
ill drop that aswell
probably the "version = 2" thing throwing it off? since i dont see that anywhere from examples
What does ItemPickerJava.Parse() do?
albion said its b40 code, which seemed to imply its deprecated
i think it had something to do with parsing distributions
It shouldn't be needed
ill just test removing the version bit to see if it fixes anything or if i encounter anything new
table.insert(ProceduralDistributions.list["BedroomDresserRedneck"].items, "ReeferMadness.Joint")
table.insert(ProceduralDistributions.list["BedroomDresserRedneck"].items, 0.01)```
getSpawnRate?
I removed that, that is a local function I wrote for adjusting spawn rates with sandbox options
i had this for suburbs
-- Male
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "CKRations.CannedCRationBUnit");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, CRationBUnitRolls);
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "CKRations.CannedCRationMUnit");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, CRationMUnitRolls);
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "CKRations.KRation");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, KRationRolls);
-- Female
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "CKRations.CannedCRationBUnit");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, CRationBUnitRolls);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "CKRations.CannedCRationMUnit");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, CRationMUnitRolls);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "CKRations.KRation");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, KRationRolls);```
i just had a simple variable that should link to SO
that is a very low spawnrate though
send client command doesnt seem to work
how
Yeah ignore the value, it gets changed in my code
whats the issue
what are you doing with it
so you're just testing it out
Your Proced is table.insert(ProceduralDistributions["list"] instead of table.insert(ProceduralDistributions.list
Idk if that means the same thing
it means the same thing
yes
in lua table.string is syntactic sugar for table["string"]
the issue might actually have to do with MP, would I have to move foraging to either client or shared?
or does it stay in server regardless
i mean nothing's wrong with this as far as i know
but it doesnt reach server
is this normal on a self hosted server or sum?
Can you show your code for receiving it on the server?
When/where are you calling sendClientCommand?
so i assume its hooked
i think it's too late to send a command when OnDisconnect triggers
See what albion said
you're sending a command after you've disconnected from the server
yeah but not even player added works
thats the thing
that one is the result of a bug
the client can't send commands until one tick after loading in
everything seems to be fine in SP
what should i do then
I haven't thought about it, but with so many little quirks like this it really is a wonder that people without background get into pz modding ๐ hopefully the pattern of documentation started in this build continues
You can hook to OnTick or OnPlayerUpdate, get the player in the listener, and remove your listener once you have the player
not spawning on zeds
could i just delay it?
like by a tick
then
its sandbox options because its not showing up in sandbox settings meaning nothing is going to spawn since its relying on variables from sandbox settings that dont exist
The code that triggers OnTick will already be running before the player is created iirc, so the player check is needed
so onplayerupdate and getplayer() inside and if player then remove lister and send player created?
isnt onplayerupdate bound to player instance? and doesnt fire until player is spawned?
I was thinking of OnPlayerMove, I think, but that's moved to the server now. Yes, update is tied to the instance, but same problem with OnCreatePlayer in that you'd have to do it on the tick after loading in
so is OnCreatePlayer
thats the point
it will be the same thing
i wanted to get there
Have you tried this ?
onplayerupdate?
i think you still need to wait one tick even if you use OnPlayerUpdate
btw client lua will reload each time you join a server right?
hmm
At least with OnTick I've had success just listening until the player is available
so i use on tick
and then when ontick fires
i fire the sendclientcommand
and remove the ontick callback
?
Yeah
i will just make a wrapper for this
now what could be causing this
lack of translation file?
thats pretty much my only issue left
What is the relevant code? The unpaired ] makes me think this is a garbled [img= BBCode tag, maybe due to the [B42] in the directory. But that's a shot in the dark, unsure off the top of my head whether the parser would fail on that
besides the rations option for foraging being above everything else
oh thats possible
I don't know why it would have the full path, though
So I think it might be something else
Events.OnTick.Remove (not :Remove) and you should be checking for the player before trying to send, assuming this is the create player one. I can never remember whether Lua (or Kahlua) handles forward-declaration with local functions, but assuming it does then that should be all
no this is actually a wrapper for sendclientcommand
that fires after a tick
always
I see, then just the .Remove
thanks for your help omar
FINALLY
textures are there
is onlineid the playerIndex?
bc for me its 0
and im alone in my server
if its like this
i wouldnt like to use it to keep track of players
can i do like table[isoplayer] = this
?
Each connection to the server is allocated 4 online ID slots, essentially, one for each potential splitscreen player. So 0-3, then 4-7, etc.
They won't be reused in the same session, so if the data doesn't need to be persistent it can be used to keep track of players
Take that, refactored build 42.13 profession system!
Does anyone know how to deal with this type of error in the log:
ItemPickInfo -> cannot get ID for container:
My custom containers for my vehicles keep giving this error and I have no idea what I need to configure to fix it.
Why is it printed in the logs ? ๐ง
That's console output from my version 42.12 profession mod. I just printed everything from there to the console in the new 42.13 format. I'll use this for copy-paste when updating it to 42.13 (there around 40 professions I have to update, so it will be much faster doing it this way)
Yeah. But that's just some easy quick and dirty lua scripting. Nothing difficult.
the old and new trait systems are barely different, it's just the input format that has changed
CharacterTraitDefinition is almost identical to TraitFactory.Trait but has some extra functionality
btw traits: is it possible to give the player a new trait on server side and so that it works in mp?
Do you mean TraitFactory.Trait, or am I missing something? (genuine question, not a weird veiled correction)
oh yeah you're right
it's all a little confusing ๐ skills are perks even though 'perk' is the term usually used for things similar to traits, which are just traits, and occupations are professions
I do wonder why they stuck with 'Perk' when (iirc?) the UI refers to them as skills, but maybe just a holdover that didn't make sense to change
Hopefully considered for a rename if/when they change like the other defs
you used to have to buy them with points, which is a bit more like a typical 'perk', but i think they were still called skills even then
if they predated traits that'd make a bit more sense but i don't think they do...?
Their addition was before my time, but either way they've always seemed skill-like to me
Which would explain the UI naming, I suppose, but not the code
yes, afterwards call sendSyncPlayerFields(player, 2)
Can someone try opening a fresh vanilla save and try to use split screen? My game is borked all of a sudden and I'm pretty sure it's not my fault, but it could be on just my end
I often see small updates getting queued
I'm wondering if they did something that broke split screen
I don't want to reinstall with my current internet :P
Hello guys... I'm really strugling with those damn new methods... Does anyone know how to add and remove traits? I've seen that now "getTraits" became "getCharacterTraits", but i can't find anywhere how to get the right type of arguments... I don't know shit about java and decompiling game files to find the right method... does anyone know where we can find the changes?
thing is how would i go on checking when a player is leaving the server?
Yes
Hey a question, is it legal to modify .lua files on pz game folder?
I don't want to create a new trait, i want to dynamically add or remove one allready existing (smoker)
I manage to find the right method for add and remove (getPlayer():getCharacterTraits().add and getPlayer():getCharacterTraits().remove) but i can't find the right type of argument
But reuploading their files into your mod modified is fine
Oh okay thanks
Read the last section of the guide, it might help a bit
HOWEVER we suggest doing patches instead of replacing entire files
For compatibility reasons, this is way less aggressive and will both improve your mod and make it less annoying whenever they update that specific file
Yeah i was thinking abt that, but i just had that question i dont need to do it for now
I need to see how can i let the server know the player left
Via event
I have read the Migration guide there nothing about traits... When i try :"getPlayer():getCharacterTraits().add("base:smoker")", it says "expected argument of type ResourceLocation, got String". And i don't understand what is the type "ResourceLocation" or how to deal with it... (English is not my native language...)
you're supposed to add the CharacterTrait, not a string
in this example, CharacterTrait.SMOKER
for modded traits you need to keep the CharacterTrait somewhere accessible after rgeistering it
That's not the guide I'm talking about
I sent you a link
Actually read it ๐
OMG THANK YOU !!! It worked with "CharacterTrait.SMOKER" . I'm on this sh** for hours looking for the right syntax! I didn't expected that the trait should be written in full caps... Where did you find this info?
42.13 broke sooooo many things... I have past the last days trying to fix mods that are not supported by their author anymore... my brain is melting... ๐
@bright fog Thank you too!
๐
This is a GOLDMINE!
They are not supported by their author because their author's brains melted. ๐
Yeah! And i understand why, now! XD
But you guys are awesome!
Do consider it has been only a few days since B42 MP unstable release and modders have a life, so it isn't too surprising lots of mods aren't updated. Those are also big changes to a system that was getting quite old now. As such it isn't too surprising that some modders which don't do that full time are having a hard time handling it
Yes of course! I'll never judge modders about being late or anything! I'm talking about mods unsupported for month or even years! (I just came back to the game for 42.13, so i managed to repair all the mods i've been using years ago)
How does that work for non-base game traits though
store them after you register them
aka
ETWRegistry = ETWRegistry or {}
ETWRegistry.AVClub = CharacterTrait.register("ETW:AVClub")
ETWRegistry.AxeThrower = CharacterTrait.register("ETW:AxeThrower")
ETWRegistry.Bloodlust = CharacterTrait.register("ETW:Bloodlust")
ETWRegistry.BodyWorkEnthusiast = CharacterTrait.register("ETW:BodyWorkEnthusiast")
ETWRegistry.FurnitureAssembler = CharacterTrait.register("ETW:FurnitureAssembler")
yes
and then pull from registry?
yeah
ok cool ty
out of curiosuty did they cook something with weight or the only way for multiple mods that modify carry weight to sync is still just 1 mod overwriting all others while mimicking their logic?
also I wonder if I should keep my registry uppercase to follow base game convention but I dislike upper registry so much

they are constants, so the convention of full uppercase makes sense
however it is your mod and your conventions are up to you
ye I know 
I failed to mention I wrote an analyzer with neat GitHub actions support when talking abt Fluent earlier
The annotation part is actually pretty easy to do, you just write output of a certain format. See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#example-creating-an-annotation-for-an-error (unfortunate limit: only 10 annotations per job display in the file, and only up to 50 per run iirc)
I also included support for run summaries which is less straightforward, but there's a node package GitHub has for it (it's just writing to a file specified in an env variable instead of writing output)
I'm desperate with the body location changes; I have four outdated mods and nothing works. I'm currently working on the simplest one, the Legendary Satchel, which creates a new body location so I can equip it along with the backpack and/or fanny pack. Here's what I've done so far:
LSBodyLocation = {}
LSBodyLocation.ItemBodyLocation = {}
LSBodyLocation.ItemBodyLocation.LSsatchel = ItemBodyLocation.register("lsbodylocation:LSsatchel")
--in media/scripts/LSitems.txt
/* === GREY === */
item Bag_LegendarySatchel_Grey
{
DisplayName = Legendary Satchel (Grey),
DisplayCategory = Bag,
ItemType = base:container,
Weight = 1,
IconsForTexture = LegendarySatchel_GreyIcon,
BloodLocation = Bag,
BodyLocation = LSsatchel,
CanBeEquipped = LSsatchel,
Capacity = 49,
CloseSound = CloseSatchel,
ClothingItem = Bag_LegendarySatchel_Grey,
EquipSound = EquipSatchel,
OpenSound = OpenSatchel,
PutInSound = StoreItemSatchel,
ReplaceInPrimaryHand = Bag_LegendarySatchel_Grey_RHand holdingbagright,
ReplaceInSecondHand = Bag_LegendarySatchel_Grey_LHand holdingbagleft,
RunSpeedModifier = 0.99,
WeightReduction = 99,
WorldStaticModel = Satchel_Military_Ground,
Tags = base:isfiretinder;base:isfirefuel,
}
--in media/lua/shared/NPCs/LS_BodyLocations.lua
require "BodyLocations"
local group = BodyLocations.getGroup("Human")
group:addLocation("lsbodylocation:LSsatchel")
or
require "BodyLocations"
local group = BodyLocations.getGroup("Human")
group:getOrCreateBodyLocation("lsbodylocation:LSsatchel")```
group:getOrCreateBodyLocation(LSBodyLocation.ItemBodyLocation.LSsatchel)
hmm... although I updated my largest mod for single player (not yet mp), subscriber numbers are still going down as hell ๐ญ
btw they added a satchel bodylocation in 42.13 if you didnt already know
Yes, big change there. Satchels and slung water canteens fight for that slot now
so... is there any little quick description on what changed with the way professions are done now? hoping to get my lil profession rebalance updated for mp here
is there an easy and secure way to check whether a profession comes from the vanilla game and is not a modded one?
character_trait_definition ETW:GymRat
{
IsProfessionTrait = false,
DisabledInMultiplayer = false,
CharacterTrait = ETW:GymRat,
Cost = 6,
UIName = UI_trait_GymRat,
UIDescription = UI_trait_GymRatDesc,
XPBoosts = Fitness=1;Strength=1,
MutuallyExclusiveTraits = base:unfit;base:emaciated;base:very underweight;base:underweight;base:out of shape;base:weak;base:feeble,
}
why mutually exclusive traits don't work (aka I can still pick them), I double checked in base game code and the names align
aka anyone knows where's the mistake? xd
Is there a mod that allows sharing of player builds? My naive version would just use a block of JSON but in my ideal world we'd base64-encode or something to make it like sharing blueprints in Factorio.
out-of-the-box - no, afaik
I'd instead suggest checking out the mapping Discord, they are currently making whole libraries of building files
depends what you mean by 'secure', but if the name starts with base: it must be vanilla
I explained that so badly using the Blueprints comparison when the only thing it has in common is how it looks in the end.
I want to share player trait builds easily.
I can see why a person would think I was talking about Player Buildings.
the game already lets you save and load builds to file, you just need to transmit them
Yeah I use that feature frequently... I'll look into how they do that, maybe I can make use of some of that.
Simply check out the files they store those in
And directly use that
I was hoping for something a bit more turn-key for those who might be averse to navigating filesystems and the like but that's a good place to start. Thanks!
There's one way you could handle it
I saw this concept being applied recently, but you can technically pass any information you want through URLs when going on a website, and a modder used this to pass directly in-game data to a website he had setup
You can find his project here:
https://discord.com/channels/908422782554107904/1412072533821493309
Extremely interesting system
Very curious as to how this was done with b42's limiting of requests, hoping it's something I missed & not the URL trick I'd considered as a possibility
Wow, that was not the URL trick I considered but it's much smarter than mine
I have a feeling that'll be patched ๐ but good to know
What was the trick you expected ?
They simply pass an entire dataset through the URL
Something I'll keep close to my chest in case I end up needing it lol
It is kind of sus security wise lmao
I'm referring to the way they have to do the actual request in b42, since it's now an allowlist of URLs
Nothing new
string.format("https://steamcommunity.com/linkfilter/?u=https://%s?%s", url, query)
i assume they use the steam trick
That has always been like that
It hasn't
it is new yeah
Was everyone else already wise to this ๐
But the trick anyway is absolutely not new lol
i first heard it around b42 release ๐
That's been known since that problem appeared at least
Maybe it was true for openUrl? Before we had getInputDataStream or whatever
Which was effectively a GET request
Chuck was the first to use it to my knowledge
I personally used it in Wiki That until the official pzwiki link got added to the whitelist
ive just created 2 separate mods to fix resting on chairs and ground and nimble
someone was interested earlier
Checked, it was anything starting with http:// or https:// in b41 (for getUrlInputStream. openUrl didn't have such a check, which come to think of it is pretty concerning ๐
)
It act like it starts crafting with the white text "Crafting bobby pin" then immediately disappears
whats wrong?
media\scripts\generated\recipes:
module BetLock
{
imports
{
Base
}
craftRecipe CreateBobbyPin
{
Time = 20,
NeedToBeLearn = true,
timedAction = Making,
AutoLearnAll = Nimble:3,
Tags = InHandCraft,
category = Miscellaneous,
inputs
{
item 1 tags[base:pliers] mode:keep flags[Prop1],
item 1 [Base.Paperclip],
}
outputs
{
item 1 BetLock.HandmadeBobbyPin,
}
}
craftRecipe CreateBobbyPin2
{
Time = 60,
NeedToBeLearn = true,
timedAction = Making,
AutoLearnAll = Nimble:3,
Tags = InHandCraft,
category = Miscellaneous,
inputs
{
item 1 tags[base:pliers] mode:keep flags[Prop1],
item 2 [Base.Wire],
}
outputs
{
item 10 BetLock.HandmadeBobbyPin,
}
}
}
media\scripts\generated\items
module BetLock
{
imports
{
Base
}
item HandmadeBobbyPin
{
DisplayCategory = Tool,
ItemType = base:normal,
Weight = 0.01,
Icon = HandmadeBobbyPin,
Tooltip = Tooltip_BetLock_BobbyPin,
WorldStaticModel = Paperclip,
}
}
recipe presist in list, but in debug item list HandmadeBobbyPin with line Craft = False
in MP?
Do the player modData behave somehow differently when they are stored and retrieved on client side?
(in MP)
Has the file struture for mods changed in the last two months by any chance?
yes
Exist bug now: in MP craft recipes not work, if recipe not from Base module. Fix WIP ๐
prinyal
For B42 do you still use the mods folder to work on mods locally or do you use the workshop folder?
I think changes to the mod data on the client don't send to the server so the changes will disappear when reloading. I saw someone else say thats how it works and while updating my mod it looks like that might be how it works but I havent tested in mp yet so i'm not sure
player moddata isent synced client side
I've also tried this and it also gives an error
does some here know wheere i can get a .fspro template file?
you mean?
to make a cutom sound mod
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
How hard would it be to edit a mod to change clothing protection stats with no knowledge of Lua?
Well, I hadn't noticed, thanks for the info. This might solve my problems with this mod, but I'll still be stuck on the rest.
@tame mulchstrange thing, even if all recipes and items be module base - it's not work.
yep. it's fixes issue with insta cancel without result - anims work, times goes into craft, but without result, without items spend
module Base
{
craftRecipe BetLockCreateBobbyPin
{
Time = 20,
NeedToBeLearn = true,
timedAction = Making,
AutoLearnAll = Nimble:3,
Tags = InHandCraft,
category = Miscellaneous,
inputs
{
item 1 tags[base:pliers] mode:keep flags[Prop1],
item 1 [Base.Paperclip],
}
outputs
{
item 1 BetLock.BetLock_HandmadeBobbyPin,
}
}
}
module Base
{
item BetLock_HandmadeBobbyPin
{
DisplayCategory = Tool,
ItemType = base:normal,
Weight = 0.01,
Icon = HandmadeBobbyPin,
Tooltip = Tooltip_BetLock_BobbyPin,
WorldStaticModel = Paperclip,
}
}
I don't know if I'm doing something wrong, but at least in the debug in the item list, the Base.BetLock_HandmadeBobbyPin has a True value for Craft now.
so any new recipe doesn't work in mp?
BetLock.BetLock_HandmadeBobbyPin...
Jesus...
Base...
Nope, not working
No
Kind of, they aren't the same for the clients and you need to sync them
It doesn't involve Lua
Oh thatโs good.
How do I support B42.12.3 for my mod? Do I simply create a new folder called 42.12.3 and put my files there?
the game doesn't support the minor version in directories
the proper way is make a B42 and B42.13 folder. B42 folder for B42.0 through B42.12.x and B42.13 folder for B42.13+
Yes
#MakeA42.13Folder
Are there any users here who can build me a mod that I need to translate into Hebrew for a fee?
I just had my folder called 42, so I guess its fine to also call it B42
You are right, the B is not required in folder name
are you sure?
Err, maybe im confusing it with the min/max version in modinfo?
i haven't used it but i've seen the code for it and it seems like it should work
I feel invisible, they don't even respond to me once.
Either way, I don't think its what people actually want when they say they wanna support B42.12.x
yeah i can't imagine needing a bugfix-specific directory
also errr, yea why do I keep thinking they need a B prefix
how to use getInventory():AddItems to work properly in multiplayer, anyone have a solution?
do it on the server side
i did but i see strange behavior by item added like that
you also have to use the sendaddtocontainer function or whatever its called.
see the migration guides
check pinned message: #1448602571810803785 message
i'm using a version folder every time a game version breaks something (which, for starlit, is nearly every time lately ๐ ) out of respect for GOG users who are usually a few patches behind
poor GOG users
Will the game automaticly detect B42.13 or previous with this setup?
common folder content is used by every version (starting with B42). then 42.13 folder overrides or patches only if game version is at or above B42.13. then 42 folder content overrides or patches only if game version is above B42 and below B42.13 (mine is empty except for mod preview & icon png because it was required in previous versions).
that's not quite right, only files from the highest version folder that doesn't exceed the current game version will be used
so if you have a 42.13 folder and you're playing in 42.13, nothing in 42 will be loaded
ahh so that is what confuses people.
I just tested, loaded up 42.12.3, game loaded that version of my mod, then went back to 42.13 and game loaded the that version instead, so it works
so adding multiple items like whit AddItems is not possible anymore?
of course it's possible, you just need to do it on the server and transmit it afterwards
i did like this why is not working?
`local function onZombieDead(zombie)
if not zombie then return end
local zombieId = zombie:getObjectIndex()
local attacker = lastAttacker[zombieId]
if attacker and attacker:getInventory() then
local amount = ZombRand(1, 4) -- 1-3 soldi
local inventory = attacker:getInventory()
for i = 1, amount do
local money = instanceItem("Base.Money")
inventory:AddItem(money)
sendAddItemToContainer(inventory, money)
end
attacker:setHaloNote("+" .. amount .. "$")
end
lastAttacker[zombieId] = nil
end`
you mean i should trasmit after the loop?
can you point me to an actual working code for doing this?
the folders are just for organisation, server folder runs on both
so what do you mean when you say it's not on server side?
i think that event is a client event which means that code is not running on the server
when you say "that event" you mean OnZombieDead?
yeah
I'm pretty sure Events.OnZombieDead is firing on the server, let me check 3s
I knew it was like that too
yeah Events.OnZombieDead should fire on the server,but to add item to clients from the server i'm using commands instead of trying to add item from the server side. So i kind of have the same issue
it's working with commands?
well yeah, everything work with commands, it's just more boilerplate ๐
can you show me an example for adding an item with commands?
i don't have a simple example to show, but take a look at how commands work : https://pzwiki.net/wiki/Networking
anyone know what CharacterStat food sickness is called? is it just FOODSICKNESS? lol
iirc onzombiedead was a client event, not a server event
thanks
i've just checked and it fire both on client AND server it seems
on MP?
helb pls ๐
yeah, i've ran more test with a dedicated and the event is firing on both the server and the client :
On server : LOG : General f:299, t:1765815805205, st:581รรยป721รรยป580> [Quest] [KillDetector] Zombie killed by player
On client : LOG : General f:873, t:1765815805568, st:581,721,921> [Quest] [KillDetector] Zombie killed by player
so any ideas why when i add item to player inventory this will not work until client reload?
not sure honestly, i've rechecked my code and my client handler for server commanding it to add item to his inventory boil down to : getPlayer():getInventory():AddItem(itemType) , no issue of "ghost" items
i do like this
local amount = ZombRand(1,4)
for i = 1, amount do
local money = instanceItem("Base.Money")
attacker:getInventory():AddItem(money)
sendAddItemToContainer(attacker:getInventory(), money)
end
cause i also used getPlayer():getInventory():AddItem(itemType) but ghost happens
locally i don't think you need to instantiate the item like that (don't quote me though), and i never used sendAddItemToContainer i think. But that could be bad practices on my part to be perfectly honest ๐
so you using getPlayer():getInventory():AddItem(itemType) on mp and it's working fine?
Well, the server is "commanding" the client to do so, passing the itemType and quantity. The server isn't doing the adding himself. But yeah that does work.
do you have the DoLuaChecksum disabled?
"# รjecte les clients dont les fichiers ne correspondent pas ร ceux du serveur.
DoLuaChecksum=true"
ty
When I run as a HOST (non dedicated server), what are the values returned by isServer() and isClient() ?
in-game hosted is just running a dedicated server in the background and connecting to it as a regular client
so there is still a separate server and client which return the expected values
Uh ??? It does
yea albion already corrected me
Also that's now you name the versioning folders
I meant the 42.12.x part
i'll just.. wait for you to scroll down.
remind me not to help before my coffee...
I make too many mistakes.
Yea saw it now
How are we supposed to edit registry of base game traits?
Like I have
character_trait_definition ETW:GymRat
{
IsProfessionTrait = false,
DisabledInMultiplayer = false,
CharacterTrait = ETW:GymRat,
Cost = 6,
UIName = UI_trait_GymRat,
UIDescription = UI_trait_GymRatDesc,
XPBoosts = Fitness=1;Strength=1,
MutuallyExclusiveTraits = base:unfit;base:emaciated;base:very underweight;base:underweight;base:out of shape;base:weak;base:feeble,
}
and it works if I pick one of exclusive traits first, my trait disappears. However if I pick my trait first I can still pick mutually exclusive traits. I checked base game and if trait A is exclusive with B, they have each other in mutually exclusive traits.
Have you tried a partial zedscript description of the other trait with just the mutuallyExclusive part?
Elaborate?
character_trait_definition base:unfit
{
MutuallyExclusiveTraits = ETW:GymRat,
}
or something.
I dunno if base:unfit is correct.
it is but question is does it append or overwrite
99% of the time it appends
zedscript is... funny like that.
k, will try, ty
Like I haven't tried it for this purpose, but thats how it works for just about everything else that takes multiple tags in seperated by ;
they don't actually have 'types' in zedscript so the behaviour of any one property is up to whoever wrote it
yea no it crashes the game on loading scripts 
in that case you can get the definition in lua and add it there
Before I bother Aiteron, can any of you answer about ItemActions: It is necessary to split the โperformโ function into 2 functions: โperformโ and โcompleteโ. Both of these functions are executed at the end of Timed Action execution. The client executes only the โperformโ function, and the server executes only the โcompleteโ one. Singleplayer first executes โperformโ and then โcompleteโ. In MP client-server (Host or dedicated), what are the odds of a sendServerCommand initiated in a complete() call being received client-side before the perform() is called ? what are the odds of a sendServerCommand initiated in a complete() AFTER an item change being received client-side before the item change is taken into account client-side ?
for the first question, i would not expect this to ever happen
local trait = CharacterTraitDefinition.getCharacterTraitDefinition(TargetCharacterTrait)
trait:getMutuallyExclusiveTraits():add(MyCharacterTrait)
can i ask why you need this? the perform function should not really be doing anything important
the new trait stuff basically works exactly the same as before, it's just moved around a bit
Is there anything I need to worry about when using player:getStats():remove(..., ...) for multiplayer?
I swear I had a case where complete managed to delete items from the client and then 'update' or 'perform' executed
you need to do it on the server and send the stat afterwards
I don't think your guaranteed that execute occur after all client updates/performs, and would at least put nil checks on your items and stuff in update/perform -_-;
I really wish people would just run my mod and install the java part if it asks them to, instead of asking me to personally guess if they need to reinstall it based on the absolute 0 information they have given me about the last time they installed it.
Automechanics: depending on success/fail (computed in complete()) of the Install/Uninstall previous action, I wanna initiate a new Uninstall/Install action.
hmm that's a fair reason yeah
Id consider saving the result and if 'perform' has completed.
on receive packet, if perform has completed you do the next action
else, save value and tell perform to do it when it completes
Syncing time between clients and servers, along with lag compensation make when stuff occurs kinda.. fuzzy.
Is there a mod that adds a like 70s amc pacer?
works like a charm, I prob should look into CharacterTraitDefinition to see whats up there considering amount of work I do with traits 
thx
Is there a link or article explaining how to do traits now, I have my old trait mods from a few months ago I want to update to this new way but I havent found the resource
Thank you
unfortunately, I receive client side OnMechanicActionDone (sent by dedicated server in ISUninstallVehiclePart:complete) before ISUninstallVehiclePart:perform is called```
LOG : General f:833, t:1765824768687, st:19,564,461> receiveObjectChange mechanicActionDone
LOG : Lua f:834, t:1765824768691, st:19,564,465> AutoMechanics ISUninstallVehiclePart:perform IsoPlayer{ Name:null, ID:145 } zombie.vehicles.VehiclePart@53a568cd nil
DEBUG: Action f:834, t:1765824768692, st:19,564,466> ActionManager.remove > ActionManager remove action { "NetTimedActionPacket": { } , "NetTimedAction": { "type" : "ISUninstallVehiclePart", "name" : null, "actionArgs" : {"character": "IsoPlayer{ Name:null, ID:145 }", "part": "zombie.vehicles.VehiclePart@53a568cd", "workTime": 100.0}, "isUsingTimeout" : true } , "Action": { "id" : 123, "state" : "Done", "playerId" : { "PlayerID": { "playerIndex" : 0 } , "IDShort": { "id" : 0 } }, "duration" : 1866 } }
the good thing is: it occured on each test. so it is likely to be reliably sequenced
so I can now rework (and I do not like rework) my state machine on a reliable base (and I like reliable).
erf even that may be wrong: my server and client are local.
@tame mulch about ItemActions:
and โcompleteโ. Both of these functions are executed at the end of Timed
Action execution. The client executes only the โperformโ function, and the
server executes only the โcompleteโ one. Singleplayer first executes
โperformโ and then โcompleteโ.```
In MP client-server (Host or dedicated), what are the odds of a sendServerCommand initiated in a complete() call being received client-side before &and after the perform() is called ? what are the odds of a sendServerCommand initiated in a complete() AFTER an item change being received client-side BEFORE the item change is taken into account client-side ?
On a local dedicated server + client, when uninstalling a part for a vehicle, the client receives OnMechanicActionDone before ISUninstallVehiclePart:perform is called. mechanicActionDone is initiated in ISUninstallVehiclePart:complete
Yea, no timing guarentes given in that statement for MP -_-;
This seems like a strange thing to be relying on ๐ But if it's consistently reproduced then I guess it is what it is
Hi! I want my mod in two versions for B42, one for 42.13 and one for 42.12 and older. Currently I do this by having two folders: 42.12 and 42.13. So my mod's folder structure is this
myMod
-- 42.12
-- 42.13
-- common
-- media (the B41 version)```
Is this the best way of doing this?
It seems to work fine but just asking cause I am not sure whether this is the "state-of-the-art" solution.
Serious talk are there any videos about how to edit the Occupation Skill points, and make custom jobs? I'm wanting to learn how to do this.
Assuming it's pretty simple but I'm just hoping for a point in the right direction as I am oblivious on modding.
Basic infos about making new occupations can be found here: https://theindiestone.com/forums/index.php?/topic/88499-modding-migration-guide-4213/, the Migration Guide.pdf and the testmod_registries.zip for your case.
A guide for mod authors on how to update your mods to the new identifier and registry system introduced in version 42.13. Migration Guide.pdf testmod_registries.zip Project Zomboid_ API for Inventory Items.pdf
Appreciate it, I'll be looking into this.
I'm mainly just needing to edit a few jobs so they're stronger, and better for a server I'm working on.
Yes
No
I'd pay someone to make one.
A video on how to do that ?
Editing vanilla professions seems at the moment only partially possible from what I see. Adding skill points or traits for example might work (at least there are suggestive commands for this in the Java API). What might be more difficult is changing costs (although not impossible).
A video for dummies. Cuz I am.
42.12 'and older' folder is just 42
I started making videos but it'll take time to get videos on various subjects
Understood.
Any chance someone could put the 3 guides for mod authors here? I'm curious to read them but it won't let me sign up. Security check is bugged and I;m stuck in a loop
Does anyone else have the issue that their subscriber numbers go down although the mods are updated for 42.13? I don't even get any bug reports. The numbers are just going down in a way I never noticed before.
They are in the pinned messages
Pinned messages
Ah thank you! Apologies
np
Im having issues with a mod i did a few months ago it was a trait for lactose intolerance but I got thr new registries and stuff done and I can see the mods its just outside the trait points, the actual negative effects wont fiee anymore
do you still see your new trait in the trait selection menu when you create your character?
Yeah its all there
Not sure if I get you right. So is your issue then that it won't apply the negative effects in game when you start playing??
So for example the mod when you eat cheese or dairy whatever in game your character expierences pain for x duration etc and goes away after x whatever. On the patch before last it all works well, but now in game I can eat cheese or other dairy and the effects don't happen. The trait can be picked normally and displays on the character in game but thats about it
so you pbbly have some code running in game which goes like this:
-- apply negative effects...
end```
????
In that case, you have to use the new trait description system and use smth like
```if player:hasTrait(MyModRegistries.MyTrait) then```
To make this work, your mod's registries.lua should look like this
```MyModRegistries = {}
MyModRegistries.MyTrait = CharacterTrait.register("mymod:mytrait")```
ofc, using some unique names instead of `MyModRegistries` and `"mymod"`.
So basically the ``` character_trait_definition lrrp_traits:lrrp_lactose
{
CharacterTrait = lrrp_traits:lrrp_lactose,
UIName = UI_trait_lrrp_traits:lrrp_lactose,
UIDescription = UI_trait_lrrp_traits:lrrp_lactose_Desc,
Cost = -2,
Texture = media/ui/Traits/trait_lrrp_lactose.png,
}
}
Needs to call on the registries to access my lua file where the traits effects are located?
That's only the trait definition. it won't do anything in game when your character has the trait. Are you the mod's author?
Yeah this is my project, I'm still new tryna grasp the ideas lol
Haha ok. Yeah so, to make your trait have any ingame effect when player eats smth, you need explicit lua code which runs during actual gameplay and which applies those effects. Just defining a trait correctly will ony show it in the user interface and make it selectable. But it won't apply any in-game effects without additional coding work.
That was also the case pre 42.13 (and even in B41)
This is the additional lua code, I had it working a few months back but decided to sit on it because I figured something would break things before 42s release which it has lmao I had ai write it up so I could understand how it worked but its still a work in progress figuring out what does what and why etc
player:HasTrait(TRAIT_ID) here my remarks from above apply 100%. I exactly described this case. (#mod_development message)
testing on mp 42.13, ive had reports the rations werent opening for some reason. everything appears but it doesnt let the player open them. works fine on sp?
do i need to move stuff, theres nothing in client
LactoseIntolerant = CharacterTrait.register("lrrp_traits:lrrp_lactose") So the "lrrp_lactose" is our trait ID inside of my registries lua that I would place there?
yeah but the "hasTrait()" requires a CharacterTrait object, not the stringID. see here: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/characters/ILuaGameCharacter.html#hasTrait(zombie.scripting.objects.CharacterTrait) . maybe it also works with a string but then you need at least the full "lrrp_traits:lrrp_lactose" (never tried that though)
also, the command is "hasTrait()" and not "HasTrait()". did you write this code by yourself?
Copy paste and tweaked as I understood for the most part
Ok. But then the main debugging is up to you ofc. ๐ Better just ask the original coder about it.
I'll give that a try, the original coder outside of anything I did was chatgpt so I guess theres potentially thosounds to ask lmaooo
ChatGPT doesn't know the Zomboid API (and even less the new stuff for 42.13). It will just hallucinate things and give you messed-up results not working in any way.
If you already know zomboid lua modding very good, you may use it by using very well-made and specific prompts. But no way it just works out of the box. Better learn coding and how to mod the game by yourself.
Yeah I have just been using it as a way to learn and work it out on my own as I go so I get a better understanding of how things work, I used to do alot of retexture work two years ago when I first started on the side and wanted to move on to bigger and better mod ideas so I turned to it to see what it could do
can oncreate functions break craftrecipes in MP
alright i removed a redundant oncreate function
but the mod still doesnt work, and it only doesnt work in mp
the console spits out this every time i try and open the kration too
and the recipes
i have heard that recipes outside of the Base module are not working properly right now
FUCK
alright i guess ill shove everything into base
just the craftrecipes right?
i dont need to change everything else and put it into base
ill test
Same here.
yeah you're right
they arent
alright so
local item = getScriptManager():FindItem("CrateOfPlanks",true) -- true means it will use Base.
item:setActualWeight(5)
local item2 = getScriptManager():FindItem("BoxOfScrapWood",true) -- true means it will use Base.
item2:setActualWeight(1.5)
local item3 = getScriptManager():FindItem("CrateOfTreeBranches",true) -- true means it will use Base.
item3:setActualWeight(5)```
this stopped working for 42.13
this is a lua script in the server folder
the mod is a submod of an existing mod and this is the only thing in the mod
did they change something
i only tested it on mp ill test it for sp
Is there any way to make debugging errors easier
Like a modded debug menu or something? My mod has too many moving pieces to understand what's wrong
issue is on both
the classic check the console method usually works for me
It sucks ass
. Spits out 3 script names and the line, each of them redirect to a different function that has like 100 lines of code, doesn't get any more specific unless I hack away at my entire mod to try to single it out
Not to mention the entire debug menu has almost 0 quality of life support
You fix an error, reload lua, can't clear the log history unless you restart. Unless there's a hidden button or something, but pretty sure I've asked before and nobody has given me an answer
does this not work anymore? its not doing it for me on 42.13
well sadly it would be much more work to try and make that more simple
A button to clear the console, the ability to drag to copy text, countless other small things I'm not currently thinking about. There's a ton they could pretty easily fix, they just don't want think it's high priority lol
Given how big modding is in this game, if I were running it I'd honestly prioritize that more than the content updates. Though making a non-shitty debug console shouldn't hinder content updates if the company is ran well
Either way, hope they improve it. Really hope someone makes some sort of mod for it if possible otherwise
still need help!
local item = getScriptManager():FindItem("CrateOfPlanks",true) -- true means it will use Base.
item:setActualWeight(5)
local item2 = getScriptManager():FindItem("BoxOfScrapWood",true) -- true means it will use Base.
item2:setActualWeight(1.5)
local item3 = getScriptManager():FindItem("CrateOfTreeBranches",true) -- true means it will use Base.
item3:setActualWeight(5)```
are you testing this in mp or sp?
for me, I have problems when doing this on server folder while playing single player
but not sure how it behaves in mp when you also use some of the new sync commands (never tried so far)
{
character_trait_definition lrrp:lactose
{
CharacterTrait = lrrp:lactose,
UIName = lactose intolerance,
UIDescription = Causes stomach issues when consuming dairy products.,
Cost = -1,
IsProfessionTrait = false,
DisabledInMultiplayer = false,
Texture = media/ui/traits/trait_lrrp_lactose.png,
}
}
So what am I missing here, everything is right as far as lower case etc the png listed is the exact one I've used prior however now I can edit the name and description fine to reflect at the trait selection screen however my icon wont show up now, i've tried moving the destination to 42 ui traits instead of common and no dice there either
id think you need the item full type
i dont see any uses of it with a boolean rn
seeing what it does in java i dont see why it shouldn't work
does anyone where the the right-click "Walk to" options is realized in lua? I searched the translate file and found a ConextMenu_Walk_to string but I cannot find this anywhere in the lua code???
ISWalkToTimedAction
do you happen to know whether there is a way to detect when the player goes into the "stand up" animation when quitting the Sit-On-Ground animation?
i haven't done it but id start with IsoGameCharacter:getAnimationStateName() which returns a string
thanks! never heard of that command but looks promising!
it's "getup" which saves my A**!!!!!!! many thanks!
Is there a way to mark your as "not availabe in multiplayer" so that it is not shown in the mp's mod menu?
would be quite handy when it comes to user-friendliness
Not that I know of
You could throw an error if the mod is activated in MP
Or completely deactivate your code too
anybody else having issues with tracer effects not identifying custom ammo types?
i get a CTD immediately upon firing a weapon with custom ammunition
anyone know the run version of this?
or how i can make isoplayer run
i tried
NPCObject:NPCSetRunning(true)
NPCObject:setForceRun(true)
NPCObject:setRunning(true)
but isoplayer seems to run for a second before reverting to walking
were there any b42/42.13 changes to assigning weapon models or something? im assigning WeaponSprite to my defined model but it just refuses to recognize it and just keeps rendering it as the icon when dropped in the world
yes, check the three last pinned messages of this channel.
ive read those a couple of times and i might be missing the part that talks about the model system changing
Solved this!
i accidentally had the ammotype of the weapon I was testing as base:bullets_### instead of my custom ID in the new registry
Hello!
Iโm curious whether itโs possible to create a mod that allows players to cut down traffic signs and use them as weapons.
How complex would it be to implement something like this in Project Zomboid? Would it require heavy engine work, or is it achievable with Lua and existing modding tools?
achievable with existing tools
Hello, im doing a mod trying to mod an object, and after some lines of codes, im able to move it to the new position but if the player has seen the object before the move it moves then you cannot see the object in the new location but you cant go through it, you can still see it in the first location but you can pass through it
here is the code
Hey guys! I just noticed that the subscriber count of my vehicle mods started a sharp fall since the release of B42 Multiplayer. Did the devs change something with vehicles which causes mods to break?
I'm having serious trouble finding information on how to apply bodylocations in version 42.13. My addons place a weapon holster on a part of the body where I then store those weapons.
Until now I did this with the following files:
--in \media\lua\shared\NPCs\LK_BodyLocations.lua
local LKLocations = {
"KatanaSheath",
"KatanaSheathHip",
}
local group = BodyLocations.getGroup("Human")
for _, location in ipairs(LKLocations) do
local bodyLocation = BodyLocation.new(group, location)
group:getAllLocations():add(bodyLocation)
end
--in\media\lua\shared\NPCs\LK_AttachedLocations.lua
local group = AttachedLocations.getGroup("Human")
group:getOrCreateLocation("Katana in Sheath (Back)"):setAttachmentName("Katana_Sheath")
if getDebug() then
group:getOrCreateLocation("OnBack"):setAttachmentName("back")
end
group:getOrCreateLocation("Katana in Sheath (Hip)"):setAttachmentName("Katana_Sheath_Hip")
if getDebug() then
group:getOrCreateLocation("OnHip"):setAttachmentName("hip")
end
--in \media\lua\client\Hotbar\LK_ISHotbarAttachDefinition.lua
require "Hotbar/ISHotbarAttachDefinition"
if not ISHotbarAttachDefinition then
return
end
local KatanaSheath = {
type = "KatanaSheath",
name = "KatanaSheath",
animset="back",
attachments = {
Katana = "Katana in Sheath (Back)",
},
}
table.insert(ISHotbarAttachDefinition, KatanaSheath);
local KatanaSheathHip = {
type = "KatanaSheathHip",
name = "KatanaSheathHip",
animset = "belt left",
attachments = {
Katana = "Katana in Sheath (Hip)",
},
}
table.insert(ISHotbarAttachDefinition, KatanaSheathHip);```
Would someone please tell me how to migrate this code to version 42.13? I've tried a thousand things with registries.lua, etc., but without success. I need documentation, an example, or a mod that does the same thing so I can review the code. I can't find any information and I'm frustrated.
here item code
module LK
{
item LegendaryKatana
{
DisplayName = Legendary Katana,
DisplayCategory = Weapon,
Type = Weapon,
Weight = 1.5,
Icon = LegendaryKatana,
AttachmentType = Katana,
BaseSpeed = 1,
BreakSound = KatanaBreak,
Categories = LongBlade,
ConditionLowerChanceOneIn = 100,
ConditionMax = 100,
CritDmgMultiplier = 9,
/* CritDmgMultiplier = 10,*/ /*commented out conflicting values */
CriticalChance = 35,
/*CriticalChance = 30,*/
DamageCategory = Slash,
DamageMakeHole = TRUE,
DoorDamage = 8,
DoorHitSound = KatanaHit,
DropSound = KatanaDrop,
HitAngleMod = -30,
HitFloorSound = KatanaHit,
HitSound = KatanaHit,
ImpactSound = KatanaHit,
KnockBackOnNoDeath = TRUE,
KnockdownMod = 0,
MaxDamage = 14,
MaxHitCount = 10,
MaxRange = 2.0,
MinAngle = -0.3,
MinDamage = 8,
MinRange = 0.21,
MinimumSwingTime = 3,
PushBackMod = 0.5,
RunAnim = Run_Weapon2,
SubCategory = Swinging,
SwingAmountBeforeImpact = 0.02,
SwingAnim = Bat,
SwingSound = KatanaSwing,
SwingTime = 3,
Tags = IgnoreZombieDensity;HasMetal;FullBlade;Sharpenable;RepairKatanaSheet;RepairKatanaScrap,
TreeDamage = 1,
TwoHandWeapon = TRUE,
WeaponLength = 0.4,
WeaponSprite = LK.LegendaryKatana,
Sharpness = 5.0,
OnBreak = OnBreak.Katana,
ResearchableRecipes = MakeLegendaryKatana,
}```
Very easy to do
No idea
Pinned messages, read the notice
ples
I've already reviewed all the information about the news pin, but I can't figure out how to apply it without errors, so I'm asking if there's a practical example or an updated mod to see how they solve it.
Hello there, anyone has a clue on why a modded item that is the output of a miscellaneous craft recipe could have its craft flag set to false in the item list ? (B42.13)
I'm trying to homebrew NecroForge to work for 42.13 MP. I get it to work for 42.13 SP, but not for MP. Any tips?
It doesn't need to work well. Just a bit. The functionality I need works in singleplayer 42.13.
I've successfully created a Java mod loader for PZ. I made it so the Furry Mod could avoid using clothing and set player models directly, but it is a general mod loader. It uses a Java agent and AOP to avoid distributing copyrighted code. What is Indie Stone's policy on distributing such things?
they don't care
NecroForge, while being made initially with high quality code (at least I was impressed), is messing with so much stuff that I have never seen it working without partially breaking the game. All that to introduce my tip about it is: do not use it. and do not use any "debug mod" either. use vanilla debug tools instead.
I'm trying to revive a character in 42.13 MP. I must've missclicked "Quit game" last night and came home from work starved to death with my mouse pointer on the Quit-button. Really want it alive again.
Have not managed with ingame debug tools. Got any tips? Sorry that this strays off topic.
debug > Player Stats: to get all your skills back & debug > Item List: to get all items back.
Oh yeah, that is my final solution. Losing kills and time alive will hurt, but it's game wise ok.
why is Recipe.OnCreate crashing on world load with the new version?
That table no longer exists
meh to tired for this xD
but the function is working fine when crafting, what do i need to change to get rid of the error on gameload? ๐ตโ๐ซ
remove Anything that adds to Recipe table.
wow i rly havent looked at that mod a while, i alrady had chance based output in the script, no need for the on create lul
anyone found the reason for ppl not being able to enter some cars? (just the door opens)
hey, it is me again...
And i need help
this is one part of my code
and i cannot run it
i allways have an error here "local glove = player:getWornItem("Hands")"
it used to work just fine on 42.12
i have tons of error like this on my project now
it is on the client side btw
i have moved all the timed actions to the right place
so, part of my mod works again
but i still having trouble with code like this one
and i don't know why
check pinned messages for B42.13. ```lua
player:getWornItem(ItemBodyLocation.HANDS)
https://streamable.com/zclh72
https://streamable.com/wuuld8
zomboid at its best, so when the vehicle moves when you attach its bugged ๐
i'd make a custom walkto that hooks update and set those in there
what data is associated with egg fertilisation?
i understand eggs as inherited from food.txt have some sort of modifier tacked on for tracking their development, but i'm not sure where i'd find it
also, is there any exposed files for chickens bc i'd really like solid numbers
no easier way to set running
?
๐ญ
If I flag a floor tile to solid, is that floor tile also solid for other players in a multiplayer server if it is set to solid in the client side of the other player? I can't test it myself, and I would prefer if it was for the client side that did it only, even if I need people to disable an anticheat whenever that's added back
it will not affect other players
Does anyone know what might be happening to me? I have all the mods I'm developing in C:\Users\username\Zomboid\Workshop, but I deleted and copied the entire mod folder again after downloading it from Steam, and now it doesn't appear in the mod list in the game. The structure is correct, because I tried using the same mod I already uploaded to Steam after downloading it, and nothing changed.
Your prob need to constantly set it or something.
Anyone else the problem that the "MutuallyExclusiveTraits" in the new trait.txt does not work properly for modded traits? For me in 42.13, this doesn't seem to work for modded non-profession traits.
Is there some new trick for creating skill literature? Specifically magazines to teach recipes? I've been working to migrate my mod to 42.13 and it appears everything is working correctly except that the custom magazines I created will not teach the custom crafting recipes added and I cannot figure out why.
ISWalkTo is compatible with the run button. If you want to avoid the small slowing when changing direction, you can use https://steamcommunity.com/sharedfiles/filedetails/?id=3389328028
Iv seen people get it working, you gotta add your trait to the vanilla trait too
with LUA
#mod_development message See this post
Thanks! That's probably it!
linked post has code snippet for doing that.
also note that traits (may?) have module qualifiers now (ie base:) if your looking them up via text or whatever.
(But you should likely use the new trait registry values for vanilla traits instead, and pass a global from where you registered your trait, so that no typo-prone string lookups occur)
do not look them up by text, this defeats all benefits of using a registry system
is there a getting started page for pz modding
there are some getting started resources in the pinned messages
i see. thank you.
i really just want to run a server side mod to script some stuff
is that process different?
Nope. You basically just need to check isClient() and isServer() to see if your on SP/Client/Server
(Both are false if single player)
also note that the client runs files in \server\ because of course it does.
Does the server also run everything in \client\ ?
am I missing something or did Zomboid recently start ignoring local mods in the Workshop folder be it in the client directory or the user directory?
Don't remember it doing that in B41 when I last played around with it
Should be fine? is your structure correct?
ie: C:\Users\Black Moons\Zomboid\Workshop\Realistic Car Physics\Contents\mods\Realistic Car Physics\common
(and then a \42 dir as well as the \common)
common also needs to be lower case on linux/mac
.. and must exist.
well the common folder is there; is a poster img required nowadays?
well it's also weird that the template mod folders are not visible 
are you logged in as the correct user?
well I copied the files into both the User/Zomboid/Workshop directory as well as the SteamInstall/Workshop directory
as in? what do you mean by correct user?
Windows user?
Then yes.
like, if your files are in C:\Users\Black Moons\Zomboid\Workshop\Realistic Car Physics\Contents\mods\Realistic Car Physics\common
And your logged into windows as 'admin' or 'phil' or whatever and not 'black moons' it may not see it.
well recopied to local user directory works now but it seems to ignore the install directory one
yea I dunno, I only use the user one
just to figure out w/e the next issue with the id is
all the new crafts not working in MP [42.13]?
Where is your mod.info file ?
It's not in the right folder
yea just noticed, although isn't it kinda odd to have it in the version folder?
Oh yea, it needs to be in \42
No it's not odd, bcs based on the version you're on, your mod might need new dependencies and shit
For the life of me I cannot get my mod to link a learned recipe on an item and cannot figure out why. Here's a snippet of what I've got if anyone can see the problem that I've been running in circles on for the last 5 hours.
{
DisplayCategory = SkillBook,
ItemType = base:literature,
Weight = 0.5,
Icon = MagazineMechanic1,
TeachedRecipes = MakeEnginePart_blacksmithingEnginePart,
StaticModel = Magazine,
WorldStaticModel = MagazineKnit1Ground,
Tooltip = Tooltip_DIYR_GeneralMagTS,
} ```
``` craftRecipe MakeEnginePart_blacksmithingEnginePart
{
timedAction = MakingHammer_Surface,
Time = 600,
Tags = Forge,
category = AutoParts (Universal),
needToBeLearn = true,
SkillRequired = Mechanics:6;Blacksmith:3,
inputs
{
item 2 [Base.ScrapMetal],
item 2 [Base.SmallSheetMetal],
item 4 [Base.Screws],
item 1 [Base.MetalworkingPliers] mode:keep flags[Prop1;MayDegradeLight],
item 1 [Base.Tongs] mode:keep flags[Prop2;MayDegradeLight],
}
outputs
{
item 20 Base.EngineParts,
}
xpAward = Blacksmith:10;Mechanics:5,
AutoLearnAll = Mechanics:9;Blacksmith:4,
AllowBatchCraft = true,
}```
The magazine loads and is readable but teaches nothing. The recipe loads and is craft able if I enable all recipe knowledge with debug. I just can't get the two to link.
@brittle swift in MP all my recipes not working, if items not Base module - time on craft skip without result and items don't spend. When items Base module - time on craft work fine, animation in craft work, but after end - without result, items don'w spend
in SP all work fine
#mod_development message
if in Base - not works too
Ah, I understand your question now. Sadly I don't have an answer as you can see I'm still stuck getting mine to work in SP still so you're ahead of me there ๐
im be here, if im not wrong, fixed like MakeEnginePart_blacksmithingEnginePart = > MakeEnginePartblacksmithingEnginePart
without _
I'll give that a shot & report back. I have a lot of those in here ๐ฐ
.
LearnedRecipes = MakeEnginePart_blacksmithingEnginePart,
do i have to put the mod into the server mods folder?
can i put it there?
i just want the server to run some lua scripts
i only want to set up a radio broadcast to start with
The lua folder server is still loader by the client too
i suppose thats fine
i just want to make some server commands available to admin
radio stations to start with
i dont intend to distribute on workshop
i gather that means i can just put my files in the username/zomboid/mods folder in this case
everyone will have the mod, you use isClient() to detect when code is executing on client and just return early
makes sense
hahah no.
everyone needs the mod or the server won't let them join.
For whatever reason I can't get any of my traits to show their respective pictures in the selection screen ``` module LRRP_Professions_B42
{
character_trait_definition lrrp:lactose
{
CharacterTrait = lrrp:lactose,
UIName = UI_trait_lrrp_lactose,
UIDescription = UI_traitdesc_lrrp_lactose,
Cost = -1,
IsProfessionTrait = false,
DisabledInMultiplayer = false,
Texture = media/ui/traits/trait_lrrp_lactose.png,
}
}
the best you can do, is make a workshop mod that loads LUA at runtime from a certain folder
and then not distribute that lua file.
if you don't want people peeking at your admin commands.. but security by obscurity is a bad idea generally, its better to have passwords/depend on admin access level or something
they can look i dont care
prefer not isServer() to isClient()
wait
nevermind
Depends on what you wanna do in single player, but yea.
yeah but i was trying to correct you to the wrong behaviour ๐
you use isClient() to make it execute on server OR sp
admin commands prob have less use in SP, but likely you wanna develope them in SP just cause its faster to load ๐
And do the final polishing in MP to make sure they work properly
what i mean is i was trying to correct you to do the thing your code does and mine doesn't ๐
oh yea.
Take a deep breath boss !
"not isClient()" right ?
I mean
if isClient() then return end
if isClient() then
return
end
this lets you code execute on server OR sp.
(code below said statement)
Note: Early out is preferred over things like
if not isClient() then
All your code, except indented 1 more tab over.
end -- Or maybe its an else? you'll have to scroll past all your code to find out!
Seems like a trivial change until you do it 5 times in a row for 5 different errors and 3 of them have else clauses.
okay i have some questions
. and now all your code starts over here
on windows i have a folder called zomboid in my username folder
but i also have the dedicated server installation folder from steam
i assume i dont want to touch the dedicated server folder at all
Both the client and dedicated server apps use the Zomboid folder for configuration storage
Yes, in an ideal world, that is what you would do....
yeah, Zomboid is your cache folder, that's where you should be doing things, dedicated server should be left alone
Has anyone posted a guide on how the hell to even get mods working on dedicated servers so I can just link that on my mod and delete the 80% of my comments that are 'doesn't work on my dedicated server! (And neither do any other mods iv tried but I won't mention that)'
you will want to look inside the game install but don't touch, all your changes should be in the cache folder
ClientCommands.lua
if isClient() then return end
...
So excluding traits for non-profession traits currently only works via lua command trait:getMutuallyExclusiveTraits():add(MyRegsitry.Trait)?? Using the script txt entry MutuallyExclusiveTraits = does nothing for me. But using the lua commands seem to work.
Yes and you still need the above line, and you still need to put the mod on the workshop.
Server folder doesn't stop the client from executing it, in TIS's infinite wisdom.
BOTH traits need to be MutuallyExclusiveTraits = of eachother in zombscript
i cant even imagine how cynical being a pz modder would make a person lol
thats is why you need the LUA
because else you can add trait A and then B, but not B and then A
they only check exclusivity in one direction
That appears to have worked on my test magazine. Now to apply that to the real ones & see if that fixes it ๐
I just thought you could set one trait via script txt and the other one via lua code. But this doesn't work. I have to use lua code for both of them.
Btw, in my case I want a modded trait to exclude a vanilla trait.
the script should work for the modded trait, that's odd
others have reported it does work, so your likely not using the correct name for the other trait or something.
but you still need the LUA if your not gonna override the other vanilla trait (I believe a partial zombscript should work)
setting it via script.txt on one trait, only prevents you from adding A after B. but not B after A
order matters lol
You could even make some totally bizzaro game of unidirectional exclusive traits for madddnnesss
Really tested this a lot. But what works fine is excluding traits via script if the new trait is an IsProfessionTrait.
Still can solve the issue by setting both via lua code which is fine. Just weird...
Fluid blacklists work the same way btw -_-;
you can add oil to water, but not water to oil in PSC -_-;
how are you testing that if one of them is a profession trait?
shrugs I didn't test, just relaying results of the last guy who was messing with it.
I tested this for profession trait and for non-profession traits. (for the profession trait, I also created a profession having this trait ofc)
has this been reported as a bug btw?
I feel bad for theharber atm lol. bug forum is scrolling sooooooo fast.
I still don't understand why mixing liquids was added at all...
does it make any functional sense at all now?!
as if I don't know where I can't apply it, or what?!
or dilute the fuel with water in the percentage while it is still fuel to refuel the car?! Stonks?!
RP for making mixed drinks, and I abuse it for oil condition by having 'oil' and 'used oil'
though if you can find a barrel of spiffo juice and vodka you can just live off that stuff without any need to sleep or eat.
in the proper mix
-_-
lol)
if i dont intend to differentiate mod for different versions i can just put my mod.info in the common folder i assume?
its just weird on the website under the b42 section it shows mod.info and poster.png in every other folder except the common one
ok it has to be in the 42.13 folder to even show up
i have to restart the whole game to see changes too lol
good grief
I'm seeing that my mods aren't able to save moddata in MP.
Draw On The Map, for example, clears the map every time I sign back in.
Thats not even mod data
ignore me
Because there's no point having both the files in common and versioning since both folders are loader
The problem too with with putting your mod.info and poster files in the common folder was that the poster file was not recognized from the common folder, which possibly have been fixed but we haven't tested since last update
No you don't
It can be in the 42 folder too
Unless you meant common versioning folder wise
You don't either, simply reload Lua
I'm starting to suspect the function to load mods on dedicated server has been disabled in this build. Attempting my own mod for testing shows the mod get downloaded from the workshop but then when it goes to load it, it can't find it.
it shows up in single player
but the server is saying
required mod "impradio" not found
thank you for responding btw
appreciated
Mods do work for servers tho, I've seen people reporting mods working on servers
Do they? Well, back to the drawing board ๐
I think people are copying the mods off steam into their workshop folder or something?
also crc has to be turned off
i've tested all of my b42 mods in multiplayer
I tried normally and using the workshop folder and had no luck either way
i have my mod im making in my workshop folder
it loads in single player but the server says
required mod "impradio" not found
Hosted multiplayer or using a dedicated server?
hosted
Hosted on Linux vs Windows?
windows
it does seem like there are some weird obstacles to enabling mods right now, probably relating to the steam workshop, but it's hard to tell because these problems appear exactly the same as the user configuration errors modders get hassled with literally all the time anyway ๐
i haven't heard of anyone having issues with local mods
so perhaps i shouldnt bother with this right now
i'm testing dedicated local and i have no issue, mods in workshop folder though, not via steam
yea, report vanilla bugs instead lol
RIP TIS Q/A team
okay im testing in single player then whatever
Hello! Hope everyone is well! Updating my Handlebar's Vintage Camo mod. I've been reading guides, and it seems fairly simple, make a 42 folder and common folder, move all media contents into 42 folder.
My items are spawning in containers, however I'm unable to equip any of my lovely camos. I'm trying to find what they've changed as far as clothing in B42, it seems my mod is not the only one. Thanks for any assistance.
I think I have figured it out. It has to do with the new typing of Type vs ItemType
Ok, I got to the bottom of the mod loading issue on dedicated server. Unlike build 41, it requires a " \ " at the front of our mod ID in the ini file. Example, my mod's ID is "DIYR" so previously it would've been "Mods=DIYR" in the ini file to load just my mod but it's now "Mods=\DIYR". @fathom forum this should be the solution you're looking for.
@bronze yoke lmao I kind of didn't expect it to be the reason everyone had problems but it makes so much sense now
Oh boy I can't wait for the moment devs will fix this and it won't be needed anymore, and it'll nuke every servers LOL
that did seem to load it yes
should my main lua file be named main
is that bad
what did it override lol
The files in your mod should never match file names of the vanilla files
what do you mean by that
does your mod include a media/lua/main.lua in it?
It's bad
both, it doesnt work for either
Not every files follow that
should it? does it have to?
i dont want to override anything
will it load everything in my lua folder?
That Lua file would never load
No
I invite you both to go read the Lua API wiki page, and more specifically the section about Lua file structure
thank you
LOL knew it
they will re-add the workshop ids to mod ids in the future
Didn't they say they wouldn't ?
Even Aiteron recently mentioned they wouldn't do that
it will not affect modders
How so ?
requires will not specify workshop id
Interesting
In single player 42.13, I can still use item:setActualWeight(5) if then item is an InventoryItem. For the Class Item objects which you get by the ScriptManager, you may try the DoParam command instead.
So smth like item:DoParam("ActualWeight = 5"). But this will change the weight for all items of that type and should be called on GameBoot.
how do i view the errors from my mod?
im not sure about that then since its going to change all the items of that type
it didnt work for me for whatever reason, I had it all enabled both in SP and MP
its calling to change the size of an already modded item
it would also be inconvenient for anyone since it has to be called on gameboot
To do this for a single item you, need to get that item as an InventoryItem and then use item:setActualWeight(5). For example
item:setActualWeight(5)```
This will work in single player in 42.13. I haven't tested how to use it in MP yet though. Using this in MP requires some additional work.
i'll test it out
for https://pzwiki.net/wiki/OnServerCommand
it says
Fires when a server command sent through sendServerCommand is received by the client.
is this the function which is called when any client uses the slash in chat?
Events.OnInitGlobalModData.Add(function()
print("iradio.lua loaded ")
end)
function OnServerCommand(module, command, args)
print("OnServerCommand test:")
print(command)
print(args)
end
Events.OnServerCommand.Add(OnServerCommand)
it should be local function
according to the dev's pdf, this event is triggered when server sends a command to client via a specific lua command. see here: https://theindiestone.com/forums/index.php?/topic/88499-modding-migration-guide-4213/, API for inventory items.
A guide for mod authors on how to update your mods to the new identifier and registry system introduced in version 42.13. Migration Guide.pdf testmod_registries.zip Project Zomboid_ API for Inventory Items.pdf
did not work
this is the new code i based on yours
local item = instanceItem("Base.CrateOfPlanks") -- create a specific item of that type
item:setActualWeight(5)
local item2 = instanceItem("Base.BoxOfScrapWood") -- create a specific item of that type
item2:setActualWeight(1.5)
local item3 = instanceItem("Base.CrateOfTreeBranches") -- create a specific item of that type
item3:setActualWeight(5)```
i think ill also drop this other image of where the lua file is, which could be affecting it. its in a submod to the main mod and its only purpose is to change the weight of certain items to make sense with certain weight reduction mods
have you tried :setWeight() instead?
i havent, is that even in the javadocs
yes. item has both, weight and actualWeight field
wait! it doesn't work on server! as said, this works in single player. you have to put it into the client or shared folder then.
I don't know how to do this on server. You then have to use some specific sync commands but I have never tried it.
I use this in my client and in my shared folder in one of my 42.13 mods and works completely fine for me
single player only ofc
do you also make sure to put the item somewhere to the map so that your player can interact with it? for example putting this in player's inventory?
it can naturally spawn with a different distributions submod
and it can also be created by packing different items into it
so for example lets say we have a box of scrap wood
it weighs 10
its supposed to carry 12 of them
the base game has its weight at 1
With the item:setWeight() or setActualWeight() you will only change weight for that specific item. So before applying this command, you have to grab the item you want to apply it to. instanceItem() creates a new item and was just used as an example by me.
i think i am going to have nightmares about this
the scarriest thing about project zomboid, the most brutal part of it
is attempting to make a mod for it
how can something have this much technical debt
this game should fall apart under its own weight
FindItem should do that?
good luck to the poor souls who are working with this

ohh i get it
i thought you meant ItemType like base:normal and similar not that
since you deleted it is it wrong?
in my last message, I just copied pasted smth wrong, therefore deleted. so ignore.
using the ScriptManager and setting weight will change the weight for all items of that type "Base.CrateOfPlanks"
local item = getScriptManager():FindItem("CrateOfPlanks",true) -- true means it will use Base.
item:setActualWeight(5)
local item2 = getScriptManager():FindItem("BoxOfScrapWood",true) -- true means it will use Base.
item2:setActualWeight(1.5)
local item3 = getScriptManager():FindItem("CrateOfTreeBranches",true) -- true means it will use Base.
item3:setActualWeight(5)```
this was my original code, which used that same method you just described
ill test it out real quick in the shared folder
since i moved the file
this will set acutalWeight to 5 for all items of the type "Base.CrateOfPlanks" and similar for the 2 other types.
how did you come up with that code?
i looked into similar code of other mods
and then made sure it would work (in versions previous to 42.13) by checking in this channel
ill try doparam
if that worked in 42.12, it should also work in 42.13 single player as long as your code is in shared and you may use doparam. they didn't change anything about that
how do i find all the datamember names for different items?
i want to create a magazine object full of bullets and add it to the player
media/scripts/generated/items/normal.txt
i find:
item 9mmClip
{
DisplayCategory = Ammo,
ItemType = base:normal,
Weight = 0.2,
Icon = BerettaClip,
AmmoType = base:bullets_9mm,
CanStack = false,
GunType = Base.Pistol,
MaxAmmo = 15,
StaticModel = GunMagazine,
WorldStaticModel = Gun_Pistol_Magazine,
Tags = base:hasmetal;base:pistolmagazine,
}
but there is no member for how many bullets are actually in the fucking thing
am i missing something or is there a lack of transparency here
obviously this is the base class. sure.
its derived into something else somewhere down the line. sure.
how do i find this information
In the PZ files, under "media/lua/shared/Items/SpawnItems.lua", they have this snippet for getting clip and gun ammo count and fiddling with it in the addBunkerStuff function.
local function addBunkerStuff(playerObj)
local guns = {};
local clips = {};
table.insert(guns, crate:getContainer():AddItem("Base.AssaultRifle"));
table.insert(guns, crate:getContainer():AddItem("Base.AssaultRifle2"));
for i = 0, 4 do
table.insert(clips, crate:getContainer():AddItem("Base.556Clip"));
table.insert(clips, crate:getContainer():AddItem("Base.M14Clip"));
end
for i,gun in ipairs(guns) do
gun:setRoundChambered(true)
gun:setContainsClip(true)
gun:setCurrentAmmoCount(gun:getMaxAmmo())
end
for i,clip in ipairs(clips) do
clip:setCurrentAmmoCount(clip:getMaxAmmo())
end
end```
may have been moved?
spawnitems.lua is in
media/lua/shared/items/SpawnItems.lua
Oh, whoops. Wrote the path manually and forgot Items
its acutally called addbunkerstuff lol
what is this function for exactly?
loot table?
for i,gun in ipairs(guns) do
gun:setRoundChambered(true)
gun:setContainsClip(true)
gun:setCurrentAmmoCount(gun:getMaxAmmo())
end
for i,clip in ipairs(clips) do
clip:setCurrentAmmoCount(clip:getMaxAmmo())
end
ah yes
heres what we are looking for
Looks like it targets a square on the map and fills the crates with ammo and guns, then maxes out the ammo and guns in the crates filled
Kinda a manual loot table lol
i have avoided exploring the new map
waiting to do with my friends in b42mp


