#mod_development
1 messages · Page 306 of 1
it's not supposed to
build 41 does not load files from build 42
the common folder is a new feature so older versions don't support it
Ok. Many thanks for the info.
But what exactly are then the supposed files which may go into the common folder if it only works for one version? Is this just a tool for future versions (or maybe even different patched version of B42)?
is there a tag or flag for recipes that allows crafting while an item of a recipe is on the ground?
yes
it'll make more sense when multiplayer comes out and people will actually stay on older versions, and when b43 comes out
bruh
for now i recommend putting all assets into common, and all code into 42
translations can also be in common
or you can do the big brain thing and place all your files in both
works for me
takes up more space but wont matter for tiny mods, only matters for large ones
i just copy and paste my media files in both 42 and common
why would you do that ???
you can just leave one empty if you really don't want to engage with it 😭
I still don't understand: which parts of the mod can access the files from common? If it is only B42, then I still do not get how you can save space by putting data to the common folder because having the data in common or in B42 doesn't matter then (takes up the same amount of space).
right now it doesn't really matter
it will matter more in the future, when b43 is out, or when there are multiple patches people are playing, and your mod may need a different version for each (this will definitely start happening when multiplayer is out and servers don't want to break their saves)
ok! then I understand! thanks for explaining!
ELI5: What does setAnchorLeft / setAnchorRight / setAnchorTop / setAnchorBottom do?
when the parent panel is resized, it will follow the edges it's anchored to
if it's anchored to two edges on the same axis, it will resize itself so that the distance between the edges stays the same as it was before
So i was thinking about something, what do you guys think that is the most fundamental coding/scripting consepts are in the creation of mods for pz, for instance I suspect that object oriented coding/scripting is a huge part of pzs system.
What are your guyses thoughts on this
Actually, object oriented coding is not that much used in the lua
It's used for timed actions, context menu, UI related elements
But I didn't need to touch any of it for a while tbf
And it's fairly easy to play with
Tbf it really depends
It depends what type of mods you do
There's no specific requirements
That makes sense, I think in order to pin point it one has to understand what they are doing before they understand what fundamental is required
I'm writing a paper and so these are just some questions I intend to answer in a digestible way
A paper ?
is the the recipe tag InHandCraft neccessary for the recipe to work?
i see it in pretty much all recipes
and i wanna make one where the items are on the ground
most modders are completely new to programming so they aren't really familiar with specific programming paradigms or patterns
the more experienced modders, especially with previous experience in computer science, do tend to use OOP, but i'd say the average mod doesn't use it at all
this is me... lol..
New page to explain ArrayLists when accessing them from the Lua side
https://pzwiki.net/wiki/ArrayList
New part about lookup tables
https://pzwiki.net/wiki/Lua_(language)#Lookup_tables
thanks again for help me man!
https://steamcommunity.com/sharedfiles/filedetails/?id=3426132882
How should I handle a wrongful DMCA complaint against my mod?
If anyone's ever dealt with this as a modder, please reach out.
Hey you can make a ticket in the modding Discord
We've done that before Chuck can possibly help a bit with that
Not saying it'll fix the problem tho but that could help
Was just about to ask for link, you are awesome bro, thanks @bright fog
As a general question: do you think it is a good idea to add your code to a lua event and also to manually trigger lua events? Or has this a significant likelihood to cause stability issues?
Depends
As long as you don't trigger the event during the event
Or that's called a while loop lol
Which lua event(s) are you think of triggering manually?
You may also want a safeguard of some sort to stop recursive/unwanted event triggering.
Like I said, don't trigger the function which triggers the event
Maybe better an infinite loop. 😉 But no... that's nothing I am going to do.
in my case, it is the OnClothingUpdated event but my question was more general about using events and what other modders think about it from a technical and stability point of view
Is there any way to teleport the vehicle?
Only find teleport vehicle in bullet,not sure if it would work
so with item tweaker mod no longer going to work on b42, what is the way to modify the values of existing items
like do i modify the item tweaker code or?
want to make something related to changes of certain values/output something different after using items
local item = ScriptManager.instance:getItem("Base.Apple")
if item then
item:DoParam("Parameter = Value")
end
this is all item tweaker ever did
Ok that makes sense
i find it interesting how this mod that has existed for 10 years now really is just that lol
Yeah just related to coding/scripting and how it's applied in the subgroup relm.
so with this i can go and modify existing parameters, and also add in new ones (possibly from other mods too)
yep
it's so common place nobody thinks to question how it actually works, everyone assumes it's just impossible without it 😅
Is it possible to change a specific parameter of a specific clothing item's xml file while the game is running via lua coding? Specifically, I want to temporarily delete the xml paramter
<m_UnderlayMasksFolder>media/textures/Clothes/BulletVest/Masks_BulletVest</m_UnderlayMasksFolder>
which can be found for several vanilla clothing items (in my case mainly bullet proof vests).
het i have a very simple lua request from anyone that can help
i want to make an item that can be written on like a notebook but doesnt require a pen or pencil to write on
thats its.
so pretty much skipping the requirement for pen/pencil for a single item
i have no idea how to do it, so if anyone can, let me know
u can help by also telling me where to find the LUA files related to the writing on notebooks system.
theres a mod that i know that hasnt been updated for almost 3 years now with no updates or interest from the original mod creator and want to port it/expand upon (which uses itemtweaker)
yep that mods goal was to make it simple for other modders to change values of items without having to learn lua
tho most of the ones that did use it added shit ton of prints lagging the shit out of servers
it also doesn't even fully work in multiplayer lol
it only changes the items on the client side, which sometimes doesn't matter but sometimes does
also, the prints aren't the fault of the mods using it, item tweaker is the one that does that
I'd start and check the vanilla code in media/lua/client/ISUI/ISInventoryPaneContextMenu.lua. This generates the right-click options for the items in your inventory. There is also an option for writing in journals, notebooks etc. The option for writing is only present when players have pens in their inventory. So you could pbbly make a writable item and simply don't use any condition stating that there must be a pen available. (Could be difficult coding though...)
After players click the option to write, there is a specific timed action which is triggered (should be ISWriteSomething:new()).
Also possible that there are simpler solutions. It is just my first idea.
thanks alot, will check it out ❤️
Not 100% sure but aren't there even easy methods to add a right click option to a modded item (using some kind of lua event or smth)? In this case, you could simply try to add a "write" option to your item and then trigger an appropriate TimedAction, similar as the vanilla code does.
Are you talking about like, a Minecraft notebook?
Or just a notebook without the required pen/pencil used in the game?
the project zomboid one.
i want to make one that doesnt require a pen or pencil to write in
Hmm
Okay so I am just trying to get a custom Map Symbol, but I keep getting stack trace errors on Build 42.
I have a 64x64 PNG stored in common/media/ui/Lootablemaps and my MapSymbolDefinitionsTF.lua is simply MapSymbolDefinitions.getInstance():addTexture("TFSkullBones", "common/media/ui/LootableMaps/map_TFskullbones.png", "Test")
Everytime I open my map with my mod loaded, I get errors and the map refuses to open. am I doing something wrong here?
Hmm. I'm thinking it might be the .png itself causing the problems
Actually it seems you need at least 9 different Map Symbols otherwise it breaks the map 🤔
oh yeah, where do i put this code in the lua folders? client server or shared?
shared

will
collider:HasCurtains():IsOpen()
check the curtains for IsOpen or the original collider?
trying to get curtain detection when a zombie touches a closed window, but unsure how to go about it
Answer: checks the curtains
trying to figure out why pz crashes from the existence of my mod being turned on
theres also only very few files in it
Did you check console.txt in your user zomboid folder?
i did but not sure what to look for
Usually at the bottom of the console log after a crash, it will show which file was being loaded before everything stopped
hmmm
If you send the console.txt file I can help you take a look
sure
i should also mention the few files that i have, referencing the file format of how other mods do it
It looks like in items_dairy.txt you are referencing "Weight" as an item parameter
Which is not valid for some reason... mind sharing items_dairy.txt?
No problem
but now i gotta try to see if theres any more problems before the repeat the process
That's exactly how professional programmers work too - fix a bug that breaks everything, then work on the next bug that breaks everything, and eventually you get to start working on the bugs that don't break everything but cause things to go wrong.
finally fixed the problem that i was dealing with
time to repeat the process
i had coded before, but never done lua or pz modding before
like sometimes
question: why do some items have "attachment world" in the model scripts, but i don't see world in the attachment block parameters, does this mean that it can be placed like the workshop mod's workbench? thats the only thing that makes sense that i can think of.
Is there a way to know if a zombie is alive when a player attacks it?
I tried using the OnHitZombie event, but the IsoZombie parameter in this event gets the state before being attacked.
i have a strange bug in my modlist and for the god of code i cant figure out which mod causes it. so i pondered to go with a Filesearch to figure out wich mods are most likely the culprit. the issue is : if i dismantle a metal floor or metal wall i crafted i get blowtorches back..... so to narrow down what mod/s might be the culprit/s i was pondering to do a "search in files" with notepad++. what functions mess with the return of dismantling?
to note : there is no error associated with it. and the return is "full" blowtorches.
check your subscribed mods, youll easily narrow it down there
do OnWeaponHitXP and then check iif its an isozombie
that event fires after allll the damage stuff is done
i was hoping to scale the amount of mods to check down in figuring out wich mods might touch it. i have like 200 active.
yeah you already have a clue "if i dismantle a metal floor or metal wall i crafted i get blowtorches back" so it might be related to mods that does that
nope not subvscribed to a mod like that. i only noticed this (i think cross mod bug) in my actual playtrough. once i had learned the recepies and tried to build a base.
maybe try to reduce em half by half so you can easily find what mod is causing it
anyone know where the function is to destroy plants when you drive over it with a vehicle?
you should have a look at https://steamcommunity.com/sharedfiles/filedetails/?id=3413150945 i bet that mod uses that function or a adjacent one.
hm ok, thx
seems it wasnt a mod. even with all mods disabled it still gives me blowtorches back. i think its that i have welding 10...(trained it up by using a mod to dissasemble cars). b42 by the way. seems i have to live with it.
To start: go to C:\Games\Steam\steamapps\workshop\content\108600 (or equivilent folder) and use whatever tool you most like to search for any .lua or .txt containing the word "blowtorch"
Unless you have some super weird mod reverse engineering deconstruction by looking at the inputs to make something, twhatever mod is creating blowtorches needs the text "blowtorch" somewhere in it.
i dont think its a mod anymore. i disabled all of them and still get blowtorches back. so i think its a b42 thing....
If it happens with no mods, report it on the bug report forums
You’re making sure to disable the mods on the save file itself, right? Not just in the mod manager?
Yes. im currently trying to figure out how to replicate the issue without using debug mode. using those would likely invalidate the report.
training up welding and finding the neccersary magazines is a hassle.
I don’t think debug mode would be causing recipes to bug out like that
my guess is that dissasembling stuff takes the crafting material. does some arbitary math and chances to return items on skill. and maxing out your skills makes it wonky and returns useables in full condition. but yeah currently testing that.
how do i disable/kill a vanilla function?
you would need to replace it with your own.
As a example (fantasy function)
`local old_FunctionForStuff = CategoryForStuff.Functionforstuff
function CategoryForStuff:FunctionForStuff(input A, InputB)
end`
if it has a return value add a "return Thingtoreturn" into that function.
this would disable the function entirely. keep in mind this might have bad consequences if not tought about. any mod that uses that function would be Broken.
Mod Manager v1.0.8 Update: I've nearly completed the next update and just wanted to showcase the mod detection system.
- What does it do?
🔎 Auto-Scanning & Fix Suggestions
✅ Detects missing/corrupt files (mod.info, modinfo.json).
❌ Flags error logs & missing files.
🔧 Provides fix suggestions automatically.
🏷 Tag Management & Custom Error Notes
🛠 Tag mods as In Progress, Bugged, Broken, or Fixed.
📌 Add custom error notes inside mods for easier troubleshooting.
🔔 Discord Webhook Integration:
- Auto-notifies Discord when mod status changes!
Built for Project Zomboid. 🙂
Official Download: github.com/OV3RLORDS-MODS/Modix-Mod-Manager
Discord: discord.gg/EwWZUSR9tM
Workshop: steamcommunity.com/sharedfiles/filedetails/?id=3422448677
Key Features:
🔍 Auto-Scan
Automatically scans your workshop folder for missing files (mod.info, modinfo.json) and error logs.
⚠️ Conflict Detection
Identifies file conflicts betwe...
thank you
can someone tell me how i can know which mask number is what in clothingitem?
that is for B41 though. not sure if the changed anything for B42...
nope still the same
i have the clothingitem already filled, i just didnt know which ones to remove to get an effect i wanted
ok iam to stupid to get it^^ I need to get rid of the self:destroyOnWalk(luaObject,square) or the if square:isVehicleIntersectingCrops() then luaObject:destroyThis() return end in the second function ```function SFarmingSystem:checkPlantSquare(luaObject)
local square = luaObject:getSquare()
if not square then return end
luaObject.exterior = square:isOutside()
luaObject.hasWeeds = SFarmingSystem:hasWeeds(square)
-- if the plant has enough of a pest flies infestation we apply flies to the square
if luaObject:hasVisibleFlies() then square:setHasFlies(true) end
-- we may destroy our plant if someone walk onto it, or if it's already dead
self:destroyOnWalk(luaObject, square)
end
function SFarmingSystem:destroyOnWalk(luaObject, square)
if square:isVehicleIntersectingCrops() then
luaObject:destroyThis()
return
end
end
is it going to be a problem if i use the 41 client to update my mods? i can't get experimental to load at all
What are you talking about ? Updating your mod to B42 while in B41 ?
B41 can't read B42 mods
is there any way to teleport the vehicle?
i don't really need it to read the b42 mod, i'm just updating the mods for b42
Are you sure they even work without changing anything ?
no, but i'm sure they don't work without updating the folder structure
my mods are mostly single recipes, like turning seeds into oil or something, i'm sure if someone tries it on 42 and it doesn't work they will let me know. right now they just don't work in 42 at all without the update.
Hi everyone! I am looking for a lua function that retrieves the debugger's error count. I thought getLuaDebuggerErrorCount (https://zomboid-javadoc.com/41.78/zombie/Lua/LuaManager.GlobalObject.html#getLuaDebuggerErrorCount()) would be the function.
@sour island might know
Whatever I used for error mag is the list of errors
Some errors are not added though - due to how the exceptions are sent
I'm new to PZ modding, does anyone knows why I get 30k+ undefined global warnings lol
on my workspace theres only the mod folder and the b42 lua folder
are you referring to console.txt?
No, there's a function and array for errors in game.
It's the same method the F11 screen uses
getLuaDebuggerErrors()
i would propably overwrite this small function :
function SFarmingSystem:destroyOnWalk(luaObject, square) if square:isVehicleIntersectingCrops() then luaObject:destroyThis() return end end
to replace it you basically overwrite it. place it appropiately into either client/shared or server subfolder.
function SFarmingSystem:destroyOnWalk(luaObject, square) if square:isVehicleIntersectingCrops() then --luaObject:destroyThis() return end return end
ok i will try that, thanks for your help
eeks. dont copy paste what i wrote i placed a "end" and a return to many into my example.
just copy the orginal function over and comment the destroy line out (--))
sorry my mistake
i tried someting similar but its just not working, maybe iam somehow at the wrong place there is also this in this function -- the other stuff is handled java-side now, maybe iam just stuck with it, so no Agrotsar welp 😄
sorry cant help with java modding. that stuff is a blackbox for me -.-
I found this in your file: getLuaDebuggerErrors(). It seems getLuaDebuggerErrors():size() is the count. Thanks!
Ah oops, yeah- sorry should have explained better.
I'm trying to port the ZuperCarts mod to B42 for myself and I have it working without errors, but the animations don't work. Anybody got some idea of what I need to change? It's painful to play this game without the mod and iBrRus doesn't seem to be coming back.
Does the common folder work in B41 or do I need to do this for my mod to still work in 41?
Yesterday, someone explained to me that you should put the contents of your 'media' folder from version 42.0 into the mod's 'media' folder! That way, it would be compatible with both versions!
tried making a main menu background mod, but all I get is a black background and 4 errors, any reason as to why this is?
i wished they had added a b41 hotfix to load a "41" or the "common" folder to ease backward compatibility. missed opportunity.
your ide doesn't know anything about zomboid's api, so it thinks everything is undefined: install umbrella and most of them will go away https://github.com/asledgehammer/Umbrella
some will remain because the vanilla lua just does things that would be considered bad 😅
ERROR: General f:0, t:1740337489247> ExceptionLogger.logException> Exception thrown
java.lang.Exception: Item not found: TNG_VHS.TNG_VHS_Collection_S5. line: item 1 [TNG_VHS.TNG_VHS_Collection_S5] mode:destroy at InputScript.OnPostWorldDictionaryInit(InputScript.java:688).
Pain. What am I doing wrong here?
u need to put a ; after the item name
in the inputs
and also the outputs dont use a [] betweent he name
heres a recipe as an example
craftRecipe ConvertToFuel
{
Time = 30,
timedAction = Making,
AllowBatchCraft = False,
Tags = InHandCraft;CanBeDoneInDark,
Category = Survivalist,
inputs
{
item 1 [SupportCorps.LanternElectricEmpty;] mode:destroy,
}
outputs
{
item 1 SupportCorps.LanternFuelEmpty,
item 1 Base.LightBulb,
}
}
see how i did it?
Weird, I don't see that in any of the base game files but I'll try it
Should just be the output, it works without the ; if you only have one
yeah, what bjorn said. im used to putting it in all my recipes
but if it doesnt work, try adding it.
btw please tell me u did voyager
lol, never got around to it
fuck, just checked, its too early.
just tng season 1-7
o7
live long and prosper
Hrmm. Still getting TNG_VHS.TNG_VHS_Collection_S5. line: item 1 [TNG_VHS.TNG_VHS_Collection_S5;] spit out at me.
this is what it looks like now
item TNG_VHS_Collection_S5
{
DisplayCategory = Entertainment,
Weight = 0.1,
Type = Normal,
DisplayName = Star Trek: The Next Generation Collection 5,
Icon = TNG_VHS_Case,
WorldStaticModel = TNG_VHS_CollectionBox,
Tags = IsMemento,
}
craftRecipe Open Star Trek: The Next Generation VHS Collection 5,
{
timedAction = PackingBox_Small,
Time = 80,
OnCreate = Recipe.OnCreate.TNGVHSCollectionS5,
Tags = InHandCraft;Packing;CanBeDoneInDark,
category = Miscellaneous,
inputs
{
item 1 [TNG_VHS.TNG_VHS_Collection_S5;] mode:destroy,
}
outputs
{
item 1 TNG_VHS.TNG_VHS_EmptyCollectionBox,
}
}
It just really hates season 5 I guess lol
there shouldn't be a semicolon after the item name
the semicolon is supposed to separate multiple item names
Was just told me to add that a few messages up 
Regardless, same error with or without.
is your module definitely named TNG_VHS?
Lua changed in B42? This mod has been working on b41 with that semicolon for nearly a year 
this isn't lua, but there may be slight differences in script parsing now
I see, funky
also if your b41 recipes referred to the item by their short types, module name wouldn't matter
huh, maybe it's a parsing difference in b42 or i'm wrong - but in my experience the parser doesn't drop special characters from module names
Anybody have experience with animations not working when porting from B41 to B42?
you need animsets in the b41 location as well as the b42 location or they won't be loaded
so media/animsets *and* 42/media/animsets or common/media/animsets
Ahhh that explains it, I think. Thank you so much!!!
Yep, problem solved. 💚
What function sends a client send a message in /all to a MP server?
Yep lol. ; in the module name definitely wasn't helping anything. New useful errors to work with now. Thank you.
Made the naming scheme sane, no more TNG_VHS.TNG_VHS_Collection_S1
Not sure what my thought process was when first making this. Few more things to solve and it's b42 working again yippie
Anyone know how to get the item’s position
I tried using WorldItem, but if the item is not on the ground, its position cannot be detected.
When the item is in a cabinet or something similar, it can still be recognized as a WorldItem, but when it’s in a car trunk, it’s no longer a WorldItem.
I believe you can get the container
And from the container you can find where it is
It has begun.
Custom icons, nice
I wish I could make these with custom colors instead of just the pens. Not sure how one would do that.
Cause right now I use 3 different stamps. The Background, the Hexagon, and finally the Icon

but I guess that also means you can use any other Icon pack you want and make a little border for it.
Changing the capacity for the mod doesn't change how much the container holds. Anybody have an idea why? It was 49 by default, but that equaled out to only 37 in game. So I changed it to 75, which adjusted it to 48 in game... until it just... stopped doing so. Now it's back to 37 no matter what I start a new game with the container value set at.
container capacity cannot be higher than 50
I'll give that a go, but the weight of 37 in-game still had that issue set at the default 49.
Yeah, don't change anything unfortunately.
https://steamcommunity.com/sharedfiles/filedetails/?id=3423871533
Update: Feb 23 @ 4:40pm
Removed multiple mod versions in favor of sandbox options!
Added sandbox options to toggle strength and target check.
Added sandbox options to toggle speed types always breaking windows.
Added sandbox option to set a minimum speed.```
"Why would you ever need to put more than 50 arbitrary units of stuff into a container?" - Devs
There are seperate limits in Itemcontainer:
why aren't these static anyway?
if you can convince people to stay in debug mode you can get around it i suppose
i'm pretty sure they're enforced by lua anyway though
there's rarely any reason to but you can set instance field values in debug mode
My guess is they are defined in some other file and end up hard-coded into the class after being compiled, but yeah - shoudl be static
They 100% are, because I'm working on a lua mod that bypasses every such restriction
Just need to fix a problem where moving a worn container over 50 weight to a different body location will drop it onto the floor AND put it in your inventory.
(which also gave me the idea for an Ender chest mod, where you make a container that access the same inventory from everywhere)
that could be brutal to implement
i suppose you could put an invisible + weightless container in the player's inventory as long as you don't care about other players being able to access it too
I thought it wouldn't be too bad, it's not 850 lines of lua patching because weight limites show up in all worts of stupid places
It might be possible to store an inventory object per-player then attach the appropriate one when the object is accessed.
That would be awesome tbh. If doable.
Assuming there is some sort of unique id per player, which I assume there is.
the issue is if it's not in a regular container somewhere it won't save
so it has to be in someone's inventory for safety
More likely it would need some sort of action to attach the inventory attaching to since accessinga container is a direct java call, so might end up being a "place chest in world to access" type of deal.
Could Make a series of boxes somewhere in the wilderness to hold stuff
the squares would have to be loaded for their containers to be accessible
hmmm
you could do it if you could serialise inventory items and load them on demand, starlit had a module for that in b41 but i don't really want to update it
well, all that is aproblem for a mod I'm not even going to consider starting until I finish up three half-done mods
every time they add some new thing that either needs to be saved or changes how items are saved i'm probably deleting people's items so i'll probably just leave it in b41 which will never change anyway
At minimum, wait for B42 stable to do that.
...and then to further make sure I don't get all my half-done mods finished I installed Avowed and it's such a weird game; like Skyrim except it all just works without horrible jank and 50 QoL mods to have a usable inventory interface. And it's Unreal 5, but runs so smooth out of the box without changing any settings on my 4 year old video card.
And it's a AAA RPG, but doesn't feel like it was built by a committee of executives that don't actually play games.
It's just.. fun to play, and I didn;t realize how much I mesed that with new games. Even if it's going to be a one-playthrough game for me, unlike Zomboid and it's thousands of hours.
Trying to find a way to detect this event <eventOccurred>collideWithWall</eventOccurred> but not seeing anything I can call. Anyone tinkered with this before?
i think you can only catch these in timed actions
Sometimes it's odd what events are missing - like I was just looking for a vehicle damaged event, and the only one is "vehicle damaged enough to need a new texture"
The car dashboard has it's own routine that saves the car state and rechecks it every 10 ticks to see if it got worse.
Ya, Im trying to detect different falling/tripping events, falling over a fence sets a flag you can detect from the playerObj, but falling from running into a wall doesn't follow the same logic
PZ devs keeping us on our toes
you might be able to detect the player entering the collidewithwall state?
Ya I was looking for something to check collide/collidetype but still looking around
Was also looking at the different bumptype variables that get set at times
Seems like 3 different systems from over the years
in an OnAIStateChange callback you can check if the new state is the collidewithwall state
I have to say, when renaming bulk images windows powershell is a godsent.
This would take hours if this didn't exist. LOL
There is a tool I use… bulk renamer or some shit like that
this is what I was looking for TY 🙂
I use $counter = 1 Get-ChildItem *.png | ForEach-Object { $newName = "$counter-REPLACEWITHNAME" + $_.Extension Rename-Item $_.FullName -NewName $newName $counter++ }
That way it doesn't have the annoying trailing (#) at the end.
My IT courses finally coming in handy. And its for modding a game. lol
Bulk Rename Utility if you wanna check it out… Ive never had that issue with the # trailing but I primarily use it to rename media files
I'll just stick to powershell. It serves its purpose really well.
Knowing some basic Powershell (or linux shell) is huge timesaver sometimes.
It really is. I have a Raspberry Pi I use to mess with linux or a virtual machine depending on the day. I'm really debating about switching to a Linux OS for gaming, but a few of the games I play rather often aren't supported.
I have well over 200 files I need to rename in various locations, so this little script is saving me so much time.
I love linux, but for gaming stick to Windows.
I will also qualify that with in the last twenty years I've done huge amounts with linux but only ~2 hours of that was using a GUI when a developer needed one for something... everything else has been commandline
cough https://game-icons.net cough
the only one out of these 5 mod images that I've been actively working on is the molotov icon
cuz that's the bomb rework mod
I got my icon done. Just gotta do the preview images.
nice
I used the rimworld font when I uploaed by first steam mod, and then was lazy and re-used it for Zomboid... but it makes for a nice distintive preview image. https://steamcommunity.com/sharedfiles/filedetails/?id=2737639560
I encourage people to use game-icons.net but I'm worried at some point someone is gonna just fully copy the design style I do (the color choices with the background and border)
It won't be a big deal just kinda bleh
The main reason you can look at a mod and tell it's one I made is because of the background color
That looks awesome. Love the font
I also try to reuse colors for the same materials as frequently as possible so that everything uses the same color scheme
for consistency sake
New page about how to modify context menus, add options etc
https://pzwiki.net/wiki/ISContextMenu
For me the font/outline/color is enough to tie things together.
I try not to use free stuff. The icons I'm using for this mod I actually paid for and got royalties to use them.
I've had alot of friends run into issues using "free" stuff. So I just pay the artists lol.
And the same vignetting overlay, but at different levels based on the background.
I don't know if I'll post more than just the one mod, but having a unique title would help distinguish them.
I mean game-icons.net is Creative Commons license, and everything is made by them.
It's not "free" like google images, it's free like public domain stories
Good to know. I'll have to give them a look.
I always say this when it's brought up, but you will genuinely recognize a lot of their icons
Free like speech, not free like beer?
That's the common analogy I've seen for open source software.
Wow actually I do recognize a lot of these.
The DND Program I use must use this as a library for icons.
Here's the icon sheet, containing every single icon.
Despite how I never see anyone talk about it, this resource is used more frequently than people realize.
I try to show it off whenever possible cuz I think it's neat
Yeah it's a great resource!
Wow I might need to use some of these for the Symbols.
It is!
Just found these beauties'
Now to figure out how to setup an Options screen so you can enable and disable these because
there is alot
Turns out you can use player:getCurrentState() but it seems like only some of the states allow you to call getName() so you can just tostring it and match a pattern
states are singletons, so you can compare them to the instance
Ya but only some of the states are exported it seems
Go figure its one of the ones I needed 😂
But now you can run face first into a wall and drop your smoke 
I found a code that can help me write my code LOL
or rather a Script to help me write my code.
Adding numbers to all these would be horrific to do by hand. Especially since there is a lot more for every other category.
wait
WAIT i messed it up
Got it working
lol
what in the fuck are you doing
Can't be produced by a recipe, but I have the recipe open and visible?
is that you writing them?
please just do
local instance = MapSymbolDefinitions.getInstance()
for i = 1, 41 do
local name = "TF" .. i .. "-Vehicle"
local path = "media/ui/Lootablemaps/Vehicles/Vehicles/" .. i .. "-Vehicle.png"
instance:addTexture(name, path, name)
end
also you have 2 of the same Vehicles folder, why?
changing the recipe module to base fixes this issue.
It also fixes an issue I hadn't brought up, which is for reverse engineering recipes
I have a few subfolders. One is just Vehicles full of Cars, another is Vehicle Wrecks, and so on.
Actually now that I'm looking at this I feel like an idiot LOL
you should really learn basic lua, it will help
Yeah that's what I'm working on. I know basic C++ and Java, but its been about 6 years since I've last modded. I should go take a refresher course.
Also that code won't work as is. The second instance of name in
instance:addTexture(name, path, name)
is referring to the Category name, which would just create 41 categories.
Thank you for jogging my memory. lol
i have a code for fetching the burnt/wreck versions of vanilla vehicles
not sure if you need it tho
I'm just making Map Icons
ayt yeah do what aoqia mentioned and just run everything on a table
your 1k lines of code becomes 6
I tried to write it based on the code you showed before, so idk if thats actually accurate, but the concept applied is the same (using for loop)
learning programming fundamentals will help you a lot when transitioning to any language, and yea you should dip your toes again on coding 6 years is too long😆
xD Got married. Coding had to go on the back burner! lol
try to use fixed(?) value for 3rd arg then
instance:addTexture(name, path, "myTab")
I took like a 3 month course on Java at one point, but I really never got into modding Minecraft. lol
question about modinfo. i know there is a "LoadModBefore=" option. is it valid to add a "LoadModAfter=" ?
Yes
loadModAfter
thanks
Yes
Hi! What is difference between those two conditions:
if not isServer() then
if is client() then
???
not isServer() will be true in solo and multiplayer (client only)
isClient() will be true only in multiplayer (client only) @small topaz
does anyone know how the "chance" works in distribution Lua? for example in the Authenticz mod, The Clown says "chance=0.04". how does this translate to percentage? im having trouble understanding what the numbers translate to as far as rarity goes
i think the chance value is not a direct percentage, from what i understand it acts as weight compared to other entries on the dist list. not sure tho but thats what i see it
tht makes sense cuz the percentages are actually impossible. i saw a freddy and a jason next to eachother which would be 1 in 10 BILLION if it were direct percentages
for example you will add all the chance value then you will divide the item chance value by that total to get spawn %
spawnrate = (itemchance/total of all chance) * 100
this is how I see it, similar to some of the other programming projects I'm working on
don't take my word for it tho, im also not sure about pz
I am modding some ui elements and the vanilla code contains several commands of the form
self:drawText(someText,...)
Is it possible to access the text after the text has be drawn? Maybe deleting it or changing its position? Btw, those commands are executed in the respective ui's render() function.
Does anyone know where the vanilla .oncreate for recipes are in the LUA files?
in lua/server/recipecode.lua
need some help
in the wiki it says the item's ID should be
farming.Strewberrie
do I have to put it as so in recipes?
no, there is no weighting at all
the chance of other items spawning doesn't affect another item's at all, except in the very rare case where so many items have already spawned that the container is full
howdy, im new to modding and decided to make a texture mod that that puts soyjak faces on zombies and players, as well as changing the overall "skin" tone to be white like how soyjak drawings typically are, because it's funny. so far i've made textures for the male player body, i made the base character texture grayscale and pasted the face i wanted over the texture, made sure the names of the images and folders were all correct like three times, but the texture still wont load. it just makes the player invisible. any insights as to why it won't work?
the chances are technically percentages however there are so many modifiers applied, many of which are not predictable, that it isn't easy to determine the actual chance of something spawning
Has anyone done any work relating to keys doors? I'm wanting to improve fort redstone next update to have some endgame content in the underground area.
I want to make keycards that will open doors in the underground area. If there is a mod that already does something similar could someone point me to it so I can look through the code
idk any mods that have done it but keys have ids and you can set the doors keyid and make a new key and set its id. I'm sure you can make a keycard item and make it be a key wth this id
key:setKeyId("any int you want to be id")```
good to know, thanks for the info!
Does the game spawn anything in (not in containers) in LUA? And if so, where??? Thanks.
what are you trying to do? spawning items in the world can be done with IsoGridSquare:AddWorldInventoryItem(InventoryItem,0,0,0) the 0's being the coordinates of the item within the square
Not sure what I did but now my game won't read ANY mod files pertaining to MapSymbolDefinitions. Time to verify game files. LOL
Thanks, How do assign it to the door though, I want to make a a door like the one on the redstone bunker need a keycards, and can we make tiles unsledgeable in 42?
I'm hoping since we have the basement walls they have made it so some tiles can't be destroyed
IsoDoor:setKeyId("your key id") idk if keyids can be set in the tiles but if you get your door through the event loadgridsquare you can set it like that
and with removing sledge destroy option on things i dont see that as an option but the context option can be removed if it is opened on the doors
Hello, good afternoon. I was working on identifying the vehicles, since perhaps at some point, I have to track some of them. I saw that there is a database of them, and that it has an id. However, from lua, I try to access that value, and it seems to not always be the same. Am I making some mistake?
local vehicle = character:getVehicle() -- BaseVehicle
local vehicleGetID = vehicle:getSqlId()
From now on, any help is welcome. There is another method, but it didn't work for me either. I'm on build 41. Thanks.
I was intended more of a "by chance" and "by location" sort of deal. Not manually placing every spawn.
And if it helps any, I intend to use a similar system to how generators are spawned in. So if, in the end, it does require manual coordinates then it is what it is.
so specifically with generators i think they have preplaced map objects that they just replace as they load
but how ive seen others spawn what they want is using loadgridsquare event checking for a buildingid so not to repeat spawns, and getting the roomname to see if you want to spawn there and then getting objects in the room to place on
Quiteee... interesting... hmmm. Thank you so much! I have some ideas to try now. ;3
I'm trying to make a simple mod for myself that is just one crafting recipe. I can get the mod loaded in but the recipe doesn't show in the crafting menu. Is the wiki still correct for B42 or do I need something more than just configure a recipe.txt file?
https://pzwiki.net/wiki/Recipe_scripts
no, this for b41, b42 has a completely new recipe system
there isn't really any documentation on it, look at the vanilla ones and other mods
(B41) So, I am working on a mod that handles InventoryPane. I thought items double-clicked within the players inventory transferred to a loot container or floor, but they only equip those items - Is that correct vanilla behavior? Seems to be, but I swear the items transferred on double-click.
Thanks, I think I what I need to do
Yes, I tested with no mods, and this is the behavior I get, but like I said, I swear the items transferred on double-click.
Thanks, I'll save this for when I get to it
Hate to be a bug again, but are the building names shown upon right-click in -debug mode applicable names for me to use in a function targeting specific buildings?
I tried the PZ wiki for POI names but... yeah not there lolll.
can someone help me understand to turn this image into that, im sooo confuse what is happening on the left image
Left image is a texture and the UV map of the 3D object puts its vertex etc on this texture to show on the various faces of the object
You mean like unique names of the buildings ? I don't think that's stored in any way in the game
oooooh... Thank you 😄
No, like... "storageunit" or "burgerkitchen" or "elementaryschool" / "elementaryclassroom". They have specific names if you right click on the ground in -debug mode and you get something like this:
those are the room names, yeah you can use them in mods
Anything you see in the UI is in the Lua
So you can easily find how the game accesses these by checking the code which makes this context menu option
not all ui is lua but most
Yea you're right
Yea, so I was hoping there was a list somewhere of these and I don't have to check each place I want physically in game.
Context menu options are Lua at least
I don't think so but that might be interesting to have such a list
there will probably be an entry for every room in the distributions
an actual comprehensive list is kind of pointless since the mapper can put literally anything in there
Only 25,000+ line to peruse hahaa.
fetch.clickedSquare:getRoom():getRoomDef():getName()
That's how the game gets the room name
not sure if the b42 map has it but the b41 map site had a room names overlay which may be faster than in-game
Not much in the java at least
public boolean isShop() {
String var1 = this.getName();
if (var1 == null) {
return false;
} else {
if (ItemPickerJava.rooms.containsKey(var1)) {
ItemPickerJava.ItemPickerRoom var2 = ItemPickerJava.rooms.get(var1);
if (var2 != null && var2.isShop) {
return true;
}
}
return false;
}
}
ItemPickerJava.rooms
Perhaps
there isn't a fixed list of rooms
the mapper can put whatever string they want in there
ItemPickerJava.rooms is just how the game stores the distribution tables
Tbf you could easily make a code which picks up every loaded room and get their name, and add them in a key table
And just TP around the map
Mapping every possible rooms
you'd have to load every single square on the map though
No
I mean
No definitely not
You can just go around every cities
I don't think there's that many room options, most are shared anyway ?
Yeah but the map you need to take note of every unique rooms ...
While this list, we could actually write down somewhere in the wiki
if you want to update it every map update 🤷♀️
it sounded like they were trying to target specific rooms so just checking those out on the map would be way faster
I mean that's a problem sure
But if the majority of the rooms are listed, and proper version is noted for the list
No idea what they planed on doing but my guess was getting a general view of what's available ?
Actually how about asking the mapping Discord
Which map site are you speaking of?
Needs to be the B41 one no ? You said it's only in the B41 version the room names ?
i said i wasn't sure, i checked now
Hello, good afternoon. I was working on identifying the vehicles, since perhaps at some point, I have to track some of them. I saw that there is a database of them, and that it has an id. However, from lua, I try to access that value, and it seems to not always be the same. Am I making some mistake?
local vehicle = character:getVehicle() -- BaseVehicle
local vehicleGetID = vehicle:getSqlId()
From now on, any help is welcome. There is another method, but it didn't work for me either. I'm on build 41. Thanks.
Thought so. Something about this doesn't seem exact tho.
You need a persistent identifier ?
Actually nevermind, it appears correct. Thanks all!
Yeah. I need to identify the vehicle, in case someone takes it, to have a record and be able to search for it on the map. I would need the ID to be unique, however, I get different results within the same game.
I'm making a log, to know, if someone takes a car, to keep a record, and to be able to know where they leave it.
the sqlid is the one i would expected to be persistent
that's its id in the vehicle database so it'd be strange if it changed
if it really isn't for some reason you can just attach a randomly generated id to the vehicle's mod data
I'm using it and it returns different results. It's strange. I assumed the same. That it would take the ID of the table, and that it would not change.
I need unique information that identifies the vehicle. I have already identified the player. Then, I would need to see where the tow cars action is called, so I can maybe add a triggerEvent or something custom.
Although I don't know if triggerEvent can be created or just invoked.
you can register events with LuaEventManager.AddEvent("myEventName")
Thanks.
Does the method executeQuery of the GlobalObject, does it work in build 41? https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#executeQuery(java.lang.String,se.krka.kahlua.vm.KahluaTable)
try getId() instead of getSqlId() - I'm not certain that is persistent between restarts but it's worth checking. Same for keyID()
Thanks. I'll try it.
I wonder if SqlId is like the place I worked at where they insisted there was no need for an ID field on the excel sheet of tasks because they could just reference the row number and then got really confused when references to "item 67" stopped making sense because rows had been added/removed.
I'm looking at the possibility of adding some extra fields, because for example, I don't have information about the car model. Just the ID, and the position.
Log towing info too or people will steal cars via towing,
yea, sqlid is a perfect name btw xD
int allocateID() {
synchronized(this.m_usedIDs) {
for(int var2 = 1; var2 < Integer.MAX_VALUE; ++var2) {
if (!this.m_usedIDs.contains(var2)) {
this.m_usedIDs.add(var2);
return var2;
}
}
throw new RuntimeException("ran out of unused vehicle ids");
}
}
void setVehicleLoaded(BaseVehicle var1) {
if (var1.sqlID == -1) {
var1.sqlID = this.allocateID();
}
assert !this.m_loadedIDs.contains(var1.sqlID);
this.m_loadedIDs.add(var1.sqlID);
}
No wonder things broke when I spawned the 2147483648th car
Holyyy crapoli, where'd you get this? This is wonderful.
Asked in the mapping Discord
I appreciate it so much. Thanksss.
I have 0 clue why, but my Lua file just stopped being detected by the game. I had to delete the entire file and copy and paste the contents back into the mod files to get the mod working again. I've changed nothing LOL
Also does anyone know if the MapSymbolDefinitions file can actually be used apart from the standard array? I keep trying to put my own code in to condense this massive file down, but the game refuses to read it properly and I can't figure out if its because of my inexperience with Lua or if I have the files in the wrong location cause I'm new to modding Project Zomboid or if its another thing entirely.
can anyone do a custom vehicle mod for me ?
Can't get my seeds icon to appear in the sow menu... not sure how exactly to reference the icon
farming_vegetableconf.props["Marijuana"] = { icon = "common/media/textures/Item_weedSeeds.png",
What I have it on right now, I've tried without common, I've tried just "weedSeeds" and "Item_weedSeeds" but can't get it
Apparently the code tracks a variable to that determines how well Zombies can keep their spending within their budget goals. 😂
Or maybe it's late and I just stared at that for too long because CamelCase woudl have been far more obvious.
is this not Zombie Scan Budget?
🤨
No, It's ZombiesCanBudget.
why tho 😭
Because I'm in a stupid mood after fiighting with $@#^@#^ ossec all day trying to write on tiny little simple #$%!@%rule
In other news, I think my munitions mod is just about ready to release
Fun fact, molotovs, and fire crackers are the only bombs that need a lighter in your off hand. Not just any sort of firestarter, only items with the "Lighter" tag
One of the things I'm changing ofc. Cuz why couldn't you use a match in this situation?
or a lit candle?
I'm also making it so the normal pipe bomb requires something to light it, and adding in a separate version that has an electric igniter.
The electric version is required for crafting the timer/remote versions.
There's a recipe to craft the electric version directly, and one to just add an electric igniter onto an existing pipe bomb
Aerosol bomb is gonna basically be a weaker pipe bomb that causes small fires.
Not really sure what if anything should be changed about the firebomb/molotov/smokebomb so they're relatively unchanged
Main difference is they are actually in loot tables now
Are the recipes to make them more available? I think right now one of those is strictly behind a profession choice
Add The Anarchists Cookbook to loot tables with all the explosive recipes
They spawn as loot, and I added the ability to reverse engineer them :)
There's also a military improvised munitions handbook which includes recipes for all of them 👍
The anarchist's cookbook is a joke, most of the "recipes" are incomplete and don't use actual measurements
It's more of an edgy book than anything
the handbook I've been researching has proper recipes, measurements, and procedures for making propellents and primers
Also adding in a can bomb, which you can craft from tin cans/water ration cans, propellent, and scrap/nails
craftRecipe MakeCanBombNails
{
timedAction = MakingElectrical,
Time = 100,
NeedToBeLearn = True,
Tags = AnySurfaceCraft,
category = Electrical,
inputs
{
item 1 tags[Primer],
item 1 [Base.TinCanEmpty;Base.WaterRationCanEmpty],
item 3 [Base.Nails],
item 10 tags[Propellent],
item 1 tags[Binding],
}
outputs
{
item 1 MunitionMag.Canade,
}
}
craftRecipe MakeCanBombScrap
{
timedAction = MakingElectrical,
Time = 100,
NeedToBeLearn = True,
Tags = AnySurfaceCraft,
category = Electrical,
inputs
{
item 1 tags[Primer],
item 1 [Base.TinCanEmpty;Base.WaterRationCanEmpty],
item 1 [Base.IronScrap;Base.BrassScrap;Base.AluminumFragments;Base.GoldScrap;Base.SilverScrap;Base.SteelFragments;Base.Aluminum],
item 10 tags[Propellent],
item 1 tags[Binding],
}
outputs
{
item 1 MunitionMag.Canade,
}
}```
It's basically the same as an aerosol bomb, but requires something to ignite it and has a smaller explosion radius
recipe will probably change a little bit before I release it
The only bomb in vanilla that isn't profession locked is the molotov.
Though in vanilla you can actually find randomized schematics to unlock the rest of the bombs. (I think this is exclusive to B42)
I decided it's not actually gonna include the
Aerosol Bomb
Fire Bomb
Smoke Bomb
This is because I'm basing it off of a real life book.
I'm also making it so the veteran profession knows how to make normal pipe bombs, and can bombs
Electrician will inherently know how to add an electric igniter to a pipe bomb, and will also be unlocked automatically by electric level.
Engineer will know all of them inherently
All of this together means you could start as any profession, find a pipe bomb in the world, reverse engineer it, hit level 4 electric, turn a pipe bomb into an electrically ignited one, and then reverse engineer that to unlock the recipe to directly craft them instead of just adding it on afterward
Or start as a veteran and get level 4 electric, craft a pipe bomb, add an electric igniter, and then reverse engineer it
Oh yeah I also made it so bombs can be put on your belt, and added in "triggerExplosionTimer" to pipe bombs to make them explode faster.
I found it very awkward to throw a pipe bomb and have it sit in the air for a long period of time, so I took "triggerExplosionTimer" from the aerosol bomb and added it to the pipe bomb and can bomb
Oh and uh, noise makers are buffed too. forgot to mention those
Oh yeah I also made it so bombs can be put on your belt,
Please tell me nothing stops you from putting them back on your belt after starting the timer...
default duration is half an hour in game, increased to an hour and a half
default range is 17 tiles (an alarm clock is 15), increased to 120 tiles
Not sure what you mean by starting a timer?
Noisemakers defiitely needed a buff, in vanilla thy were terrible.
Yeah 120 tiles seems dramatic, but why would you use the resources to make a noise generator when you could fire a single pistol bullet and have a much further draw radius
- remove pipebomb from belt
- activayte pipebomb
- change mind. draw another weapon, replacing pipebomb.
4)... - BOOM
I don't think you can activate the bombs without placing down or throwing them
120 tiles is ~1/3rd the area of a shotgun. Seems fine.
And rewards people for preparing & using tactics.
draws attention for an hour and a half before needing to be picked up and reset
I think they're infinitely reusable, don't know if I can change that in some way
I think it's fine given the commitment required to get to that point in the first place
Hey now that I'm thinking about it
why can the fire bomb be used without without something to ignite it? while the molotov needs something to ignite it?
isn't it just alcohol vs gasoline? I don't think gas explodes on impact in a plastic bottle?
also I hate that the flame bomb is in a plastic bottle... gasoline melts most plastics
It's not safe to put gasoline in a water bottle
If you're really keen you can make a device you throw, and on impact a glass bit breaks a and a chemical reaction ignites it.
Would it still be active for an hour and a half tho is the problem
This woudl be suicidal the way we run/climb/fall/bet in melee in zomboid.
But you coudl do it.
I mean the aerosol bomb recipe kinda implies we already do that
honestly, no idea... on a quick look I'm not seeing how the noisemaker works, unless the sound is defined to last for 30 minutes
I'm just gonna make the normal version require an igniter
I think it would still work, cuz the smoke bomb makes 10 in game minutes of noise while not being reusable
Maybe firebomb is meant to be a fuel-air explosive?
i wouldn't take the recipe too literally, that recipe hasn't been changed since the game had about 5 items in it
so it has a small amount of explosives and an electical trigger to spread the fuel and then create a big airburst with resulting pressure-wave
that is also a very good point!
hahah
I will take every recipe literally and you can't stop me
So they wrote the recipe 20 years ago and never looked at it agian because explosives are horrible and no-one uses them. That seems likely.
I'll just do what I did to the pipe bomb, vanilla version needs igniter, and then a new version that doesn't need one cuz electric ignition
Also how does the smoke bomb work? does it burn the rag, and react to the cold pack to create smoke?
is it technically steam?
steam from the steamed clams we're having
Ah no I think it actually reacts to the paper burning?
Possibly not, looking at the java if it's not reusable it is removed after it explodes which deletes the isoobject so that may also kill the sound being updated.. you'd have to test to make sure.
idk either way, needs an igniter, vanilla doesn't have one
I'm also curious so I asked to GPT and
If the game assumes that the cold pack contains ammonium nitrate, and you combine it with rags/newspapers, the idea might be that the pack is broken open and the reaction starts to heat up the rags, causing them to smolder and produce smoke.
idk anything about chemistry so idk
Maybe I could just increase the explosion duration time then
As the smoke bomb has an explosion duration of 10, which is how long the sound lasts
in this video we make pull pin smoke grenades without using potassium nitrate their is no cooking involved they work very well and are easy to make. This smoke grenade does not include KNO3+Sugar
Instead of the KNO3+Sugar this smoke grenade use an instant cold pack that and paper.
WARNING: DO NOT ATTEMPT WITHOUT WEARING GLOVES - AMMONIUM NIT...
It's not as strong as what we see in game obviously, but it's functional in the same way
oh interesting vid
Still, would need an igniter, which in vanilla it does not use one
It's weird how molotovs are the only bombs that seem to have gotten any attention, probably since they aren't profession locked
"oh nobody uses the other ones, let's just work on the one people use"
Nobody uses them because they don't get worked on

true
it's funny that we need at least 5 pipe bombs to kill a single zombie
i think they know there's nothing short of a complete overhaul that would get people to use them
that should be true too. it's just not started yet like vehicles i guess.
I feel that's not entirely true, they could easily increase the damage of the aerosol/pipe bombs and they would immediately become more viable
Would give an alternative to horde clearing that doesn't involve a campfire
It is nice though that they are no longer profession locked in B42
but relying solely on some random schematic RNG doesn't sound great
did they change the skill requirements at all
it's one hell of a combo of profession lock + needing high levels in a useless skill + they feel terrible to use + they're shit
for what?
any of the engineer bombs
The recipes don't have level requirements, at least not the basic ones
noise maker requires level 3 electrician, and auto learns at level 7
did they have skill requirements in b41 or did i misremember that?
If you mean the ability to add the triggers n' stuff, yeah those are still pretty high
Adding a tier 3 sensor to a bomb requires....
electrical 6
same with a tier 3 remote controller
The bombs themselves just need the recipe tho
Not really sure why putting the sensor/remote trigger on the bombs requires the same electrical knowledge needed to actually craft them though
you'd think it would be a lot easier to know how to attach it rather than how to create it
Hello everyone! I have a question: I know how to translate one mod, but how do I create a collection of translations in one of my mods for several different other people's mods?
You should be able to combine multiple translations files together.
For example if mod1 has ItemName_XX
ItemName_Base.Foo = "Fooin",
ItemName_Base.Bar = "Barin",
}```
and mod 2 has ItemName_XX
```ItemName_XX = {
ItemName_Base.Wiz = "Wizin",
ItemName_Base.Zoom = "Zoomin",
}```
you can combine those to one file,
```ItemName_XX = {
ItemName_Base.Foo = "Fooin",
ItemName_Base.Bar = "Barin",
ItemName_Base.Wiz = "Wizin",
ItemName_Base.Zoom = "Zoomin",
}```
Is there an event that can be triggered before the game saves or closes?
Helloo, I am new to modding the game and need some help with it. I have created a mod with the right structure, as following:
MyMod/
│── media/
│ ├── lua/
│ │ ├── client/
│ │ │ ├── MyModFile.lua
│── mod.info
│── poster.png```
My mod info File looks like this:
name=My Mod
id=MyMod
poster=poster.png
description=XXX
version=1.0```
And the folder for the mod is located under users/myUser/Zomboid/mods/
Unfortunately the mod doesnt show up in the game. I am using the latest unstable build. Does anyone know what exactly I am missing out? Thank you for your help in advance
OnSave I believe
B42 ?
Yes
Thank you so much, this seems to be the issue. I will try it out 🙂
Worked, I can see my mod now in the game. Thanks again for the quick help 🙂
thanks for your help, you are my hero!
😊
I have another question. So my mod is almost done, it's about healing zombification and wounds. It seems to work almost completly, it just can't heal lacerations and I don't know exactly where to find the method to remove it. This is what I have:
-- Heals all wounds
for i=0, BodyPartType.ToIndex(BodyPartType.MAX) - 1 do
local bodyPart = bodyDamage:getBodyPart(BodyPartType.FromIndex(i))
bodyPart:SetBleeding(false)
bodyPart:SetDeepWounded(false)
bodyPart:SetBurnTime(0)
bodyPart:SetScratched(false, false)
bodyPart:SetBitten(false)
bodyPart:SetFractureTime(0)
bodyPart:SetCut(false, false)
end```
I thought "deep wounds" would be lacerations, but unfortunately it's not. Does anyone know how to set lacerations to false?
its setCut. only SetBitten has a capitalized S. check the cheat panel lua code
Thank you for that as well, I looked now in the docs and yeah Idk I just thought they are all written capitalized
The last issue seems to be this:
local bodyDamage = player:getBodyDamage()
bodyDamage:setMoodleLevel(MoodleType.Queasy, 0)
I am confused with that tbh. The method setMoodleLevel doesnt exist in BodyDamage according to the docs. But somehow, it works and throws an error that tells me following:
function: CurePlayer -- file: CureZombification.lua line # 12 | MOD: Cure Zombification
function: onMouseUp -- file: ISButton.lua line # 56 | Vanilla
ERROR: General f:116, t:1740490781807> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: Object tried to call nil in CurePlayer at KahluaUtil.fail(KahluaUtil.java:82).
Stack trace:
Sorry for all the questions, it's my first time modding a game
Do not worry about asking questions, it's the only way to learn
i've never seen MoodleType being used before. are you sure that's a thing and not something that was imagined by Copilot or something?
Porting a mod from B41 to B42 and it seems the guns are flipped? Any idea why?
It really works, I have a save where I am Queasy due to zombification and when I press the "Heal" button, it removes the Queasy moodle and throws an error at that line. I guess that error is preventing the Laceration to be healed (I corrected the setCut() method already)
How would you remove a Moodle from a player object then?
Somebody please make a tile pack /mod to add more garage items to the game for b42 engine stands/displays,tire balancers ect.
Hello everyone! Is it possible to change a specific parameter of a specific clothing item's xml file while the game is running via lua coding? Specifically, I want to temporarily delete the xml paramter
<m_UnderlayMasksFolder>media/textures/Clothes/BulletVest/Masks_BulletVest</m_UnderlayMasksFolder>
which can be found for several vanilla clothing items (in my case, it is mainly relevant for bullet proof vests). Thanks for any ideas!
I will leave this here if anyone wants to finish this, i give up with my limited lua and api knowledge at this point. I disabled that crops are killed when you drive over them. The last thing to finish this is in AgroMain.lua line 176 filling the "seeItems" variable, there is something wrong there and AgroUtils.removeContainerItems(seedItems) fails to read it. Good luck 
it works because you're healing the wound, it throws an error on the queasy moodle because its not a real thing
Hey folks is it possible to add a sickness modifier to a tablet/pill? I.E you take Painkillers but overuse causes sickness?
First time trying to mod Zomboid (or anything haha), figured I would work on the medical system as I work in the sector, but been trying to figure out how to add sickness and modify the base player stats
Think I have a hang of the creation of new items using text, it's just causing increases in sickness/fatigue while still keeping it as a drainable item, just I notice when I fatigue is added to painkillers for example and it's drainable it doesn't apply, but if I apply it to antibiotics which has the food class it works
Don't know if its dependent on that?
Don't know what bip is used for attachments tho, I already tried seeing if it was effected by bip01_prop1
you can use setFoodSicknessLevel() in a script to add sickness when taking pills
its bip01 yea
Ah, haven't experimented with the scripting side yet, doing the project to to teach myself LUA and see if I can come up with something folks can have fun with
Thanks 🙂
bruh its gone
yes its bip01, thats what i use on the attachment
you can join the modding server for resources, i cant send the link it got blocked.
Where can I find the link?
https://discord (dot) gg/C24wzB5Q
amazing thank you!
Okay so which bip01_prop then
are u tryna put it on the back? if yes its not prop (this for handheld item), for attachment i use BackPack
What the fastest way to load your mod changes in debug mode?
Is there something different with the way semicolons work in B42 lua's?
probably not
There's no use to semicolons anyway
Remove them
do you guys know what this means
uh
I figured as much, but in one instance using one seems to be fixing a bug. No idea why yet.
it shouldn't be
in lua semicolons are just treated as whitespace
the only exception is they can take the place of commas in table initialisers
neither of these uses are common or recommended though
Yeah, it's really weird. Errors galore without, none with. I am half tempted to go back to Build 41 and see if the code works fine in 41.
Hey all, how do I find the correct X and Y to open a window center screen please?
something along the lines of
x = (getCore():getScreenWidth() / 2) - (your_UI_width / 2)
y = getCore():getScreenHeight() / 2) - (your_UI_height / 2)
fantastic, appreciate it
Assuming B42: What folder names are in use, (e.g: 42,42.0, etc) and what is in the mod.info?
I'm guessing something in mod.info is specifying what version of the game the mod is for.
Do you happen to know any off the top of your head that use this? Build doesn't matter, I just want to take a little look under the hood. My script is running fine but the items refuse to spawn and I'm not sure why.
Different process, but Excalibar adds a number of fixed spawn via lua.
It does some stuff to build a table of things to add, then calls this via EventsEveryTenMinutes:
P4Excalibar.CheckSpawn = function()
local spawnReserves = P4Excalibar.getSpawnReserves()
for k,v in pairs(spawnReserves) do
local square = getSquare(v.locx, v.locy, v.locz)
if square then
if v.item == "Zombie" then
local crawler = true
local isFallOnFront = (ZombRand(2) == 0)
local isFakeDead = (ZombRand(2) == 0)
local knockedDown = true
spawnZombie = addZombiesInOutfit(v.locx, v.locy, v.locz, 1, v.outfit, v.femaleChance, crawler, isFallOnFront, isFakeDead, knockedDown, false, false, 2):get(0)
if not isFakeDead then
spawnZombie:setHealth(0)
spawnZombie:DoZombieStats()
end
else
local spawnItem = square:AddWorldInventoryItem(v.item, v.x, v.y, v.z)
spawnItem:setWorldZRotation(v.r)
spawnItem:getWorldItem():setIgnoreRemoveSandbox(true)
spawnItem:getWorldItem():transmitCompleteItemToServer()
end
spawnReserves[k] = nil
end
end
end
So it's just checking if each square is valid (presumably they will only be valid if close enough to be loaded) and if so, spawn something (item or zombie) and remove the entry from the list of things to spawn.
That is beautiful. Hmmm. I will absolutely be taking this into consideration. THANK YOU! 💚
It's a great mod too, if you want a bit of fantasy "assemble the artifact from multiple pieces" questing.
If a vanilla file declares a local variable like this, is there any elegant way to change it? Or do I have to patch every function that uses it?
there is no way to change it
Oh well. Patching functions it is.
...or I just edit my local copy of the file and don't make it a proper mod.
Current WIP of craftRecipe
https://pzwiki.net/wiki/CraftRecipe_(scripts)
This should help people who requested a proper guide on craft recipes
I'll try to finish it tomorrow :)
We (I) need a tiny mod that locks the inventory windows in place. But I lack the skills required to make it.
Wdym ?
The inventory windows. I keep dragging them by accident while dragging items around quickly.
I'm gonna be honest, no one will make your idea unless you do it yourself
Most mod ideas get lost
The miniature health bars mod has a locking button so you can't do that. It would be super nice if it was there for inventory windows
That are thrown here at least
I'm just throwing it out there.
I lack time to learn. Hopefully someone sees it and agrees.
Every modder has a huge pile of high-level ideas, then gets distracted and does something else instead.
I used this inspiration to use spawnReserves and it's working flawlessly. Not even a hitch in lag; billions of times better than loadGridsquare... now if only it would actually spawn my object. That's what has been fighting me the most today.
I guess there might be an issue if EveryTenMinutes isn't often enough and the player can load the area and reach it before items spawn, but for Excalibar that's plenty of time... the spawn locations are things like "inside Rosewood prison" or "lowest level of the secret military base" and you're not getting to those places quickly.
in build 42 you can check to spawn things during loadchunk
if done properly it's exactly as effective as loadgridsquare but literally hundreds of times more efficient
anyone kknow where I can learn how to add new base models from CGtrader
Do you mean spawn a vehicle, or add a new type of vehicle to the game?
I messed up i edited the message sorry
no probs, I do that constantly.
is it hard to do ? can i just get a model from cgtrader and script it in game or do i need to poly crunch
What is the model for? item, clothing, vehicle, other?
Yeahhh, it's probably going to have to be faster for me. Especially concerning how many places it will involve.
But I am thinking a 60+ tick interval (minimum, probably more).
You'll need to make a new vehicle, not just load in the model
and if you want to actually put cars on it... good luck.
i mean there already a mod to put a car on a trailer, cant you piggy back off of that mod.
also why make a new vehicle from scratch if you can buy the base model work off of that
A vehicle is more than a model
it's a bunch of data on parts, mechanics interface, stats etc.
Not hard to do, at least if you can use an existing mechanic template instead of building a custom one because that looks super fiddly.
yea similar to gtav adding modded vehicles
I suggest getting the model (or a free placeholder) and giving it a go.
ik this dev he a really good dev everything is broken down etc
btw idea is actually nice. I like that
got a link to that mod? I'm curious how they do it.
I wonder if they just put the car on top of the trailer and hope it stays there 🤔
Ah, that makes sense - sounds similar to animal trailers, the vehicle is no longer a physical object in the world but can be respawned near the trailer.
there a vid of him doing it also
I think its not something easily possible but Since we have similar thing,the Animal trailer, it can be implemented if we give up the 3d models
yeah
everything doesnt have to be like u lower the rams and drive it on just a hauler to haul more cars
then change the trailer model to add the cover, add weight, done.
You could almost certainly scale that up to a bigger trailer with multiple vehicles.
i dont care about adding the cover just want someone to mod the car carrier in game
Alternative approach: https://www.youtube.com/watch?v=gM7jCBlxhzg&t=5s
i thought it not hard to add ?
And that mod also has issues where the cars despawn. Just a heads up. It's a tall task to do a mod like that, let alone a full carrier.
end of the day its worth
Think about it this way: you're not just adding a new vehicle, you're adding new features/capabilities that are not in Vanilla Zomboid.
I've been forking a B41 mod for the last 2 days and it's been hell. All I'm doing is expanding upon existing framework, too. So it's gonna be a lot of days to end before it's worth it lolll.
Honestly, it's a good idea but don't start with a focus on the model - just use a minimal model and build a proof-of-concept mod
okay but forget about adding a new script rn just want to get the trailer in game first, if there are 18 wheelers with living quarters i think this is not far off
Even if that means a big flat rectangle that gets other rentangles added on top as cars are added.
That much will work easily - you can look at the existing big trailers.
AFAIK any living quarters type stuff is from RV Interiors, which is B41 only... I don't think anyone has been crazy enough to reproduce that when they could just make use of RV Interiors for more vehicles.
Hi all! How's going on?
I've a question regarding pz modding. I'm trying to achieve server-side mods. Is is currently possible in the dedicated server to specify server-only mods in any way? I didn't find anything tbh.
I was thinking in patching the NetChecksum class to skip files in media/lua/server, so I can ship the mod without the server files, but dunno if the game needs the server files for anything at all.
Thanks!
What do you mean by "server side mods"?
Mods that are on the server but NOT installed by the client?
Yeah
well first thing first. I just want to get the hauler scripted in game who can do it. and what needs to be done ? if i need that base model first
done 1st step complete. ik there alot of steps but baby steps first
who can do it
You can!
i dont know how to mod pz
let alone add modded vehicles dont i need to poly crunch it and add the paint etc
You don't know how to mod pz yet
the modelling/texture side I can't help with, but if you look at existing vehicle mods you'll see it's justa bunch of text files to define things.
https://theindiestone.com/forums/index.php?/topic/28633-complete-vehicle-modding-tutorial/
this doesnt help me much
Hello and welcome to my tutorial. It covers full workflow of vehicle creation for PZ. If you are a complete beginner in 3D modelling, you'll have to watch/read additional tutorials, I won't cover every aspect of model creation and 'where this button is located'. I divide vehicle creation in these...
Where are you getting stuck?
it not getting stuck i just need the PZ basics for adding NEW modded vehicles, do they have to be broken down in categories. what the poly count they need to be etc that i have not done in a minute bc pz is a bit different then gtav
When modding in lua, it is necessary server and clients have the mod enabled. But you can still manipulate things on server-side only
Have a look at existing models, use whatever they do as guildelines.
I'm trying to find a way to not share some server files
will that trailer work from cgtrader or no im sure that how others got there vehicles
i can use cgtraders tho correct ?
for most mods that would actually work server-side you don't need to do anything complicated like that
you can just have a lua mod that pulls and loads lua files from the sandbox folder
If you can load it into blender and export as a .fbx you can use it, but that doesn't means it's a good starting point - if that image you posted is of the model it's massively more detailed than what you want for zomboid.
there's already a couple executions of this concept floating around
Oh, so is it possible to require() outside the mod folder? Interesting
i'm not really sure what they're called though
no, but you can read the files as strings and load them
That's a great hacky workaround
yea ik that bc the poly is at 38k bc his models are hq ik it wont look like that, but i can find one lower quality or polycrunch it i just need to know what the poly crunch limit for vehilces and ther no vehicles to download to look at
this is not possible with mods which are officially supported by the game. though not sure about java mods or what happens when you directly manipulate the pz lua files in pz's installation folder (the latter is pbbly not a good idea).
Through java modding anything is possible... at least in theory. A lot of stuff is impractical.
Yeah, I was thinking on patch the NetChecksum class to skip server files tho
What do you mean there are no vehicles to look at? there are lots of modded vehicles.
okay can i message you on the side or someone else that knows about importing a new vehicle like this ? trust i want to learn but i rather not asking alot if im not talking to the right person ?
Check the #modeling channel, or ask again here in a while and see if other people are around who do vehicle modding.
otherwise, java mods can run serverside regardless because there is no java checksum, and pretty much anything else wouldn't work without a client mod anyway
alright btw i did manage to find a download for a vehicle looking at the script now doesnt look like alot of lines just want to do it right. thank you tho
also asked in tsar discord and k15 hopefully i can get one of them
FYI: you can see the code for any mod, get the mod id from steam workshop:
downloaded content is under your steam installation, game id 108600
oh, maybe a misunderstanding? I thought I just replied to this question: "I'm trying to find a way to not share some server files". Not related to vehicles
Sorry, my fault - I got the conversations crossed
Hey people, i just made a Lifestyle addon of 20 tracks for the Keytar. Anyone interested, i can stream some of the tracks before you try too.
i asking a little technical question for anyone out there, is actually any way to give the player more hp? (not imortality just more health, so can bleed or get hurt more before death) i was triying to make gunfights a common thing but its hard to enjoy them cus how easily it is to die of a shot (i know its unrealistic) im just asking if is there a way trough lua scripts to do such a thing, so that players may survive and heal back up after a fight
i looked up mods and conversations on this chanel and i didt find anything
the best feeling in existence when you are modding recipes
literally what I am doing right now and I hate it so much
Hello, I've been looking to commission a mod on reddit. I've been contacted by a guy that was very enthusiastic, but the more we talk themore he sounds like a LLM, so before the discussion blows and they start harassing me for money, I thought I'd ask here:
I want a mod that records the amount of zombies in a chunk when the player enters it (or spawns when the game starts), and when he leaves that chunk, the mod compares the stored amount to the current count to see how many the player has killed, and deduces a small (custom) proportion of the killed amount from the chunk's maximum population (and records the amount of the newly entered chunk to do the same there). Is that possible at all?
Alternatively, when the player kills a zombie, that zombie's starting chunk has a small chance to get its max population lowered by 1. Same result, different way to do it. No clue of the inner workings of the game so I can't judge on the relative difficulty of either implementations.
before the discussion blows and they start harassing me for money
boy that didn't take long
that's an absurd amount of money 😭
this is little off topic but
if you are looking for commission, you can also visit here: https://discord.com/channels/908422782554107904/1121918795385163948
Tbh I offered 30/h + 50 base, max of 500. That's what I pay for textile work....
Yeah it shows as # unknown and I can't open that link.
can't you click it too?
sry i mean, Albion's
I can click it, it says I don't have access.
What's the channel name, not as a link ?
pz modding community thread in #1019743790178762812
there's community_recruitment ( #1019743790178762812 ) channel and you can search for "modding community" then you will be able to find this post.
In the modding community discord, there is a request channel so you can ask for a paid commision.
i wish the console would tell u everything wrong with the code at once instead of giving it to u piece by piece as u crack down errors
im at my work 🤣 they want to check IE compatibility
monkey's paw curls you now get full java logs, so every error is 2000 lines of recursive stack traces.
Probably works a job where they still have apps that only work with IE6.
it's not really possible for it to give accurate errors for future code, since everything's already messed up from the first error
can lua do try/catch blocks?
they have pcall to call functions in protected mode but it doesn't really work
in zomboid anyway
googles "For many applications, you do not need to do any error handling in Lua." HAHAHHAHAAHAHA
They wrote that before seeing my code.
the error handler literally doesn't care if you pcall and shows a red error to the user anyway, and for some reason they made all function calls protected so all pcall does is double the overhead
you'll notice errors don't propagate upwards in pz
I guess that means the lua calls made from java are already pcalls (or equivalent)
pcall is useful in the very niche case where you specifically want to get the error since that part still works
i hate exceptions anyway so it's not a big deal to me
Just have to add "if foo~= nil" checks everywhere.
and errors not propagating upwards by default is pretty merciful since otherwise mod errors would be way more brutal
since something being nil instead of what I want it to be is probably 98% of the lua errors I generate at runtime.
i'd say nil checking is a better solution than try/catch blocks
but you can technically do this with pcall if you're crazy
does zomboid make other player data inaccessible beyond a certain distance (or does the client unload the player)? I'm trying to make a player compass mod for something like manhunts, but beyond 100 tiles from another player, their position stops updating and stays fixed at their last "close enough" position.
Good question - how is your code getting triggered, and how are you checking the player location?
Since the server has to know all the players I'd expect attaching to an event like EveryTenMinutes and recording player location should work, though I'm not sure how to share that with clients.
It's through the context menu on a specific item, which then populates with submenus for each player:
-- all hooked to OnPreFillInventoryObjectContextMenu
local onlinePlayers = getOnlinePlayers()
for j = 0, onlinePlayers:size() - 1 do
local p = onlinePlayers:get(j)
subMenu:addOption(p:getForname(), p, findPlayer, p)
end
findPlayer then gets their position like so:
target = player:getForname()
targetPosX = player:getX()
targetPosY = player:getY()
ourPosX = getPlayer():getX()
ourPosY = getPlayer():getY()
distance = math.abs(math.sqrt(math.pow(ourPosX - targetPosX,2) + math.pow(ourPosY - targetPosY,2)))
angle = math.atan2(ourPosY - targetPosY, ourPosX - targetPosX)
I'll defer to anyone with more mulitplayer modding experience.
can anybody help me out real quick?
I added a ammo type to my game, but I want two bullets to give my modded gun 20 shots, anybody know how this can be done simply?
You will need to do some lua scripting
The default is every bullet item becomes one bullet in the gun
Hey guys, im having issues with lua, specifically with the context:addOption
this is my code
context:addOption("Spawn a BoZo", nil, spawnBossZombie)
but i get the error on the screenshot, ive been going thru this for hours and cant seem to find the solution
If you download this mod you will see it patches pretty much everything related to putting bullets in guns, so you'll at least know where to look. https://steamcommunity.com/sharedfiles/filedetails/?id=3408420806
Would it be possible to remove a context option when in an area? I want to remove the sledgehammer destroy option while in the redstone bunker
you can look in the wiki
@Kraz yes. Add your own function to the populatecontext menu, check if "Destroy" is a existing context menu entry, do you check and choose to remove Destroy if appropriate.
isnt this for adding a new UI? im just adding an option to the right click menu
thats already it
You're using ISContextMenu:addOption(), thats one of the things on that wiki page
Ok ill be going through it, thanks
@Kraz see Removing options on the same wiki page
Given an ItemContainer as parameter, I want to find the outer most container it is contained within so I can get its location aka square.
ItemContainer:getParent() always return nil with backpacks. This works with moveable and player inventories, but not for item inventories such as backpacks.
Any ideas on how to get the location of a backpack?
@copper abyss ISReloadWeaponAction:loadAmmo() is the function you want to look at, particularly self.gun:setCurrentAmmoCount(self.gun:getCurrentAmmoCount() + 1);
Add a prefix patch to the function that adds an extra 9 bullets if the weapon type is your gun.
(with safety checks to not overfill)
Thanks I had a look, is there a similar page that details how to get the players location
AWESOME
ty so much
I know its a strange request
Sorry I'm barebones in lua
but my modded gun is also- very strange
What sort of gun is it? We've had discussions of very weird gun ideas here before.
Nice.
welll its a fictional firearm that I'm suprised hasn't been made yet for this zombie game lol
theres a gun like that on a b41 map mod, i forgot what it is
Do you mean which slot it is equipped in?
back/fannypackfront/primaryhand/etc?
tho its not lootable, only can be spawned through debug
No, location, as in game world xyx or square object its on.
Only thing I'm sure of is you first check if it is equipped and if so use player location, if not equipped... not sure. Likely something to do with the square it is on.
what does getSquare() give you?
Backpack within another backpack or within a moveable container. Backpack on a floor is still within a container.
I thought Id be able to get its square location by using ItemContainer:getParent():getSquare() like you can everything else.
That would be too easy.
it doesnt inherit that method
declaration: package: zombie.inventory, class: ItemContainer
declaration: package: zombie.inventory, class: ItemContainer
B41?
But that's B42, because I forget there is still B41
Yup, working on a MP project
Damn, you get access to that in B42 at least.
yeah then there's no getSquare I believe
public IsoGridSquare getSquare() {
IsoGridSquare var1 = null;
ItemContainer var2 = this.getOutermostContainer();
if (var2.getVehiclePart() != null && var2.getVehiclePart().getVehicle() != null) {
var1 = var2.getVehiclePart().getVehicle().getSquare();
}
if (var1 == null && var2.getSourceGrid() != null) {
var1 = var2.getSourceGrid();
} else if (var1 == null && var2.getParent() != null && var2.getParent().getSquare() != null) {
var1 = var2.getParent().getSquare();
} else if (var1 == null
&& var2.getContainingItem() != null
&& var2.getContainingItem().getWorldItem() != null
&& var2.getContainingItem().getWorldItem().getSquare() != null) {
var1 = var2.getContainingItem().getWorldItem().getSquare();
}
return var1;
}
this is getSquare() for inventoryContainer since B42
A horribel idea: what if in B41 the square stores containers, but those containers have no link to the square?
maybe you can tweak that for B41?
Ill have to itterate through each square to find the container lol
hrmmm
ok made it work, now im having issues with local zombies = getWorld():addZombiesInOutfit(1, x, y, z, nil, false, nil)
I basically need to spawn a zombie, to later alter its attributes, thats the spawn line, it just jumps an error with no stacktrace
I don't think you need getWorld() for addZombiesInOutfit
ill try this
Ok it does spawn it, but how do i access it after it?
what do you mean access it? do you want to get list?
yes, im trying to alter its HP and other values
Could you please send me getOutermostContainer as well? I havent decompiled B42 yet.
addZombiesInOutfit will spawn zombies but also return zombie list which you spawned.
oops I was trying but forgot suddenly sure
Yeah, im getting and error prompt here local zombies = addZombiesInOutfit(x, y, z, 1, nil, 0)
let me get the exact error
public ItemContainer getOutermostContainer() {
if (this.getContainingItem() != null && this.getContainingItem().getContainer() != null) {
ItemContainer var1 = this.getContainingItem().getContainer();
while (var1.getContainingItem() != null && var1.getContainingItem().getContainer() != null) {
var1 = var1.getContainingItem().getContainer();
}
return var1;
} else {
return this;
}
}
oh wait the error is in the if
parents used for world object
for inventory item
use
getItemContainer()
Hello, good evening, I was trying to keep a record of the vehicles, but I noticed that the methods I am using, in both cases, change the value when the chunk is reloaded. The getID is supposed to change, but the strange thing is that the getSqlID also changes (when it is supposed to refer to the database ID). I don't know how to identify them, in case I lose any. Any suggestions? Thanks in advance for reading.
The strange thing is that it seems to add 10. Because it is clear how it says 11, and then 21. How it says 13 and then 23. I had not noticed that. But well, maybe those are not the methods I have to use, and on the contrary, there is another way to identify them.
Dude imagine if there was a mod where you couldn't see the percentage of batteries and you need a battery checker to check the percent 🤔 (this is a mod suggestion :3)
And make batteries spawn in with random charge levels
There is a sqlite3 database for vehicles. Finally, vehicles, in that DB at least, have an ID.
The strange thing is that the method called getSqlId() returns different results.
The method to access the battery exists. https://projectzomboid.com/modding/zombie/vehicles/BaseVehicle.html#getBattery(), however, it returns a VehiclePart. Then you have to identify the battery. Although you would have to check (perhaps), that the battery is installed, because if it is not, I don't know what could happen.
If I remember correctly, the VehiclePart can be accessed by index, but I don't know exactly which battery it is.
We differentiate them, but I see that they have the same name.
The getKeyId() method seems to always return a unique value.
I will have to use the method to identify the vehicles for now.
You can store zombies in a variable when spawning them in
heyyy.
alittle confused here
I cant get it to work
I'd suggest checking the various vehicle fields and also classes which are linked to that vehicle, check if they are persistent. The fields might have some stats or data of the vehicle which is persistent
Also
Are vehicles object pooled ? If not then the vehicle keeps the same class on reload
If so you can just do tostring(vehicle) and you will have an ID
Tho I doubt it tbf but who knows
I'll try it. But at the moment, the only value that seems to persist is the key value. But I'll see what you tell me. Thanks.

[2025-02-26 08:12:55] player: Pango. TP: /teleportto 12063,6874,0. vehicleGetFullName: Base.SmallCar. getKeyId: 97884626. vehicleGetEngineQuality: 34.
does getKeyId() give a unique, persistent result? I assume it's related to car keys matching up to cars.
Using modData to make your own unique identifier should also work.
Apparently. At least it is more accurate than the other 2 methods so far. I will have to test it.
Do you have any examples of that? I'd like to see it. Or any mods that use it.
Have yo done lua scripting before? What you want will need some lua code, since it's not possibel through just item configuration.
just alittle, this is the most I could really do, it works but- the reload wont happen for awhile unless the player presses shift, sometimes it breaks entirely.
it focuses LESS on the TYPE of ammo, and more on the actual gun
problem is, if I do it this way- it will only add +18 once the MaxAmmo is reached
Also, you're replacing vanilla functions so you're going to break other guns.
😭
Might be some confusion, I am hooking ISInventoryTransferAction:isValid() where you can pull the source and destination containers.
I am having problems getting the square an ItemContainer is located in when it is an item container such as a backpack.
It's OK, writing code that doesn't work is how you start writing code that mostly works.
Would it be possible to turn this channel into a forum? So that each topic is a thread. That way the conversations are kept separate. I think that would be a good idea, so that we can collaborate better.
idk how can i say this in english :/
First of all - does your gun have an item defined as bullet, and without any extra lua code does that thing get loaded in one-by-one when you press reload?
yes! I made a custom ammotype "Cold Cell Battery"
and also yes
The gun says it has 2 bullets, but
Does this mean you can actually shoot 20 times?
indeed, I want the gun to consume 2 bullets, but have a max capacity of 20
no, we're not there yet - rember in vanilla one bullet = one shot
I thought you wanted one bullet to restore 10 shots when loaded in?
yes 10 per cell, but 20 max capacity
2 x 10
2 cells consumed
problem is, whenever I try to code it so that it focuses on the ammotype, instead of the max capacity, the gun doesn't consume 2 cells, and instead just adds the amount of ammo I want if I have atleast 1 cell in my inventory
and irregardless of the way I go about it, whenever the gun is unloaded you end up extracting the current ammo amount that is in the gun..
so if you insert 2, you get 20 in the gun, unload the gun, and now you have 20 in your inventory lol