#mod_development
1 messages · Page 264 of 1
@bronze yoke do you know how to get a characters skill level inside the onCreate handler?
i mean the 3rd argument of the event seems to be the user/player/character right?
function ImprovisedTool.OnCreate.Salvage(items, result, character)
getCharacterTraits ?
use character:getPerkLevel(Perks.PerkName)
you can see a list of internal perk names here https://projectzomboid.com/modding/zombie/characters/skills/PerkFactory.Perks.html
not all match their displayed names
ha! thanks!
i assume Woodwork is carpentry right? which is does carfting pair to?
MetalWelding would be metalworking?
yeah
keep in mind the structure for these is *really* weird so perk categories show up here too
so what is crafting?
for some reason perk categories (such as crafting, passive, etc) are represented as actual perks that can gain xp (though there's no code that actually does that)
does this sort of dictionary construct work in lua?
local woodMaterials = {
['Base.Twigs'] = true,
['Base.TreeBranch'] = true
}
function getIngredientGroups(items)
local metal = false;
local wood = false;
local cloth = false;
for i = 0, items:size() - 1 do
local item = items:get(i);
local type = item:getFullType();
if string.find(type, 'Metal') then metal = true end;
if string.find(type, 'Wood') or woodMaterials[type] then wood = true end;
end
end
yeah!
cool thanks
and is this how you handle function that return multiple values?
local metal, wood, cloth = getIngredientGroups(items)
yeah
kk thanks
What are you doing with this ?
right now i'm using it to check witch ingredient groups were used to create the item
function getIngredientGroups(items)
local metal = false;
local wood = false;
local cloth = false;
for i = 0, items:size() - 1 do
local item = items:get(i);
local type = item:getFullType();
if string.find(type, 'Metal') then metal = true end;
if string.find(type, 'Wood') or woodMaterials[type] then wood = true end;
if clothMaterials[type] then cloth = true end;
end
return metal, wood, cloth;
end
@bright fog ^^
You can remove ;
There's no point using it
Also don't make your function global
Make it local, unless it's a crafting function referenced in a script file
how do i do a function local just preceed it with local or do i assing it to a local var?
as for the ; i'm on team cant stand fault tolerance in interpreters / compilers if ; is part of the language as the end of statement character i will use it
btw are require paths relative to the client / shared / server folder or to the file they are used on?
yup
I find it not necessary and just messy
to each their own i find it lazzy
they are relative to client shared and server
kk thanks
Hey y'all,
so I have a problem I am unsure how to fix with animations which play from a timedaction.
I have an animation where the held item needs to stay still while both hands are moving. In the actual animation, I have the prop2 field set to a static position. It does not move throughout the animation at all. In the animNode xml, I have tried both defining a bone weight 1 for all of Dummy01, and defining all the bones (including prop2) individually.
In single player and on my own screen, everything works perfect. It looks great. But in multiplayer, the prop is attached to the hand and not the prop2 spot and as the hand move the prop moves around as the hand does.
Anyone have any idea how I can approach this? My guess is there is something about it being another player that is causing the prop to not attach properly in the animation.
I find that surprising
Bcs that somehow means the game doesn't follow proper prop bones if seen another player run the animation ?
Whats also realllly weird, is with non-steam server, the animation is correct
with a steam server, the prop flails around in the hand
which makes it really hard for me to debug locally, as I can't run a steam server with two client connected on my machine
wdym by a Steam server
Host ?
Don't use host for MP tests
It doesn't act the same as a dedicated server
is there an easy way to change my new item to show the condition bar like in the shovel here?
Yeah I think so
is it in the item def?
It's what Susceptible does with its filters
I'm not sure
Check out Susceptible and its filters, and how they show durability
you lost me i just searched Susceptible in the vanila code and nothing coming up
It's a mod lmao
oh
any object in particular i should be looking at in this mod?
Filters
def seems pretty neutral
item GasmaskFilter
{
DisplayCategory = Accessory,
Weight = 1.0,
Type = Normal,
DisplayName = Gas Mask Filter,
Icon = GasmaskFilter,
WorldStaticModel = GasmaskFilter,
}
So, I just tested with a nonsteam dedicated server, and the animations also all worked as expected. I did change a bunch of stuff so I am launching to a steam server now to test there. The last time I tested this, it worked everywhere but steam-enabled multiplayer servers
Then ignore it
Bcs they do it with lua code
yep looks like they are overriding ISInventoryPane
how can i use that width value in my code?
local test = item:getTexture();
print('--==--==> ' .. tostring(test));
tried test.w, test.getWidth, test[w] these all return nil
test:getWidth()
So yeah. On non-steam servers, animation looks great. On steam servers, it's broken :-(
By Steam server you mean host ?
Thanks!
No, using dedicated server.
test with the -nosteam flag, animation is perfect
test with the normal steam-enabled server animation is broken
both using dedicated server.
What
So, you can launch PZ, or the PZ dedicated server with all the steam related stuff disabled.
That's fucked
Ik
oh, misunderstood the what
Heading over there
it's not, the interpreter sees ; and whitespace as the same thing
lua has never required or expected you to use it, it's just there to make it easier for c developers
my guidance on it is use it if you think it makes your code easier to read
it does
i used to use it to separate multiple statements on one line
(but then i just stopped doing that entirely anyway so i don't use it anymore)
that yeah I can get it definitely
That would be the main use I find of it
Are the events in LuaEventManager.java referencing lua scripts? If so where doth one find said scripts 
media/lua/
anyone think they can make a mod to add moon knight's costume?
What unit of time is referenced in a recipe script?
48 recipe ticks = 1 real second
scales with day length
Thanks
still need help finding where the logic for the generators are
they're all java
Hey all, I'm trying to "tag" zombies with an ID that I can recognize so that I know the id of the zombie even after it re-renders.
I tried something like:
-- Check for modData ModData
local modData = target:getModData()
-- add a unique ID and assign it
if not modData.zombieUniqueID then
modData.zombieUniqueID = generateUniqueID(target)
print("Assigned new unique ID to zombie: " .. modData.zombieUniqueID)
else
print("Zombie already has a unique ID: " .. modData.zombieUniqueID)
end
And then I use a local array to keep track of these generated IDs, and execute a function each few ticks that affects the tagged zombie.
But I just can't get it to work.
Any help or tips are very much appreciated.
zombie moddata is not cleared when a zombie is recycled
nor is it actually saved into the save file
so you can't use it for storing a unique identifier like this (or really much at all)
you can use a zombie's persistent outfit id (getPersistentOutfitID()) to track a zombie
Thanks I'll try that. Didn't see it in the docs at pz.com/modding/index.html
index page doesn't look up to date, i'd stick to the individual class pages
I think something might be wrong with my approach though. I save a zombie to an array like:
zArray[target:getPersistentOutfitID()] = { zombie = target, tickCounter = 0 }
And to call I define a function that's added to Events.OnTick.Add(onGameTick);
where
local zombie = data.zombie
-- Check if the zombie still exists and hasn't been removed
if zombie and not zombie:isDead() then
zombie:setCanWalk(true)
-- etc call function from Class IsoZombie
Maybe this is not the way lol. New to LUA.
the zombie object will always exist, the game doesn't ever(?) delete them, it recycles them into a pool and reuses them for new zombies
for many reasons like this doing stuff with zombies is always awkward
I see. Thing is the code works so long as I can see the zombie and I'm in precense of it.
It's when I go out of the reality bubble that, when I come back, the code iterating over the array keeps running, but it's not affecting the zombie anymore.
It's how I noticed that if I had, say zArray[12] being executed on, when I left, came back and targetted the zed, it would add a new entry like zArray[15] and just iterate over the new object and the old one.
Even though it was the same zed. This was using getID() which seemingly changes even for the same zombie lol
as soon as that zombie leaves the bubble, it gets recycled into the zombie pool, when you return that zombie object is mostly likely being used for a different zombie or sitting idly in the pool waiting until more zombies are needed
so keeping a reference to a zombie object doesn't really guarantee you'll have a reference to that specific zombie as we understand it
you would have to rewrite how the game manages the zombie population
Gotcha. Figured it would end out being something out of scope
you can check every zombie's persistent outfit id for the one you want - i suppose you could hold onto the zombie object until that changes, assuming it gets reset when recycled
Yeah just tried it an not working anyway, even though getPersistentOutfitID() does indeed return a unique and repeateable ID.
How do I check every zombie in the reality bubble?
Considering I keep track of the ID's in the array, I guess I could technically detect when it's back in range if I loop through all zombies.
Not sure if that would cause performance issues lol
loop through getCell():getZombieList()
also does anyone know of any lua docs like rust's tutorial, maybe something a bit more in depth and user friendly, because the lua manual iis complicated for anyone who hasnt gone through CS,
"The type table implements associative arrays, that is, arrays that can have as indices not only numbers, but any Lua value except nil and NaN. (Not a Number is a special floating-point value used by the IEEE 754 standard to represent undefined numerical results, such as 0/0.) Tables can be heterogeneous; that is, they can contain values of all types (except nil). Any key associated to the value nil is not considered part of the table. Conversely, any key that is not part of a table has an associated value nil." I get that it's a struct and all but it's a bit much
it looks like they do reset their persistent outfit ids, so i guess what you can do is keep a reference to the zombie object, check its outfit id, if it's not the one it used to have then scan the zombie list for that id - but to be honest this seems like you'd still end up having to scan most of the time anyway so it might be simpler + just as cheap to always scan the zombie list for the right id
are you reading the manual or Programming in Lua? i think they're both a little obtuse but the manual isn't really meant to be a tutorial, it's a reference
programming in lua is what you'd usually be guided towards
I also have a different idea but the goal is to get the zombies to attack each other, I don't think I'll get it, I don't know much
I think imma bruteforce my mod sooner or later
How feasible would it be to mod in a way to drag live zombies around?
btw this worked. Thanks a lot
Hello, good day, I am trying to make weapons from other mods (for the moment VFE) not be affected by the RecoilDelay that I have in my mod and it works for the weapons that respawn but not for the weapons that I have already looted, do you have any idea if can that be solved? This is the code.
how can I play a sound in this game which can attract zombies? I made an alarm trap but the sound only can be heard by the player
how loud should it be? you can use house alarm or player shout etc.
I am using this ''playSoundImpl()''
it's the audio file trigger innit?
yep, I use my own audio file
zombies dont care about audio files. They dont have a real hearing, gotta trigger them with events
and I want to trigger the alarm audio once the player step on the tile
Are those events coded in Java file? I can not find them in lua
well there are ways to trigger them with lua
just search for shouts, house alarms, car alarm, honks etc
thanks🫡
Morning peeps!
I am using this for shout, it still does not attracting zombies🥲
SayShout
public void SayShout(String string)
Check where it's used, you'll most likely find a code snipet which creates a sound that attracts zombies
it works, but only showed on the screen, no sound played
Yyyeees
That's what I'm telling you
You found the function which writes the text
Perhaps the sound creation is NOT in that same function, and instead is called at the same time as this function
Look in the java, where your shoot function is called
So which one is the real shouts in this game, I found several functions
And you will possibly find the same thing that creates the sound too
yep, maybe in the Java
Or even in the lua, that could be possible
I think the triggering of the house alarm is in the Java file, not sure about this
why do you care about the house alarm
You want to make the player shout ?
And you want to create the sound which alerts zombies when shouting ?
just make some noise like the noise maker which can attract zombie hord
(also it should literally just be addSound)
addSound will not play an actual sound, but it will attract zombies
GlobalObject I believe
You just use it this way:
addSound(...)
Let me bring up the code from my mod that creates a sound and attracts zombies
local emitter = getWorld():getFreeEmitter()
local square = door:getSquare()
emitter:playSoundImpl("DoorCreek"..tostring(ZombRand(1,16)),square)
local radius = SandboxVars.CheckUpstairs.Radius + 1
addSound(nil, square:getX(), square:getY(), square:getZ(), radius, radius)
Thanks a lot, I'll try this
It works, thanks😁
👌
I found the solution and the script is not necessary jjajah
It's normal
It's due to existing items not taking on script item changes
Overall I wouldn't suggest making a patch for that, the patch is a new save
saying that to the people who have hardcore 1y saves rip
Oh and by the way, with the second part, player won't exist at all at OnGameBoot stage
You would want to put the second loop with the player part in maybe OnGameStart or OnCreatePlayer
actually no, DoParam wont exist for InventoryItem
1 year, like old saves that people refuse to migrate to newer ones because they really want their old stuff
correct
I mean yeah sadly it's part of modding
It's why I wouldn't suggest a patch if it's not 100% needed. Like some mods could modify the type of an item or add a tag to it which would make old items obsolete or break the mod, then yeah sure make a patch when updating your mod so players don't ever get a problem with that
But overall if that will not implode your mod on updating, I don't think it's worth the trouble
I usually just put a sandbox option for these people like "Migrate Existing Save" where if you tick it, it runs code once that does the thing it needs to. But I still have to figure out if it's possible to modify containers that are not loaded by the client due to load distance for one of my mods
You can't
If things are not loaded you simply can't access them
And sadly I don't think it's even possible to
- get containers interacted with by the player
- load specific squares to access anything on the square
So I assume the world loading at the start when you load the save or join a server is just loading the squares around the client player?
Should be yeah
Would be insanely costly to load a save else
Imagine the game loading the entire map lmao
true, but no operations at all to do anything remotely like that is weird
It's already INSANELY heavy to load the map xD
probably cache too
I'll benchmark save loading in a while, just busy fixing stuff on an already existing mod that showed up
Yeah well welcome to PZ. If the devs didn't need it then they didn't implement it, and spoiler: they didn't need it
yep
I know it does some sort of caching but I just don't know what
if you havent seen this
i believe thats the chunk thats loaded
yea that I know that
It's the squares
I don't think it uses chunks does it ? Maybe it does I don't remember
im actually tellibg this to @grizzled fulcrum
cuz i know you know this
ive also tried that container thing tho
is that to demonstrate that it caches the cell that the player loads?
no luck
searched all possible functions i could find
about the container thing, isn't there just an event to get containers accessed by the client?
or do you mean the two combined
I think he meant like accessing already accessed containers by the player
if only its not dependent on the players posiion
since theres also camera object right
like force load it hacky way
oh theres an event for that
ah sorry
nope squares but not container sadly
No, missunderstanding here, I'm talking about accessing EVERY accessed EVER by a player, to check for items and update them with updated script data
Currently loaded or not
closest thing is
but not exactly what you want
Events.ReuseGridsquare.Add(ReuseGridsquare)
maybe theres a bin? na...
since id changes after restart that shouldnt be possible
theres a debug function for containers
idk much abt it
its related to loot
so maybe theres a chance?
I was thinking of OnContainerUpdate, sorry, you are right in that there is no apparent event for it
what you trying to do?
I am not trying to do anything myself, I was just trying to think about this ^
global objects act differently
maybe turning containers into global objects could achieve this maybe?
like oven
Though I am thinking, it's definitely possible to keep the "memory" of previously-loaded now-unloaded squares (in the scope of Java, not lua)
or freezerw
Like I wonder if we could still keep the squares loaded per-se but just not do any real operations on them
that will be cool
and access it only when called
so that it doesnt add to memory unnecessarily
basically just saving partial data as a square gets loaded normally
but idk java so..
kinda like ghost/placeholder squares that keep their memory, so when you need to reference what was last in the square when it was "unloaded"/turned into ghost square, we could just refer to the memory of the square
try the reuse event
of course it's very very very hypothetical and obtuse
yet possible
yea, or even just load the square when getSquare is called, then let lua manually unload it via unloadSquare
or something like that
you might need to look at how its unloaded
isn't there a downside to this event?
when pao and i worked on the mortar mod
we explored this
like tested distance when a client can fire the explode function
it doesnt do it when square isnt loaded
but when another player is there
it works
this is cuz the explode function is sent to server
Maybe if all clients had to load other clients' squares (assuming it's performant enough to do so), this would solve any race-conditions of the square memory theory where the square is loaded by a client and updated but the memory isn't updated
so what determines loaded square is presence of player
so what if we can create dummy player or something
tho im sure thats not possible cuz thats basically recreating another player instance with a new client shared server load thing for it
I think it would be straight up just easier to manually call something like loadGridSquare(IsoGridSquare)
assuming it would be exposed in Lua 😦
I think for my Lua implementation I am just going to expose everything but some very specific things
or just ditch the sandbox entirely, but I feel skeptical about that
I don't know yet, I see other games do Lua imeplemations pretty well so I have to study them some more before I can make good judgements
pls share zed related discoveries
wat
I don't have any cool wacky new zombie code stuff to share, im just doing a java mod to improve the game, thats my goal
I don't want to really boast publicly about what's on my todo list just incase I fuck up and somehow become unable to do it, but I've got about 3-4 months to do some stuff
I haven't even started the majority of it yet because I have to fix two mods I've already published as one randomly broke out of nowhere and another one isn't even fully released yet
Hang in there
yeah
anyone here knows what self.joyselection stands for in vanilla ISInventoryPane:renderdetails ?
did you check where it's used ?
Just casually responds to a 5 year old message with no context or anything 😭
it's used in the vanilla ISInventoryPane:renderdetails as i mentioned -.- just can't figure out what that actually is from reading that code. It's related to rendring the characters inventory panel
Did you check for joyselection within the whole object ?
a simple 'i don't know' is a good answer here @bright fog... the reason why i'm asking is because i'm trying to avoid having to read through thousands of lines of code after i've already spent quite sometime trying to understand what that is.
This is what typically is done in an professional environment between peers
But you don't have to read through thousands of lines that's the thing
This searches for the term within all the lua files of the game, and you can eliminate some of these which are not linked to setting joyselection
are you seriously trying to teach a veteran programmer how to search source code? .... you know what forget i even asked
Was I supposed to know you are "a veteran programmer" ?
Bcs I don't see it written anywhere, so don't act like a jerk because I'm trying to teach someone how to find what they are looking for, and me making the mistake of not knowning that you are a " veteran programmer"

Hey, he's just trying to help you out.
Even from a glance, the sheer amount of "if X happens, then Y..." is approaching Yandere Dev levels. You would have a fair chance to optimize your code if you started with these basics in the future.
I'm actually rewriting that feature because it's near unreadable and almost impossible to mod without overloading the entire thing
for the people that have a deeper understanding of zomboid modding i was wondering how zombie data is stored as i was wondering if it would be theortically possible to have a script that could detect what a zombie wearing when it kills a player
I am pretty sure zombies store what they are wearing as bits (IsoZombie.persistentOutfitId or something like that), wouldn't know how to properly manipulate that
time for yet another possibly dumb question but does each zombie have its own ID of sorts like can you see which specific zombie in this case killed a player?
Yeah you can
No need to use the pID
Simply do zombie:getVisuals()
it was literally one search and I found the answer, jvla is right!
you can't possibly use the notion that you are a veteran programmer (which was unknown at the time) to disprove why you can't search code properly and then proceed to not be able to search code properly.
look at where self.joyselection is being assigned. if you still can't find it, no offense but you're not a veteran programmer (whatever that means)
On the killer zombie, and it gives out the zombie clothing
Heya, so I am curious. How do you create a mod to change the zomboid music main menu and such?
Thank you!
welp time to properly learn lua and work on that script
Gl 
The hardest part might be getting the zombie that killed the player tbf
Simply bcs this does not give the killer
and the main issue is i need to know which zombie killed the player so i can cross refrence the zombie is wearing when the player dies
i'll try that for now while i learn how to actually code
quick question what program do you reccomend for a beginner when attempting to write and learn code in lua?
i've had a few people reccomend notepad++
VSCode
The reason is that we have an addon that allows auto completion of code
And easily detecting quirks in your code
It's called Umbrella
- ctrl + shift + P when in VSCode
- Open addon manager
- Search for "Umbrella"
- Install and activated
Did anyone here create this mod? -> https://youtu.be/WyOFQfXvVBM
I wanted to ask if they could help me out to change the main menu with this theme but keep the rest, like an alternate version -> https://youtu.be/aPgy33lqyRU?si=Ej4JdIH1M_JGusQj
This mod uses edited clips of music from RE4R and JJBA.
When this mod is enabled it will change the menu background, loading screen, and death song when you die in game.
Workshop ID: 2974221035
Mod ID: enhancedmenu
Join The DBD Music Discord! https://discord.gg/TuRFYsbSet
@runic siren so
hi.
hi. so its very simple
you go to your mods workshop page
and scroll down a little
i got it in spanish but
its those 2 options under eliminate
itll open a list thing search thing idk
you can take it from there its pretty intuitive
badass, tysm
assuming you have sumneko's lua extension installed! just clarifying
Hey everyone. I'm having an issue with deleting vehicles through code in a server. In singleplayer it works fine, but multiplayer is where I'm getting the issues.
First I'm using some code to grab specific vehicle IDs from the cell, then I'm running
vehicle:removeFromWorld()
vehicle:permanentlyRemove()
This removes the vehicles, but it spawns them back in. Considering this is run serverside (lua/server), what could cause it to not sync the deletion?
what actually triggers the code? putting it in the server folder doesn't mean it runs serverside
object respawning after deletion usually means it happened clientside
I have a code on client side that checks whether a button is pressed, quick lazy method, that then runs a servercommand whose function is in the server folder.
definitely a server command and not a client command?
sendServerCommand
they're named after the sender, if the client calls sendServerCommand nothing happens
this is what i use
function despawnCar(car)
local pl = getPlayer()
if car ~= nil then
if isClient() then sendClientCommand(pl, "vehicle", "remove", { vehicle = car:getId() }) end
car:permanentlyRemove()
end
end
Is it theoretically possible to make a zombie friendly towards the player and have it follow you around?
I know there's a flag that's like zombie:setUseless(true) or something of the sort, but I'm not sure if that works.
Whatup, I have pretty much completed my EHE submod and I wanted to ask some questions regarding testing
Most of my tests have been SP in debug mode. I wanted to ask, is hosting a game via the Host option functionally the same as a dedicated server?
Or should I be testing all three: SP, Hosting, and dedicated?
Afaik hosting from main menu is identical to dedicated EXCEPT that you gotta find a friend who can test stuff for you
Cuz if you host and you play alone i think it's not exactly the same
might be wrong
I ask because it's just a ton of effort to configure the dedicated server and would also fuck our save i think
I can just grab the save and put it back later, just time consuming
yeah, cool, will be easy then. i just run two non-steam instances of zomboid to test hosting
it's pretty much the same
you don't technically even need a second client unless you're specifically testing if things synchronise between players
oh cool
i'm fairly confident my scripts work, i copied vanilla code for syncing the IsoTraps
i think thats the only thing i had to worry about
Albion to the rescue as always 
the mod is 80% just new EHE presets, 20% additional functions
so it should just work
new submod for EHE
BUT, some features are inherently destructive so I'm trying to be absolutely certain lmao
Will it work with military drop?
afaik it works with everything?
You can peep it while it's in testing phase, if you want
I havent looked at military drop code but it says it overwrites some stuff from EHE
so idk
my tests have been focused on making sure the functions work, but I've tested with 400+ mods loaded included the military drop and no errors so far
yes, same as mine. just has to be loaded after
pog
i should probably note that
big W
feel free to look at it or test it, i'm coordinating a testing run with some friends so we can try to make sure everything works
it's super time consuming and fast-forwarding time is bad for the heatmap
so i havent been able to fully sign off
I won't but ty for invite. Havent played PZ in a while and probably going into your usual 4-month break from PZ cycle xdd
Im just chilling here every now and then

all g word
honestly i could probably just make it public but people can get instakilled by this shit so i need to test more
also wrestling with the EHE scheduler but i can't change any of that
btw when going public, better republishing mod instead of making it public
better for algorithm
neat
i might try and write something up about it soon because it's starting to irritate me how confidently wrong 99% of the community is about it
Is there much to say outside of top is first, bottom is last? or does pz behave differently for things like that?
it's more what it affects
e.g. it not affecting the order in which lua files load whatsoever
a lot of advice i see surrounding load order doesn't actually make sense, and overall it rarely matters and changing it will rarely solve conflicts whereas the general conception seems to be that it's extremely important?
for example advice to always put library mods near the start of your load order doesn't mean anything because as pure lua mods they aren't affected by load order whatsoever
(except for file overrides)
never have given load order a thought with 400+ mods loaded. only thing where order mattered was maps
yeah, it does matter for maps but it's quite intuitive there anyway
i also don't know what the load order interactions might be for tile mods
the only thing mod load order does outside of maps (and potentially tiles?) is resolve file conflicts, if multiple mods contain the same filepath the file from the mod latest in the load order is used
for lua files this can be significant (though in 99% of cases this means the mod is badly made to begin with) but for anything else it'll almost never cause a game breaking issue
i'm not sure of the order in which scripts load actually
Heya folks, I have question
How would one go about changing the protective regions of equipment?
I'm working on something for a server I'm in, and it requires tweaking some armor values, which is easy enough, but there's some overlap and I need to add shin coverage to an item that only covers the thighs and groin
its the "bloodlocation" parameter in the item script
apparently these are all the ones you can put for it
LongJacket,
Trousers,
ShortsShort,
Shirt,
ShirtLongSleeves,
ShirtNoSleeves,
Jumper,
JumperNoSleeves,
Shoes,
FullHelmet,
Apron,
Bag,
Hands,
Head,
Neck,
UpperBody,
LowerBody,
LowerLegs,
UpperLegs,
LowerArms,
UpperArms,
Groin;```
i just figured that out
but thank you regardless
im pretty sure you can also add multiple if you separate them with ; like "LowerArms;LowerLegs,"
(i was just cheering to myself when it worked)
it's the same as lua, alphabetical order, vanilla files first, latest in load order used when files conflict
something curious i didn't know is that file names that begin with template_ always load before other files
yes
Thanks. Is it a flag of sorts?
but burryaga mentioned that setuseless has a bug that makes other zed become useless too
that could be it
i wish they have onZombieSpawn event
Would align with what I've seen in testing and explain a lot.
yea
Is there a way to make a modded evolved recipe allow vanilla ingredients? I've been reading the code and the only way I found to do it was to add my modded recipe in the vanilla item parameters
you can use DoParam in a lua script to add your item to its evolved recipe list
local item = ScriptManager.instance:getItem("ModuleName.ItemName")
if item then
item:DoParam("EvolvedRecipe = MyEvolvedRecipe:5")
end
Is there a way to append using doparam? As far as I understand, I have to add my recipe in the evolvedrecipe parameter, but to do that with doparam I have to overwrite the entire list
this is a special case where it won't overwrite
I can't believe this worked. Thank you so much! 
Are there any good tutorials for making timed actions?
Or alternatively, what's a good example in the vanilla files to reverse engineer?
does anyone know if there are any mods for filibuster rhymes' used cars that basically lets you select which vehicles spawn and which don't from it (as in i want to disable some vehicles from the pack)
(i know its not really a mod development related question but i figured this is probably the best place to ask)
Hi,good day, i have a question, is it necessary to make a .lua file or something like that to be able to test my mod in multiplayer?
no
And if I want to test it on a server or host, I don't need to do anything?
sorry for so many questions jajj
How do you check the item in a player's hand?
Had tried
if playerObj:getPrimaryHandItem() == "Necronomicon" then
But that doesn't seem to do it
Gotta make sure it's in the server's mod list. Gonna wanna upload to the workshop so your friends can get it
Ah, got it.
if playerObj:isPrimaryEquipped("Base.Necronomicon") then
Did it
I uploaded it to the workshop but when I subscribed and wanted to test it in multiplayer, with me being the host, it told me "The server stopped during the launch (NormalTermination)", am I doing something wrong?
Do you have enough RAM assigned?
What would be the best way to access dead bodies on the floor in a timed action?
Wanna use a random body's mod data at the end of the action
Ahh. getplayer():getsquare() and square:getDeadBodys() might be the solution
Does anyone know if it's possible to make zombies rot via script? Like, advance to the stage where it's a skeleton on the ground, as well as checking for whether or not said zombie is a skeleton?
damn, so I finally got around to testing my ehe submod while hosting. the bombs, smokes, and firebombs are showing up, but no explosion sounds or lights are emitted for players or for the host. just the explosion itself and the fire
Hello! Community translations are ending this build but the developers said that we can keep doing them but as a mod. How can I create a mod exclusively for translations? I have never made a mod.
I assigned 16gb of ram and it is only my mod that I am placing jaja
just for test
in mp jeje
Check in the files of the game and go in media/lua/shared/Translate
You should be able to figure out the rest
Ok, then it's no different of what I have been doing. Then, how could I upload it to Steam, for example?
I need a little help with my thumbnail
See, I tried making it this screenshot
but whenever I uploaded the mod, it got set to a default indie stone one
oh! i got it now
i dont got it
i even made sure it was 256x256
it's in the spot it should be
restarting the game worked
If you don't share your file paths, names etc and your settings we can't help you
Make sure it's in your Workshop mod folder, as preview
Anyone around with experience and a deep understanding on the vanilla ISInventoryPane ? trying to wrap my mind around why renderdetails is executed twice per tick once by the prerender with the doDrag set to false and another by the render with doDrag set to true ::scratch head confused::
nvm i think i finaly managed to test it and it seems the prerender (doDrag set to false) renders the normal inventory while the render (doDrag set to true) only renders the items being dragged?
is there a function to remove an items container property?
like disable it?
something like setInventoryContainer()
maybe onZombieDeath setUseless false would prevent this maybe?
No
Bcs zombies are recycled when they are unloaded
From death or unloading an area with the zombie

Now you see the source of all my madness
No persistent and unique data is ever possible
You just can't leave them setUseless I guess lmao
Let's hope they make a better system for zombie identification in b42
such a waste...
yup
hopefully
Literally my entire Zomboid Forge framework is flawed and everything I worked on was to count act this single problem of zombie identification. And I still have so many problems with that today
It's impossible to make a zombie truly unique rn
And to reliably identify unique zombies
OnZombieSpawn event please
OnZombieSpawn wouldn't even be perfect but that would help a fuck ton
Zombies need unique IDs that's it
yeah...
i wish we can run everything serversided and just send commands to player
instead of having to pick a single client to send the data
Give zombies unique IDs and all your problems are fixed
and maybe allow us to create custom states
or atleast sync the setVars
Give every zombies a unique 16 bit ID and we are fucking saved
that would make everything easier and better synced
syncing the setVariable isn't a problem
You can already do that
The problem is that the zombies, even with a 16 bits ID would have a problem
16 bits is not enough
That's 65536 zombies
oh btw i had this idea
setWalkSpeed can be
1 to 5
or sprint1 to sprint5
or crawl1 to crawl3 right?
this syncs right?
The problem is that how tf do you even store so many IDs, bcs 65k zombies is nothing
eh
not sure
when you set it
i believe its synced? not 100% sure
so my idea is to create custom walktypes
What for
to make em unique in terms of custom animations
so i would need to setVar and sync
and have various bool for behavior and animation
maybe doing the walktype would already make them unique
like my current check is based on outfit
but i still need sub bools
for other checks like if its doing custom behavior
so the setvar is reset when recycled? that might not be a problem
i just want to know if a client set custom walktype
will it be synced and persistent after restart
it won't
A restart = a reload
Unloading an area
Zombie gets recycled

I can't, I tried to remove my mod from the workshop and upload it again, I tried to allocate all the ram to the server, I tried to allocate ram to the server little by little, I tried to open the server with only my mod and I think that's the problem, it's my mod, I can't test my mod in multiplayer, does anyone know why?
I'm making a mod that modifies farming_vegetableconf timeToGrow for each plant, and it works great on a SP game but for some reason doesn't work in MP? I'm thinking that it could be file structure (I have the .lua script under /lua/server/Farming)
hello, is there any file-format description for MAP_###_###.bin (from within the save folder) ?
i found some C# utility on github (https://github.com/blind-coder/pz-mapmap), but after brief look into the code it seems my saves look a bit different (checked reading of first bytes)
(is this channel the best for this question?)
the format changes a lot, the last release on this repository was about two years before the game's last update so i wouldn't be surprised if it's a bit off
hello hello. Can anyone please provide me with the clarification for getPlayer() function with splitscreen? I know it has been asked here before, but I'm still quite confused how it works.
in splitscreen getPlayer() returns the most recently added player
getSpecificPlayer(index) can be used instead, where index is a number from 0 to 3, which will get the player in that number slot
if you want your mod to work in splitscreen, you should avoid usages of both functions as much as possible and pass around player objects between functions (this is also just better for performance and is better code style anyway)
I see. Thank you so much 
how about something more specific like overriding and adding another slice in the existing radial menu? Is that something do-able for the added spliscreen players?
pretty much anything should be possible
okay. Thank you for your help!
32x32, better if you set it to indexed pallette
ty cap'n
Oh shit really? I always misunderstood this
Thought it grabbed player 1 haha
i think it might technically be 'the highest active player slot' and not necessarily the most recently added? but yeah it's almost never player 1 in splitscreen
iirc it's an artifact of how they use that internally, when they're doing player updates they just change which one IsoPlayer.instance points to (i guess to make a transition from pre-splitscreen code easier) so when lua gets around to running it'll still be pointing to the last one
Me too lol
i mean its just a little dump question but how can i get in the translation the german ä ü and ö to work ?
check the translation wiki page
Encoding
how do you even do split screen
iirc we have a translation channel
im not sure if its visible by default tho
thanks (Y)
indexed pallete?
plug in a controller (or second controller if player 1 is on controller) and press something
i see
Someday, the Cessna 172 will be made
256 fixed colors
So I have a couple mods that contain clothing items, few zombies. I was looking at making mod options where you can adjust their spawn rates rates in the world for users that use my mods.
I have no idea how to go about doing that though, anyone able to help me or got any examples I can follow?
please @ me if you respond to this ^^
can someone point me to the method that returns pixels on the frame buffer? not familiar with opengl at all. Need to manipulate or store individual pixels on the canvas
Try looking into the files of mods that do the same thing. I think undead survivor has that for zombie spawns
It does? Thankyou very much! I will look into it now
Hello, I would like to ask if I create an API that connects to the web and sends it to my server, is it possible to do something like add items to players? Through the website, if someone has done it before, can I have a guide?
anyone knows if theres a vanilla way to fetch whatever movingObject the player is aiming at?
cuz i had to do this
i wish theres a better way
function PsychoZedMod.isTarg(pl, targ)
local fov = 45
local plX, plY = pl:getX(), pl:getY()
local targX, targY = targ:getX(), targ:getY()
local targDirX = targX - plX
local targDirY = targY - plY
--print(pl:getDotWithForwardDirection(targ:getX(), targ:getY()))
--local fVec = pl:getForwardDirection()
local aimAngle = pl:getLookAngleRadians()
--local angle = pl:getDirectionAngle()
local angle = math.atan2(targDirY, targDirX)
local angleDiff = math.abs(aimAngle - angle)
if angleDiff > math.pi then
angleDiff = 2 * math.pi - angleDiff
end
local fovInRadians = math.rad(fov) / 2
--print(angleDiff)
--print(fovInRadians)
--print(angle)
return angleDiff <= fovInRadians
end
I searched the channel and saw your input on the matter. I saw the answer to just use getSpecificPlayer(int) but never had any explanation on why getPlayer() behaves the way it does. It makes a lot of sense now
Press A (or South button) always pops out a context menu to add a new (or existing) player for me
Hello, do you guys know if it's possible to turn off/on a room light without toggling the light switch? I've been trying for hours but can't find anything that works..
You could do that, but I don't think there's a concrete way to interface with the internet, like I believe you can't really do GET/POST requests?
IsoBuilding.lights
You might be able to loop through building's lights and set call light:setActive(false)
actually that's for all the lights in the building, one sec
IsoRoom.roomLights
so something like player:getSquare():getRoom() and then somehow get roomLights field or maybe you can do
local player = getPlayer()
local sq = player:getSquare()
local room = sq:getRoom()
local switches = room:getLightSwitches()
for i = 1, switches:size() do
local switch = switches:get(i - 1) --[[@as IsoLightSwitch]]
-- Do stuff with switch here, or even the source below
local lights = switch:getLights()
for j = 1, lights:size() do
local light - lights:get(j - 1) --[[@as IsoLightSource]]
-- Do stuff with source here
end
end
If you're talking about from a game perspective and not modding, nope
Can someone help me on how to install a mod on Zomboid? I created a map spawnpoint for project zomboid but I am stuck on how to implement it on the game.
@grizzled fulcrum I tried that. light:setActive(true/false) does not seem to do anything
If I start "ISReadABook.start", am I able to cancel the reading action if a check i run after doesn't pass? I've tried ISBaseTimedAction.stop(self), self.character:setReading(false), ISReadABook:stop() but i cant seem to stop the action 
you should just be able to call self:stop() or ISReadABook:stop()
idk why that wouldn't be working for you
usually you dont start it yourself, you add it to the TimedActionQueue which starts it
but stopping should literally just be one call I think
maybe my character really likes reading
If it is your action, instead of calling stop after (which depending on what you do might only get executed after the action is completed/stopped naturally)
are you trying to cancel it *within* the start function? that probably wouldn't work
you can put it in update function of the action
i'm guessing this is the issue, ill try write a function outside to cancel it
thanks for the insight guys
they support an isValidStart() function for this usecase, if it doesn't return true the action won't actually start
you can use isValid() the same way to check every tick instead of only at the start of the action if needed
function ISReadABook:start(...)
-- Nutritionist Trait
if self.item:getFullType() == "Base.NutritionistMag" then
print("Nutrition Magazine found.")
if not CheckIfCanRead() then
self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 0.55, 0.55, 0.55, UIFont.Dialogue, 0, "default")
return originalReadStart(self, ...)
end
local traits = self.character:getTraits()
-- Add the Nutritionist trait if the character doesn't have it
if not traits:contains("Nutritionist") then
traits:add("Nutritionist")
-- Remove the trait if sandbox option to remove is enabled
elseif SandboxVars.GydeTraitMags.ReadRemove == true then
traits:remove("Nutritionist")
end
end
return originalReadStart(self, ...)
end
This is how the script currently is
i'm thinking i call self:stop() or ISReadABook:stop() like aoqia said in another function outside to cancel it maybe?
try ```lua
IsoLightSwitch.setActive(state, use_switch, force)
-- like this
light:setActive(true, true, true)
`state` is just on or off
`use_switch` is like, if true it plays the sound, switches the light like if you were to press the switch yourself
`force` just forces the light to `state`, even when it cannot switch the light normally using the switch
try something like:```lua
local old_isValidStart = ISReadABook.isValidStart
ISReadABook:isValidStart()
if self.item:getFullType() == "Base.NutritionistMag" then
-- same logic as you already have but return false if the player can't read it
end
return old_isValidStart and old_isValidStart() or true
end
by the way, this may be nitpicking but it might make more sense to add traits in perform() than in start()
no worries, i highly appreciate the feedback
i got into pz modding 2 days ago
been digging around a lot to try and learn this
are you behind the trait magazine mod that came out yesterday? i was really impressed by the art
Chat, I clearly messed up somewhere along the way. Anyone know how this happens? I've done the XML's correctly afaik and the Items aren't using the proper icon either.
a very common cause of icon woes is not knowing that it prefixes whatever name you give it with Item_
e.g. Icon = MyIcon looks for Item_MyIcon.png
oooh
So, I was left a comment about adding color variety to the weapons and wanted it to be random as a result from looting or crafting similar to some crafted clothing. How can I do this or is there a good reference to look at? Mod for reference: https://steamcommunity.com/sharedfiles/filedetails/?id=3196209274
Very awesome, thank you!
now time to figure out why the models aren't working :ryan:
from my understanding you just need multiple textures? don't listen to me tho i've just recently picked up PZ modding
If anyone can help, it would be really appreciated 
It is not possible for weapons/static items. The only things that accept multiple textures are vehicles and clothes. Your best bet might be making few variations of same item but adding diffrent model scripts with diffrent textures.
Looks great, thanks! I'll try asap
Ahh tyty for letting me know!
rahhhh i've been trying for an hour but i just can't seem to get this to work
function ISReadABook:isValidStart()
-- Burglar Trait
if self.item:getFullType() == "Base.BurglarMag" then
print("Burglar Magazine found.")
if not CheckIfCanRead() then
print("GydeTraitMagazines: Not valid start.")
self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 1, 1, 0.55, UIFont.Dialogue, 0, "default")
return false
else
local traits = self.character:getTraits()
if not traits:contains("Burglar") then
traits:add("Burglar")
-- Check if sandbox option to remove is enabled.
elseif SandboxVars.GydeTraitMags.ReadRemove == true then
traits:remove("Burglar")
end
end
end
return old_isValidStart(self)
end
I've tried return old_isValidStart(self) and return old_isValidStart and old_isValidStart() or true but in-game the reading starts regardless

am i missing something
it's also not running my debug prints
Did you verify CheckIfCanRead() gives what it's supposed to?
the reason for return old_isValidStart and old_isValidStart() or true was because ISReadABook doesn't usually actually have one - but now that i look it actually inherits one from the base object so return old_isValidStart() is fine
oh and self should be in there, looks like you caught that though
i usually ignore inheritance with timed actions because the game usually does too but this is a case where it actually works
function CheckIfCanRead()
local hasReadRestriction = false
if SandboxVars.GydeTraitMags.DaysBeforeRead ~= 0 then
hasReadRestriction = true
end
-- Get player survival time
local player = getPlayer();
local hoursSurvived = player:getHoursSurvived()
local daysSurvived = hoursSurvived / 24
-- Checks if player can read magazine
if hasReadRestriction and daysSurvived < SandboxVars.GydeTraitMags.DaysBeforeRead then
print("Gyde Trait Magazines: Read restriction check failed. Days: " .. daysSurvived)
print("Gyde Trait Magazines: Days Required: " .. SandboxVars.GydeTraitMags.DaysBeforeRead)
return false;
else
print("Gyde Trait Magazines: Read restriction check passed. Days: " .. daysSurvived)
print("Gyde Trait Magazines: Days Required: " .. SandboxVars.GydeTraitMags.DaysBeforeRead)
return true;
end
end
This is the check function, it should return correctly and it was working before i tried implementing the ValidStart function
validstart seems to be the ideal way for me to check if the read should start but for some reason it just wont work for me
if you add a print outside of your if statement does it print?
yea
Try printing some values and parts of your code, to see which parts run and which don't
will do
(just please make sure to remove your prints at the end of development)
okay so nothing gets printed at all when using ISReadABook:isValidStart(), but it's fine when i use ISReadABook.start(...)
I dont see isValidStart in ISReadABook.lua and I only have require "TimedActions/ISReadABook" in my script, do I need to call any other requirements?
no, requiring vanilla files actually does nothing at all
it's sort of a mass hallucination by the community 😭

ISReadABook doesn't usually have an isValidStart but you can see it defined in ISBaseTimedAction which it inherits from
ah i see
if that's the case i have no idea why it's not making anything work
the most confusing thing is why my print statements arent running at all
yeah, it's like you're not modifying the function at all
or the function never runs in the first place though i can't see why that would be the case
Hey Chat, so to confirm. A model needs like ... a proper texture, right? Like this and not a material - image texture
so i tried running ISReadABook:isValid() and it works almost perfectly, the only issue being that it runs my character:Say twice, I assume it's because you mentioned how it runs every tick
yeah, if i remember even the vanilla ones have that bug
isValidStart was a very recent addition (if you don't count the two years the game has gone without an update) so it's not used everywhere it should be
i'll get ingame and try and see if i can get it to work
i super appreciate the effort
its like 7am here and ive been trying to get this to work all night

take care of your health!! modding is secondary
ah... i gave it a try and i see the issue
for whatever reason it's only called if the action was queued after another one, if you just start the action on its own it doesn't get called
i looked for where it gets called and it kinda looked like that might be the case so i just put function ISReadABook:isValidStart() print("isValidStart called"); return true end in the lua console and it only printed on a queued action
dangg
i guess ill just have to deal with the double character:Say for now then
or i try the other method of cancelling the read
OKAY, i managed to get my message to show only once with this ultra scuffed check
if not CheckIfCanRead() then
if not self.hasDisplayedMessage then
self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 0.55, 0.55, 0.55, UIFont.Dialogue, 0, "default")
self.hasDisplayedMessage = true
end
return false
else
If there is anything i should look out for with this method or if this implementation is bad please let me know
happy with the progress for now so im heading to bed.
@bronze yoke thanks again for the help tonight really really appreciate it 
looks good!! i'm not sure if you saw but i dmed you about a bug i noticed with your mod
ohhh my bad i didn't see the notif
@grizzled fulcrum using
light:setActive(true/false, false, true)
works but still plays the sound.
When I set the second parameter to true like
light:setActive(true/false, true, true)
it does not switch the light on/off.
From the documentation, the 3 params are:
active, setActiveBoolOnly and ignoreSwitchCheck. Where did you get the use_switch from?
I just looked at the function's Java code and basically named them myself (I couldn't really think of good names)
Those param args sound correct
It might not be possible to switch the light without playing the sound (for the light switch specifically)_
you could just maybe call light:switchLight(true/false)
but then you have to manually call syncIsoObject (can you get a UdpConnection??)
maybe like
light:switchLight(true)
light:syncIsoObject(false, 1, nil)
but I think the syncIsoObject wont work because the second param needs a byte
If you can get ahold of the IsoLightSource like I was talking about before, you can just set that to false like light:setActive(true)
I got it to work. I decompiled the javaCode and saw the switchLight function being used within setActive. I used this one and it worked
nice
at worst, you can just use commands to get all the clients to do it
hello, i want to make a mod but am pretty clueless on it, ive read some tutorials but am still pretty confused. can anyone help?
unfortunately i also play on mac, so im not too sure how much of it i can do on my computer
Can I post a finished mod here?
of course
Thanks
Just tell us what you're trying to do and we can guide you a bit
Or give some intel on your idea
i enjoy the nomad playstyle so i wanna build a overland thing
earthroamer sx would be cool but anything like that
the mobile motorhome mod, but like smaller and realistic textures
Well after a lot of suffering I finally achieved it, my first mod.
https://steamcommunity.com/sharedfiles/filedetails/?id=3342646728

Hey guys, how to spawn a specific item in the world in random places but not in the city? like not on road tiles but only on dirt and grass?
Hey, can anyone tell me how to change the number of uses of the item? For example, salt, pepper. And also the durability of the weapon.
There are two main ways, you either overwrite the original item in the item script by defining the exact same item in whatever module it is in, and then changing the params there, or you can patch it by calling DoParam on the Item at say OnGameBoot
hey guys, got a question. I made a weapon for PZ but it needs 2 models. One Model for when it is equipped and one for when it is on the belt. It just looks off when its on the belt. How can I do that
Howdy, folks. Does anybody know how the GetItemTypes function works in recipe? What file are they stored in, I've been trying to get one recipe for scrapping and figured it'd be the best course of action
Any file, it's pretty similar to all the other callbakcs
It's the same like the others, under Recipe.GetItemTypes global table
So like
function Recipe.GetItemTypes.BlahBlah(script_items)
script_items:addAll(script_manager:getItemsTag("TestItemTag")
end
So it basically gets all the items with the tag "TestItemTag" and that is what it will use for the item types
Oh okay, so essentially it uses the tag system. I had it partially right haha
Well I chose to, you don't have to
it can be basically anything to select an item, but I use tags because it's pretty easy for inventory code
I have the tags already added to the plushies, so it'd be fairly simple to do. I presume the base game does it in a similar way, given pencils and pens have the tag 'write'?
Like for example if I had 10 types of wood, I'd give them a Wood tag so I can get all items from an inventory with the Wood tag pretty easily
yep
function Recipe.GetItemTypes.Write(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Write"))
addExistingItemType(scriptItems, "BluePen")
addExistingItemType(scriptItems, "Crayons")
addExistingItemType(scriptItems, "Pen")
addExistingItemType(scriptItems, "Pencil")
addExistingItemType(scriptItems, "RedPen")
end
Awesome! Thank you a ton!
enable comments?
Is there any program that would organize different parameters and names more conveniently?
One other question I suppose I shall propose is how to allow a drainable item that is the result of a recipe not full, for instance when ripping a shirt and you may get 1-2 units of thread back. Should I just cross-reference that lua bit from PZ's recipecode file?
wat
You can make lua tables with params in them and just loop through those doing DoParam on each value
idk what you mean tho
Possibly an OnCreate callback for the recipe
like ```lua
function Recipe.OnCreate.ClaimVehicle(
sources,
result,
character,
item,
isPrimaryHandItem,
isSecondaryHandItem)
-- do stuff here with the item
end
So you could set the amount of uses, or something else similarly
Of course, everything is for improvement.
Hmm, I'll check into that. Any suggestions on where to look for it in a similar usage? I'm still trying to learn lua haha
Well, actually, this is exactly what I need. So thanks.
Hey hey fellow modders, either of you knows if we can get this damage value through an item's methods? something along the lines of item:getDamage()?
been trying to locate where this is currently being rendered but without much luck
got as deep as ISToolTipInv but i cant see anything there that would produce this value 😕
this?
yep that looks like what i need thanks @tranquil kindle
this seems to be taken from some sort of public api documentation though, mind telling me where i can this?
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory.types, class: HandWeapon
thanks
is it safe to assume that getProjectileCount() and getClipSize() are the current and max values for a gun loaded ammunition values?
nvm getProjectileCount() seems to be how many bullets are fired each shoot?
Yea, but its limited my MaxHitCount, Like shotguns have 5 Projectiles, but can hit max of 4 targets
looking to emulate that current/max shown on equipped guns on the side bar
for shotguns the getClipSize actualy comes out at 0 even though it shows 6 on the side bar
:/
You have Clip size and Max ammo, and i belive Clip size is only for guns that use magazines, where max ammo is for guns that do not.
oh wait of course i was only looking at the methods for the HandWeapon, ther's also the inherited methods 😊
thanks @tranquil kindle
instance:getCurrentAmmoCount() and instance:getMaxAmmo() seems to achive exactly what i want for all guns 🙂
anyone got an Idea about my problem there? Can't figure it out after hours of searching
You cannot have 2 separate models for it, unless you make lua function to check if player has equiped that weapon and then replaces it with one you want displayed. You can mess with diffrent "AttachmentType" for it, but other than that it would include making new location for your weapon to be displayed on, which then will work only on clothing you edit to provide that attachment point (quite annoying to make and not worth it)
So basically I can do it like a magazine on a gun? And the things I want to remove are the "Magazine"?
Not really.
magazine isnt attachment
yeah I'll just read into that. At least I got a lead now ;D
i am trying to add more songs into project zomboid. about half of the songs i added work, all files are routed correctly for all of them, and all songs are currently in mp3 format. however, the half of the songs that dont work bring up errors that they cant find a sound file, although i have clearly defined the file as in the rest. anybody know how to fix?
some .mp3 file names that work have parenthesis, hyphens, and some other symbols, so ive eliminated those from possible issues. some of the file names have commas in them, which may be causing issues, but not all of the non-working titles have commas
I don't know if this would be much of an issue as I've seen it been used interchangably, but maybe try converting specifically the CassetteGimmeBackMyBullets.mp3 to ogg and then load the game and see if you get the same error
It seems odd because it only sets the sound file string to either specifically ogg or wav?
But then again, it is also working with mp3 just fine you say, so it's very weird to find the actual issue
i did this with the song peaches and it still wouldnt work
i converted "The Presidents of the United States of America - Peaches (Official Audio).mp3" to .ogg and changed file name under the sound CassetteMillionsOfPeaches and still couldnt find it
huh
Just to be sure, make sure they are in the root folder of media/sound and that it isn't in a subfolder
i am working off another music mod as a template, as ive never made a zomboid mod before, so all music is in media/yourMusic/TCBoombox/
I assume you know about file extensions, some people don't so I'll still mention it; files can be named like song.mp3.flac without knowing because Windows by default hides these extensions.
But I doubt this is the issue in your case.
that could be why
yeah, i have file extensions shown on, and actually converted from mp3 to ogg when trying to resolve that, didnt just rename file extension
Maybe the other music mod manually loads these files. In your case, it isn't.
So put them in media/sound just for the time being and if you get the same error still please lmk
alright
I can't say I've seen TCBoombox folder before, are you planning to add more songs to the boombox specifically or just the game in general?
i am trying to add more cassettes into the game that are played through car or boombox
i also use true music and some other music mods, but true music is what i edited and am working off of as a template
location and directory changed, still wont work
sound CassetteMillionsOfPeaches
{
category = True Music,
master = Ambient,
clip
{
file = media/sound/The Presidents of the United States of America - Peaches (Official Audio).mp3,
distanceMax = 75
}
}
I honestly don't know much more about sound stuff enough to figure out why
I've never gotten that issue ever before because it just works somehow
oh 😮
comma after distanceMax
you need commas after every line except for lines with braces on them and definitions (like sound mysound doesn tneed comma)
so basically a comma after every param
sound CassetteThreeLittleBirds
{
category = True Music,
master = Ambient,
clip
{
file = media/yourMusic/TCBoombox/BOB MARLEY THREE LITTLE BIRDS.mp3,
distanceMax = 75
}
}
this song works however
but i will still try that and see if it fixes it
I am going to chalk that up to the comma thing
sometimes scripts can act weird when you dont have commas
I don't know why and I don't know how but it just happens
the b40 sound engine didn't support mp3s iirc, they don't care about this function anymore because they don't even use loose files (mp3 support is kind of coincidental)
oh thats why they use the soundbanks right?
yeah, not every vanilla sound is in them yet but every new sound is, presumably by the time the sound rework is done nothing will be loose anymore
add the comma to every sound script if you haven't
the entire file will stop reading as soon as it hits one missed comma
so everything below that will not load, even if it is fine
heres to hoping
Or maybe try following the tutorial on the True Music mod page.
music for the end of the world was the mod i was working off, and it seems sometime along the way i deleted the commas after distancemax
hey i work on that
well then by default you did some fine work
Hello! I'm trying to replace Base.CreditCard with my mod item. Everything works: texture, weight, category, and so on. But for some reason DisplayName is not working. It doesn't show up in the game. Why?
this error persists, ive compared my code to the code of the mod im using as template, and all is seemingly identical, besides where i changed name and file name obviously
DisplayName is (misleadingly) not usually displayed since item names are set by the translation file
only items without translations will actually use it
all songs after line 189 in the file with the sounds dont work, but some songs before line 189 also dont work
I have it displayed on all other subjects. But even so, I was making a translation file and it still didn't work for me
could this be related to the fact that I am replacing Base.CreditCard?
yes, the vanilla translation will be used
can I be "on top" of it, as it happens with the textures of my subject?
to my knowledge translations from mods should take priority over vanilla translations but it's not something i have much experience with
Okay, thanks! I'll try to check how I'm doing the translation and see if I made a mistake.
Hey guys, how to spawn a specific item in the world in random places but not in the city? like not on road tiles but only on dirt and grass?
is there any sort of util we can use to get an item name, at runtime, from is 'class name' like Base.Bullets44 without instantiating it?
getItemNameFromFullType(fullType)
it is true
thanks
@grizzled fulcrum @bronze yoke thank you both for the help, i learned a little about project zomboid modding and fixed some other errors while trying to find to root cause. apparantly, i was missing an opening bracket, and everything after that in the file was not executed
yippeeeeeeee
progress being done 😄
What is consired the best backpack in auntethic z mod? Also, im curious since militafy backpack is so rare is it better when upgraded?
I have a ton of guestions since i onluly recently started usibg mods... and reedit is not full of ibfo regarding mods...
This channel is made for people that develop mods, i think you would most likely find answer for those in #pz_b42_chat asking other players.
you may want to ask in a different channel like #pz_b42_chat as this channel is for creating mods
LOL yes
Not that we want to make you move/force you or anything. Its just better for both worlds i belive.
yeah most people dont look at this chat often unless theyre a mod creator
Exacly
I have about 250 hours logged on the game not including the time I spend in the batch file for development, and I'd say only 50 hours or less are on actual gameplay
"I think this game could really use X... wait, i can just make mod that does X."
is it possible to create an item with InventoryItem class (unextended)? when I try to use type "normal" it just becomes ComboItem
no
or is there a way to access values of the InventoryItem class that have no getter method, from the extended class?
also no :(
thanks. that's unfortunate
anyone know the distribution name for this living room low shelf?
unsure which one it was in the list and couldnt find low shelf anywhere
If you're using debug mode, go to cheats and enable LootZed, then right click its icon in inventory and you should have option LootZed that shows you all definitions that are assigned to this tile
ah amazing, thanks!
Some containers can have multiple distributions assigned to them (most famous for me at least are armory in Military Base above prison)
ah i see
hey! new here
where can I get basic moddiing document?
You guys have documents?
There's some useful information in the pins of this channel, but there's not standard documentation for the game's code. There's a javadoc but it's easier to use Umbrella (see pins)
Ah... Forgot to renew my modding license
Thank you, could you tell me how to get player's information?
like healthy data
getPlayer() and getSpecificPlayer() seem can't work
I am currently using reinforcement learning to train an intelligent AI agent within the context of the Project Zomboid game, aiming to teach it how to survive in the game world. However, the official documentation for the game is extremely disorganized, leaving me unclear about how to properly create mods and write correct Lua scripts.
I would like to ask: what is the simplest way to retrieve character status information from the game (e.g., health, condition, environment data) and control the character to perform actions like moving, dodging, and interacting with objects? My framework is largely inspired by AlphaStar (https://deepmind.google/discover/blog/alphastar-mastering-the-real-time-strategy-game-starcraft-ii/). Is there anyone familiar with Lua scripting who would be interested in collaborating on this idea?
package index
This might interest you
Also, there is a project by @red tiger called Pythoid that allows you to use Python in PZ
This might interest you too
Thank you 🙏
Wondering if you'd be interested in coming along for the experiment project @red tiger
tell me, where is the database of players stored on the server with which some people implement Discord bots and display statistics about players and online on the server?
Looking for someone to make a mod for me i can pay you 25 dollars
players.db
Sounds like a fun project
anyone around that knows how this stencil concept used by the ui actually works regarding it's coordinates when using something like setStencilRect ? i understand it takes 2 pairs of x,y values but are these absolute values as in x and y for top left corner on the screen and x and y for the bottom right corner or is it relative to the panel the method belongs to.... and is the second pair coordenates or dimensions applied to the first pair?
i've never seen a ui render method that doesn't co-ordinates relative to the object
trying to clip the second field here, this is drawn from the character inventory while dragging items and follows the mouse xy... now when trying to stencil it i just can't get it to work... namely the entire text i'm trying to clip just goes away
for the 2 first arguments i tried passing the mouse X and mouse Y, the same i use to draw the black background and for the 2 other arguments i tried a combination of mouseX/Y + width/height, just width/height .... nothing works
and this is a example snipet of what i'm using code wise:
local left = positionX;
local top = positionY;
local right = positionX + panel.column4;
local bottom = positionY + height;
panel:setStencilRect(left, top, right, bottom);
panel:drawText(name, positionX + panel.column2 + gap, positionY + gap, 0.7, 0.7, 0.7, alpha, panel.font);
panel:clearStencilRect();
panel:repaintStencilRect(left, top, right, bottom);
panel:suspendStencil();
nvm i think one of my tests i must have forgotten to reload or reloaded the wrong script.... it seems to work now, with: mouseX, mouseY, width, height
the information there is encrypted in byte code. How can this be fixed? Are there any examples of work with what I need?
I am like 99% sure it's a SQLite database, you should just be able to open it
same with vehicles.db
yep
it is, but the majority of the actual player data is just a binary
what\
like in binary, or a binary
either of which is weird, why would you just store it in the db like normal?
take a look at the data field in that database
I see, wth
It seemingly just stores the player inventory and stuff right? *and skills
Is it safe to create moodles on client? I am using MoodleFactory (moodle api)
I suspect I will need to create them on both client and server, I don't know why I have it in the client, but these kinds of things I am never sure about
I feel as if it's pretty hard to learn client/server for this game, especially when you get told a lot of stuff is on the client only but then you learn otherwise. It's a very weird situation
it seems MoodleFactory global isn't available from the server anyway (table is nil) but I put my trait creation on shared too so hopefully it will work
Ok I put moodle creation on the client and trait creation in shared and it works like a dream!
you don't need to create moodles on the server, they're just ui elements
keep in mind that names like 'moodle *api*' can be misleading, the game does not have any support for modding moodles in any way, moodle mods are complete reimplementations of moodles
I guess that makes sense considering the vanilla ones are hardcoded
and I don't even do state calculations based on the moodle anyway lol
It literally just acts as a visible element on screen like you say, so that makes more sense when I think about it
the game does actually use them for calculations but i think they're all client side
why cant we do --- @cast self.field Class raaaaaaaaa
only thing I can think of is store the field in a local and cast that stupid way
🤔 can't you do ---@field public field Class|otherpossibilities ?
yep, it still doesn't like it when I access fields from on e class
It's InventoryItem|IsoObject
It still doesn't likey when I call say obj:Use()
so I have to cast it, it doesn't matter that much though 😄
in that case, just cast the variable itself to InventoryItem instead of have it be considered an Object? (that way it shouldn't complain about methods it does have)
thats what I do
local water_obj = self.water_obj
if instanceof(self.water_obj, "IsoObject") then
--- @cast water_obj IsoObject
ISTakeWaterAction.SendTakeWaterCommand(self.character, water_obj, 1)
else
--- @cast water_obj InventoryItem
water_obj:Use()
end
I just had to make it a separate variable beacuse otehrwise it'd say that self.water_obj wasn't a valid variable or something like that
oh!
i was wondering if someone can help me with the true music mod. the music works fine with both vinyl and cassette but the vinyl covers aren't showing up i did what the creator said but im still having trouble
---@cast self { field: Class }
I think this is not very attractive, but it is possible
Especially since it'd be a mess of type intersections if you want the other fields to stick around
I think for that approach just ---@diagnostic disable-next-line would be better then, just ignoring it whole 😅
Agreed, although the "cast in either if statement branch" approach is what I prefer
actually, just searched through PZ Modding Community posts, albion aoqia mentioned inline casts, which could be used.
self.water_obj--[[@as InventoryItem]]:Use() bit hard to read potentially, but seems to work when only doing one liner?
And when doing more than just "a single call, or field access", making it a local first like aoqia did isn't bad either, since one'll save up on further table access and re-getting the field constantly.
Actually, that mention from albion was actually aoqia's back then 😅, albion just continued on the conversation, my bad.
Considering it's a single line, what I just mentioned from the post you left in PZ Modding community back then might help if you do want to prevent making it a local first (don't see a downside to making it local first though)
true, I just didnt want to inline cast it because I like parity between my code
and all the other parts where I couldn't use inline casts I used normal cast
DM u
is Vector3 broken? .x .y .z all return nil, tostring returns a vector2, there are no "getX()" or "x()" methods
trying to retrieve the z value of SwipeStatePlayer.getBoneWorldPos(obj, "Bip01_Head", Vector3.new()) so I won't even be able to hack it out of tostring
there are no getters
looks like there's two different classes with the name vector3 😭 as you say the one actually exposed to kahula does not have any getters, you can use my mod to make field accesses work as expected https://steamcommunity.com/sharedfiles/filedetails/?id=3001901955
badass, thanks
Does anyone have a list of all the bones on a player model? At this point I think not having a bone number in my attachments is the issue
I’m cooking
Do you know what kind of serialization is in the database? I want to decode this information
it's the game's raw character save data so it's not really in a specific parsable format, you'd have to analyse the game's save/load functions to make sense of it
is there a way to get an unpublished mod still in development enabled in game? i tried moving the files between the installation mods folder and the steam workshop folder but i can't seem to get it to show on the mods list >\
That means your mod structure is wrong
ok but which folder should i be using for this then? the steam workshop with some bogus id folder name? or the game installation folder mods folder?
What's the path of those mods and steam workshop you've put your mod in are ?
C:\Users\ ......\Zomboid
This is the path for the mods and workshop folder
steamapps\workshop\content\108600
steamapps\common\ProjectZomboid\mods
Yeah that's wrong
C:\Users\utilisateur\Zomboid\Workshop
This is my path for example
ha it had to be the 3rd option that i completely forgot about he he thanks
👌
I suggest using the /Workshop folder
The reason is that if you put your mod in /mods, you'll have to copy it in /workshop too (check the templates tho, the folder structure is a little bit different, requires a bit more steps in /workshop)
And having multiple copies of your mods will fuck you up, make sure to never sub to your mod on the workshop as both your local and workshop versions fuses together when they have the same mod ID
Which you shouldn't change
yep i was trying to figure out how to solve that, pretty sure i my previous attempt mods i had on the workshop folder under the user folder wasn't showing in the list either but i probebly messed something up then
going to try it again
yep that worked perfectly thanks!
👌
@magic eagle
Is there anybody who can fix a mod for money?
Hi everyone! I'm currently working on training NPCs using reinforcement learning and am encountering issues with extracting local game data. The mod I'm developing seems to lack permission to read and write data from my computer in local mode, particularly when trying to store player state data in real time in a local database. Has anyone experienced a similar issue or have any advice on how to resolve this (specifically for extracting data to store locally)? Any guidance would be greatly appreciated!
Thanks!
Did you check Pythoid ?
I found a battleroyale mod, everything works, but the PVP Off delay feature
Yes, but the problem may be in the step of storing data. In local mode, the mod cannot obtain the permission to store data locally 🤔
Doesn't matter, Python should allow you to store data
is it possible to embed an image contained in my mod file structure in the workshop description? i'm assuming on the workshop.txt...
It should allow you to do waaayyy more than currently what's available in PZ
Yup
Do it from the mod page directly
Or the edit tool when posting a mod
assuming the file is on the same folder as the workshop.txt what is the sysntaxe to emebed it on the description then?
In the modding Discord I made a guide on Steam embed
Oh you meant in the in game description ?
Or Steam ?
err no
but you cant run multiple instances of nosteam to test MP tho
What can be wrong in this code? Its a battleroyal mod which have a "PVP Forced Off Delay" works like at the start of the round it forces PVP off, but it not working.
where do you find this panel? is it your mod?
it’s the F11 lua debugging panel that appears after an error, you can select the variables on the left to get methods and fields
Still a WIP but here is my first version of the item inventory refactor, i tried to stay close to the vanilla behavior but i couldn't resist some minor tweaks, in any case it should make it far easier to mod the inventory when done on top of this:
https://steamcommunity.com/sharedfiles/filedetails/?id=3344798556
there's an entity relationship diagram in the screenshots to make a bit easier to understand where and what can be overridden
If you guys need mod test i can test it
wana give it a go at the one i posted earlier @crystal terrace ?
sorry? what this about?
no worries all good
Hello! I've been told someone called Braven is working on a train mod. Is this true??
1s is probably less than the time to log in. try with 200s. also you need to set it before starting the new world on the server like every other MP sandbox option.
I tried with 300 @mellow frigate and with a new world.
Also im would like to run with 2700s (45minute) the whole royale is 3 hour. final ray is 15 minutes. It doesnt have any rest time because I dont need it at all.
Sadly the characters can hit eachother
Am I right that disabled safety system?
And i ticked PVP on in the server base settings
is it possible to define a modules requires another one on the workshop.txt file? i know we can do this on the mod.info for the in game mods managers but i'm looking for the equivalent for the steam mod page... or does this have to done manually on their site?
Not that I know of, there's really not much you can do in the workshop.txt, just ignore it
Write the necessary stuf and that's it
the workshop.txt file is not something normalized by Steam, it's PZ dev who made it to pick up some info you write in it
Technically you don't even have to use the in-game uploader and can use outside uploaders
Does anyone do mod commissions? I need a mod done for me that uses the Radial Menu API as a required mod!
Thank you for the report. Version 1.15 should correct it.
How much time it takes Tcherno? Thank you.
Can you please make a seperate line on your "battle royale overlay" in the game for showing how much times left from NON-PVP? thank you 🔥
@mellow frigate i saw the update, testing it now!
you are so fast man 😄 hope it works
okey we tested it and i put 300 second, now started with nonPVP but after 8 minutes its still nonPVP
as we see it starts in nonPVP which is good, but doesnt turn on the PVP mode after 300 sec
300s after the circle starts
this lets time to people to join
circle starts right now at the server start
yea i understand
we joined the server
and waited 8 minute
and still in nonPVP
but now i restarted my whole game
trying with 30 sec
this way when i join it needs to be PVP
are you sure you modified the values in the pending server sandbox vars ?


