#mod_development
1 messages ยท Page 297 of 1
And the recipe parser is a piece of junk.
they should be in the 41 folder now, try not to rely on the common folder.
if they're in the b42 version
Can anyone do me a favor and open up items_smoking.txt and tell me what the custom eat sound was for them, i managed to accidentally replace the lines with empty "CustomEatSound = ," and save while trying to steal definitions xD
Fixed! Dissapointed that now I have to figure out how to make a entirely new recipe, but fixed!
gimme path
media\scripts\items\
Oh they are just empty? could have sworn they had something there. Oh well thank you.

When i add and equip a ALICE Belt Suspension to the player on spawn the UI and the logic for extra slots dont triggers.
I use this code to add and equip it:
player:setWornItem("Webbing", aliceBeltBag)```
There must be a function to trigger the update but i am clueless where to search.
No need for a hole lol. I meant to drink water.
Like if you have a hand drill in you hand use it to breach the ice and fish or drink water
but yeah, its likely to cause performance issues unless its limited to areas around the player
no need to render the entire map's water into ice
just the few chunks the player is in
Even limited to areas around the player, you need to check every cell as you load to see if there are water/ice tiles that need updating.
maybe make it update every long time
no need to have it melt the instant it becomes -4.9 c
like every 12 hours ig or something
Wont' matter.
IT's summer, I explore.
I's winter, now I explore
you reload the chunk I went to previously
the water is all water, but choudl be ice
i mean doesn't snow literally cover the entire map? causing a change in texture and checks happen
its not that far off from how from snow works
That's why I suggested seeing if you can update the water tiles "live" instead of swapping them.
But you might find you can't change the "can be walked on" propelrty without reloading the game, or some other such thing
Give it a go, it's a good idea.
yeah very likely
ill check it out later
but its prolly too much work and debugging
You can make water possible to move over, there's swimming in.. um.. Aquatsar? for B41.
but that's a "all the water, all the time" thing that does not change.
hey, so i'm trying to update my mod to b42 and my xp modifier code is broken.
its too big to paste here, but i'm doing this;
function XPMult(Player, Perk, Amount)
local Modifier = 1
--Change Modifier based on conditions and what perk is getting xp
Player:getXp():AddXP(Perk, Amount*(Modifier-1),false,false,false)
end
Events.AddXP.Add(XPMult)
this worked in b41, now it seems to instantly max out whatever perk it triggers on.
what changed about the xp functions?
okay i think i already figured out whats going on. it looks like AddXP() is calling back to the event. the 3rd arg used to be a callback boolean that would disable that. need to go find the xp code again..
looks like they disabled that feature in 42
the third argument just does nothing now
i just looked through my decompile
were you able to just search it? because thats something ive been trying to do for a while
yeah, i have it open in my ide
i fixed the instant max xp issue, for anyone finding this later.
The issue is that the AddXP() function calls back to the AddXp event with the amount of xp it gives. so it creates an infinite loop of giving the player xp.
you have to add a manual debounce to the function now since you can't prevent the callback anymore in b42;
Debounce = false
function XPMult(Player, Perk, Amount)
if Debounce then return end -- if Debounce is true we "reject" the entire event call.
local Modifier = 1
if Perk == Perks.Strength then
--Change Modifier based on conditions and/or what perk is getting xp
end
Debounce = true
Player:getXp():AddXP(Perk, Amount*(Modifier-1),false,false,false) -- Debounce being true while this line runs means that when it calls back to the AddXP event, the debounce will stop it from running again.
Debounce = false -- can immediately set it back so the next xp instance doesnt get rejected.
end
Events.AddXP.Add(XPMult)
Unfortunately this means that multiple mods trying to modifiy the same xp gain will now be forced to interact with each other, this can cause some wierd effects like 2 different 50% xp bonuses giving you 150% more xp instead of 100 or 112.5.
this is because both mods see the initial amount and then both mods see eachothers bonus xp call. this scales exponentially with the number of mods looking at the xp
you gain 10 xp
mod A sees 10, gives 5, then B sees the 5 and gives 2.5
then B sees the 10 and gives 5, and A sees that 5 and gives 2.5
totalling 5+5+2.5+2.5 = 15 bonus xp.
with 3 mods this scales again. totalling +26.25 xp, or +262.5% xp from what should be 3 separate +50%
I found this mod for b41, you can look at how they did it to do something similar. https://steamcommunity.com/sharedfiles/filedetails/?id=2897072401
why is IT NIL
I am going crazy why can I not make mod data on the player and transmit it, and have the server look at that mod data
it says this when transmitting data
did you ever figure this out (sorry for necro ping) chuck seems to have answered my confusion
Is there a work-around for adding mod data to the player reference? I'm trying to add mod data to the player and I keep getting this error.
mod data has to be set on a player from their client
yes but it isnt apparently transmitting across to the server, as the traits aren't either (until rejoining)
I'm at the point that i might just make a mod data table on the server
but I don't know how global mod data works
or rather i forgor
do isoplayer references change between sessions
im assuming so
which means i need to use steam ID
all object references are volatile
so steam ID is the only way to have persistent data for the players across sessions because mod data on IsoPlayers simply doesnt work
it works fine but it's not reliable to query or edit from other clients or the server
i have it set up so the client adds mod data to themself, then transmits it
the server is getting nil from this transmission, and according to what chuck said transmitting mod data in reference to the player simply no worky
from my understanding transmit mod data needs to be done on the object that has the mod data, to then transmit it to the server (unless I am wrong)
if I make mod data on the server, it will get saved between sessions right?
the thing im confused on is how these functions work...
would I have to do something like
ModData.create(moduleName)
ModData.add(moduleName, {})
to init the mod data? or whut
so
ListOfIDs = ModData.getOrCreate(moduleName)
ListOfIDs[#ListOfIDs + 1] = DataToAdd
-- or doing
ListOfIDs[PlayerID] = true
ModData.add(moduleName, ListOfIDs)
I had a mod idea but dont know how to make a mod, is there anyone i can ask to create a mod (if the idea interests them of course)? If not, then any tutorials maybe?
the best way to init it is```lua
local modData
Events.OnInitGlobalModData.Add(function()
modData = ModData.getOrCreate("MyMod")
end)
almost no one is going to make a mod for you without a commission. check the pinned links in this channel for info on how to start modding.
alright
and to save the modData, after modifying the table, I would do
ModData.add("MyMod", modData)
```?
no, the table itself is saved
is there anyone i could ask with commission?
wait I don't need to manually save it
you don't
depends on what you want done and how much you are willing to pay I guess. as for who takes commission, the only one i know of is @faint jewel.
ok, i basically wanted to make an item inspired by TWD's "Whisperers", i dunno how hard it would be to do to make a mask and make zombies more neutral when wearing it
Is anyone able to help me out how i can change the rgb tint of an item that is tintable using lua?
Lua passes tables by reference, and everything other than really only boring stuff like int/float/bool is a table.
Which was a real mess to get my head around.
java objects aren't really tables but they do act the most like them
the only real trait they have is having a metatable
ive seen several people want something like this. I dont see the appeal but
not sure you can modify zombie behavior at run time like that.
if you can would basicially need to just make the zombie unable to see the player and it would be passive.
or look into how the Bandits mod works, it basically uses the Zombie logic to make NPCs.
if the vision modifier on headgear applies to zombies, could make a mask that has a 100% vision blocking and that should do it, how you get it on a zombie I have no idea unless it spawns with it.
I know of 2 mods on the workshop. "The Whisperer Mod" which is very buggy but the process of making the mask seems more fair and pretty hard. I currently use "Dead Skin Mask" which functions great, minimal bugs but the process of obtaining it is way to easy, you can get it on day one of playing
can always make a patch mod that changes the recipe of the skin mask to be whatever you want.
How could i do that?
make a mod and in your mod overwrite the recipe file by making it the same name. load it after the mod you want to change.
make the file the same name, not the mod.
Alright Ill look into that
should be pretty straight forward, copy the mod you want to change into your mod directory, remove any part of it you dont want to change, edit what you do, and then load the patch mod after its parent, of course edit the mod.info so that it uses a new name so it shows up in the mod list.
Any tutorials i can use?
Not really, stuff pinned in this channel is about it.
has anyone gotten a lua remote debugger to work? I'm trying ZeroBrane's mobdebug with no luck so far..
check out Braven's Camouflage: https://steamcommunity.com/sharedfiles/filedetails/?id=2981216690
B41 mod that lets you use a corpse to disguide yourself, then Zombies are non-agressive to you until it wears off.
Neat, but it was GrumLuker asking for the whisper stuff ๐
@vague tide see comment two comments up ๐ผ๐ผ๐ผ๐ผ
Thanks! I use this mod too, i think this mod is really awesome
I mostly look for stuff that increases mid to late game difficulty, it gets way too easy eventually.
Thats fair
"THIS IS HOW YOU DIED" unless you live more than a week. then its "THIS IS HOW YOU GOT BORED AND FOUND A WAY TO CREATIVLEY KILL YOURSELF"
I usually make it so that peak zombie pop kicks in later than normal, but is way higher, but this has really nasty results on performance.
Makes sense
might have to see if I can make the zombies tougher and or faster as time goes on, like adjusting the percentage spawns on a timescale.
I feel like modders are most likely to have seen the relevant code, so I ask here: The "% chance for building to be looted" is calculated one time, when you first visit/generate a cell, right? Can't see how it would work any other way
prety sure its when the cell is generated.
So it would follow that you can drive around in the early game to 'lock in' important POIs with a low chance to be looted? 
I don't want to clear Guns Unlimited rn but I'm very close and could just cruise by
i haven't seen that specifically, but basically everything simlar works that way
buildings dont spawn/generate containers until they are entered.
That can't be true you can look in the windows and see shelves occupied or not
that's not correct, containers are populated as soon as the squares load
I mean the container itself is there, the contents arent
add a listener to OnFillContainer and you'll see it fires for every single container that loads, when it loads
this is a myth
thats fine, im wrong then. silly system honestly if you just drive around the map for the first few days.
Anyway, it would be really weird if you could visit an area, then return to find it looted. That would require the game to track which buildings you have looted or not, first of all
Yeah that's what I want to do
My last save it was a pain in the ass and several important things were looted by the time I got there
it does actually track that anyway but for loot respawn reasons
Oh interesting 
would be easier to just up the loot chances for the types of loot you feel are hard to get.
thats in the sandbox settings.
you can also reduce the chance of a building being fully looted, I think by default its only 50%
I want to survive 1 full year on default apoc settings 
I feel that sandbox settings is basically cheating
whats the point if you cheese it?
What cheese?
you dont want to cheat, but you are basically going to cheat in another way?
driving around locking in all the loot early. pretty cheesy.
you do you, I don't care either way.
That's not what cheese means at all. I want to play the game by the rules, not change the rules
riiight.
public Nutrition(IsoPlayer player) {
this.parent = player;
if (this.isFemale) {
this.setWeight(60.0D);
} else {
this.setWeight(80.0D);
}
this.setCalories(800.0F);
}
Why is it still 80 for females?
this is the constructor, and it does not set isFemale, so when this is called isFemale will never be anything but the default value (false)
hi, i want to make a mod that convert ammos to being simple like pistol ammo, revolver ammo, rifle ammo, sniper ammo and rocket ammo. Any help is appreciated
Sounds like the easiest way to do this to me would be to group them into the 3 weapons categories: Handguns, Shotguns and Rifles. Probably easier to make them all compatible with an existing ammo type. Like 9mm for handguns, shotguns all use the same already, and .308 for the rifles.
Then modify the ProjectZomboid\media\scripts\items_weapons_firearms.txt file so that they all use the same AmmoBox and AmmoType
You'll also have to update the ProjectZomboid\media\scripts\items_weapons_ammunition.txt so that the weapon clips/magazines take the same AmmoType as well.
Then modify the disribution file so that only your selected ammo types spawn.
I'm probably missing something, but that's my first thought.
Can I somehow define that my mod should load before another one for other people?
That's how I'd do it too, but use DoParam to change specific parameters instead of replacing entire script files. That way you won't have issues as things keep changing with the way guns work.
Every gun will have two or three parameters to change, depending on if it uses a magazine or not: AmmoBox = 556Box, AmmoType = Base.556Bullets, MagazineType = Base.556Clip,
I've heard that B42 adds some sort of "load before" type option to mod.info, and I've also heard it does not work properly... but worth looking into if load order matters.
in b42 you can add this to your mod.info ''loadModBefore=\ModID''
Spongie with the useful answer instead of my vague hints. ๐
Thanks both of you, will give it a try! ๐
Hmm.. I guess it will only show in the mod load order menu that it needs to be before something
Lol no fucking way

yeah its scuffed
it's on purpose
the code to set it is probably just commented out
all the other gender mechanics in there have constants but no code
Hey everyone, I'm currently trying to get an if then query with my own sandbox variables into the VehicleZoneDistribution.
- in my VehicleZoneDistribution.lua I change the codes for the police zone so that PickUpVanLightsPolice and CarLightsPolice spawn with different skins (index = -1) -> works
- for B42 I deleted ProfessionVehicles.PickUpVanLightsPolice and ProfessionVehicles.CarLightsPolice so that zone-specific vehicles no longer spawn on my own map. -> works
- the lower part also works, where I introduce two new zones, "morepolice" and "forcedpolice".
What I'm wondering now is whether I can add a query to my sandbox settings here. If the "VanillaReskin" option is switched on, two more vehicles should spawn in the police zone (and in my own two zones). However, it doesn't work the way I think it should. With the if then query in the screenshot, I currently achieve the following result: If my sandbox option defaults to "true", the two vehicles spawn regardless of whether I then switch the option on or off in the game. If I set the default to false, the vehicles do not spawn, regardless of whether I switch the option on or off in the game.
So I assume that "basically" the query works, but it only looks at the default and not the current selection.
you have to move all this into a function added to the OnInitGlobalModData event i'm pretty sure
right now its just doing all of this as soon as the lua file is loaded at startup which means its only using the default sandbox options
local function onInitGlobalModData()
--do stuff here
end
Events.OnInitGlobalModData.Add(onInitGlobalModData)
this should set the spawns when loading into the game after the sandbox options are set
Hello. Can anyone tell me how I can hide the character model?
player has a invisible flag
I mean that the player does not see the model of his character
Is there a function to see if an item of a certain type exists in the game registry
will try it, thx ๐
Not sure if the best way to do it, but this seems to work (setTargetAlpha is used to hide other players when they shouldn't be seen, so it hides everything, not only the model): ```function setPlayerInvisible()
local player = getPlayer()
if player ~= nil then
player:setTargetAlpha(0.0)
end
end
Events.OnRenderTick.Add(setPlayerInvisible)```
Interested in knowing if that ends up working
Tested it in B42 and it works
Does it really needs to be set every render ticks ?
Tested setting it once and every tick, but didn't work then. Might have done something wrong, I can confirm they don't work if you think this would be useful to someone
Uh ... I don't understand, it works or not ?
Sec. I will check if there are other ways, but the code I posted works
Just your sentence was confusing bcs you said it doesn't work when setting it once or every ticks
I mean OnTick
๐
OnRenderTick works. OnGameStart and OnTick don't. Maybe there are some other that works, but I think it has to be constantly set to work
Looks like this
Setting it to something between 0 and 1 might be more useful
Think I might have imagined seeing something like this but is there a clothing tag to make something unrepairable but still able to be ripped?
in b42 you should be able to remove the FabricType parameter but add a Tags = RipClothingCotton,
just replace Cotton with Denim or Leather
in b41 theyre both connected to FabricType though so its not possible there
that's cool
I'll add that to the wiki
darn, thanks. I'll try and remember that for later then
Hello, anyone knows what the "NoBrokenItems" flag does in craftRecipes ?
For example right here:
item 1 tags[Screwdriver] mode:keep flags[MayDegradeLight;NoBrokenItems],
I tried to modify the recipe and removed the flag but I still couldn't craft the recipe with a broken screwdriver. So what is this flag actually doing?
Hey, been thinking for a while and one of the things that REALLY bothers me about Project Zomboid is the whole progression system with reading books.
Think it's a bit annoying and distruptive to the gameplay.
Does anyone know of or ever considered making a mod that removes all the default skill books entirely from the game.
And rather reward a very very tiny % of multiplier for each action you did towards a skill?
So that the more you did e.g. metalworking ingame, the higher your multiplier would become over time?
Probably means that you can't use broken items, such as weapons being broken you know ?
Hmm and that multiplier could be lowered by doing a different action for a while ?
That could be an interesting system
yea something along those lines, I just don't like the book system at all, it feels distruptive to the gameplay imo
Understandable
I'd rather just "play the game" and have my gameplay decide the multiplier - seems more fun honestly
and if I just make book speed 10000% then its just a perma multiplier and is "too easy"
so was curious if anyone knew of such mod or ever thought of making it
No mod does that no
I thought it was about the tool that is being used not being broken, but I tested it and no matter if the flag is there or not, you can't use broken tools anyway
Hmm
Are you doing this on b41 or b42?
Since even the recipe scripts on wiki says it's supposed to be for saying it can't use broken items in crafting.
Since if it's b42 then it might just be standard not to use broken items?
Yes I tested this in B42. Also I found this line of script I posted here within B42 files on the game.
just released my new mod, Firearm Radial Plus. It remakes the icons to be more logical, and look cleaner. https://steamcommunity.com/sharedfiles/filedetails/?id=3414778453
those icons look sick
Do you have experience with developing mods or think such system would be hard to create?
isnt there a mod that changes skill books to work like in CDDA where it just gives you the xp instead of a multiplier
i havent seen it in years though so i have no clue if its been updated
Yea no idea @winter bolt just never seen any system that tries to fully remove the books/reading system
But it's more of doing the actions than touching books
this right?
Holy smokes do I miss Cedar Hill 
Not sure, the main problem is that it'd take quite some long time to map every actions that should give the boost
I feel really dumb but I am in the middle of updating my mod to B42 and when I moved it over to the Workshop directory for submit, the mod no longer appears in my mod list and I do not know what I am doing wrong.
Anyone has an idea on what is going on?
What if I wanted to publish multiple mods as a single workshop entry? What would the file structure look like?
Each mod would live in its own subfolder within Contents/mods
So, the same file structure per mod, just with multiple subfolders under that folder
i fucking hate coding dude..
I just spent 3 hours trying to figure out why my fucking table was giving nil values only to realise that the table saved in PlayerModData() isnt being updated to the changes i'm making. because it saves it between loads.. UGH
note; if you store functions in a table in ModData. those functions will be nil when the world reloads. this was also messing me up
A
Functions do not persist in mod data 
according to my reading of the source code, literally nothing
there's an entry for it as a flag (so it technically exists) but it is never checked or used
local SM = ScriptManager.instance
local function isItemExists(full_type)
return SM:getItem(full_type) ~= nil
end
-- Examples
print(isItemExists("Base.Belt2")) -- true
print(isItemExists("Base.BlaBlaBla")) -- false
a bit optimized
local SM = ScriptManager.instance
local SM_Cache = {}
local function isItemExists(full_type)
local val = SM_Cache[full_type]
if val ~= nil then
return val
end
val = (SM:getItem(full_type) ~= nil)
SM_Cache[full_type] = val
return val
end
-- Examples
print(isItemExists("Base.Belt2")) -- true
print(isItemExists("Base.BlaBlaBla")) -- false
Thank you for looking into that!
how do you make a B42 mod that adds NPCs you can spawn and control? i look at Week-One mod and think "it can be done, but how?"
I suggest you start small tbh
i want to make a mod for zomboid and for test issues i try to remove all zombie clothes but somehow it doesnt work, what is wrong in this code? (i know nothing about coding)
local function removeZombieClothes(zombie)
if zombie then
zombie:setClothingItem("Hat", nil)
zombie:setClothingItem("Shirt", nil)
zombie:setClothingItem("Pants", nil)
zombie:setClothingItem("Shoes", nil)
zombie:setClothingItem("Bag", nil)
zombie:setClothingItem("Vest", nil)
zombie:setClothingItem("Underwear", nil)
zombie:setClothingItem("Jacket", nil)
zombie:setClothingItem("Gloves", nil)
zombie:setClothingItem("Socks", nil)
end
end
Events.OnZombieAdded.Add(function(zombie)
removeZombieClothes(zombie)
end)
i think it is possible to make an addon for bandits that lets you spawn and control npcs? im pretty sure braven made a friendly npc mod that uses bandits
OnZombieAdded isnot a thing
Yes it is
But if he asks the question it means he probably doesn't know shit about zombies or the Bandits mod in general
what can i write instead of that?
setClothingItem isn't a thing either lol
ChatGPT will make mistakes
all i want is to spawn them and they auto-attack any zombies that can be seen with weapons i chose. that's it
That's literally what Bandits does then
i thought they spawn naturally in that mod, not whenever i want them to
so use debug mode?
Yea
alright, i'll give it a try
i never tried storing a function before
good thing i read this so i wont do it
i spawned one and it instantly left the area before i could interact with it
it depends what bandit you spawn, different clans have different "friendly" settings, some you can command to follow you, others leave and others kill you
i made it so only friendlies spawn
Talking about bandits, there is an issue where they can insta-kill you if they spawn in the same room you're in
are you invisible or ghost?
no
i called out and attracted zombies instead๐
unfortunately it doesn't work well with the Sixth Sense mod, since they count as zombies
it always thinks one is nearby
hey guys I was wondering if anyone can give me a bit of guidance here, I am trying to make a mod that makes the trunks of cars that the player enters invincible. I haven't modded PZ before.
I don't think the code is the issue, it might be the way my folder structure is organized?
I didn't really understand much from the wiki and the github example. Debug console gives no error.
I am loading the mod through the Workshop and testing it in singleplayer. here's how the structure looks in ..\Project Zomboid:
Project Zomboid/
โโ Workshop/
โ โโ indestructible_trunks/
โ โ โโ Contents/
โ โ โ โโ mods/
โ โ โ โ โโ Indestructible_trunks/
โ โ โ โ โ โโ 42/
โ โ โ โ โ โ โโ media/
โ โ โ โ โ โ โ โโ lua/
โ โ โ โ โ โ โ โ โโ indestructible_trunks.lua
โ โ โ โ โ โ โโ mod.info
โ โ โ โ โ โ โโ poster.png
โ โ โ โ โ โโ common/
โ โ โโ preview.png
โ โ โโ workshop.txt
move your mod to %UserProfile%/Zomboid/Workshop/
the one in the ProjectZomboid folder isn't used
In case you need more info on the subject
it's not quite what i'd like. wanting to choose what weapon they spawn with and have a hotkey bind that spawns them. don't see a way for those to happen
Just make an addon to Bandits
It's either you reprogram the entire Bandits AI into your own mod and make something to customize them, or you just directly use Bandits
Make a custom UI to spawn bandits with specific weapons or clothing
That'd be very easy to do
That's why I suggested starting with something smaller
Bcs you're going to be having a terrible time, and the first option of reprogramming Bandits AI in a standalone mod is a no no
smaller = ?
Hey, quick question is there a some way to apply different properties to the tiles or combine them? Sort of making a 3 in one 1 tile with a stove counter and microwave functional all at once?
Hello all, ok i'm finished the vscode extension for managing scripts/recipes files ๐
https://marketplace.visualstudio.com/items?itemName=cyberbobjr.pz-syntax-extension
it's a very early version, please be kind ๐
When I press 1 or 2 it doesn't play any animation, it was working in build 41
mod folder structure
42
media/
AnimSets/player/idle/Test_Idle.xml
lua/
client/AnimationGuide.lua
common
media/
anims_X/
AnimationGuide.fbx
AnimSets/
player/idle/Test_Idle.xml
//
AnimaitonGuide.lua
local onKeyStartPressed = function(key)
local source = getPlayer(); if not source then return end
if key == Keyboard.KEY_NUMPAD1 then
source:setVariable("IsAnimationGuide", "true")
end
if key == Keyboard.KEY_NUMPAD2 then
source:setVariable("IsAnimationGuide", "false")
end
end
Events.OnKeyStartPressed.Add(onKeyStartPressed);
looking good man, thanks for the work you put in there! ๐ quick question, does it work with new functions in B42?
use tripple `
to
have
multi-line
code
animsets are buggy in 42, add the animset to the build 41 mod structure or it won't load
so copy it to mods/MyMod/media/AnimSets/ (not inside common or 42) as well as leaving it where it currently is
the one in the common folder (or 42) is the one that will actually load, it just won't find it if there isn't also one there
Wrong: lua/indestructible_trunks.lua
Correct: lua/client/indestructible_trunks.lua
Or: lua/server/indestructible_trunks.lua
ฤฑ failed
AnimationGuide/
โโ common/
โ โโ media/
โ โ โโ anims_X/
โโ Test_Idle.xml
โโ 42/
โ โโ media/
โ โ โโ AnimSets/
โ โ โ โโ player/
โ โ โ โ โโ idle/
โ โ โ โ โ โโ Test_Idle.xml
โโ media/
โ โโ AnimSets/
โ โ โโ Test_Idle.xml
it needs to be in the exact same filepath as your actual animset
so AnimSets/player/idle/Test_Idle.mxl
just a weird bug where it still searches the media/ folder for the names of files to load, but correctly searches 42/media/ and common/media/ folders when actually loading them
it only manage item/craftRecipe/fixing scripts
yeah this did it, thanks a bunch
Nice !
That's good !
you can format item/recipe/fixing file, you can also see the definition of all vanilla "Base.ITEM" (by default the extension will look inside C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts, but you can change it in your settings)
you can also hover a base.ITEM and see the definition
like that :
wait this is sick
can someone show me a basic reference code for giving zombies clothes
That's sick
Thanks Batman
is there a way to get the bottom row first table cell to take up the full row? Like a colspan feature?
i cant seem to figure it out with the steam formatting
Code isnt working as intended.
Print debug says the array size is 2 both before and after this removal. [originally is a list of all online players]
Thoughts?
Oh the remove funciton uses an object reference.
private void updateWeight() {
this.setIncWeight(false);
this.setIncWeightLot(false);
this.setDecWeight(false);
float baseCalorieThreshold = 1000.0F;
float maxCalorieIntake = 4000.0F;
float calorieDeficitThreshold = 0.0F;
if (this.isFemale) {
baseCalorieThreshold = 1000.0F;
maxCalorieIntake = 4000.0F;
}
if (this.parent.Traits.WeightGain.isSet()) {
calorieDeficitThreshold = -200.0F;
}
if (this.parent.Traits.WeightLoss.isSet()) {
calorieDeficitThreshold = 200.0F;
}
if (this.getWeight() < 90.0D && this.parent.Traits.WeightGain.isSet()) {
baseCalorieThreshold = 700.0F;
}
if (this.getWeight() > 70.0D && this.parent.Traits.WeightLoss.isSet()) {
baseCalorieThreshold = 1800.0F;
}
float weightBasedThresholdAdjustment = (float)((this.getWeight() - 80.0D) * 40.0D);
baseCalorieThreshold += weightBasedThresholdAdjustment;
calorieDeficitThreshold = (float)((this.getWeight() - 70.0D) * 30.0D);
if (calorieDeficitThreshold > 0.0F) {
calorieDeficitThreshold = 0.0F;
}
// .....
Is it true that calorieDeficitThreshold = -200.0F and calorieDeficitThreshold = 200.0F are useless because later there is just calorieDeficitThreshold = ...?
When I read code, I assume that it is thought out. So in such cases I always doubt, maybe there is something wrong with me?
Hi, Is it possible to make sandbox settings that block or prevent recipes from appearing?
yes
that's my reading too and my ide even points it out as a mistake
I thought chicken-pocalypse was a joke, but its real and I hate it, I had six chickens, went to bed, I now have 170 chickens...
Is there a way to get the name of a tile? trying to get the unclimable military/prison fencing but i can only get the gid
is there a list or something i can look at
I dont think so
You need a new table
Sadly
@whole swan do you mean something like:
null:location_trailer_01_8:location_trailer_01_8:zombie.iso.objects.IsoWindowFrame@7e6e6a87? Sorry, not sure what you mean by name of a tile I'm new too
possibly, but I'm not entirely certain, i'm referring to something like carpentry_01_20, like as is used in DebugUIs/Scenarios/Trailer2Scenario.lua at line 158
i'm familiar with tilezed but i wasn't sure if there was a way to get the name of a tile from that
Is this correct?
mods\modname "Any pre 42 mod files and folders"
mods\modname\42\ Version 42 specific files like scripts
mods\modname\42.1\ Version 42.1 specific files like scripts
mods\modname\common\ any files for 42 that arent version specific, models, xml files etc etc.
yeah
It also uses nearest version number.
build 42 will load any files from the highest numbered folder that is equal to or lower than the current game version, and from common, with the version folder taking priority
ok makes sense now. Dunno why but i kept failing to set it up right previously but was probably due to conflicting examples in other mods lol. but yeah seems simple enough
That's my understanding. 4X and Common folders are for B42 forward, everything else in the folder is legacy.
goal)for this post, just to add some items
problem) the items I make aren't being recognized by the game
how i know) not appearing in the debug item list
build)42
things I have tried) changing the file location around, comparing to my items to other modded items, and comparing to regular in game items
code) (hopefully I do discord code box right)
{
imports
{
Base,
}
/****************************** FOUND ITEMS ******************************/
item StoneOfIntrest1
{
DisplayCategory = Material,
Weight = 0.3,
Type = Normal,
DisplayName = Stone Containing Iorn,
Icon = Rock,
WorldStaticModel = Stone,
}
/****************************** ITEMS MADE ******************************/
item StoneOfIntrest1bund
{
DisplayCategory = Material,
Weight = 0.3,
Type = Normal,
DisplayName = Bundle Of Iorn Ore,
Icon = Rock,
WorldStaticModel = Stone,
Tags = SmeltableIronSmall,
}
}```
Also please @ me to get a quick response
Can the module name have a dash? That might be an issue.
Does the module name show at the top of the debug item list?
Ok Let me test that, because the module named is not show up in the debug list
I'm trying to test out your suggestion but, now the game isn't recognizing that I have a mod in the mods folder at all. -_-
Okay I fixed the mod not being recognized issue but, the suggestion didn't fix it though
See logs, i.e. console.txt
ok here it is
I don't see any related errors there.
So what do I do, I'm relatively new to modding so I don't know what else I can do to provide information
Can you post your ModInfo file?
poster=poster.png
id=HBRC
description=a full colection of mods by HotheadB```
anyone know how i can make a melee weapon have more then 1 texture
or how a texture is assigned to the model i have made a melee weapon and it has its texture but i do not know where its being called from
I'm pretty sure a weapon can only have one texture. You'd have to make separate entries for more than one.
right okay so i have done that
here and the blue one does not have a texture
i even tried making a seperate model cause i thought maybe the texture was inbeaded into the model
what do you think before this i only called for mesh im scripts and it had the correct texture
seems that calling for it is not chanfing anything
changing
so where do you think the texture is being pulled from the model just knows
i know fbx files can do that
WeaponSpritesByIndex probably
i also changed the weapon sprite between the two
When using ReduceFoodSickness, the game only removes sickness when consuming the item the first time, and will not remove any more until you exit and reload... is there a time restriction on it reducing food sickness, and is there a way around it?
Thoughts on a material crafting recipe: 3 Sacks of Dirt and sifter = 1 Bag of Sand 1 Bag of Gravel and 1 Unity of Clay, Return the Sifter and 1 empty sack?
maybe add a bucket of water for the class? and return an empty bucket as well?
I also think it would be great if we could have a "dirt pit" and when spending time using it, it generates Dirt, Sand, and Gravel randomly as long as you have empty sacks and a shovel. Collecting Dirt, Gravel, and Sand is tedious and makes the map look really ugly.
@bronze yoke does your excavation mod give dirt and sand ?
I wondered the same, but had not gotten around to trying it yet.
only dirt
stone further down but it's difficult to dig downwards until tis fix a bug associated with it
Thank you very much, it works perfectly.
I was now able to set it so that when the option is switched on, the vanilla "police" zone is emptied and vehicles are loaded with the reskinned scripts instead of the vanilla scripts. In the vehicle script itself, I change the skins or add more skins.
I do a similar thing with mod vehicles, which means that mod vehicles, provided I have reskinned them, are displayed correctly. To do this, however, I have to include the script file of the mod vehicle in my mod, which means I will ask the relevant authors for permission. Their mods are still necessary for the vehicles to appear for me, as I do not include any other files from other modders - only the script file, as I cannot avoid it. (and of course the reskinned texture files).
Do you or any of you here have any other ideas/suggestions?
It worked but it gives this message " warning did not find node with condtion" performingAction=Animationguide" in player/actions "
Hello boys, Is there someone I could talk in private about dev. ? Iam trying currently make a clothing but strugling.
Just ask here
Or in modeling
How do I log from lua?
Wdym ?
There's a log view in debug mode once you enter a game. How do I log to that from a mod's lua script?
Print function.
Is the syntax documented somewhere? I tried Print("message") but that did not work
Ah I see it's print not Print
thank you for the assist @old ginkgo
I suggest you read
https://pzwiki.net/wiki/Lua_(language)
Someone please update Jiggas Green Fire โค๏ธ
no
Why not?
"someone please spend their time on this thing that I want"
looks like its missing clothing stuff
actually no it has tooltips but its saying theres no keyword?
You know what it was a nice ask, I didn't expect anyone to do anything for me but thought "it's worth an ask" to then get replies like this, Im just going to learn lua myself.
I mean this is not really a channel for mod requests or update requests. However if you do start updating it yourself and have questions you'll get completely different kind of replies 
Like there are hundreds of thousands of mods out there
imagine if ppl would start coming here asking for updates
that's why ppl generally not liking these kind of msgs
but we'll be happy to answer lua or modding questions :)
i am trying to make a sword tha lights zombies on fire its not working
local burningZombies = {}
local function OnFlamingSwordHit(character, weapon, target, damage)
if weapon and weapon:getType() == "FireSword" and instanceof(target, "IsoZombie") then
print("FireSword hit detected!")
print("Zombie health before hit: " .. target:getHealth())
if not burningZombies[target] then
burningZombies[target] = true
target:getBodyDamage():setOnFire(true)
addSound(target, target:getX(), target:getY(), target:getZ(), 20, 20)
getWorldSoundManager():addSound(character, target:getX(), target:getY(), target:getZ(), 30, 30, false, 0.5)
print("Zombie set on fire!")
end
end
end
local function UpdateBurningZombies()
for zombie, _ in pairs(burningZombies) do
if zombie:getHealth() > 0 then
if not zombie:getBodyDamage():isOnFire() then
zombie:getBodyDamage():setOnFire(true)
print("Reapplying fire effect!")
end
local delta = getGameTime():getMultiplier()
zombie:setHealth(zombie:getHealth() - 0.02 * delta)
print("Burning zombie health: " .. zombie:getHealth())
else
burningZombies[zombie] = nil
zombie:getBodyDamage():setOnFire(false)
print("Zombie died from fire!")
end
end
end
local function ManuallySetZombieOnFire()
local player = getPlayer()
if player then
local zombies = player:getCell():getZombieList()
if zombies and zombies:size() > 0 then
local z = zombies:get(0)
if z and instanceof(z, "IsoZombie") then
burningZombies[z] = true
z:getBodyDamage():setOnFire(true)
print("Zombie manually set to burning")
else
print("Invalid zombie target.")
end
else
print("No zombies found nearby to set on fire.")
end
else
print("Player not found.")
end
end
_G.ManuallySetZombieOnFire = ManuallySetZombieOnFire
Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit)
Events.OnTick.Add(UpdateBurningZombies)
Awesome well, Im going to attempt to learn lua and work on the mod instead then any questions I may have I'll post here, ty ๐
if you put code in tripple
`
it
will
format
it
into a readable thing
also why do you have to manually update burning zombies?
can't you just hook up to something in base game and jsut call it from your code? 
also "not working" is vague. You have a bunch of printouts, how are they looking? What is not printing out?
That's my thought too.
He said currently it's mostly for crafting I believe
That's a good idea
Learn how to mod, we'll gladly help you
Should just need
if weapon and weapon:getType() == "FireSword" and instanceof(target, "IsoZombie") then target:setOnFire()
end
Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit) ```
But randomly begging random modders you don't even know to update such an old mod ? Hell no
I wouldn't call it begging, it was a decent and not rude request, it's just imagine if everyone would come and ask for updates. Not the purpose of the channel
It's actually the recipe syntax you'll need to spend the most time fixing.
https://www.reddit.com/r/projectzomboid/comments/1hgwccl/if_there_is_a_mod_you_absolutely_cant_live/ <-- that will get a mod into the B42 folder structure, but any recipes fron B41 will be broken and need replacing. Then figure out what else needs fixing.
[Creating my own server manager for Project Zomboid.]
The image is a screenshot of the next update for the terminal page showcasing a new batch system where users can change the batch in seconds feeling a little bit proud.
https://steamcommunity.com/sharedfiles/filedetails/?id=3320238921
This channel is really good for getting help when you get stuck, but think of it more as a bunch of helpful people that will offer directions but then you still need to get there yourself.
Easy mod manager for servers? That sounds useful, mod setup for MP looked very manual to me (not that I've ever done it)
There's a mod manager build into it, uses SteamCMD to download mods from steam ID. Actually, it completely works automatically when selecting the mod folder.
I do recommend hosting external content using https using a domain name, a lot of people will freak out when they see http://45.10.161.92:5051/
Yeah I've got the domain, not worried about it right now
But I assume that's a placeholder.
Sure is
Not worried about getting people on it at all, just trying get it on the same level as tcadmin / pertodactyl
Hey all, firstly sorry if this has been asked before, but is isTool() on the InputScript class busted at the moment? (B42 obviously)
I'm getting instances where input items like hammers and saws etc are returning false on that function
Those tools might be broken ?
this didnt work ive tried multple ways and i cant get it to work
Mod Idea:
Name of the mod (just a suggestion): Useful Heli's
Premise of the mod: making the helicopter not a burden, but a godsend. making it so the helicopter can pick up your character and bring them to salvation
Pros: helicopter events are a good thing now
Cons: helicopter events are unneedingly rare now to make balance (can be changed via sandbox settings)
maybe its a problem with this
Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit)
it needs o be OnZombieHit
or something
does anyone know how you could make the capacity of trunks be unaffected by the trunks condition? I wrote this in 42/media/scripts:
module Base
{
item SmallTrunk1
{
ConditionAffectsCapacity = false,
}
etc...
}
template vehicle Trunk
{
part TruckBed
{
container
{
ConditionAffectsCapacity = false
}
}
part TruckBedOpen
{
container
{
ConditionAffectsCapacity = false
}
}
}
but it doesn't seem to work, trunk capacity still gets lowered with condition.
maybe you need to assign the Capacity value inside Container
container { Capacity = 100, ConditionAffectsCapacity = false, }
OnZombieHit is not a thing, that's the right event here
The code he provided is good
it doesnt work but there is also no errors
it's missing an end so there should be a syntax error
yeah i need to evolve the known token. PZ has too much token for properties ๐
i noticed individual vehicle script files, like vehicle "Offroad" use the item "SmallTrunk" instead of something like "SmallTrunk1/2" like in the vehicle items file.
part TruckBed
{
itemType = Base.SmallTrunk,
container
{
capacity = 40,
test = Vehicles.ContainerAccess.TruckBedOpenInside,
}
}
maybe this "smalltrunk" is defined somewhere else?
and the extension is only for b42 version ๐
there was something like that, helicopter extraction or sth
oh and let me guess, the helicopter always crashes because apparently in zombie media the pilots always have both of their arms fucking amputated?
not 'round here pardner

Has anyone started a flow chart for crafting material usage yet?
How do I go about making a map mod?
simple google search has tons of info on how.
@vernal ferry this YT channel also has a lot of great info on it.
https://www.youtube.com/playlist?list=PLc7_sQ-Tb6e3siC4Cwu4JfxuqJZkGO6sy
Older vids but still relevant.
was player:getXp():setPerkBoost(perk, newBoost) changed?
used to work in b41 but now it doesn't seem to do anything 
nevemind i got it fucked up somewhere
@true plinth so cool thing, it also formats my console file
I updated OSRS Weapons for B42 Unstable - Hope y'all enjoy
https://steamcommunity.com/sharedfiles/filedetails/?id=3415859337
Heyo! I'm just getting into modding zomboid, and I'm struggling to find any robust documentation. I have an empty trait, but I want it to give the player moodlets when they have facial hair, is that possible? Is there any specific wiki pages that are relevent to any systems that would involve?
My previous experience modding is with Minecraft Fabric, if that helps put me on a map for my knowledge at all :P
not sure about facial hair but since there's beard grow it should be possible to check if player has beard
for moodles you'd need moodle framework, its on workshop
i think you can do it like this getHumanVisual():getBeardModel()
awesome, is there a way i can print info into a debug console anywhere?
sorry for asking all the basic stuff i promise ive been looking before asking โจ
print()
i suggest that you learn the basics of lua scripting before modding
from a new modders perspective the documentation generally is kinda cheeks. That being said, everyone here is super helpful
Here is a reference for B42 classes etc but its not great
https://demiurgequantified.github.io/ProjectZomboidJavaDocs/index.html
I also have thevscode setup with the lua plugin and the "umbrella" addon to help out
package index
I'd also highly recommend copying the game code and opening the LUA in another instance of VS code to follow what the base does to learn from
all my own experience of course
are there any usability issues with the javadocs other than the lack of written documentation?
No I mean the javadocs thing is fantastic for knowing what there is. My main criticism is not knowing a lot of the what each thing is / does (from a docs perspective)
I'm probably spoiled from working with more formal documentation that has full descriptions of functions and classes etc
no i totally get it, that's definitely the biggest issue we're facing, just the one i can do the least about unfortunately
yeah I get that 100%
unfortunately im using sublime text since i cant get VS to run on my os (cries) thank you so so much tho!!!
Where do i find the game's code? do i need to decompile it?
we have plans for incorporating community sourced documentation into the javadocs + umbrella but we're a little behind on the technical side, let alone actual documentation
would be an interesting use case to see if you could throw the codebase at an LLM of some kind and see what it spat out in terms of descriptive text
all good, no the game is a lot of .lua files which are plain text. the rest is in .jar files that have to decompiled but thus far I've not needed to do that
I did think about seeing if I could throw the code base at something that could at least visualize an inheritance , interdependency and reference map of some kind
thought that might be useful
you dont really need to decompile anything unless the thing you're modding is really specific and you need to know how the game handles something
the java doc that was posted above is lifechanging though
oh yeah, couldnt even imagine trying to mod without that
Heya folks, I'm trying to change a vanilla item to be able to add it to soups etc.
I'm using DoParam lua "EvolvedRecipe = Soup:5"
It works perfectly in B41 but doesn't work at all in B42
I tried with RemoveUnhappinessWhenCooked along with EvolvedRecipe on B42 and only RemoveUnhappinessWhenCooked works, once again, not adding the item to EvolvedRecipes
Would really appreciate any help here, as I'm baffled as to why it works fully in B41, but only halfway in B42.
the metal parts of broken tools should be smeltable.
am I stupid?
---Adds xp boosts from a trait to a player
---@param traitName string
local function addXPBoostsFromTrait(traitName)
local player = getPlayer();
local trait = TraitFactory.getTrait(traitName);
local xpBoostMap = trait:getXPBoostMap();
if xpBoostMap then
local table = transformIntoKahluaTable(xpBoostMap);
for perkName, boostLevel in pairs(table) do
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName:", perkName, ", boostLevel:", boostLevel);
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName: null , boostLevel: null
while if I crash the game by putting print(table .. "a") and inspect the table it's a table that has k,v Electricity 1
I feel stupid every time I look at LUA. I can do C++ just fine, but Lua hurts for some reason. the lack of structure really breaks my brain.
lua is fine
yeah im not saying its not, its just hard to downgrade my brain to a less strict language.
Whenever I ask myself this question, the answer is almost always yes
I've been trying to search around, and one other guy had the same issue, where Albion helped them, but that was around B41, where like I said, my DoParam:EvolvedRecipe works just fine
it's not something i've tried since 42 released, but it does look like it should work the same way as 41 codewise
but it's hard to blame user error if you have the same thing working in 41 so i have no idea
Exactly my thought.
Works with no errors, exactly as intended in B41.
Of course I made sure the item is the same in B42, no problem, it's only the EvolvedRecipe part that doesn't work in B42
Unhappyness removal when cooked still works, but there's no way I can add the item to stirfries or anything like that.
the #1 thing i have to say is make sure logETW isn't fucked because somebody did recently fuck up their log function and was very confused about why every single thing they print is nil

nah it works
i'm guessing logETW passes the arguments into string.format before printing?
nope
oh, does it just append them?
if it dumps them all into print you should be aware it has a hardcoded implementation of tostring (it does not call tostring metatables) so it might not convert all things to string properly, here i guess it's a perk object
so you suggest tostring things?
that would be one solution
ETW Logger | addTraitToPlayer() : adding trait AVClub
ETW Logger | ETWCommonFunctions.addRecipes(): adding recipes for trait AVClub
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type: zombie.characters.traits.TraitFactory$Trait@3be820b3 userdata
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:
Electricity = 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName: Electricity , boostLevel: 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type: nil nil currentBoost and type: 0 number
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): Electricity newly set boostLevel: 0
getPerkFromName aint getting
---Adds xp boosts from a trait to a player
---@param traitName string
local function addXPBoostsFromTrait(traitName)
local player = getPlayer();
local trait = TraitFactory.getTrait(traitName);
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type:", tostring(trait), type(trait))
local xpBoostMap = trait:getXPBoostMap();
if xpBoostMap then
local table = transformIntoKahluaTable(xpBoostMap);
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:");
printTable(table);
for perkName, boostLevel in pairs(table) do
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName:", tostring(perkName), ", boostLevel:", tostring(boostLevel));
local perk = PerkFactory.getPerkFromName(tostring(perkName));
local currentBoost = player:getXp():getPerkBoost(perk);
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type:", tostring(perk), type(perk), "currentBoost and type:", currentBoost, type(currentBoost));
local newBoost = math.min(currentBoost + tonumber(tostring(boostLevel)), 3);
---@cast newBoost integer
player:getXp():setPerkBoost(perk, newBoost);
logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): ", tostring(perkName), "newly set boostLevel:", player:getXp():getPerkBoost(perk));
end
end
end
local perk = PerkFactory.getPerkFromName(tostring(perkName)); this returns nil
and i don't really know why
can someone help me learn how to make a map mod?
I replied to you earlier and even gave a good link to a youtube playlist...
oh sorry i did not see it
perkName isn't a string, it's a perk
DaddyDirk on youtube is amazing for teaching mapping.
It can be fun, but very slow.
thats the playlist I linked to them earlier.
ooooh, lemme fix then, thanks
Made my real life neighborhood thanks to him.
Great guy.
on the javadocs you can look at the return type of getXPBoostMap() to know what types the keys and values will be
yea I was looking at those to make sure everything is correct types, somehow missed the hashmap 

ETW Logger | addTraitToPlayer() : adding trait AVClub
ETW Logger | ETWCommonFunctions.addRecipes(): adding recipes for trait AVClub
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type: zombie.characters.traits.TraitFactory$Trait@2abb31e6 userdata
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:
Electricity = 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk: Electricity , boostLevel: 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type: Electricity userdata currentBoost and type: 0 number
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): Electricity newly set boostLevel: 1
it's always something with types 
New page about newrandom
https://pzwiki.net/wiki/Newrandom
#musicmaniacpins replace all zombrands
Speaking of map mods, is the new version of tilezed out and do we have access to the new sprites in the game? I am guessing they need to be unpacked, etcโฆ
Nop
can someone explain how script overrides work? if i have in my mod something like:
module Base
{
template vehicle Trunk
{
part TruckBed
{
container
{
conditionAffectsCapacity = false
}
}
}
}
what get overwritten from the original template code (which has more than the "conditionAffectsCapacity" field)? the entire "part TruckBed" block or just the line conditionAffectsCapacity?
because I don't want to copy paste the entire original block of code just to change one flag in my mod lol, I noticed that I completely break vehicle trunks if I write it as I did above, but they work fine if I copy paste the entire original script with just the flag value changed.
you just answered your own question, no?
does the OnDisconnect event just apply to the client leaving a server or does it apply to other players leaving the server as well?
says client and multiplayer. I think if its server side its on any player dc and if client side it's this player dc? not sure
do we have resources similar to this but for actual mods not maps?
i guess i'll probably have to test to find out for sure. thanks though!
if albion comes in she knows the answer
that's correct

awesome, thanks y'all ๐
Anyone know where code that controls when it gets light and dark is located? I found GameTime.dusk and GameTime.dawn but changing those doesn't seem to affect when the sun comes or goes
javadocs updated to 42.2.0: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/
umbrella diff: https://github.com/demiurgeQuantified/UmbrellaAddon-Unstable/commit/18ef44684a6854da6a7d4cdb3ab544a713fde572
umbrella update will go live when the addon manager accepts the update
In the java I believe
I mean sure, but where?
I looked into a "night brightness affected by moon phase" mod and got as far as confirming that setting the sandbox options for night light level via Chaneg Sandbox Options takes effect right away, but then couldn't replicate that without bringing up the full sandbox options gui and didn't get back to it.
fair enough
i just found another, separate dusk and dawn property in ErosionSeason, maybe this will lead somewhere
Maybe WeatherShader.java
i'll take a peek there too thanks
Try searching for "nightvision" since that shows up a few places, and cates eye trait & the stubs of nightvision code whould be where light level gets set
oh interesting point
Sorry if I'm interrupting someone else's question but this should (hopefully) be a one post response.
Based on the responses I got yesterday, when I asked my main question, my syntax for adding a new item is properly done, which means it might be my file path.
So are there any changes to the file path that an item's scripts have to be put in for build 42 other than putting the scripts folder in 42 folder.
Keep in mind I am incredibly new to modding this game as I've been using online tutorials to teach myself.
"ambient" is another good term to search for
I usually mirror the vanilla paths, but with a different filename
People say the animsets are broken, do they only mean the fact you have to copy paste it in all directories? I've had problems with them in other circumstances, hoping it's the game being bugged and not me being a dumbass
So <mod>/42/media/scripts/items, or whatever - but in theory anything under /media/scripts/ will work
Sorry if I'm interrupting someone else's question
That's just the nature of Discord, there's always going to be a few overlapping conversations here because technical modding questions here will often have someone check the channel hours later and have something useful to add.
is this how its supposed to be done, because this doesn't work, the items don't appear in the debug item list
You are missing the "media" folder it seems
hold up I just tried to pull up the tutorial for porting to 42, and 2 popped up. one is the original, one says to do some additional steps (what Voltron said is missing)
The one I put on Reddit is a minimal process, the sticky posts in this channel have more detail useful for modders.
Your B41 mod should have had the items in <mod>/media/scripts/items/... unless some weird quirk let it work without the media folder.
this is crashing the game
Item not found: HCS-M.StoneOfIntrest1. line: item 3 [HCS-M.StoneOfIntrest1]
Ok
Guns Less Limited
High level concept: More guns in Guns Unlimited. Additional items gets added directly into appropriate storage containers, so they might be anywhere from the lockers to the storage room but they will be in there somewhere.
Biggest question I have is what would be the best way to format sandbox options? I'm thinking of somthing like this:
[int] number of guaranteed extra pistols
[int] up to this many extra pistols at random
[int] number of added magazines per generated pistol that uses magazines
[same for shotguns, rifles, assault rifles, SMGs]
[int] 12 guage extra rounds
[int] 9mm extra rounds
[same for other calibres, then that many rounds gets added in cartons/boxs/loose]
Then the code makes a list of items to add, there's a list of container co-ordinates I'll make manually, and it just shoves items into containers at random until it is done. The list of weapons to add can include modded items by manually adding "if modIsRunning(BobsGuns) add more to weapon lists"
Anyone got suggestions, especially as it relates to the way of presenting sandbox options... I'm not sold on the simple category approach but I don't want to make it a list of every single gun type.
I'm not familiar with coding sandbox options specifically but if you can have a textbox for input, let them enter a comma separated list of weapons to guarantee
as an optional input probably
Is it possible to override existing java methods? I think the stuff I want to modify is in private fields. =(
not through the lua api
makes sense, is there a way though?
if you're java modding you can replace that class's file entirely
And that's supported with modding? Or are you talking about overwriting native game code?
okay, thanks
Hi, this is my first time talking, i need help finding a beginners friendly tutorial or the full documentation about clothing modding, i have seen the pinned messages, but have a hard time understanding the script part in every tutorial because i have no experience with coding, sorry to bother with my question.
I'm trying to give my custom items a custom sprite, but it no worky. Am I doing it wrong. Once again I'm new to modding/coding so please bare with me.
icon shouldn't include a module, the icon will look for media/textures/Item_ + what you put in + .png
so e.g. Icon = copp_rock, looks for media/textures/Item_copp_rock.png
ok
What is your goal? Having a look at the vanilla clothing scripts for similar items should give you an idea what your item script shoudl look like.
Some mods like "Better Car Physics" modify java - these require you to manually copy files that overwrite the original game files. In my opinion you need a really good reason to make a java mod; it's extra work for users meaning extra questions for you from people that don't follow directions, it risks breaking very badly every game the game update, there are security considerations from running arbitrary java code (not that most users will care)
Oh sure, I'm not planning on making a java mod. That pretty much put a stop on that mod idea, at least for now.
I've moved on to trying to see if there's a way to add a custom action to an equipment item. Like, a ring that lets you shoot a laser at a zombie.
Although I'm not optimistic looking over the item script fields
Custom action via right click context menu, yes. Very common thing for mods to add.
A hotkey that does stuff starting with checking if you have VoltronsMagicRing equipped, also yes.
Shoot a laser? Good luck with that.
yeah ideally i'd want to utilize the gun aiming system but for a clothing item
I want to add clothing type "cosplay" from other videogames from the 90s like the original doom or half life
Are you doing this as pieces of clothing the player can equip, or by replacing the entire player model with your model?
For full model replacment this person has a lot of mods doing that: https://steamcommunity.com/profiles/76561199178116693/myworkshopfiles/?appid=108600
Whatever is easy to start, i make a full body one piece HEV Suit and use the hazard suit as a reference of scale
But if is easy as pieces i do it that way
A piece of clothing that the player can equip
I've not done any clothing work myself so I can't say how easy it is, but look at CreamPie's stuff for examples of "replace everything" (no promises they do it the best way, but they have a way that works) and for normal clothing you've got all the vanilla items and lots of mods as examples.
How this work? Can i see the mod files and "copy" the files as reference for my model?
Look at the URL for the mod: see the id number?
steam will (assuming default install path) download zomboid mods to C:\Games\Steam\steamapps\workshop\content\108600\< id number>
So you can subscribe and then look at all the files in the mod
Just like you can go to C:\Games\Steam\steamapps\common\ProjectZomboid\media and look at vanilla stuff.
example: When I wanted to add a button to the car dashboard, I subscribed to TPMS and looked at how they did that.
Ahhhhhh i did not know i can make it that way
What a legend you are
Thank you so much
Sorry to bother
I promise to update the progress of the mod
Thanks again
Not a bother, questions on modding is what this channel is for.
Hi and good evening everybody. Does anyone know how PZ actually decides which type of zombie to spawn? I have changed the chances in "media\lua\shared\NPCs\ZombiesZoneDefinition.lua" to ridiculously high numbers for the Zeds I'd like to spawn but they still only make up about 50%. Precisely I'd like the Mod "girl zombie" (With thumbnail Waifu Zombie) to spawn it's zombies to a 100%. But not even renaming the original ZombiesZoneDefinition.lua changed the spawn rate.
GPT also threw me a short script that supposedly will remove all entries from the original file, still won't work. (for k in pairs(ZombiesZoneDefinition.Default) do ZombiesZoneDefinition.Default[k] = nil end)
I want to play with a few friends but one of them is a huge weeb but to scared of the "real" zombies..
I think in the java code, ZombiesZoneDefinition.java getRandomDefaultOutfit()
And plenty of other functions for picking outfits in different situations.
(assuming you want the actual code on how the game is making use of the zone definitiosn etc)
So in this part the java code loads the ZombiesZoneDefinition.lua right?
(also, that link is for B41 but it's probably the same in B42)
No, that is done via Khalua the magical Java <-> Lua interface.
KahluaTable var4 = (KahluaTable)LuaManager.env.rawget("ZombiesZoneDefinition");
so it can be accessed like that when neeed by java.
Thats good, need it for B41 anyway, hence multiplayer
You can search for "ZombiesZoneDefinition" in the decompiled java code, and do the same in all the lua files.
Good pointer already, I guess gpt can help me from here maybe ^^ I kind of want it to ignore all the standard zombies.
Wait a sec; you said you set chance to a really high number?
Try setting it to 1
Since most "chance" type numbers in zomboid are a 1 in X chance
even though the Zones stuff loosk like percentage.
I also don't know how the game picks a zone for spawns, I assume that is set in the mapping tools or in special event code.
in the .lua it looks like this: `-- total chance can be over 100% we don't care as we'll roll on the totalChance and not a 100 (unlike the specific outfits on top of this)
ZombiesZoneDefinition.Default = {};
--table.insert(ZombiesZoneDefinition.Default,{name = "FitnessInstructor", chance=20000});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic01", chance=20});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic02", chance=20});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic03", chance=20});`
ignore trying chance = 1 then
the -- is commented out, implying it adds all the chances up to whatever number and then rolls a random number
So I understood you can have as many entries with whatever chance, they even added the comment with the fitness instructor having a chance of 20000. So un-commenting that would have most zombies spawn as fitnes instructor I guess.
As I understood it, the mod basically just adds rows to this list with standard settings each type of their zeds having a chance of 1. (the mod description says "The probability of spawning cute zombie girls has been increased by 10%." But I don't find anything in their files that actually does this?)
when using :addItem() for an ISScrollingListBox, does the method return the resulting LayoutItem? How do I get it after it's created so I can modify it?
function ISScrollingListBox:addItem(name, item)
local i = {}
i.text=name;
i.item=item;
i.tooltip = nil;
i.itemindex = self.count + 1;
i.height = self.itemheight
table.insert(self.items, i);
self.count = self.count + 1;
self:setScrollHeight(self:getScrollHeight()+i.height);
return i;
end
thanks!
Does anyone know how to localize a mod effect to a locality on the map? I was looking to add the ability to use the dingo's store mod but only to the edges of the map. Anyone know if this is even possible or if another mod accomplishes the same thing of allowing players on a server to trade resources for gear but only at specific places?
there's no problem just checking the player's location and determining if it's within a certain area before letting them do something
4 day late reply, turns out swapping pants or replacing your pants with a belt does not unequip items from the belt slots.
I'm assuming this is because the attachment types are identical.
That's convenient.
How do I add a tooltip to an item? I want there to be a tooltip on the pants that have belts
you can set the tooltip in the item script (or with a doparam or load or whatever) but there can only be one
That's fine, I don't think there are a lot of mods adding tooltips to clothing?
I was more so asking what the param is
Tooltip
it should be the name of a translation string
so Tooltip = Tooltip_HasBelt or something like that
alrighty, thanks
Hello, does anyone know how the Invisible option works? Does it only make you invisible to the zombies or also to the players?
I back and with a crash log that makes no sense (to me at least) please help
Am I not setting up the translation string properly?
Is it because I'm applying the tooltip using lua?
the file should just be called Tooltip_EN.txt
translation files don't override each other and they actually have to use hardcoded file names to be read
oh, that's a strange way to do it
everything about the translation system is strange
Just confused why it's hard coded instead of designed to just search inside the translation directory?
the strings from each file type (so every file of each name from each mod together) are stored in separate hashmaps, and it uses the prefix in the translation name to determine which one to check inside
Can tooltips be colored?
i have no idea if that's a performance optimisation or what
i don't know if this is still true, but in 41 they had separate code for parsing each of them, and they weren't just copy pasted, some had unique bugs
What a strange dev cycle this game has
i suspect they must have been lua tables in the past because otherwise them being placed in the lua folder and taking the shape of them is baffling
bump
i think you can use any of the text formatting you can use elsewhere, i don't remember where the list is
try <RGB:0.5, 0.5, 0.5> my text
Can someone please take a look at this and see why its telling me I have no mod.info when I try to upload it to workshop. Trying to upload in b41 but the mod supports b41 and b42
nvm
fixed
Where can I find the image (not texture) associated with an item that is shown in inventory lists to the left of the item name? And how is it associated to the item? Trying to add an item and can't figure out how to set the inventory pic
Thats set by "icon = name" with path if necessary, in B42 some icons have been moved to internal files tho, like for instance Rubberducky icon can no longer be found in textures. So either grab them from an install of B41 if they existed or scrape them from the wiki.
It's just in pack files
They can be found
Just use the modding tools
I mean its pretty quick to just google them but yeh if you need to access a lot of them thats the better option for sure
Ah Icon field how did i miss that, thanks!
Okay the harder part...is it possible to hook into the gun aiming system with a non-gun item?
if anyone knows, where can profession clothing presets (the options you have in the customization menu) be found? im interested in changing a couple of them for a mod
If you need I made a wiki page about it
Is there a way to have an ongoing status effect while an item is equipped? Like a bonus or penalty other than the specific ones defined? Maybe a way to hook into a tick cycle to check if the player is wearing something?
An event when a weapon is equiped
And whenever the weapon gets equiped, boost stats in x field, and then once unequiped, revert back
yeah that would work
I found how to check if something is currently equipped but haven't seen an onEquip or similar type of hook
Oh I don't know why i didn't expect it there i've been looking at java classes
wait no those aren't quite what i want
this is for clothing
OnClothingUpdated maybe
i think that will work, thanks
Aaaah
Is there a way to store a state? Trying to figure out how to track if the item is already worn or was just equipped
So I Did Something With The Animal UI...
And Its Working Great. Thanks To All The Help Here
what lines of code allow for this?
Depends what the action is. lets say it's a context menu thing. You add a function to the context menu fill event that is basically:
x,y = player's location
if (x,y not at top of mount doom) return
add_to_context_menu("Cast ring into the fires", theOneRingThrowIntoVolcano)```
There's no special code for telling if (x.y) is near the map edge, so you'd end up with something like "(if x < 250) or (x> 19500) or (y>15800)
Can I somehow make a local function that works like item:isKeyRing() instead of isKeyRing( item )?
And tell people not to cheat across the river to the north map edge. Or use more compkicates rules to decide is x,y is where you wnat it to be.
No, that would be a java thing
So technically yes but in every practical way, no.
Hmm I see, thanks!
But it's a really easy test: item:hasTag("KeyRing")
for some reason vanilla code in various places uses (item:getType() == "KeyRing" or item:hasTag( "KeyRing"))
Yeah that's what I just wanted to point out, really confused me that's why I made a function of that xD
If you were going to use it 100 times a function would look a bit neater, but it's not a big deal to just test without a dedicated test function
You can store things to an items modData, so if you can find the "number of game tick elapsed" which I'm sure is a function, I just have no idea hat it is called) you could add that to an item's moddata when it gets equipped.
Then you can check that value, look at the current game ticks, and decide if it was recent or not.
Basic math
I'm trying to only allow the dingo's trade mod to activate in the border region to make a scenario where knox county is infected and the government has sealed it off and will trade with people within the infected zone for goods.
Unfortunately I am not the greatest at this code and don't have another mod to use as a functional example
you don't need to be good at maths here, you need to look at the map: https://b42map.com/
Now, which parts of that are "border regions"?
ah i see
Imagine drawing a bunch of rectangles on that which are the border region, then each rectangle is just (left <= x <=right) and (up <= y <=bottom)
is adding a "if x<10" good enough to activate on the western border?
Sure, if you want them to get within 10 tiles of the map edge...
But have look at https://b42map.com/ and see just where X=10 is.
yes, x=10 is the far west of build 42
that would satisfy the goal and i could do the same for south i suppose
Just check basic geometry lessons on how to know if a point is in a rectangle
If the math is the problem
that tiny green bit is the only access that does not involves a long forest trek
And that's a trek after you travel via road as far west as you can go.
would it not apply to the entire edge if Y is not a factor?
yes, but think about how players are going to get there.
Also, I think it it would make more sense to make a small trade zone at the end of roads leading off the map instead of the entire edge.
this would make sense. what would you suggest would be a better solution?
(x>=0) and (x<=25) and (y >= 9875) and (y<=9910)
for example
Then similar at other road exits
actually that is the only road exit other than the louisville bridge.
yah, i havent gone to 42 unstable yet so it looked like there were 3 or 4 in the last build
(I'm assuming you're doing this for B42, if not the B41 map has different co-ordinates but the same logic applies)
the idea will maybe have to wait for 42 stable and then figure another solution out
those spots would also work as "edge of map" trading spots, where the road just ends.
And they are in locations that are more feasible to drive to from the Eastern sections of teh map, but still a pain to travel to.
so the text shoudl be something like:
module Fence
{
imports
{
(x>=0) and (x<=25) and (y >= 9875) and (y<=9910)
}
recipe Sell Gold Jewelry $10
{
Necklace_Gold/Necklace_GoldRuby/NecklaceLong_Gold/NoseRing_Gold/NoseStud_Gold/Earring_LoopLrg_Gold/Earring_LoopMed_Gold/Earring_LoopSmall_Gold_Both/Earring_LoopSmall_Gold_Top/Earring_Stud_Gold/Ring_Right_MiddleFinger_Gold/Ring_Left_MiddleFinger_Gold/Ring_Right_RingFinger_Gold/Ring_Left_RingFinger_Gold/WristWatch_Right_ClassicGold/WristWatch_Left_ClassicGold/Bracelet_BangleRightGold/Bracelet_BangleLeftGold/Bracelet_ChainRightGold/Bracelet_ChainLeftGold,
Result: Money=10,
Time: 10,
keep WalkieTalkie1/WalkieTalkie2/WalkieTalkie3/WalkieTalkie4/WalkieTalkie5/WalkieTalkieMakeShift,
Category: The Fence,
}
Is that code specifc to the trade mod?
Because almost certainly not.... ๐
unless it accepts that syntax for valid locations
Does the mod support defining a location?
module Fence
{
imports
{
Base
}
recipe Sell Gold Jewelry $100
{
Necklace_Gold/Necklace_GoldRuby/NecklaceLong_Gold/NoseRing_Gold/NoseStud_Gold/Earring_LoopLrg_Gold/Earring_LoopMed_Gold/Earring_LoopSmall_Gold_Both/Earring_LoopSmall_Gold_Top/Earring_Stud_Gold/Ring_Right_MiddleFinger_Gold/Ring_Left_MiddleFinger_Gold/Ring_Right_RingFinger_Gold/Ring_Left_RingFinger_Gold/WristWatch_Right_ClassicGold/WristWatch_Left_ClassicGold/Bracelet_BangleRightGold/Bracelet_BangleLeftGold/Bracelet_ChainRightGold/Bracelet_ChainLeftGold,
Result: Money=100,
Time: 10,
keep WalkieTalkie1/WalkieTalkie2/WalkieTalkie3/WalkieTalkie4/WalkieTalkie5/WalkieTalkieMakeShift,
Category: The Fence,
}
Because if it does, look up how it wants you to define it. If it does not, you're going to need to add code to create that feature.
iassume"base" is a location
ah
But you can often just say "Shotgun" and most places will assume you mean "Base.Shotgun"
That looks like a recipe to me, so will be completely different in B42 because teh recipe syntax changes so much
(for the better, but the changes are a pain)
Nothing in vanilla recipes has a "this only works in this map location" feature so that needs to be coded.
maybe better to revisit this in full 42
If you're building off an existing traidng mod makes sense to wait for that to be updated.
But I assume it's a mod that is more meant for multiplayer servers?
eventually
You can always ask the mod maker if there is any way to restrict trading to a certain area only.
modder is mia i think. last update 2022
Why the heck is the logic for a washing machine in java
That does not need to be optimized
it's the exact sort of thing lua is good for
But no, lets put it in java and hard-code it to only work on instanceof Clothing so no-one tries tries to clean a pile of dirty rags in there.
@dull moss I know you mentioned you haven't started looking into More Traits, when you do also consider looking at Even More traits, it has tons that will synergize well with your mod.
Not really sure how to use these :(
yes
Idk about coloring them but you add a tooltip entry to the item's script and then use the translate lua folder to actually give it the text shown
Unfortunately it doesn't work for items, those are different custom tooltips. But you can use those tags for other tooltips, like for sandbox options. You have to put them in the translated value of the tooltip
Darn
Was just wanting it to be more visible when mousing over pairs of pants if they have a belt or not
Haio lads I made recipes for B42. However despite them working fine for a couple of weeks now none of them work so the game wont open. Did something change in a recent patch or something? I just want to figure out this simple problem
Yes
Can I have an example of what is done wrong now if I put a recipe here? pls
craftRecipe Caution Visor Helmet [Rook]
{
timedAction = Making,
Time = 180,
SkillRequired = Tailoring:6,
NeedToBeLearn = True,
tags = AnySurfaceCraft,
category = Tailoring,
xpAward = Tailoring:1,
AutoLearn = Tailoring:6,
inputs
{
item 1 tags[SewingNeedle] mode:keep,
item 2 [Base.Thread],
item 1 [Base.Hat_Army;Base.Hat_ArmyDesert;Base.Hat_MetalScrapHelmet;Base.Hat_RiotHelmet;Base.Hat_SPHhelmet],
}
outputs
{
item 1 Base.Caution_Helmet_Rook_FaceShield,
}
}
Hmm
That's your only craft
?
Nah I have full uniforms for packs. 2 uploaded that work literally same frame, the rest all worked... then I uploaded another 3 days later and it didnt work despite doing so few days ago
none work now when all did
For the day / night timing switch for Zombie Lore, what times do they actually happen?
probably the same way in forage system
https://steamcommunity.com/sharedfiles/filedetails/?id=3416395382
DESCRIPTION
BeltPants adds belt attachment slots to pants that visually have a belt on them, while making them incompatible to wear with belts.
Meaning choosing a pair of pants on character creation that has a belt will cause you to spawn without the leather belt.
Save on that 0.06 carry weight by not needing to wear a belt!
NoBelt makes it so you spawn without a belt, regardless of what pants you choose.
NoBelt does not make any changes to pants like BeltPants does, just removes starting belt on spawn.```
Is there any way to get exact game version (e.g 41.78.16) from game files except from java method Core.getVersion()?
hope u have a great day,
today i created 700+ mods mod-pack handselected with countless hours of work made it work in harmony maybe it gonna be a long announcement but intresting things is inside so for no botherin if anybody ask i share the steam workshop collection and also the config files for the easier nearly 1 minute to play form text me private or just ask for the announcement i will send it here but it LONG!!
Best Regards Neoi Mods
Steam Workshop: Project Zomboid.
[h2] IMPORTANT FOR MAKE IT WORK FOLLOW THE GUIDE IN OUR DISCORD SERVER!! [/h2]
[b] Discord server link: https://discord.gg/2GFZSeRbtp [/b]
๐ก Whatโs Inside the Modpack? ๐ก
This is not
brb
does :drawText() work? I've been trying to use it with a panel but nothing is appearing.
local entry = ISPanel:new(0,i > 0 and y or 0, list.width, h)
local text = entry:drawText("Me", 0, 0, 0.1, 0.1, 0.1, 0.8, UIFont.Small)```
my panel appears just fine but i've just had zero luck with drawtext()
try to change ui font or more color variants maybe some brighter like 10, 10, 1, 1, 1, 1,
just to make sure it's appair if doesn't then the problem somewhere else
tried that, gonna see if it's returning anything after i call it
it returned nil, so maybe it just doesn't work with a panel?
you need to call drawText every single frame in a ui element's render() or prerender() function
if you don't mind adding a dependency you can add a coloured tooltip label using my library
starlit?
I already released the mod or I probably would.
Don't wanna just add dependency randomly for something minor
Although I won't be able to test solutions right now, I would like to have some possible answers to the message I'm pinging.
Thanks for including my mod in your pack! โค๏ธ
i have to say a very big thanks no matter wich mod you created because every piece of the mods are my favourite one's what i play with! i want to share with others also 
You'll get a much better responses if you give some context instead of posting a console.txt file and expecting us to know what you were doing when the probelms started, what problem behavior you've seen in game, what you've already tried to fix it, etc.
Especially in a channel for mod development - you could be doing anything with your mod and we have no idea.
There are two clear errors in your console.txt, with the second saying "I gave up, probably because of teh previous error"
The first is because you used Base.log instead of Base.Log.
java.lang.Exception: Item not found: Base.log. line: item 4 [Base.log] at InputScript.OnPostWorldDictionaryInit(InputScript.java:685).```
Is that for B41 or B42? I can see B42 only mods, B41 only mods and mods that became part of the vanilla game in B42.
should i be calling the render function in OnRenderTick? i've tried that as well as OnTick. not sure if i should even be calling it at all tbh. i'm sort of lost on this part
you don't need to call a ui element's render functions, as long as it's added to the ui manager it'll be called automatically
it won't work on those events because ui rendering happens at a separate stage so none of the state needed to actually render ui is set at those times
so much modder using tag build 42 also for inform the people it's compatible
but what i use build 42 mod nearly all of them from b41 so generally they work in b41
do you have to add every element to the UI manager individually? or is it sufficient if i add children and add the main window to the manager?
you need config files to give the saves and selectable pre configs inside the game menu when creating a new game to load everything clearly and nicely
there is around 130 mods hidden and 80 broken this is why i share the config files with you
yeah, that's fine, you only need to add 'root' elements to the ui manager
read the description are at my collection it's important
trying to post my code but the server's blocking me for some reason
can i DM you albion?
sure!
You've got a mod I made that I know will only work in B42, because there are no files in the mod for B41.
At least one other mod has "B42 ONLY!" in the description.
god damn m8 thanks for the attention the modpack still working fine without any crash i had 20 hours gameplay inside
but im gonna delete them
can u write the mod names please because i searchin for them long time ago once i had cleared all the only b42's
Yeah, B42 only mods won't cause issues but they won't show up at all in B41.
ohh well thanks m8 i really approciate it
Starving Zombies [B42] is B42 only (mod descriptuion)
Canteen Slot is B42 only (my mod, changes an item that does not exist in B41) and Authentic 1990s Battery Charge Detection (my mod, no code for B41 because the value of that mod is less in being used and more as a performance art piece on the mod workshop so I didn't bother backporting it t B41 )
It would be worth checking for mods tagged as B42 without the B41 tag to find any others.
Are there any resources for setting up loot distribution files? I hope those haven't changed in B42 because I haven't even set one up before
Oh, also if there's anything on the new recipe system for B42, I wanted to make one of my mods b42 compatible but I couldn't really figure it out
they haven't changed at all
that's good to hear, gives me more time to figure them out without worrying about it
Except for breaking WardrobeWoman and WardrobeMan
(fix is to swap to WardrobeGeneric instead)
yeah but it's not surprising the actual loot tables have changed, the game was updated, the loot system hasn't
Now I'm really confused about what the developer's goals are with the new aiming system.
I hope that's a silly communication failure and not the actual intended behavior.
I got 2 questions, but they're a bit complex for me to ask both at the same time. Here is the first
Is there a (hopefully beginner friendly) way to immediately eject items from the players inventory, or at least make it where they don't have to/ automatically pick it up to get it from crafting or foraging?
You want to remove an item from the player and immediately place it on the ground?
Definitely possible.
what..
why
why??
why.
no not you
It would be weird for you to be able to pick up an entire mine shaft wouldn't it
You can see that happening in ISTransferAction:transferItem in ISTransferAction.lua
Why would you put an entire mineshaft in teh player inventory and then drop it?
It's automatically being picked up. I don't want it to be
Just spawn items where they should be.
In the mine, shaft isn't spawning in directly it's being made by the player
I'm not sure what a "mineshaft" is exactly
That was my question too! With a lot more swearing but I left the wwearing out of my reply on the Bug Forum.
mannnnโฆfuck this
Are you adding something that gets found via foraging?
Okay so I made it where it's possible to find these "there's iron in the ground here" in the deep Forest areas of the map with foraging level 10. (That will also be ejected from the player's inventory when obtained), then the player can use that item to make a mineshaft.
Assuming B42, why not do mining with the new right click on resource node -> use pickaxe/etc to mine
I know about that but this is for in mass collection because of my mod will require it
I'm adding a lot of endgame stuff for myself
What is the item that foraging detects? If it's too heavy for the player it will automatically end up on the ground
I've got a not to check that code in my "bypass all container size limits everywhere" mod.
That's a way to eject items from the players inventory? If so, it should already be doing that. As it is 9999 lb
And what happens when you find it and collect it?
- Foraging (not tested)
Lua\client\Foraging\ISBaseIcon.lua:118: if plInventory:hasRoomFor(self.character, self.itemObj) and plInventoryHasSpace then
lua\client\Foraging\ISBaseIcon.lua:146: if (not backpack.inventory:hasRoomFor(self.character, self.itemObj)) or (not plInventoryHasSpace) then
To be honest, I made it so rare where I would have to spend quite some time to find it in a deep forest
I guess that would be solved by cranking up its spawn right for a temporary time then eh
Rate*
I think it will just not let you pick it up.
if plInventory:hasRoomFor(self.character, self.itemObj) and plInventoryHasSpace then will be false
for _, backpack in ipairs(bpList) do local bpItem = backpack and backpack.inventory and backpack.inventory:getContainingItem(); will be false for every backpack equipped
is there a way to immediately spawn it in once spotted or do i have to pick it up?
if thats the case of course
I'd say the assumption is if you find something too heavy you discard it or free up space.
You could modify function ISBaseIcon:doContextMenu(_context) to includ "put on ground"
But... having an InventoryItem that weighs 9999 makes no sense
i want it to not be that moveable
Make it a world object
Like the stone outcroppings etc
You'd have to add some code to the "I found a thing" forage code to do that instead of the normal stuff
will that lock it behind lvl 10 foraging?
You're the one coding it, so it will if you add "and playerskill"foraging")>=10"
This is getting more involved than a simple "add to foraging tables"
What about having the character find a chunk of ironstone that can be smelted?
wait i just realized an easier way
"You want to remove an item from the player and immediately place it on the ground?
Definitely possible." ... how, because if i just make it eject, and not weigh much...
i can pick it up from foraging and have it on the ground
If you pick up a light object from foraging, why would it be on the ground? You just picked it up.
scroll up a bit, I pisted a vanilla function name + screenshot of code
ok
you might even be able to call that existing function directly instead of making your own based on it.
an for why i want it... its not really an "object," but more of a concept
The foraging system is for finding items and spawning them into player inventory when picked up. You're fighting with it to do something that different.
Even the concept of using an item to make a location with iron is odd.
I really think you're better off adding a world item, "exposed iron vein" that can be right click -> mined like other resource nodes but doesn't despawn once used.
Then decide on what logic you want to spawn one.
- I've seen it in build 41 mods, just for things like "has animal tracks" instead, I'm just making it where you can't pick up the item and take it to a safe place
- at the end of the day im a beginner, im trying to teach my self off of existing advice and tutorials, also (off topic) why are all the good video tutorials for food items anyways lmao pain
i dont know the names of the mentioned 41 mods off the top of my head though
If you know a mod that does what you want (or at least part of what you want) look at how that mod did it.
Might not be the best way, but it works.
And that gives you a starting point for your own code.
the problem is im trying to do the part that is not there
the concept of using an item to make a location is thogh
*though
The mod you base this on - what exactly is it spawning via teh foraging system?
And is it just adding an item or is it adding an item and lua code to change the vanilla foraging behavior?
How does that look to the user? there's an "animal tracks" item on the ground?
Or it does the "you found something" from foraging but then you don't actually get the option to pick it up (i.e.: there is never an InventoryItem)
i think it was an item that could be picked up, its why i it. i designed my sprite after what they used so leme pull it up
*un downloaded
What is the mod name and we can look at the code they use
But... "I think it was" means we don't have any clarity on what you're actually trying to do.
hold on leme clear it up
FoodEffects.OnEat_FullHealthFood = function(food, player, percent)
local bodyDamage = player:getBodyDamage()
bodyDamage:RestoreToFullHealth()
if bodyDamage:IsInfected() then
bodyDamage:SetInfected(false)
bodyDamage:setInfectionLevel(0)
end
bodyDamage:setOverallBodyHealth(100)
end
Could this work in MP even if getPlayer() is not used? In SP it works, but I worry about mp.
if the player parameter is the player object to affect, yes.
It's up to whatever is calling that function to put the correct playerobject in there.
im making (what the code will see as) an item, but it will eject from the inventory on pickup. i've already done evrything else i need.
the RP concept is something your PC realizes about the environment
I have the lua file in the Client folder, there should also be no problems, right?
Ever seen one of those bins that has an opening for "rubbish" and one for "recycling" but underneath there is just once garbage bag for everything?
For the most part, that's how client/shared/server folders work.
oooh what a good way to explain jjajaj
Thank you very much and sorry for the inconvenience

You probably want to modify the foraging code then, because I don't think there is any "item put in inventory" event listener you can add a function to and if you're going to patch vanilla code if makes more sense (and will be a lot easier, and better performing) to patch the foraging code to put the item on the ground than to patch the inevtory code to decide every time an item is moved if it should be put on the ground.
no probs.
The exceptions I know are: server code loads later than client and shared code. But in a weird way you probably can't rely on.
the stuff in shared/translate isn't really lua, it just pretends. And unlike everything else you want to use the same filenames for your translation strings.
hmm so there no "OnPickupItem" or what ever it would be called function?
Maybe OnProcessTransaction
but that looks like it might be for world items, not inventory items.
adding an OnCreate is no good because that happens before the item is placed into an inventory.
is there a way to get the player to make a world item?
depends what you mean by "player make"
you can create world items
happens every time you put down a piece of funriture.
But it's not the player object creating it, it's whatever code triggered to create it
But now we're going in circles and discussing spawning world items again.
Anyone know if there's a way to differentiate between a shove and a stomp? They both appear to use the same "Bare Hands" weapon.
"what difference?"
is it possible to tie dropping the item to a action that almost guaranteed after its picked up, like the player moving?
Is there a way to access public member variables on java classes from lua or are only methods available?
ah i see the documentation for that now
OnUpdate
make certain you set a very low cost check that aborts if yoru code is not needed, bcause onUpdate runs more-or-les once with every frame.
if not HotHead.NeedsToDrop then
return
else
<drop item here>
HotHead.NeedsToDrop=false
end
end```
Checking a bool on every update is fine, going through the whole player inventory checking items is going to be a perfomance hit.
And obviously you'd want to set HotHead.NeedsToDrop, but that can be done with an OnCreate function attached to the item.
There is a potential timing issue with OnCreate and when the item goes in your inventory and when OnUpdate is called, safe way is to handle it with some safeguards around the drop code; "if I've tried more than 3 times to do this then give up, log an error, set HotHead.NeedsToDrop=false"
can someone look at my clothing.xml and tell my why literally only the tights spawn? Ive tried to base this on other working mods that add zeds and i have no idea honestly.
You know what, i thought about it, im guessing i need to include all the base game items in my own fileguidtable. ๐ฎโ๐จ
im having the hardest time with a simple beanie mod for some reason. everything looks textbook and good. however the icon in my inventory is tinted sometimes, but its not tinted in the crafting menu. and when i put the hat on its invisible. and then when i drop it on the ground, it makes me invisible until i walk away from it lol. any ideas? im driving myself crazy over this lol
Id check your beanies clothing xml clothing/clothingitems/youritem.xml
for random tint function
<m_AllowRandomTint>false</m_AllowRandomTint>
Assuming your icon is just called "item_name" and its setup doesnt include anything like _mask _tint etc it should be fine
I mean thats if you dont want the item to be tinting.
If you do want it tinting you could download my tinted tights mod and see how ive copied the base game files to get that working right.
idk why it is only tinting in the inventory tho its weird. and i have it false already. in crafting menu the color is fine. just the inventory of my persons is tinted
my main thing is why is it making me invisible when i drop it on the ground
So somehow I fixed it. I looked at another hat mod and they had more directories than mine. Like the textures were deeper in folders which I didnโt thought should matter. Iโve done several mods where textures arenโt but one or two folders deep. Idk if itโs different cuz itโs a hat? And the texture png I changed to 128x128, which is weird cuz all my other mods have been bigger. But those two changes fixed it
I rlly donโt know how it fixed
Honestly clothing i find extremely confusing, i had a shirt with custom decal in my duck mod and decided to just delete it. After many fixes and spending probably more time on the shirt than the entirety of the mod i just said stuff it lol
Like in the end i couldnt make it not tint the decal so i was like stuff it i hate this xD
Itโs honestly been pretty straightforward once I saw the structure. Iโm new but Iโve messed around before and I got some to work pretty easily just by studying structures of other mods. But the hat was the only one that really screwed me over it just took me like 7 hours to get it to show up I was going mad. But I guess you just have to have a specific order of directory names or something which I didnโt have to do for pants or shoes. Idk itโs weird af
Looking for some input or direction on how to display a model dynamically on the character model somewhere.
I want to display the cigarette on the characters mouth when conditions are met, ideally looking for a way to just display it and not make it into a wearable item
Can a clothing item have it's status toggled between two states that display differently? Actually yes that must be possible - things like hoodie hood up/hood down, Spongies' jackest, etc. Which does not get away from having a clothing item... no idea about that.
I wonder if you could use the "impaled by a weapon" feature somehow.
you can mess with item visuals directly without actually equipping a clothing item but it's pretty complex
Out of curiosity, what conditions are you planning for showing/hiding a cigarette?
Since you have the cigarete in your hand when doing the smoking action.
I wrote a smoking mod that extends the smoking mechanics, gives smokes duration/length, you can puff them, they burn at variable rates, etc. Wanted to look into displaying it on the mouth when not actively being puffed as thats my intended mechanic happening.
So less "smoke a cigarette, get back to doing stuff" and more "I nearly always have a cigarette in my mouth, but sometimes it's just resting there and I take a puff occasionally"
Ya the idea is it's passively being smoked outside of a timed action but you can also actively smoke it for immersion
