#mod_development
1 messages Β· Page 299 of 1
what's there?
it's in line 2
this is for B42 btw
cool, well how do i make that part into my recipe on.create code? as i said, im basically illiterate in lua
like i know there is a bunch of local commands and stuff
so im not sure how to put that in
oh, 42.. I'm sure for 99% that it should work for 41 but I'm totally not sure about 42. I'm waiting for stable build xd
function Recipe.OnCreate.KeepItemsInContainer(items, newContainer, player)
local currentContainer = items:get(0)
newContainer:getItemContainer():setItems(currentContainer:getItemContainer():getItems())
end
this should work i think
wrong reply oops
oh, :setItems, yea
yeah
doesn't work, but no errors
Im having a perplexing issue. I made a little voice pack mod, the local version worked fine, but ever since I uploaded to workshop both the local version and the version downloaded from the workshop brick my mod manager. Pulls up the stacktrace screen when I click on mods in the main menu.
it's breaking on local modId = modInfo:getId() and throws the error attempted index: getID of non-table: null
can u send the file?
like workshop link?
or u can send it as compressed rar to me
i'll check it out for you and see what i can find.
cheers man.
they can save u alot of time in finding bugs
its just weird cause it was working fine as a local mod, until I uploaded to workshop
like when u uploading the mod
huh, deleting the workshop.txt from the local copy fixed it. think i should just reupload??
Sorry to tag you again, but how do you deal with dependencies error when recompiling? I saw you mentioned in the chat history that you would put everything but the modified java file into a jar, and use the jar as dependency? Did I understand that correctly?
it looks like whatever you're getting modInfo from is returning nil
if you do something like if not modInfo then return end it should avoid the error but it depends on what the code is doing
For some reason reuploading the mod with a new workshopID seemed to fix it. I rly have no idea. 
steam moment
Also thanks for the guide on custom voice packs, spongie!!
yeah, though i've since realised there's no need to remove the file you're recompiling, java will just ignore it, which is slightly easier
you basically just need to make a new folder, copy every .jar file in the game directory into it, make every loose folder containing class files in the game directory into a jar (you can just turn them into .zip and rename), and then do javac -cp "dependencies/folder/*" "file/you/want/to/recompile.java"
these folders + zombie should contain classes
Thank you! By "class files in the game directory", did you mean everything in "zombie" package?
Or the classes shown in these directories as well
you need those directories too
Thank you 
Can I change how long a custom food item takes to be eaten by the player? Time : 50.00 does not work and I can't find any information on it
casually changing default options 
Full list of sandbox options that this mod changes without telling you
Starting day from 9th to 23rd
Zombie speed from Random to Fast Shamblers
Zombie Sprinter amount from None to Normal
Zombie Toughness from Random to Normal
Zombie Sight from Random to Normal
Zombie Hearing from Random to Normal
Zombie Population from 0.65 to 0.64999(Repeating)
Generator Spawns from Rare to Normal
Locked House Frequency from Very Often to Sometimes
World Item Removal list from Base.Hat,Base.Glasses,Base.Maggots,Base.Slug,Base.Slug2,Base.Snail,Base.Worm to Base.Hat,Base.Glasses
Time Before Corpse Removal from 216 to -1
Character Nutrition System from True to False
Recent Survivor Vehicles from Low to Normal
Vehicle Spawn Rate from Low to Normal
Chance Has Gas from Low to Normal
Initial Gas from Low to Normal
Locked Vehicle Frequency from Rare to Sometimes
General Condition from Low to Normal
Vehicle Alarm Frequency from Extremely Rare to Sometimes```

The ones that really confuse me are
Starting 14 days later than you normally would???
Sprinters going from non existent to being "normal"
Locked houses seemingly unlocking themselves??```
I installed this mod to make it so I can disable house raiders and make them wandering bandits instead.
I did NOT install this mod to add sprinters to my vanilla settings
Bad mod etiquette
wcyd
that's bizarre
i see what they did
they overwrote the lua files that define the prefixes with a bunch of bandits options for some reason
damn i was too late i just checked the mod and was about the point that out
but they removed all the original stuff so all options go to their code default values (which do not actually line up with the in-game defaults which are just the apocalypse preset)
they should be able to fix it by doing something like this right?
local apocalypse = require(Sandbox/Apocalypse)
apocalypse.Bandits = {
...
}
I'm making a VHS movie mod. Aiming to have like 100+ movies altogether. Im wondering what yall think of the captions: too long/short/boring?
Heres one:` Groundhog Day (1993):
Bill Murray as Phil Connors
Andie MacDowell as Rita
Chris Elliott as Larry
Comedy / Fantasy
"It's February first, Phil. You know what tomorrow is?"
"It's a cute story."
"He comes out, he looks around, he wrinkles up his little nose, he sniffs around a little, he sees his shadow, he doesn't see his shadow -- it's nice."
"Many people like it"
"Many people are morons."
"You know what's wrong with you, Phil? You're selfish."
"You don't have time for anyone but yourself."
"That's what I'm trying to tell you. You don't want to be with me. You can do better."
"Okay, campers, rise and shine, and don't forget your booties because it's COOOLD out there today!"
"It's cold out there everyday. What is this -- Miami Beach?"
"Sorry, ladies and gentlemen, but it looks like it's going to be a long winter."
"Awwwwwww"
"We're closin' the road. Big accident up ahead. Blizzard movin' in."
"Nice going guys. That's yesterday's tape."
"Think it'll be an early Spring?"
"Didn't we do this yesterday?"
"Don't mess with me, pork chop. What day is this?"
"I'm not talking about last year. I'm talking about today. I lived it before."
"I shaved my head last night, today its all grown back."
"Last night I got completely loaded and drove head-on into a police car."
"Rita, if you only had one day to live, what would you do with it?"
"There's only one way out now. Just remember⦠we had a wonderful day together once."
"Jake! Call the police, and get the word out. Somebody kidnapped Phil."
"Let's go! Phil just snatched the groundhog!"
"I'm A god. Not THE God -- at least I don't think I am."
"I know all about you, Rita."
"I could never tell you this, but from the first minute I looked at you I wanted to just hold you close and be with you forever."
"I've been waiting for you every day for ten thousand years."
"I dream of you every night of my life."
"Are you always this jolly in the morning?"
"No groundhog! Rita! They're all gone!"`
so far I've made 14 such captions for movies
I have been trying to make a .lua that would allow me to have the effect of putting an item on the floor when it would otherwise insert itself into the players inv but i cant get it to work. (think crafting and foraging)
Things I have tried
-a .lua that ejects items with a specific tag from containers
--this one simply didn't do anything, so it might be doable but IDK how as im new to .lua
-a .lua that utilizes the new item breaking system from build 42, by breaking a debug item OnCreat, that drops the usable item
--it 1 wont drop its 'head' item innless its already in player inv, and OnCreate breaks it before it gets put in inv, and 2 keeps the original item in a broken form, insted of deleting
-making it so heavy that the player wants to drop it
--in foraging you can't pick it up and bring it into existence unless you have room in inv (and its janky)
I am extremely new to .lua so i might need a bit more explanation than most

Worked like a charm! Also I confirmed that they disabled rendering IsoPlayer objects (except for the one with the controller attached) entirely with the new FBO stuff
π
Old lighting can be toggled with the HOME button, it does show IsoPlayer objects again, but it's hella broken with the current translucent layer system
ProjectZomboid\media\lua\shared\items\OnBreak.lua
-- change to putting glass tile on the floor
function OnBreak.BrokenGlass(item, player)
OnBreak.HeadHandler(item, player, "Base.BrokenGlass", false)
inv = player:getInventory()
inv:Remove(item)
end```
Not sure how to do the rest of what you're wanting, but this is what the game uses to drop broken glass on the floor instead of putting it in your inventory when your bottle weapon breaks
I'm seeing what I can do with that
"Son, how high are you?"
"No Officer! It's 'hi, how are you?'"
what, even causes this?
Either your item is boned wrong or it's 100x too big (my guess)
Yeah fyi PZ's own 3D models are scaled down to 0.01 of their actual size
Because it's trying to start at one point but because it's so yuge, every vertice is spread 100x farther than they should?
i put "HCSM.MineableZone1" as something a OnBreak lua code would use, but in game it is saying "base.MineableZone1" which is not what i put
if item and item:getCondition() > 0 then
item:setCondition(item:getCondition() - 1)
end
end
function OnBreak.MineableZone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
inv = player:getInventory()
inv:Remove(item)
end
btw this is the file im talking about
Is ther a way to make it possible on table install {requireInstalled = Enginedoor,} to say only possbile if the enginedoor is of a certain itemtype, like sport for example?
question, how do i make an item spawn with it's drainable empty?
just wondering, can i use Β± for sandbox tooltip? I heard some special characters have a chance not to be shown.
The game uses UTF 8, that's all I know lol
Anyone know where code for the push part of shoving a zombie is? I'd like to replicate the ability to shove a zombie using an item but I am having trouble finding relevant code.
I have something for that actually
Give me a sec
-- Staggers the `zombie` based on a given `hitReaction` or determines it thanks to the `handWeapon`.
---@param zombie IsoZombie
---@param attacker IsoGameCharacter
---@param handWeapon HandWeapon
---@param hitReaction string
ZomboidForge.StaggerZombie = function(zombie,attacker,handWeapon,hitReaction)
hitReaction = hitReaction or ZomboidForge.DetermineHitReaction(attacker, zombie, handWeapon)
ZomboidForge.ApplyHitReaction(zombie,attacker,hitReaction)
end
This code is a replicat of the java sided code, tho I believe issues can arise or it's not perfect, but it does what base java does
At least for B41
thanks a bunch! i'll look it over
Either way you can find the original in the java
yeah i figure this should at least point me in the right direction
π
hmm.. sometimes OnFillContainer(Event) gives something else for container arg??
-- lua
local function randomBackpack_OnFillContainer(roomType, containerType, container)
print("CheckThis!: " .. tostring(container))
local backpacks = container:getItemsFromCategory("Bag")
local containers = container:getItemsFromCategory("Container")
-- console.txt
CheckThis!: ItemContainer:[type:Wallet_Female, parent:null] -- This is normal
CheckThis!: zombie.inventory.ItemPickerJava$ItemPickerContainer@16a72318 -- but sometimes, this is returned.
second on seems not ItemContainer, it's something like ItemPickerContainer?
how can I check for this, anyone have good ideas? i just want to skip checking when it's not ItemContainer.
i'm trying to make this work but it is not happy with me
its a bit funny that what i did went quite cosmically wrong, thats life when you are hacking things together that you barely understand π
Use instanceof
instanceof(container,"ItemContainer")
Returns true if ItemContainer
oops i forgot quotes in require
ive seen a few vanilla scripts dont use them so idk if it makes a difference but try it with this instead local apocalypse = require("Sandbox/Apocalypse")
that's one of how to use instanceof
I've been always wondering for this function π thanks a lot π
Yea useful when you can get multiple types of objects
before, it was throwing an eof error, now theres no error but equally it doesnt seem to change the values
ive literally just put in that though, does it need to be run from an event to work?
it should just work i think?
Can I change how long a custom food item takes to be eaten by the player? Time : 50.00 does not work and I can't find any information on it
unfortunately it doesn't seem to, maybe the sandbox presets were the wrong approach anyway
Hey, wondering if anyone can help me out here, Some containers only accept specific items, not sure if its only some mod containers but the container im asking about is modded and only accept logs/logstacks/planks and stuff, but i cannot find the code that determines what is allowed in that container. Does anyone know where/how i could find that? Ive scoured the mod and it seems to be something to do with the containers property but i cannot find any other information on it.
ah nevermind i think i found it XD
spent the last hour trying to figure it out before asking for help then i magically find it
does anyone know how to get the user-input text from ISTextBox when initializing it with ISTextBox:new(..., callbackFunc) from a function "callbackFunc"?
this .lua is in the shared folder, and is not getting recognized by the game
i have tried
replacing local function with function (in fact this was its normal state)
having it in other .lua locations
this is a example of an item that uses it
{
DisplayCategory = Material,
Weight = 1,
ConditionMax = 1,
Type = Normal,
DisplayName = Investigate Further,
Icon = important,
OnCreate = LowerItemCondition,
OnBreak = OnBreakMineableZone1DB,
}```
it cannot find local functions
"replacing local function with function (in fact this was its normal state)
"
do not name your function things like 'LowerItemCondition', this is insanely generic and the chance of another mod conflicting is very high
ok but no other mods were enabled, so fixing that wont fix the issue
so i fixed it being generic but i still need to fix that none of the functions are being seen by the game
make sure your file is loading, you should see its name in the console.txt
nvm I found the answer from callback func:
button.parent.entry:getText()
ok i found the solution to the first prob but now
inv = player:getInventory() is being flagged in game (DB mode) as an error, there is no error in console
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
player:getInventory();Remove(item)
end```
this gives an ingame DB error
```function OnBreakMineableZone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
inv = player:getInventory()
inv:Remove(item)
end```
does the same thing,
the console points at `inv = player:getInventory() ` or `player:getInventory();Remove(item)`, but does not say its an error it says `function: OnBreakMineableZone1DB -- file: debug_luaHHB.lua line # 16 | MOD: Hothead's random crapola mining-part` idk what that means though
can someone can help explain what's wrong?
https://steamcommunity.com/sharedfiles/filedetails/?id=3419268636
Inspired by "A stomp nerf mod" by nigel
(link to their mod)
This mod expands on the concept in build 42.
Trench Foot - Stomp Properties
Makes stomping zombies degrade shoes/socks based on the footwear stats, and your Maintenance/Tailoring Skill.
Also adds a chance to get foot pain from stomping without socks, and/or with broken shoes.
Socks are less likely to be damaged when wearing good condition shoes.
Trench Foot - Discomfort
Adds 0.1 discomfort to boots, nothing else.
Does category = "Retail-VHS ", determine if vhs' spawn in stores and not in houses? And if spawning = 0, will it prevent it's spawn?
Anyone know?
I think you will need to manually add the item(s) to world spawns.
Category is just for inventory sorting I think
i still need an answer for this but i also need a .lua that when triggered delays by a set time then triggers another .lua
and i don't know how to get ether
player:getInventory();Remove(item)
The error is ;
Does anyone know why this is causing the game to break?
craftRecipe ElectricLanternRemoveBattery
{
timedAction = DismantleElectrical,
Time = 30,
AllowBatchCraft = False,
Tags = InHandCraft;CanBeDoneInDark,
OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
category = Electrical,
inputs
{
item 1 tags[SupportCorps.Lantern_Electric;UsesBattery] mode:keep flags[NotEmpty;ItemCount],
}
outputs
{
item 1 Base.Battery,
}
}
craftRecipe ElectricLanternInsertBattery
{
timedAction = MakingElectrical,
Time = 30,
OnCreate = Recipe.OnCreate.TorchBatteryInsert,
Tags = InHandCraft;CanBeDoneInDark,
category = Electrical,
inputs
{
item 1 tags[SupportCorps.Lantern_Electric;UsesBattery] flags[IsEmpty;AllowFavorite;ItemCount] mode:keep,
item 1 [Base.Battery;] flags[ItemCount] mode:destroy,
}
outputs
{
}
}
its the exact same as the vanilla electrical recipes
even without the oncreate it doesn't work.
I guess ;]
its in other recipes and works completely fine
Check the logs then, I guess there should be a hint.
It depends on languages, no?
[Base.Battery;]
theres no need to include separator in that
i found out whats causing the crashing
its this
;UsesBattery
i put it in and it breaks the game
you specified SupportCorps.Lantern_Electric as a tag but that looks like an item
the game crashes if you specify a tag that doesn't exist
thats the item's name?
where do i put the item then?
also i changed a bit in the code
craftRecipe ELRemoveBattery
{
Time = 30,
timedAction = DismantleElectrical,
AllowBatchCraft = False,
Tags = InHandCraft;CanBeDoneInDark,
OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
Category = Electrical,
inputs
{
item 1 tags[SupportCorps.LanternElectric;UsesBattery] mode:keep flags[NotEmpty;ItemCount],
}
outputs
{
item 1 Base.Battery,
}
}
craftRecipe ELInsertBattery
{
Time = 30,
timedAction = MakingElectrical,
AllowBatchCraft = False,
Tags = InHandCraft;CanBeDoneInDark,
OnCreate = Recipe.OnCreate.TorchBatteryRemoval,
Category = Electrical,
inputs
{
item 1 tags[SupportCorps.LanternElectric;UsesBattery] flags[IsEmpty;ItemCount] mode:keep,
item 1 [Base.Battery;] flags[ItemCount] mode:destroy,
}
outputs
{
}
}
currently this works without usesbattery and itemcount
but it doesn't drain the lantern
so i can't access the insertbattery one
I hope we get access to the CombatManager at some point cuz I need to access a static method of it grr
What's the best videos/tutorials to watch before creating a mod?πΏ
Not anymore in Build 42, it's UTF 8 for everything, tho some UTF X or spme shit I don't remember for korean or chinese
how do you like make an item give u happines and stuff? without it being like a food or a book. So just some normal item u can use and when u do u get some stuff/something happens
cant figure this simple stuff for the life of me
What is the tigger that will cause the happiness gain?
You can add lua code there such as: oldHappy = player:getBodyDamage():getUnhappynessLevel() newHappy = oldHappy + 0.05 player:getBodyDamage():setUnhappynessLevel(newHappy)
It's only simple once you know how to do it!
if an item gets used, but im trying to make an junk item usable
What does "used" mean?
Right Click -> select a new context menu entry you will add, or something else?
yeah something like that
i found some stuff up there but couldnt get stuff working as i didnt know what functions to call to set stuff
Adding a context menu entry that calls a function is easy - here's an example:```local doDIYContextMenu = function(playerNum, context, items)
local primaryItem = items[1]
if not instanceof(primaryItem, "InventoryItem") then
primaryItem = primaryItem.items[1]
end
if primaryItem:hasTag("DIYSchematic") then
print("##### It's a DIY Scematic")
local playerObj = getSpecificPlayer(playerNum)
readOption = context:addOption(getText("ContextMenu_ReadDIY"), items, DIYonLiteratureItems, playerObj);
end
end
Events.OnFillInventoryObjectContextMenu.Add(doDIYContextMenu)```
So every time the game populates the right click context meny for an inventory item it will trigger doDIYContextMenu() because it has been added to the OnFillInventoryObjectContextMenu event
then that function says "If the item has the tag DIYSchematic then <do stuff>
is tag just the name or
for your case it would be a check like "if primaryItem:getType()=="Base.SomeItem"
Tags are the tags that items can have in their defintions. So you can use hasTag("hammer") instead of (is a "clawhammer" or is a "clubhammer" or is a "ballpeenhammer" or is a "smithinghammer"...
local addContextOption = function(playerNum, context, items)
local primaryItem = items[1]
if not instanceof(primaryItem, "InventoryItem") then
primaryItem = primaryItem.items[1]
end
if primaryItem:getFullType() == "Base.Cube" then
local playerObj = getSpecificPlayer(playerNum)
context:addOption("Use", items, handleOptionClicked, playerObj, primaryItem)
end
end
so would this pass the item to the other function correctly?
or should i do it other way?
and then from the other one i can interact with the used object right
is handleOptionClicked the function that you want to trigger?
yes
also this confuses me, why does increasing unhappines level increase happines?
yes, that will add a context entry "Use" and I can't remember exactly how the other fields all get turned into function parameters in the correct order... might need to adjust it slightly to get the correct prarameters into the function call.
Probably because I wrote it backwards π
The game tracks unhappyness rather than happyness.
i assume items, player and then the item?
honestly, I'm not certain - I'd have to find an example and figure it out
I think you're correct
hmm alright, and this goes to local folder right
context:addOption("label for option", parameter1, function, paramerter2, parameter3......)
context name for first
target(what thing you want to use) for second (opt)
onSelect(What will you do when you click) for third (opt)
as far as i'm aware
trial and error lol
make yoru function print out the arguments for troubleshoting if it's not clear.
media/lua/client/
yeah that i meant
the client/shared/server distinction doesn't actually do much, it's mostly more helpful to organize code, but this is definitely "client" stuff.
also where can i find like the docs for these functions or something? i could not figure out how to get the happineslevel, etc
is there for b41?
index: A
Yes, but I don't have a handy bookmark for B41 javadocs.
can someone helo me
helo!
im getting this error when i want to load my saves
Bookmark this though: someone uploaded a decompiled version of Zoboid B41 to github which was 1) naughty and 2) very helpful if you want to look into the java stuff to see WTF it is doing. https://github.com/piromasta/PZDecompiled/blob/4a130973322f57ade82a9a313cb1360c79fd80db/zombie/core/Core.java
You'll get a better response in #mod_support - mention what the error is, when it started and if you changed mods at all shortly before that, and upload console.txt
(also, open up console.txt and search for "exception" - sometimes it will be really obvious what is breaking when you do that)
local handleOptionClicked = function(items, playerObj, primaryItem)
if not playerObj then return end
-- Increase happiness (reduce unhappiness)
oldHappy = playerObj:getBodyDamage():getUnhappynessLevel()
newHappy = oldHappy - 5
playerObj:getBodyDamage():setUnhappynessLevel(newHappy)
-- Remove the cube from the player's inventory
if primaryItem then
playerObj:getInventory():Remove(primaryItem)
end
end
So I guess this would be it?
its says the savefile can not be loaded
Works, but how could I add an indicator it will lower the unappines when u hover over the item?
Add a tooltip?
yeah if its that, you know how food has like ho mow much hunger gives
I did notice that Slavic languages isn't ANSI or whatever Windows-1252 anymore. I didn't know they make it UTF-8 across the board, which is cool
UTF 8 works for every language already
almost all
So far I only saw people reporting RU, UA and PTBR on my mod that they switched to UTF-8. Maybe I should check others too
Yeah I know. I was so dumbfounded when I found out I had to do file encoding conversion back in B41 π
Thanks for letting me know tho π
UTF-16 for Korean
Standalone mod manager I've been working on. It will also be included in my server manager but thought to share a little image. https://steamcommunity.com/sharedfiles/filedetails/?id=3320238921
I'm so happy they did my suggestion 
I hope they give the same treatment to the 4 languages that were left out
which ones? 
Argentinian Spanish, Catalan, Czech, & Korean
Unsure whether that's still true as of the latest update; information from late January (#mod_development message)
is there a way to have a .lua function have a short delay from when its called on to when it triggers?
yes
from the top of my head make an event that setsup another event
for example, 1st event adds coounter increase every OneMinute and when it hits 10 you fire what you wanted to be delayed
local tickDelay = 10
local tickTimer = tickDelay
local function DelayedFunction()
tickTimer = tickTimer - 1
if tickTimer > 0 then return end
tickTimer = tickDelay
Events.OnTick.Remove(DelayedFunction)
--do stuff here
end
local function SetUpDelayedFunction()
Events.OnTick.Add(DelayedFunction)
end
you can replace OnTick with another event like EveryOneMinute, just replace tickDelay with whatever you want but ticks depend on the fps i think
yep, that
Actually you possibly shouldn't use that
From what @bronze yoke reported to me due to an issue of removing an entry in the function events, making it skip the next function in the list which could be another mods function
For OnTick it's not that much of a problem as that could simply skip to the next tick call for the other mod, but you're probably better off using a table of entries of functions to call later, and iterate at OnTick
That's personally what I do
hey does anyone have a good start on where to get into modding? more specifically making vehicles, what programs are used for designing them etc
However there's no guide for vehicles in the wiki rn
But there's a steam guide I believe
much appreciated, ill see what i find
im trying to find the EveryOneMinute lua file location, but i can't find it. if any one knows what lua file its defined in please tell me
if you wondering how to write it, here:
https://pzwiki.net/wiki/Lua_event
So it wont be possible for me to make a EveryOneSecond thing?
you can do every tick and jsut skip X ticks
it's possible
im an onTick hater though so I encourage you to contemplate if very second is that important
and if you cantr do every minute instead
i just need it where a OnBreak function runs while the item is in inv, as i am using a OnCreat function to damage a one condition item by 1 but it cant run a OnBreak function when not in inv. and when its created there is just barley enough of a delay to not be in inv when it breaks
Actually not really I believe
Bcs even the time variables, only update every minutes
getGametimeTimestamp()
Only updates every minutes at least
So I don't even think seconds are a thing in the game
Unless you mean every real life seconds
every in-game second would be literally insane
yeah i mean IRL
Yea lol
At least I don't see a use for it 
hello, im trying to make a hat mod spawn with zombies. I need help to confirm if everythings correct or not. I tested it and theres no error or anything but I've not seen a single zombie wearing it (this part im not sure cuz i only roam around like 3 blocks of the neighborhood) im too lazy to run around and find em. what am i missing?
clothing/clothing.xml
<?xml version="1.0" encoding="utf-8"?>
<outfitManager>
<m_MaleOutfits>
<m_Name>MetroBeanieZombie</m_Name>
<m_Guid>17b63df0-9a8d-4c2d-b83c-123456789abc</m_Guid>
<m_items>
<itemGUID>e7a5c2d4-1b89-4f2e-8d35-3f6a91b0d712</itemGUID> <!-- BurntSunset Beanie -->
<itemGUID>9c3d67f2-8b41-4e2c-bf68-7a2d5e01c5f4</itemGUID> <!-- GlitchGrid Beanie -->
<itemGUID>4f8e2c3a-6d97-495d-a8b1-9e0cfa3b2d65</itemGUID> <!-- InfernoLuxe Beanie -->
<itemGUID>ae9b1d76-5c43-41e0-9f23-bc07e81f54a3</itemGUID> <!-- MidnightInferno Beanie -->
<itemGUID>37d2c6a9-81f7-46b3-bc25-6e3d9a4f1e90</itemGUID> <!-- PhantomGrid Beanie -->
<itemGUID>c4a1b5d8-ef2a-4d63-98d4-74b9a8e5f01b</itemGUID> <!-- ShadowBlaze Beanie -->
<itemGUID>5f8c9d21-7a62-4b8e-80f1-3a4c7e59d6e2</itemGUID> <!-- ToxicHaze Beanie -->
<itemGUID>b6d49c83-2e75-4978-a1f3-94c8e2d7f0b5</itemGUID> <!-- VoltageSurge Beanie -->
<itemGUID>d13f8a76-4b22-4a7e-98c6-5fbc1e92d0a4</itemGUID> <!-- GVBlack Beanie -->
<itemGUID>a72c5d18-ef43-4c89-bd21-6e8f9b37c2f0</itemGUID> <!-- GVBlue Beanie -->
<itemGUID>f9b4d6e5-3a72-485c-b8f1-2e6c7a8d5c34</itemGUID> <!-- GVCyan Beanie -->
<itemGUID>c58e9d24-6b3f-498e-97a2-4e7c1b62d8f5</itemGUID> <!-- GVGreen Beanie -->
<itemGUID>e6a47d92-8c3b-4b1e-92f8-3d75c6e2a4b9</itemGUID> <!-- GVRed Beanie -->
<itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID> <!-- GVWhite Beanie -->
</m_items>
</m_MaleOutfits>
<m_FemaleOutfits>
<m_Name>MetroBeanieZombie</m_Name>
<m_Guid>c3b94f20-2b7d-4c2d-94d6-987654321def</m_Guid>
<m_items>
<itemGUID>e7a5c2d4-1b89-4f2e-8d35-3f6a91b0d712</itemGUID> <!-- BurntSunset Beanie -->
<itemGUID>9c3d67f2-8b41-4e2c-bf68-7a2d5e01c5f4</itemGUID> <!-- GlitchGrid Beanie -->
<itemGUID>4f8e2c3a-6d97-495d-a8b1-9e0cfa3b2d65</itemGUID> <!-- InfernoLuxe Beanie -->
<itemGUID>ae9b1d76-5c43-41e0-9f23-bc07e81f54a3</itemGUID> <!-- MidnightInferno Beanie -->
<itemGUID>37d2c6a9-81f7-46b3-bc25-6e3d9a4f1e90</itemGUID> <!-- PhantomGrid Beanie -->
<itemGUID>c4a1b5d8-ef2a-4d63-98d4-74b9a8e5f01b</itemGUID> <!-- ShadowBlaze Beanie -->
<itemGUID>5f8c9d21-7a62-4b8e-80f1-3a4c7e59d6e2</itemGUID> <!-- ToxicHaze Beanie -->
<itemGUID>b6d49c83-2e75-4978-a1f3-94c8e2d7f0b5</itemGUID> <!-- VoltageSurge Beanie -->
<itemGUID>d13f8a76-4b22-4a7e-98c6-5fbc1e92d0a4</itemGUID> <!-- GVBlack Beanie -->
<itemGUID>a72c5d18-ef43-4c89-bd21-6e8f9b37c2f0</itemGUID> <!-- GVBlue Beanie -->
<itemGUID>f9b4d6e5-3a72-485c-b8f1-2e6c7a8d5c34</itemGUID> <!-- GVCyan Beanie -->
<itemGUID>c58e9d24-6b3f-498e-97a2-4e7c1b62d8f5</itemGUID> <!-- GVGreen Beanie -->
<itemGUID>e6a47d92-8c3b-4b1e-92f8-3d75c6e2a4b9</itemGUID> <!-- GVRed Beanie -->
<itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID> <!-- GVWhite Beanie -->
</m_items>
</m_FemaleOutfits>
</outfitManager>
lua/shared/NPCs/BodyLocation.lua //is this needed?
require 'NPCs/BodyLocations'
local group = BodyLocations.getGroup("Human")
group:getOrCreateLocation("Hat")
lua/shared/NPCs/ZombieZoneDefinitionBeanies.lua
require 'NPCs/ZombiesZoneDefinition'
table.insert(ZombiesZoneDefinition.Default, {name = "MetroBeanieZombie", chance=0.5})
i can spawn them with it but they only have one variant of the hat which is whiteπ
the white variant is: <itemGUID>b84c3f72-5e91-49d7-8c32-7f2d6e8a4c51</itemGUID>
the game is trying to add all of these items to the zombies but theyre replacing eachother so only the white one thats at the end of the list is showing up
instead you need to do something like this where the possible choices are subItems
<m_items>
<probability>0.15</probability>
<itemGUID>48cb6484-ae95-4135-b308-30d97eff2819</itemGUID>
<subItems>
<itemGUID>dcdc9576-6d8e-4dd5-bb0a-ea10dbae66b0</itemGUID>
</subItems>
<subItems>
<itemGUID>81b4d638-fb13-4153-9960-e50705cb335f</itemGUID>
</subItems>
<subItems>
<itemGUID>87917281-f5e5-4fa7-aaeb-4530d3111c09</itemGUID>
</subItems>
<subItems>
<itemGUID>e5eb1bae-a679-4cd1-ae7a-8666d3990ae8</itemGUID>
</subItems>
</m_items>
i havent messed with the format much so i'm not entirely sure if you need the first item to be outside of subItems but it does work
okay thanks, ill try it
it should be outside yeah
i have a lua function called HBRCLowerItemCondition it does exactly that it says, i want to use it to to break an item in hopes to be able to run a OnBreak command as soon as foraging/crafting/whatever puts it in inv. however HBRCLowerItemCondition is run OnCreate which seems to not work, is there a way to get OnBreak to run properly/in player inv?
it works!! thankss
π
Im also ok with making it where the item ejects itself from player inventories, as that was my original goal before i started using DB items that immediately break into other items
is sound played from player's emitter always heard by zombies and other players?
done from server side
probably a bad place to ask but how do i get started with mod development? what applications should i use, is there a guide i could look over?
This is the correct place to ask
you can start looking through to get started
https://pzwiki.net/wiki/Modding
It has a lot of useful info and should be updated for b42 (i think)
and also looking at other peoples mods to see how they do things
this thing here is even legal?
https://www.catarse.me/how_you_died
it's a cool project tbh
Please guys i just need to know how to eject specific items from inv, I don't care how just if its beginner friendly.
I need some advice on how to call a crafting recipe from lua.
I've looked into ISInventoryPaneContextMenu.OnNewCraft(), specifically the HandcraftLogic object but I'm not sure how to create the CraftRecipe object I need for it
is there is a lua event that items can use for when they are put in player inv?
Hmmmm
there are these
OnItemEquipped - Fires when item is equipped by a player, including one-handed or two-handed.
OnItemMoved - Fires when inventory item is put or taken by a player.
OnItemPlaced - Fires when inventory item is put down via place action.
OnItemUnequipped - Fires when item is unequipped by a player, including one-handed or two-handed.
Is there a way to add a sprite to a known x,y,z on game creation?
without remaking and entire map grid anyways....
what I expected and I know of no processor cheap way to find that square...
thank you
onloadgridsquare is just ripe for stealing process time...
and I don't think the tools for b42 mapping are out yet...
has anyone had an issue where swapping to the other firemode for a firearm bugs out like this?
I'm testing them but they're not working
?
looks fine to me

i have been trying for hours to get this to work can someone help
here is the code
if item and item:getCondition() > 0 then
item:setCondition(item:getCondition() - 1)
end
end
function HBRCRaiseItemCondition(item)
if item item:getCondition() = 0 then
item:setCondition(item:getCondition() + 1)
end
end
function OnBreakMineableZone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
player:getInventory():Remove(item)
end
function OnBreakMiningzone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.Miningzone1", false)
player:getInventory():Remove(item)
end
-- experimental
function HHBRCTick(item)
Events.OnTick.Add(HBRCLowerItemCondition)
Events.OnTick.Add(HBRCRaiseItemCondition)
end
function HBRCLowerItemConditionDB(item)
HBRCLowerItemCondition(TestItem)
end
function HBRCLowerItemConditionDB(item)
HBRCRaiseItemCondition(TestItem)
end
function OnBreakTest(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
player:getInventory():Remove(item)
Events.OnTick.Remove(HBRCLowerItemCondition)
Events.OnTick.Remove(HBRCRaiseItemCondition)
end```
and here is the console error i get
```SEVERE: Error found in LUA file: C:/Users/brian/Zomboid/mods/HotheadsRandomCrapolaM/42/media/lua/shared/debug_luaHHB.lua
ERROR: General f:0, t:1738533660201> ExceptionLogger.logException> Exception thrown```
it starts at HHBRCTick with a OnCreate
Updated encoding section for B42
https://pzwiki.net/wiki/Translations#Languages
Looks like a syntax error - and I bet it's from if item item:getCondition() = 0 then which is missing an and
I highly recommend VS Code & Umbrella plugin for mod development - that setup will pick up lua sytax errors as you go and also gives help with API calls/variable types where it can.
I still think this is the wrong approach and you should just modify the way finding the item via foraging works to trigger putting an item on the ground directly instead of giving the player a temporary item and breaking it to trigger putting an item on the ground.
Vehicle mod issue. The last vehicle I made (very large) wont connect to front or back trailer attachments. It has the same settings as any of the other vehicles I've made or edited but for some reason this one just wont tow. Any suggestions?
Did you do something to set the tow attachment point? I've seen mods do horrible things when the "towbar" is located in a position that can connect but results in the trailer and vehicle collision box overlapping.
So if you have a very hig vehicel I's assume the "towbar" can be so far from the back of the vehicle it can't connect.
Nothing custom, even removed the attachment in debug mode and added it again and moved it into the correct position
...but I don't actually know how that gets configured.
Well that was my one hepful idea, hopefully a vehicle modder can offer better insight.
I checked location stuff as well and Im closer/more aligned with this vehicle than the 379 petyarbuilt and trailer
Hi, does anyone know what the mailboxes are called in the distributions? Are they PostOfficeBoxes or is it another name?
i changed the code to this but it still has no effect, (although console no longer recognizes that it exists not)
if item and item:getCondition() > 0 then
item:setCondition(item:getCondition() - 1)
end
end
function HBRCRaiseItemCondition(item)
if item and item:getCondition() == 0 then
item:setCondition(item:getCondition() + 1)
end
end
function OnBreakMineableZone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
player:getInventory():Remove(item)
end
function OnBreakMiningzone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.Miningzone1", false)
player:getInventory():Remove(item)
end
-- experimental
function HHBRCTick(item)
Events.OnTick.Add(HBRCLowerItemCondition)
Events.OnTick.Add(HBRCRaiseItemCondition)
end
function HBRCLowerItemConditionDB(item)
HBRCLowerItemCondition(HCSM.MineableZone1DB)
end
function HBRCRaiseItemConditionDB(item)
HBRCRaiseItemCondition(HCSM.MineableZone1DB)
end
function OnBreakMineableZone1DB(item, player)
OnBreak.HeadHandler(item, player, "HCSM.MineableZone1", false)
player:getInventory():Remove(item)
Events.OnTick.Remove(HBRCLowerItemCondition)
Events.OnTick.Remove(HBRCRaiseItemCondition)
end
Break it down into steps.
You have one of those functions called by OnCreate in the item properties, is that correcet?
Events.OnTick.Add(HBRCLowerItemCondition)
Events.OnTick.Add(HBRCRaiseItemCondition)
end
this one
Add a debugging print statement so you can confirm it is being called.
Then if it is, do the same for HBRCLowerItemCondition and HBRCLowerItemCondition to confirm they are being called (and prepare for log spam)
etc etc
side note - how is HBRCLowerItemCondition getting passed the item as a praemter?
AFAIK there's no OnTick for a an item, it's just called every tick and then you need to work out how to get the player object/item object/etc
i don't really know why ontick or any event is used here at all
Because spawning an item on the ground was not an accepted solution.
I'm unclear why, but shrugs
because the methods(plural) of getting these items put them in player inv, and rewriting that is far beyond my skills,
anyways
Events.OnTick.Add(HBRCLowerItemCondition)
Events.OnTick.Add(HBRCRaiseItemCondition)
print("HI")
end```
the print does nothing to the logs
gota keep in mind im a beginner type beginner
in ontick check x,y,z π
I think what you're trying to do is actually more complicated.
What is the item definition that includes the OnCreate?
If no print, the function isn't used.
{
DisplayCategory = Material,
Weight = 1,
ConditionMax = 1,
Type = Normal,
DisplayName = Investigate Further,
Icon = important,
OnCreate = HHBRCTick,
OnBreak = OnBreakMineableZone1DB,
}```
yeah im trying to find out why
Because you don't use it. π
Check the place where it should be using.
?
And then you create a MineableZone1DB using debug mode's item tool?
thats the fast way
Does the MineableZone1DB get created properly?
For example, immediately:
function HHBRCTick()
Events.OnTick.Add(HBRCLowerItemCondition)
Events.OnTick.Add(HBRCRaiseItemCondition)
print("HI")
end
HHBRCTick(); ----> just used
It should be getting called via the item's OnCreate value
I think it's going to throw a huge pile of erroes once HBRCLowerItemCondition/HBRCRaiseItemCondition are being called because they are not being passed the item parameter they expect, but that will come later.
And then we'll mention that in an effort to do things an easier way you're making everything harder.
But, for now - Can you create a MineableZone1DB item?
And does that throw an errors when you do so?
i can create the item, and no errors pop up
It should be getting called via the item's OnCreate value
So it's better to put
Also print after definition:
function HHBRCTick()
.....
end
print('HI! Definition is ok, lua file was laoded')
I agree, my current thinking is the lua file isn't loading at all for some reason and a print statement there will confirm/deny that.
Also, from the lua console when in game what happens if you run HHBRCTick() ?
red error if file is not loaded
1)if i run it manually it gives a debug error onHBRCLowerItemCondition/HBRCRaiseItemCondition
2)well if it is truly easier then can you point me to where i would start on learning the necessary things for the other method
cuz I legit don't even know where i would start on the other method
https://pzwiki.net/wiki/SurvivalGear
SurvivalGear = true,
I can't find any information about what this item parameter does
it sets whether the spawn chance is affected by that sandbox option
Duh, thank you
Keep in mind that if I do that method, I need to know how to make it go on the ground automatically for both foraging AND crafting
Crafting will probably do it automatically if it's too heavy for the player inventory.
first) Be sure that OnCreate works
second) Be sure that your lua is loaded print('file loaded')
third) ...etc. Add your small ideas one by one and then check it immediately.
Do playtest just after a small piece of code is added, so you can be sure that all previous is correct for sure.
It likely does nothing on it's own, but is used in functions related to loot generation
Or maybe it never gets used anywhere, because isSurvivalGearLoot isn't in any vanilla lua file.
well loot isn't lua
one use I can find in decompiled B42.2
And a few more that don't use the method and just look at the string:
im looking for info on how to get foraging to work like that, but i can't find any
vanilla foraging wasn't designed with a 9999 weight item in mind. Somewhere previously we found the function that checked weight vs inventory/bags and it looked like if you can't pick it up or put it any bag the option is just unusable, with the assumption being you would free up space and try again.
very noticeable with Big Rock or whatever being an item you can only forage and weighs like 40
ISBaseIcon:doContextMenu in lua\client\foraging\ISBaseIcon.lua
You could extend that function with a check for self.itemObj being a MineableZone1DB, and if so add a next context menu option that calls code to create an item on the ground.
You might not even need that, did you actuyally test fidning a 9999 weight object through foraging?
yes i couldn't pick it up
OK, so that was teh correct interpretation of the code
Have a read through ISBaseIcon:doContextMenu and think about what you could add as a prefix or postfix patch to do what you want.
i will try to do the same, but i might not get what's going on though
would i do smth with local plInventoryHasSpace = (plInventory:getCapacityWeight() <= plInventory:getEffectiveCapacity(self.character));
and near by lines of crs
Where possible don't change the existing code. Sometimes there is no practical way to avoid doing that by copying the function, but your mod will be a lot more robust to future updates if you instead run code before and/or after the existing function.
ok
Hey stalker i gotta question bout before
im having a problem where a tile is floating mid-air
even tho i have the tiles as "IsLow" and "BlocksPlacement"
which did the job in the past
To simplify a lot, what you will do is somthing like:
<my code>
ISBaseIcon:doContextMenu(_context)
end ```
or
```function MyNewCode(_context)
ISBaseIcon:doContextMenu(_context)
<my code>
end```
I have forgotten everything I talked about more than 30 seconds ago, but ask and I will work on remembering what was going on. π
all good, u helped me add the right click context to an item, but i want the item tooltip to show how much happines it gives
when it is used
If you want to extend a tooltip there are two options:
- Starlit library
- Go insane
well im just trying to add the text of how much it gives
I know, but tooltips are not simple to modify... starlit makes adding something very easy.
Don't ask about removing something from a tooltip, I ended up using a horrible hack to do that in Authentic Battery Charge Detection.
yea dont need to remove
i tried but its not working
function HHBRCForagingChange(_context, _worldItem)
local player = getPlayer()
local square = player:getCurrentSquare()
-- do the square exist
if _worldItem and square then
local itemType = _worldItem:getType()
local itemName = _worldItem:getDisplayName()
-- List to drop
local heavyItems = {
["MineableZone1"] = true,
}
-- If the item on list, drop it instead of adding to inventory
if heavyItems[itemType] then
-- Remove from inventory if added
if _worldItem:getContainer() then
_worldItem:getContainer():Remove(_worldItem)
end
-- Drop item on the ground
square:AddWorldInventoryItem(_worldItem, 0.5, 0.5, 0.0)
-- Stop further processing to prevent inventory addition
return
end
end
ISBaseIcon:doContextMenu(_context)
end
do you know what's wrong
keep in mind idk what is going on
never say just "not working"
ok
i select the item and the option to pick up is red and it is still trapped as a pick up to make real thing
Appearing the context menu doesn't add the item to inventory. It just shows the menu for a while.
well idk how to stop it from just doing the base menu
I'd suggest a quick workaround, but I even have not tested it. Just as an example
do
local old_fn = ISWorldObjectContextMenu.onPickupGroundCoverItem
ISWorldObjectContextMenu.onPickupGroundCoverItem = function(worldobjects, player, object)
if object:getType() == 'MineableZone1' then
return -- do nothing, skip action
end
return old_fn(worldobjects, player, object)
end
end
Holy crap I just broke 100 000 subs :3
Deleted a mod?
Lol no, my gun mod just went 100,103
Ah ) Gratz
where do i put this in the file
like in place of what
wherever
See what it does because you can apply the same technique to your other ideas
I'm not sure if I chose the right function etc
welcome to 6-digits club 
When TIS fixes their AnimSet bullcrap and I dev in my minigun I'll shoot straight to seven. (jk)
function MyNewCode(_context)
pcall(function()
<my code>
end)
-- will work for sure:
ISBaseIcon:doContextMenu(_context)
end
ok i got no idea what im doing now
pcall(function()
do
local old_fn = ISWorldObjectContextMenu.onPickupGroundCoverItem
ISWorldObjectContextMenu.onPickupGroundCoverItem = function(worldobjects, player, object)
if object:getType() == 'MineableZone1' then
return -- do nothing, skip action
end
return old_fn(worldobjects, player, object)
end
end
end)
-- will work for sure:
ISBaseIcon:doContextMenu(_context)
end ```
this is what i just put into the file, can you point out what needs to be added
"can you write a mod for me pls"
btw there is little reason to pcall a lua function, zomboid calls all lua functions in protected mode anyway, it only adds extra overhead
(function() ... end)() is equivalent if you need to do it to separate a scope but here it should not be used because it will compile the function every single time the function is called (you should just define the function normally in the root of the file)
so we gonna ignore MusicManiac's toxicity?

hey im just saying rules exsist on severs this big
and moderators don't like @'s this late
Just call 'em a goof or better yet, a goofball and move on.
Also what do you mean late? It's morning
feel free to report me for that comment 
ima just start from
function HHBRCforagingstuff1 ()
ISBaseIcon:doContextMenu(_context)
end
and try. cuz apparently asking for help is = to "can you write a mod for me pls" lamo
we have different approaches to what's considered "asking for help"
@silent zealot I want the tooltip to be when i hover over item and then show how much boredom it reduces, right now its when i hover over the context menu option
"i dont understand anything please tell me what do i add to this code"
!=
"I'm trying to figure out X and I've so far looked into Z and understand that Y does thing A and thing B, so I tried doing thing C, but for some reason thing D doesnt happen"
1st doesn't show any effort
If you add the tooltip to the item's script it should show up on hover.
At least that's how my tooltips work.
anyways i prob shouldn't feed the trolls more
you are trying to shoot yourself in the foot
that's literally your words???
can you show an example if possible?

Are you sure that it will compile every time? It's not even a string, just normal code as closure
item 9mmSuppressor
{
Type = WeaponPart,
DisplayName = Suppressor,
DisplayCategory = WeaponPart,
Icon = 9mmSuppressor,
Weight = 0.25,
WeightModifier = 0.25,
MountOn = Pistol;Glock17;MP5;UZI,
PartType = Canon,
Tooltip = Tooltip_Suppressor,
MetalValue = 22,
WorldStaticModel = Suppresssyy,
}
Then I have the shared translate lua for Tooltip_Suppressor saying what I want it to
it will, kahlua's compiler is really passive and will not optimise things even when it's very easy to
is it possible to add colors?
function() ... end means 'compile this function and put it in this variable' so it will always do that when it gets to that line, even if the result will never change
Someone asked that a few days ago and apparently not
if you don't mind adding a dependency my starlit library has support for custom tooltips with colours and other stuff
wait so if i have this line
local notification = function() return modOptions:getOption("EnableNotifications"):getValue() end
it'll run compile the func every time I call notification?
yeah i did that but i only figured out for the context menu how to add a tooltip
no, the function is compiled and put into notification, the issue here is that function() end is itself inside a function, so every time the function containing it is called it compiles the inside function
oh
No. As I understand it will compile every time only in this case:
function AFunc()
local notification = function() return modOptions:getOption("EnableNotifications"):getValue() end
end
That's crazy
Just give the item itself the tooltip and it will show up.
so i when back to
function HHBRCForagingChange(_context, _worldItem)
local player = getPlayer()
local square = player:getCurrentSquare()
-- do the square exist
if _worldItem and square then
local itemType = _worldItem:getType()
local itemName = _worldItem:getDisplayName()
-- List to drop
local heavyItems = {
["MineableZone1"] = true,
}
-- If the item on list, drop it instead of adding to inventory
if heavyItems[itemType] then
-- Remove from inventory if added
if _worldItem:getContainer() then
_worldItem:getContainer():Remove(_worldItem)
end
-- Drop item on the ground
square:AddWorldInventoryItem(_worldItem, 0.5, 0.5, 0.0)
-- Stop further processing to prevent inventory addition
return
end
end
ISBaseIcon:doContextMenu(_context)
end
because expandability/i can make sense of it
and is if heavyItems[itemType] then and all that the prob?
yeah but i want it to be like food you know, have the colored text and show what stats it boosts
I've seen color tooltips here
https://steamcommunity.com/sharedfiles/filedetails/?id=2932853467&searchtext=terraria
When you got access to a genie that could grant you any wish, you wanted to have two of them, and for them to be nested inside each other.
Are you going to help me or am I going to have to try this again tomorrow?
holy entitlement 
Wdym one of those? These aren't for crafting bullets, the measurement is just equal to 40 bullets worth of gunpowder
Oh okay nvm then π
@dull moss I'm going to tell you this once, unless you have something actually useful to put into the conversation, don't speak to me. I'm hoping you can respect this. I don't want to get someone who's in charge involved.
I'm just tired at this point

I have no solution for you. To get it a modder needs to dig and test, it's a work, not just thought experiment. So the simplest way is to find someone who can do all the job, otherwise it's better to rest and continue learning tomorrow.
And it's a dry propellent, you could still theoretically use it in place of gunpowder, just might not work as well. The irl mixture is used in explosives
Ok, and thank you for being mature
I'm basing this off of real explosive mixtures
Yeah I'd definitely stand 50 yards away from that test
It's a 1:1 ratio of ammonium nitrate and fuel oil.
If you're using gasoline instead of fuel oil then it would be 2:1:1 of ammonium nitrate, gasoline, and motor oil
for legal reasons, don't mix these substances in your home without the proper licensing. It is illegal in the United States to manufacture explosives :)
it's like that meme
ATF guy: "Hey is that thing legal?"
Me: "Hey are those level 4 plates?"
ATF guy: "What?"
Me: "What?"
learning hommade explosives in pz 
Mixing plain fertilizer and gasoline probably wouldn't get you anywhere irl.
As you would specifically need fertilizer grade ammonium nitrate (32% or higher nitrogen content) and not just generic fertilizer
well actually idk if it's a dry propellent or if the nitrate solves into the fuel
probably shouldn't make bullets with liquid propellent
doesn't sound right
It would be great to have a mechanic that "kills" people in a room, like the generator does.
But there should be specific muldet because of smell
toolTip.description = string.format(
[[%s: <RGB:%f,%f,%f> <SPACE> -5
%s: <RGB:%f,%f,%f> <SPACE> -25]],
"Unhappiness", r, g, b,
"Boredom", r, g, b
)
``` Can someone tell me what did i do wrong with formating? boredom is fully green, while unhappines is fine
yeah I think corpse sickness does this already. Maybe you could piggyback off it?
I guess you can set only one color per line in tooltip.
Ah, no, may by format issue (multi-line argument)
wouldnt be suprised, idk how formatting works im just going of what i learned
Just check it in console
print(
string.format(
[[%s: <RGB:%f,%f,%f> <SPACE> -5
%s: <RGB:%f,%f,%f> <SPACE> -25]],
"Unhappiness", 1, 2, 3,
"Boredom", 4, 5, 6
)
);
<RGB> affects everything after it
To only affect text within a certain range of the string you can use <PUSHRGB:r,g,b> text <POPRGB> (So, <PUSHRGB:%f,%f,%f> <SPACE> -5 <POPRGB>)
Damn, if the game took place before 1960 then I could make it so you use a fire extinguisher to get carbon tetrachloride
(carbon tetrachloride was phased out of use in fire extinguishers in the mid 1960s because it's toxic)
thanks omar
wait so these codes *do* work in tooltips? didn't somebody find just the other day that they don't?
Yeah someone said that they dont in item ones
ok and last thing i swear, why does it go out of the box. the code that only used <rgb> had it all aligned properly
Make sure you have spaces before & after every <> command
Failing that I'd just throw a newline on the end, but it's usually that. The rich text parsing is a bit finicky
yeah i do have spaces
Including after the <POPRGB> where your cursor is? (unsure whether the newline + tab would be stripped off the top of my head)
looks like there wasnt 1, but its still not fixed
Maybe try putting the space command before the push/pop?
nothing
Yeah this is about where I'd throw my hands up and put a <LINE> at the end
Real ingredient listed in one of the explosive materials in the handbook
If anyone wants to offer boilerplate translations for their work:
https://github.com/Chuckleberry-Finn/pz-translator
who else except animals and humans can produce urine? 
I think the (including humans) is there because this handbook was written before 1969 and a lot of people didn't and still don't consider humans to be animals

Really? But why? How it works?
I will add it to my mod so I have to know everything about it.
the propellent that uses urine isn't being included in my mod as the rest of the ingredients wouldn't be reasonably accessible in game.
Trying to not add in a lot of items, and rather use existing materials
Some people even now in 2025 get ultra-triggered if you just ask them to look up the definition of the word 'animal'. Because obviously humans are animals lol.
How am I supposed to get fox urine to put on my crops to keep rabbits away when modders won't add a full range of unique animal pee to the fluid lists!
Tell you what, if you add a urine system to the game, I will consider an addon that includes the propellent using urine.
/hj
That's fair.
Also, no thank you.
π
Adding a bladder need would just mean a lot of peeing on the ground wherever you sere, I can't see how it would add to the gameplay.
I want immersion not realism!
I remember someone popping up in mod_support because their character pissed themselves in a car and now the car had a forever smell lmaooo
lol
Credit to the modder for implementing that level of detail, but... I shall admire his dedication without trying it myself.
(Also I hope it was the seats that had the smell, not the vehicle object itself.)
Either way it's hilarious.
Even funnier is imagining the character uninstalling the seat and then washing it at their rainbarrel sink
Of course that is a thing.
Not really. You can change the seat.
Speaking as someone who likes Dubs Bad Hygiene in Rimworld, I don't want it in Zomboid. π
Yeah I know PZ is basically the Sims 2 with zombies but I don't need all that
It's your choice! π
Unlike Oxygen Not Included, where the early game revolves around manging pee and "contaminated soil"
I don't need all that
I guess that's why it has only 137k subs))
And getting any pee into you natural water sources is a huge problem to fix.
Lots of popular things are beyond brainless (not saying that the mod is)
Sounds as an idea!
Fair warning, I added better error handling, as during testing I exceeded the 200k a day use. π
I need to add a way to pick which languages to apply π€
Automatically fills up empty containers in your inventory, like reverse auto drinking
Or like in My Summer Car, if you walk forward while emptying your bladder upward, your thirst goes down for some reason
Can you enable Autodrink and Autopee on the same container for the true extreme survival experience?
Wait, wait, I'm writing this down.
Shy Bladder
Can't pee if thinks there is a zombie around.
And impliment crawlers doing this.
I can add autopee but as an additional mechanic, in addition to manual pee
Not sure yet how it fits to the mod idea. Have to think about
I feel like it might be better to just have the option to get urine from animals the same way you get milk. Adding a new mechanic for players to maintain as intrusive as pissing sounds annoying
I mean really think about it, you would be peeing so much in zomboid given the in game time vs real world time and how much water your character is drinking all the time
The character can hold it. Let's say if it's 1 hour=24 hours, they should do it about every 30 minutes.
Hello, I would like to ask about Mod Shops and Traders. Can I configure this mod to change currency exchange into exchanging rings or jewelry instead? And how do I set it up? Please let me know.
Is there any function to get world brightness?
IsoPlayer:TooDarkToRead() is mostly working but it returns false when player is using flashlight or is in vehicle(when vehicle has battery; from 42.1.0) .
What I want to is: ignore flashlight, just check lights from world/objects only. (Moonlight, Sunlight, Floor light, etc..)
I believe the answer is in the method you referenced, tooDarkToRead()
float var2 = this.getSquare().getLightLevel(var1);
Quick question: Where are Tags defined in PZ, and can a tag universally double a weapon's damage output using a global function or replacing one?
I'm attempting to make all weapons with the 'ChopTrees' Tag, double their damage against Zombies/NPCs, but without touching any recipes.
@jovial valley
local function DebugSay(message)
print("NepForage2GroundDemo: "..message )
end
-- add postfix to ISBaseIcon.doContextMenu
ISBaseIcon.NepOGdoContextMenu = ISBaseIcon.doContextMenu
function ISBaseIcon.doContextMenu(self, _context)
-- This is where I put code to run before the original function
-- Maybe if self.itemObj is a particular item I want to do something here return without calling the original function
-- then I call the original function
ISBaseIcon.NepOGdoContextMenu(self, _context)
-- This is where I put code to run after the original function
-- Add a "yeet onto ground" function - would be a lot nicer to add it to the Foraging submenu
if _context then -- there might not be a context menu at this point, depends exactly what was clicked on
_context:addOptionOnTop("Yeet Onto Ground", self, ISBaseIcon.NepYeetOntoGround, self.itemObj, self.square)
end
end
-- My custom context menu action
function ISBaseIcon:NepYeetOntoGround(item,square)
DebugSay("Yeet!")
print(self)
if not item then DebugSay("NepYeetOntoGround: ERROR: item is nil"); return end -- somehow we got here before self.item was configured
if not square then DebugSay("NepYeetOntoGround: ERROR: square is nil"); return end -- somehow we got here before self.square was configured
-- put the world item in the square
square:AddWorldInventoryItem(item,0.5,0.5,0)
-- Now removes the foraging marker and call reset to clean up
self:remove()
self:reset()
end
It would be a lot prettier if the context menu option was put under the "foraging" submenu, and instead of just putting the item on the ground it should make the player walk over and do it via timed action, "Yeet Onto Ground" should use translation instead of a hardcoded string... but that's an example of extending the foraging context menu to put found items directly on the ground.
hmm.. sorry still confusing. How can i get light level but except lights which is created by player?
Because when player turned on his flashlight, getLightLevel(playerIdx) is always increased since there's a light around player.
You can get the square the player is in, and there are a lot of light related functions for IsoGridDquare... but the obvious one.
getLightLevel(int playerIndex) will return 1 if the player has a flashlight on.
There's a getLightLevel2(), but it does noy work for me (throws an error about calling nil, and getLightLevel(-1) also fails.
Hey lads, this is a bit of a weird one but I can't actually seem to find a definitive answer just browsing the web.
Just for context, I've no map-making experience in Zomboid what-so-ever so this is a shot in the dark but, is it possible to spawn buildings mid-game, or would such things need to be ahead of launching a world?
By buildings I mean literal buildings, houses, tents and the like.
how does one make/do sandbox-options.txt? is there a guide somewhere?
do u have to make a translation version?
The're is a wiki page, https://pzwiki.net/wiki/Sandbox_options
Not sure if that's exactly what you were looking for but hopefully that helps!
guys real quick: I want to have clear visual for graphics adjustement for my tiles or ingame screenshots, how do I remove weather effect with debug
NEVER MIND it's under CLIMATE then you read Weather.
XD it's alway like this... you wait for asking, you keep failing, and when you ask, you answer yourself and success before someone answers you...
Rely on "yourself seeking help", admits it, while keeping working but with an alternate idea that comes right after "yourself seeking help" aaaaarg.
I hate debugging AI generated code.
Have you tried it to see if it works?
And if it does not, how is it failing?
I have a question about permission for a mod to @violet fractal . If you read this I would be happy if you contact me π Contacting you seems impossible π
i get a single 1 error pop up that cant be found, which sounds like a noob error on my end
What is the error? Check console.log if you want an easier way of viewing it.
LOG : General f:0, t:1738579603542> ERROR: mods isn't a valid workshop item ID -- this get spammed a lot
That's normal. Well, it's expected.
search for "exception" first as that will show any java exceptions
And doesn't get caught up on all the usual "error" occurance.
ah found it LOG : General f:0, t:1738579580704> ----- LOG : General f:0, t:1738579590828> ----- LOG : Mod f:0, t:1738579598736> loading \FenceDamageMod ERROR: General f:0, t:1738579598789> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: invalid or missing VERSION at CustomSandboxOptions.parse(CustomSandboxOptions.java:104).
parse errors have all sorts of knock on effects, so that is definitely the starting point to look at
post your sandbox-options file
option NepOverdrive.RequireTrait
{
type = boolean, default = true,
page = NepOverdrive, translation = NEPODRequireTrait,
}
option NepOverdrive.DebugMode
{
type = boolean, default = false,
page = NepOverdrive, translation = NEPODDebugMode,
}```
that's one of mine
I'm guessing you have a sandbox options file either the VERSION line
option FenceDamageMod.Chance
{
type = integer,
min = 0,
max = 100,
default = 50,
page = FenceDamageMod,
translation = FenceDamageMod_Chance,
}
option FenceDamageMod.Damage
{
type = integer,
min = 1,
max = 1000,
default = 10,
page = FenceDamageMod,
translation = FenceDamageMod_Damage,
}```
ok i fixed it, my 42 version didnt have the comma. very confusing having 2 media folders
doesnt appear to work in game tho lol
as in nothing happens
Add some debug print() statements that will trigger when the zombie-going-over-a-fence code is triggered.
Aslso so crtl-f <name of lua file> in console.log to make sure it didn;t skip the file due to a syntax error
espcailly if you used AI, because large larngauge models don't actually know LUA and just give you Looks Like Luaβ’
"LOG : General f:0, t:1738581120008> ERROR IntegerConfigOption.parse() "FenceDamageMod.Chance" string=" - spammed this. Does it mean anything?
i assume its just fussing over me changing the sandbox settings
is there somewhere a list of anims and sounds?
the names
nvm
ok i just cant find the sounds
Sounds can be in .bank files
i mean the names (strings) all there are for the playsound function
What sounds are you talking about ?
self.character:getEmitter():playSound("ClothesRipping")
all sounds that can be played
That's the script name tho
It links to the script of the sound
Some sounds are not as .ogg files or whatever but in a .bank file
yea i mean where can i just find all of the sounds that can be played
._.
Scripts
Sound scripts
Unless you want the sounds themselves, I told you some are in the files and some are in .bank files
hey i need help with distribution lua
for some reason, my added items wont spawn anywhere outside military surplus stores
like it spawns normally there
but i tried adding spawns to gigamart and it doesn't show up
I want to make a vehicle teleport mod,but donβt know why when the car teleport,it will go back and spawn a same one on the raw one,make it to be two cars
Like use debug ,when u sit at a vehicle,teleport to somewhere would get the same result
Hey, i'm struggling to add something in a mod :
some contextMenus are banned, but i still can disassemble things, i tried ContextMenu_Disassemble and ContextMenu_Dismantle without any success. any idea?
thx in advance
how would i go about adding a custom sound when using an item? ive got a minecraft chest that I want to add a sound to when i open it or put things in etc. i know how to access the different vanilla sounds but how would i go about accessing a custom sound
What does your mod actually do with that BanList table?
Unless there's a vanilla functionality I'm not aware of all that screenshot does is declare a few variables.
did the folder layout change from b41 to b42? i canβt figure out why my mod shows up in b41 but not b42
yeah you stick build 42 mod data in a folder just named "42.0"
I'm being serious
You NEED to have the common folder there as well
it can be empty, but it needs to exist
if it doesn't exist, your mod won't load
Lol
It confused me when I had to shift everything to B42. Didn't know why ppl were doing it differently
Is there a way to force a player to have their PVP enabled/disabled?
bruh moment. so just 42 and then a common folder and thatβs it? i was seeing something about a lua folder? maybe i was just missing the common lol
The lua folder is in the mod file directory
I reccomend looking at someone elses mod if you eant to study the filestructurr
You basically put all the files you would normally put into the mod folder, into the 42 folder.
The 42 folder goes where you would normally put mod files
Read the wiki page I just sent above
If you don't have the common folder, stuff won't work
Is there any way to disable the highlight of safehouses in debug mode? I'm trying to create a mod that applies a highlight to the safehouse area, but the debug mode is preventing me from seeing clearly where the highlights are being drawn
How do I add a custom sound to my mod? For example if I wanted to have a custom sound for when craft something or for when I loot something from a container
You need to define a sound script
Looting from a container this will most likely require some lua coding
I got a request to make
Actually keep the console.txt formating
It actually made my life easier
It actually made reading the console file easier
And was actually a huge bonus point to the extension
So if possible, please keep the console files with the formating
Now it's just blend, before you could actually see the different sections better even if it was not meant to do that
I just realize that this channel exist, and I made a tech support request. My bad. Ill link it here https://discord.com/channels/136501320340209664/1336045123905261599
Thanks in advance for anyone able to help!
how PZ decides what item icons should have color tint? I'm trying to change icons on some books. Removed IconMask and ColorRed, ColorBlue, ColorGreen lines. And book icons still have tint
Is there a way to load the game without opening steam?
this is #mod_development
do you prefer that syntax?
wdym ?
I just always used it this way
I find it harder to read like that I guess
Some personal preferences
But the extension should take into account any possible available typings imo
Hello @bright fog , yes sometime the detection of module is weird.
Normally, if you close all the files, you should be able to open them in a detected pz format.
But i take in consideration your request, maybe with a custom setting for opening all the txt files in the pz format, i'm doing this tonight π
Thanks !
Perhaps you could also simply automatically detect the console.txt file no ?
How can I get the coordinates of the spawn locations with lua script?
The War Economy Update has been released! Enjoy, cheers.
https://steamcommunity.com/sharedfiles/filedetails/?id=3409836763
Reasonable pipe bomb recipe?
excellent suggestion !
Hi guys!
[21:08]
i need to write a items.txt file with Gun info, about Displayname, AmmoType, Icon and something. BUT i have problem with time.
RecoilDelay = 1, <------ Is this 1 a second or a tick?
finally i have a better idea : a setting which you can specify the filename you want to be treated like a "pz-scripting" file
π
ok done
in the next version (0.2.7) you can specify a list of filename which will be treated like a "pz-scripting" file, regex can be used too
ok the version 0.2.7 is under verification by Microsoft, it will be available in a couple of minutes
in the API, if a method has a string as a value, is there a way to see what strings are acceptable?
example: public void setBumpFallType(String val)
Thank you !
no.
you must check the source code.
For example :
this.setBumpFallType(Rand.NextBool(5) ? "pushedFront" : "pushedBehind");
Is there a way to programmatically know how many squares an IsoObject furniture occupies? I'm trying to count the number of each piece of furniture in a room by checking which one is sitting on each IsoGridSquare, but it's naturally returning one IsoObject per square for each. If I knew the size of the furniture, I could divide the hits by their size in squares.
I've also tried to see if a single piece of furniture shares one same characteristic across squares (like an ID) to know that it's the same object as the one returned by another square, but have been unsuccessful.
Knowing if the piece is number 1 of X of the furniture would also work (I'd only count piece 1).
how does "require" in Lua work? Specifically when is it necessary to "require" files from my own mod in other mod files? edit: all my Lua files are already loaded and usable in other files. Maybe because my files look like MyFile={} ... return MyFile
ah, is it because I'm making the MyFile object globally accessible by omitting "local" before "MyFile={}"?
a quick tl;dr LUA uses global namespaces, i think pz loads lua alphabetically? so it's a matter of making sure ur mods load after other mods if ur using their functions or vice versa
it is recommended not to use globals though
makes sense. I'll "local" all my classes
does the "require" argument need additional qualifiers if the class calling the command and its target are under media/lua/client? this is for a b42 mod
has anyone ever made a mod that changes zombie behaviour at certain times? i cannot seem to find where to begin with this. i just need to make it so zombies sprint only when its raining. would that be a LUA file?
it should just be require("path/after/client") so media/lua/client/myMod/MyFile.lua is required as require("myMod/MyFile")
is it absolutely necessary for me to use blender/a 3d model for me to get the items i put on the ground to look bigger than the base icon size
Would loading (not running during gameplay, but the initial load) the lua script without loading the other one first cause problems? If so, use a require.
It's probably java, but a good place to look is the sandbox variable than changes zombie behavior during the night.
Find out what it is called in sandbox settings, check if any vanilla lua scripts use it at all. If not, it's probably handled entirely within java.
There are ways to override zombie behavior - mods like Bandits turn zombies in NPCs with very different behavior.
thank you. ill try to look into it. i am trying to find out how this all works. i do textures and models, so coding is a new one for me.
do you know where i can at least find it? ive been looking into each of the folders and files. i'm really struggling to make sense of all this
lua\shared\Translate\EN\Sandbox_EN.txt hs the translatiosn for sandbox setting names, so we can see what we want is called "ActiveOnly"
Then a quick look through every .txt and .lua file under media shows other than translation that string is only used for sandbox presets.
Someone uploaded a decompiled version of Zomboid B41 to github which makes it easy to search, and looking there wer ecan see it gets used internally in IsoZombie:
What's interesting is while we can't make us of that diectly we can use isoZombie:makeInactive(bool)
I'm not sure what the best way to make use of that would be though - I don;t know if there is a reasonabel way to get all loaded zombies (for when rain starts/stops) and then grab each new one as it spawn or loads in (so it can be set to active/inactive)
There's a "scale" parameter in the model definition that can scale things up/down, but someone with more modelling experience can probably offer more practical advice (such as what size to make things in blender so yo don't send up needing scale 100000 or scale 0.00000015)
i know this is stupid but is it possible to avoid blender? if it isn't I'll just bite the bullet and use it but i hate blender
Probably, but I don't know what other tools will do the job AND be easier to use.
How do I stop a sound?
self.character:getEmitter():playSound("Dismantle")
ok
Blender's Learning curve is rough, but there are a lot of tutorials... which is good because you need a basic "How the Heck to I use the most basic UI features?" tutorial since it is full of hidden features.
yeah, it doesn't help that google is seemingly getting dumber
would it be possibel for me to look at hte models of existing items though
stopSoundByName()
Does play sound play for everyone or just for the player? Cus I saw somewhere that stopbyname stops only for the player
Yes, look at the FBX files in C:\Games\Steam\steamapps\common\ProjectZomboid\media\models_X\WorldItems and other folders
i'm not sure, i think it depends on which emitter you use?
There's a Zomboid taco in blender. I have no idea how texturing working though, since all my blender skills were learned for 3D printing.
Pretty sure they're breaking TOS by doing that (do with this information what you will; I'm putting this out there with no intent beyond informing)
there's prob a way to paint directly on the model
They absolutely are, and it should not be on github.
i tried using self.character:getEmitter():stopSound but that didnt seem to stop it
stopsound takes in the actual sound instance as the input so you cant use that
you cant save it to a var and then pass the var?
thank you. at least this is a start?
Yes, it suggests the idea may be feasible within certian limits... some ideas once you track things down they just won't hjappen at all without javachanges
There are other isozomvbie properties you can look at, like speedmult, in case those are more useful
you can but i was assuming you're trying to stop a sound being played by some other part of the game
just trying to stop the one i play when the action finishes
but that did nothing so thats why i asked of other ways
the vanilla timedactions do this
is that any way to make a weapon can lighting?like the vehicle light
i have add lamp to cell,but dont konw how to attach a light texture
You mean like a gunlight?
You might be able to make melee weapons take attachments the way ranged weapons do, and if not you can look at the gunlight code.
Or do you want a light source that is not attached to a player?
I want to make melee weapon take the gunlight
But canβt find the gunlight code
Like add a spark
https://steamcommunity.com/sharedfiles/filedetails/?id=3420760270
DESCRIPTION
Patch for Contacts by Russo
Adds a miniscule amount of discomfort to contacts (0.03)
Literally nothing else.```
Has anyone else had trouble getting mods to load locally... I have been hardstuck rebuilding my mod for B42, and I can't even get other b42 mods to load locally rn

can you show where you're putting the mod you're working on? and what it looks like for folder structure?
Omfg
I've been putting it in the mods folder in the game directory instead of in users for an entire day
rip
so im using starlit libary
local option = context:addOptionOnTop("Play With", character, onCubePlay, cube)
--I call the function when the button is clicked
onCubePlay = function(character, cube)
CubePlay:queueNew(character, cube)
end
--Which then calls this other one in the other script
function CubePlay:queueNew(character, cube)
TimedActionUtils.transfer(character, cube)
ISTimedActionQueue.add(CubePlay:new(character, cube))
end
-- I get an error that a param passed to TimedActionUtils is nil, i tried printing out which is nil but it does not print anything
could you post the error?
how do i copy it?
it should be in your Zomboid/console.txt
function: queueNew -- file: ActuallyUsefulItems_Cube.lua line # 60 | MOD: Actually Useful Items
function: onCubePlay -- file: ActuallyUsefulItems_Context.lua line # 7 | MOD: Actually Useful Items
function: onMouseUp -- file: ISContextMenu.lua line # 90 | Vanilla
ERROR: General , 1738648949022> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: transfer of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1738648949022> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: transfer of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
at zombie.ui.UIManager.update(UIManager.java:816)
at zombie.GameWindow.logic(GameWindow.java:262)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:681)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1738648949023> -----------------------------------------
STACK TRACE
TimedActionUtils is nil, have you included```lua
local TimedActionUtils = require("Starlit/timedActions/TimedActionUtils")
i just did requires = path
oops
well still didnt fix it
it also says "warning require("Starlit/timedActions/TimedActionUtils") failed"
are you in build 41 or 42?
41
ah, should be Starlit/client/timedActions/TimedActionUtils then
it was moved in b42 since timed actions themselves moved to shared
where can i edit the loudness of sounds? (outside of the ingame shitty menu)
Is there any documentation for recipes?
`craftRecipe FillPipe
{
timedAction = Making,
Time = 60,
Tags = InHandCraft;CanBeDoneInDark,
category = Miscellaneous,
inputs
{
item 3 tags[Tobacco],
item 1 [Base.SmokingPipe;Base.CanPipe] mappers[PipeMapper],
}
outputs
{
item 1 mapper:PipeMapper,
item 1 Base.SmokingPipe_Tobacco,
}
itemMapper PipeMapper
{
Base.CanPipe_Tobacco = Base.CanPipe,
Base.SmokingPipe_Tobacco = Base.Base.SmokingPipe,
default = Base.SmokingPipe_Tobacco,
}
}`
Among other things, I am trying to figure out why tags[Tobacco], gets item 3 in front of it but the others get item 1
item 3 means you need 3 items, while item 1 means you need one item
how can u play sounds for like recepies when making them?
If the input item has a use delta, of say 0.5, then what would 3 mean in that context?
Sound: (sound file),
As a recipe parameter
I guess it probably uses the item by the delta 3 times
if item has 0.5 useDelta, as you knew you can use twice.
so item 3 will use 1 + 0.5 items i guess?
craftRecipe RefillBlowTorch
{
timedAction = Welding,
Time = 50,
OnCreate = Recipe.OnCreate.RefillBlowTorch,
Tags = InHandCraft;Welding,
category = Metalworking,
inputs
{
item 1 [Base.BlowTorch] mode:destroy flags[NotFull;ItemCount],
/*item 1 [Base.RubberHose] mode:keep,*/
item 1 [Base.PropaneTank] flags[NotEmpty],
/*item 1 tags[OxygenTank] flags[NotEmpty],*/
}
outputs
{
item 1 Base.BlowTorch,
}
}
btw if you have flags[ItemCount] for item which have useDelta then
item 3 mean Three Whole Items nomatter it's remained delta.
refilling blow torch is an example.
It destroys BlowTorch and create a new BlowTorch.
i was thinking... maybe if i did a script that checked the weather every in game half hour or so. if it is raining, it runs the command to set zombies to sprinters, if it is not, it runs the command to set them to fast shamblers. problem is, i am a modeler and texture artist. i can change a script or lua or java file, but writing one from scratch is... hard.
OnWeatherPeriodStart
there's a event which fires function when weather is about to start. I think you can use this to check current weather.
local function myFunction(perioud)
if period == "something" then
--here
else
--and here
end
end
Events.WeatherPerioudStart.Add(MyFunction)
https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/iso/weather/WeatherPeriod.html
periods
declaration: package: zombie.iso.weather, class: WeatherPeriod
The tricky part is "set zombies to sprinters" isn't one command (unless you find a better way to do it), it's one command PER ZOMBIE.
And only the zombies in the area immediately around the player are loaded and able to be modified, and even then I don't know how to iterate through them all without killing the PC.
Then the player moves, a new bit of the world loads, and all the zombies in it need to be set to sprint/not sprint since we have no idea what status they were in when their chunk was last active
If you're lucky there's a way to handle all this that doesn't rely on editing each zombie, otherwise I guess you just give it a go and see how much it hits performance.
Actually... it would be quite easy to do imo
Tho I'm very familiar with setting zombies
https://pzwiki.net/wiki/Mod_optimization#Load_balancing
I read this, still not fully understanding but i think this is helpful.
- OnZombieCreate: set zombie to right speed based on current weather state
Then overall
- detect when it starts raining, or stops raining
- iterate through every zombies in the chunk
- set their speed accordingly to the weather change
Yes that's mine lol. Basically instead of iterating through every zombies which could possibly create a lag spike if you do a lot of operations, you instead should spread these operations on multiple ticks
I suggest you check that out
Both my messages
oh lol the whole sections were very helpful. i've changed a lot of things myself after read that.
Good to know, it's meant for that !
The principle of load balancibg applies to everything. The simple question to ask yourself to know if uou should do it are:
- do you need to run the code during the event instantly ? If no you can load balance
- do you have anything that could be load balanced ?
For example my mod detects whenever a chunk loads in, and I iterate through every squares (not all in reality) but instead of running my very costly code right on load chunk, instead I run a square per tick right after by iterating through a table and removing entries and adding new squares to it to check on chunk load
Great idea, sharing the load over more than one tick
ime a square per tick is way too slow
unless you're checking less than every square or something of course
Easy to adjust the rate though
Like I said I actually iterate through every squares, I only do 4 square per level per chunk
So in my case, it's good
But I agree it might be too slow, tho it really depends what you are doing too
But a chunk is 64 squares per level so yeah I agree it can be quite fucking slow
and keep in mind you never load just one chunk at a time, it's usually several
@autumn garnet actually this applies to your new code, do you iterate through 1 square per tick ?
If you do you probably want to bump that up
Also one thing I do is run the code only on newly generated chunks
so it can be thousands of squares that you're iterating through very slowly, the player can easily add squares faster than you process them and if you're making a change the player can observe they can easily outrun it
Agreed
no, for now I don't use the OnTick, the load chunk works quite well without compared to the OnLoadGridSquare, I focused on adding various features
Random stories / vehicles stories and vehicles / random add barricade (not like Barricaded based on gridsquare) /actually i'm on the roof generator
But yeah adding random stories was a good idea !
Idk about the barricades, I feel like some might prefer barricaded worlds as it adds more ?
Also breaking windows
I'm wondering if I should try to import the b42 vehicle skins into b41
Would that be worth it
Haha i will redo it for floor > 1 it's only smashed windows
I also need to automatically add the sheets that cover the windows
Perhaps there should be a chance for a window to be broken with a rag laying around it, to show a zombie still broke in
I tried this just now, didn't work, don't bother
can i get some pointers on how to make a whole outfit appear on a female zombie in a certain area
nvm figured it out while butchering some mod, another question tho, is it possible to add entries from different mod to an outfit, like i have boots from 2nd mod i'd want to use in an outfit in the 1st mod, but if someone doesn't have that mod installed would that cause errors?
I know how and I'm gonna be honest this can be a long process to explain
Alternatively I made a framework that allows you to do this kind of stuff on zombies but I didn't write the doc for it
No idea, I believe it doesn't throw any errors
I need to write a wiki page about itemvisuals and zombie visuals in general
is it really, in that mod i checked it's just a clothing.xml and 2 .luas with like few lines in them
Meant long to explain
ah ok
The problem is that spawning a specific zombie at x coordinates poses some challenges
I believe there's an easy solution, to make the zombie player reanimated so it's data gets saved or some shit
But if you don't do that your zombie won't be persistent
i just want to spawn a zombie near a church or smh
so it's safe to throw in GUIDs from diffrent mods to the outfit, and if someone doesn't have those mods those items will just be ignored?
this is odd, I can get a players AnimationPlayer, but can't call any methods of it
I think so yes but test it
Good day to ya all modders funkers !
I have a issue, my mod with custom new items/moveables (Traps), is coming close to being done but, I had problem with sounds not playing (I though it was because I was trying to call sounds that were missing/not existing)
but once I used all existing vanilla sounds, I noticed a continuous sound, still looping after sparkler-trap explode. (script-item type weapon:CountDownSound = BlowTorch, I used this to simulate sparklers).
Any dΓ©jΓ -vu ? or insight ?
My guess is you used a sound which is in loop mode
I notice that, cuz I used FixWithTape and that one is one shot sound, best for quick recipe.
You need to define your sounds with sound scripts
and its glitching footsteps.
I used vanilla sounds but I could create .ogg or any I know music prog.
Just your sounds need a sound script to be played, which is why your sounds didn't play is my guess
ok I see thanks you, i need to program the use of that sound for my recipe/ item
I added a tooltip, but i cant get it to show it says it cant find translation but i added the files
Translate\EN\Tooltip_ENG.txt and added it
Rename it to Tooltip_EN.txt
i mean it is, en i miswrote it
How is your tooltip set up in A) the script itself and B) in the Tooltip_EN file?
Do you have it as Tooltip = Tooltip_Cube
or as
Tooltip = Tooltip_Cube,
?
with ,
Weeeeeird
That's exactly how mine are set up and they work just fine.
The translate files are in media/lua/shared/Translate/EN?
I know someone who does such
they don't spawn at all, the shoes, do i need to specify it in the lua too somewhere?
and also while we're at it, those shoes have 3 texture choices, is it possible to limit spawning to only 1?
No
Not sure
It just means you didn't properly specify the clothing to spawn
i mean with the mod enabled the shoes aren't spawning on the zombie with the outift
can you put "onbreak =" on clothing or is it only for weapons?
No idea
Guess I'll find out real quick
You can
could you please tell me what does this file do, it's in the lua/server/items folder, i found that in some other mod and just filled it with my stuff, but not sure what it actually does π cuz there's another lua in shared/NPCs that specifes where the outfit should spawn
That puts your items into loot tables ingame. So with those lines your stuff would have a small chance to spawn in crates that are defined as CrateClothesRandom
oh thanks!
can i somehow force zombies to spawn in their locations in game?
like i went to a church to see if there were any zombies wearing my outfit there, but there weren't any zombies there at all heh
I have a hunch your mod is a skimpy nun outfit
MyCamo mod is now available! This modding tool allows you to add in your own camo clothes to the SupportCorps mod or independently!
https://steamcommunity.com/sharedfiles/filedetails/?id=3420982916
say your prayers cuz it's almost done lmao
any idea how i would go about tiling an object? ive made a flatscreen tv and got it to function and work with vhs tapes, but currently only option to place is like freehand. it doesnt snap to a tile like a regular tv or other furniture does.
i also want to know how i can make disassembling a furniteure item i made split up into 2 parts like the couches and stuff do
idk if thats possible tho
that class is not exposed to lua, so while you can get an instance of it, it does not have a metatable (which would contain its methods)
oh thats annoying grr
i'd suggest looking in the game files, i have no idea how any of that works but there's a script folder with furnitures at media/scripts/movables, just poke around the game folders and you might figure it out
thank you so much. i am looking into it! bless! β₯
okay so i talked to one of my friends who is familiar with java, he said he would be looking into those to use as the "checks"
I have been having a hell of a time trying to get recipes to work on B42...
i tried changing the item type to "movable" because thats what the items did in the media/scripts/newMovables. but when i go to craft the item it breaks the game in debug mode completely. and when looking further it looks like furniture calls for "worldobjectsprites" or sdomething that is in a VERY long lua file lol. so idk how i would create a new object sprite or somehow make it so that I could make the items moveable (tiled). i think the main issue is that this is a crafted item, and maybe crafted items arent supposed to moveable on tiles like that idk
i think movable objects aren't craftable but buildable, whatever's the difference
you could look into building files maybe that would help somehow π
New wiki pages which explain how to manipulate the clothing visuals of IsoGameCharacters (zombies or players)
https://pzwiki.net/wiki/ItemVisuals
https://pzwiki.net/wiki/ItemVisual
where could i find the file for skills?
What file ? What skill ? What do you mean file for skills ?
i forget the name of this skill when creating a character. it's the one where you are harder to be detected by zombies
Is there a lower limit to setting the procedural distribution chance?
When I check LootZed, this:
table.insert(ProceduralDistributions.list["ArmyStorageOutfit"].items, "Base.Test_Item_01);
table.insert(ProceduralDistributions.list["ArmyStorageOutfit"].items, 0.005);
Has a much lower chance of spawning than
table.insert(ProceduralDistributions.list["ArmySurplusOutfit"].items, "Base.Test_Item_02");
table.insert(ProceduralDistributions.list["ArmySurplusOutfit"].items, 0.000000001);
In this example, Test_Item_01 comes back with a 0.0039999% chance of spawning while Test_Item_02 comes back with a 7.999% chance.
Is it possible to set the value so low that it wraps back around and actually increases? If so, what's the lowest?
New page about HumanVisual
https://pzwiki.net/wiki/HumanVisual
Setting such a chance doesn't make much sense I believe
This might interest you
Thank you, I read through that before posting here but didn't see anything that actually gave a limit.
The main thing to remember is that calculation for chances is kind of weird
And if you just need such rare items, you're actually probably better off doing it OnFillContainer
Better control on what's going on at least
I would definitely use that option, but we're actually overwriting the distribution of another mod's items
I'll keep lowering them until it wraps back around like it has haha
Thanks for your help
Siiiiiick, i got my fuse sound (non-commercial use license and my editing with my license) working for my sparkler armed trap.
Vanilla Timer trigger traps have that special sound combo of beeping (TrapTimerLoop) until it's expired (TrapTimerExpired) before the explosion.
The weapon:traps have that param: CountDownSound you can use to change the traptimerloop sound, but it doesn't allow changing the TrapTimerExpired it seems.
and it can't be changed with either other vanilla sound (events sourced) or loops because nothing is going to stop the event or loop playing.
So my guess is use only single shot sounds / not looped for this.
and make it short if you don't want the sound to continue playing (after item destroy) until it's reaches it's length. My loop not looped is 15 sec, so it's fine for 45/30/15sec timers I might not even change it.. yup the flame blast last long enough with noise so that it's barely noticeable if the sound is not finished playing after the blast.
Hi! In B42, is the command "item:getRemainingUses()" for drainable items not usable anymore? If so, is there an equivalent?
Many thanks!
craftRecipe emptyOutCigarillo { timedAction = Making, Time = 120, Tags = InHandCraft, category = Miscellaneous, inputs { item 1 [Base.Cigarillo] mode:destroy, } outputs { item 1 ReeferMadness.emptyCigarillo, }
This simple recipe is causing my game to freeze so bad I don't even get any errors, it just stops while loading my recipes file, and I know it's this one because all the others work with it removed but I cannot for the life of me figure out what's wrong with it
it there any way to make the icon of a item with no world model bigger when on the floor? Blender with its lack of documentation and notorious leaning curve is fighting me on every step i try to take.
I'm using reloadLuaFile to update my UI classes in my mod, but after reloading, the UI still behaves as if it's using the old code - event handlers and other updates don't seem to take effect. How can I ensure that UI elements are fully reinitialized when reloading UI classes?
event handlers are external to the file, so they won't be removed just by reloading the file, the new ones just get added on top
Based on what I'm finding, I can't do what I asked before. However, I'm still going to take the easiest route is the best route strategy, so if I were to make a flat plane with a 2d texture on it, what angle would I have to put it on either in blender, or if rotation is a value I can put into the script for its model, then that, if I wanted it to face directly at the camera.
If there is no world model then an item on the floor should show the image used in inventory as a flat sprite.
You see this with items like broken glass, which has an inventory icon and place-as-world image but no 3d model for "sitting on the floor"
if you want to change icon's size then
inventoryItem:getTex():setWidth() and setHeight()
you can do this
oh damn google lied to me, thank you! will this work if i put the item on the ground?
they are also big when you dropped into floor.
I actually did inventoryItem:getTex():setWidth(32) for 256x256 icons to make smaller
because when you dropped on floor, as DrStalker said it's just an its icon
i assuming i need to put inventoryItem:getTex():setWidth() in a lua file
but i have no idea what will be happened when you size up icons of items which are in inventory/container pannel lol
when sizing up the icon do i use a client, sever, or shared lua
can you point me to some documentation on how to set up the lua file to use inventoryItem:getTex():setWidth():setHeight()
I think you have to make a new function for that if you want to make icon is only bigger when it's on floor.
Leaving and re-entering the world works (it's UI client code). Is there a faster way?
for me, I initialized all 256x256 icons to 32x32px when game is booting.
I'm kind of spitballing here, since I have no direct experience with making mods, but I kind of wanted to create a mod thats in the form of a tarkov-style flea market, driven by players in SP. You think that's possible?
its the only way i think
Why not? unless you want to recive data from online. if you want to receive data from online, you will need something else like external program and not recommended
the game camera is at 45 degrees i think?
doing this wouldnt be ideal tbh since the texture would have filtering applied to it
Thanks for the clarification
just gotta make sure,
inventoryItem:getTex():setWidth(10):setHeight(10)
end```
this will work on a OnCreate item func right?
function HHBRCAdjustItemIconSize(item)
item:getTex():setWidth(10)
item:getTex():setHeight(10)
end
like this
oh ok thx
i did some organizing of my mod and now PZ wont recognize that its there
that would be it
Is anyone interested in making a collabaration to make a medieval-focused mod?
I have a plan for a mod called After The End that adds new things related to medieval such as alcohol brewing, melee weapons, leather and cotton clothing, new furniture, etc.
What sorta help do you want/need for the collab?
incompatible=\theUnwantedMod,\theOtherOne
dope, thanks
require=\Bandits
incompatible=\BanditsDayOne
from bandit week one
I can't seem to get the "bare hands" weapon type. I'm trying to simulate a shove. Static methods should be accessible with. right?
InventoryItemFactory.CreateItem("Base.BareHands")
causes a null exception
what are you needing to simulate a shove for?
are you in b41?
b42
I am modifying stomp to push back all nearby zombies as if there were a shockwave. Current attempt is trying to leverage a shove to push them backwards.
instanceItem("Base.BareHands")
InventoryItemFactory.CreateItem does not work anymore in B42
whatever u wanna help with.
pretty much we divide the work and try to finish faster. but if u know LUA then I'll need u to focus on that while I focus on the other things like items and clothing