#mod_development
1 messages ยท Page 155 of 1
how did you find it if you dont see error\
started a new game
found a vape on a zombie
context worked fine
transferred to inv
cool
didnt check it for a while
went to check it to use it and the context text was gone
spawned new vapes, also gone
reloaded save, still gone
I got this, which fixed itself after I went and opened the mod list from main menu ๐ค
that sometimes happens if it's the first item in the inventory
i'm honestly not sure how to fix it
We were just looking at that GnomeBars code this evening. Is it posted on the workshop yet @fading horizon ? I'm off to bed for the night. Finally got the schedule right but I'm back to being an old person ๐
weird thing is that no user has ever reported this issue
so idk
just booted a new game and same issue
Anyone?
You're selecting burnt script, makes sense that it's a burnt vehicle?
It doesn't show up in the normal area though, I didn't make it a burnt one
Not intentionally anyway
If you share the vehicle script maybe somebody will notice something wrong about it.
this gonna be the dog in b42?
Sorry but no
I was inspired by the WoW quest voice mod thing. You guys seen it? Basically AI-generated voices to accompany quest text in WoW. Imagine something similar in Zomboid; auto-generated voices for characters whenever you type out something they say. That'd add so much for immersion.
So, in theory, someone types "Hello" in multiplayer, for example. The character would have a few invisible tags (chosen at character creation, or tied to pers) describing the voice, such as "male", "young","raspy voice" and similar, and the mod would follow those tags to generate a fitting voice. We could literally hear that "Hello" in an appropriate voice.
Hey, so I have my moddata being initialized by separate lua, and at the end of it I have this
Events.OnCreatePlayer.Remove(createModData);
Events.OnCreatePlayer.Add(createModData);
but I'm getting reports that if you die and try to create new character it throws errors (errors are in other luas on lines that use moddata, therefore it's not initialized)
I thought it'd fire when new character is created?
it does
Steps:
1. Create the first character in a new save;
2. Do nothing and be killed by zombies immediately;
3. Create a new character in same world;
4. Report errors in the lower right corner after customizing character but before spawn.

hm
well everyminute/every10minutes fire before player is created
cuz it errors
yea idk
anyone got any ideas how to fix? 
is it only lines to do with moddata that are erroring? you'd expect anything that tries to use the player to error if that's the issue
yes, for example, here's stripped down code, throws null error at modData.FoodSicknessWeathered = modData.FoodSicknessWeathered + foodSicknessStrength;
local function foodSicknessTraits()
local player = getPlayer();
local foodSicknessStrength = player:getBodyDamage():getFoodSicknessLevel() / 100;
if debug() then print("ETW Logger: foodSicknessStrength="..foodSicknessStrength) end
local modData = player:getModData().EvolvingTraitsWorld;
modData.FoodSicknessWeathered = modData.FoodSicknessWeathered + foodSicknessStrength;
if player:HasTrait("WeakStomach") and modData.FoodSicknessWeathered >= SBvars.FoodSicknessSystemCounter / 2 then
player:getTraits():remove("WeakStomach");
if notification() == true then HaloTextHelper.addTextWithArrow(player, getText("UI_trait_WeakStomach"), false, HaloTextHelper.getColorGreen()) end
elseif not player:HasTrait("IronGut") and modData.FoodSicknessWeathered >= SBvars.FoodSicknessSystemCounter then
player:getTraits():add("IronGut");
if notification() == true then HaloTextHelper.addTextWithArrow(player, getText("UI_trait_IronGut"), true, HaloTextHelper.getColorGreen()) end
Events.EveryOneMinute.Remove(foodSicknessTraits);
end
end
local function initializeEvents(playerIndex, player)
Events.EveryOneMinute.Remove(foodSicknessTraits)
if SBvars.FoodSicknessSystem == true and not player:HasTrait("IronGut") then Events.EveryOneMinute.Add(foodSicknessTraits) end
end
Events.OnCreatePlayer.Remove(initializeEvents);
Events.OnCreatePlayer.Add(initializeEvents);
and a bunch of other similar errors, all say that my moddata table is null
ok what happens
is that after you die but before you spawn it catches a moment where it runs all that code. Moddata is getting initialized but a second later, right when you spawn
i think if i clear my events when player dies it should fix it, if there is such event
hey guys
wher's the best place to ask question about clothing modding
im having a problem with applying a texture
i think you guys would find funny as well ๐
if problem is code-wise then prob here
Sir this is #mod_development
maybe i should go to modeling ?
Just hand around, someone may help you. Idk textures so can't help
maybe try with
local player = getSpecificPlayer(0)
print("player 0 exists ",player ~= nil)
local player = getSpecificPlayer(1)
print("player 1 exists ",player ~= nil)
already fixed
but ty
fixed by removing my events on player death btw
since they are added when player is created anyway
how can i get a list of active mods?
You can modify my code for adding mods
This js one way of how you can get the list
I recently posted this on our severs debug codes
It uses
getServerOptions()
do you know how to do that also in sp? I get a blank list even though i have 3 mods on rn
getActivatedMods()
if you're trying to see if a specific mod is loaded you can then use :contains("ModID")
swear to god i knew there was a a call like getActivatedMods couldnt find it though
but thank you albion
it has to be the modID and not the mod name right?
yeah
you can technically loop through activated mods and use getModInfoByID(id) to get the mod object and then :getName() on that
but i'm not really sure there's a particular reason to use names anyway
get active mods is a thing
Server options may have a use here too
They also include all the other options
well i used the id, the number, but it said it does not include that even though i got the modid from steam but when i used the name of the mod it did say its included
yeah, not the workshop id
yea getActivatedMods is an java array
but i figured it out already
the thing is im tryint to pass my mod on advanced trajectory since it kinda overwrites the normal shooting and my mod need the OnWeaponHit event
local loadedModIDs = {}
local activeModIDs = getActivatedMods()
for i=1, activeModIDs:size() do
local modID = activeModIDs:get(i-1)
if crossRefMods[modID] and not loadedModIDs[modID] then
require (crossRefMods[modID])
loadedModIDs[modID] = true
end
end
I do this to grab files that cause problems and load them first
Also so I don't have to keep calling the function and parsing through
1 - how can I pass the same inventory_items to the read_all_maps function via context:addOption as in the maps_context function
2 - and also another question - how can you read a map without calling up a window about what is drawn on it? well, that is, just call the function and after that the map that is in my pocket will be displayed in the main map
local function read_all_maps(items)
print("-------------------------------------------------------------")
for key, value in pairs(items) do
print(value)
end
end
local function maps_context(player, context, world_objects)
local inventory_items = ISInventoryPane.getActualItems(world_objects)
local find_map = false
for key, value in pairs(inventory_items) do
if string.find(value:getFullType(), "Map") ~= nil then
find_map = true
end
end
if find_map then
context:addOption("ohhhhh yeeaaaaa", world_objects, read_all_maps)
end
end
Events.OnFillInventoryObjectContextMenu.Add(maps_context)```
Hello. Someone knows how can I change the size of the rectangle interface in map ISUI ? I need to extend the size of the rectangle to be able to see the hidden content ... I believe it is in this file but I don't know where to change it exactly. If anyone knows and can help I appreciate it!
Maybe here ?? Idk ..
ISPanelJoypad.render(self)
if self.selectedSymbol then
self:drawRectBorder(self.selectedSymbol.x - 1, self.selectedSymbol.y - 1, self.selectedSymbol.width + 1, self.selectedSymbol.height + 1, 1, 1, 1, 1)
end
if self.joyfocus then
self:drawRectBorder(2, 2, self:getWidth()-2*2, self:getHeight()-2*2, 1.0, 1.0, 1.0, 1.0);
self:drawRectBorder(3, 3, self:getWidth()-3*2, self:getHeight()-3*2, 1.0, 1.0, 1.0, 1.0);
end
end```
I need to extend down rectangule of map symbols 
Hey guys, I'm beating my head against the wall on adding a delay/timer to my lua script.
I can make the game AddGeneralHealth with ease, but I would like for it to happen several times over a set period of time. Any tips on where to begin looking?
anyone here know how to do traits, professions, and perks?
new modder. Is there a way to quickly reload a mod without restarting the game?
you can reload lua files from the f11 menu or just have the mod disabled on your main menu so it reloads lua every time you load the save you're testing on
Anyone here know why a tile with the "can be hit by car" property and a damaged sprite would work in single player but not multiplayer? No matter what I've tried on the tile properties, I can't for the life of me get a couple of tiles to properly be damaged on impact in MP, they are just driven right through for some reason even though all other tiles work fine.
now you can equip a backpack with my satchel as well as wear it on the front
What have you tried already? In general, for timed stuff, you need to use some event that is triggered on an interval and keep track of the timing state yourself
The event that's the most suitable varies depending on your use case
That's the only way as far as I'm aware, anywayโas always, I'd love to hear that there's a better way
So I have attempted to create a storage mod allowing the building of a couple variations of pallets without using lua (due to skill issues.) This has resulted in a few additional issues. 1: When using the result format Moveables.Tilesheet# the objects appear with the default icon and "Moveables" as the display name. 2: Items are not able to be removed once placed and must be sledgehammered. 3: Replacing the result with the item name corrects #1 but #2 still applies. 4:The IBC container when using the Moveables.ect format shows a water capacity when placed but cannot be refilled, however if changed to the item name it no longer displays this information or acts as a water container when placed. #2 also still applies to this container.
Is there a guide for what I am attempting to do somewhere that I have been unable to locate?
need a bit of help here, so this function is called when a recipe is used, i have it on another line where it works when you take the battery out of the vape it maintains its delta from the vape to the battery but when you go and put the battery back into the vape it gives a full delta, the recipe for removing the battery only has one item in the recipe but the code for this one has two items in the recipe and it cant find out what one to call so it skips and gives a full delta, is there a way i can have the get/set usedDelta to call a specific item its self? the if item:getModule() == "VapeMod" and (item:getFullType() == "VapeMod.VapeBattery") then is only checking if you have it not using it ๐ฆ
Can you give an example of one such event?
disregard used this argument instead and removed the need for adding an item as the delta does not get effected in that part seeing as you would get the items delta from the recipe its self when it finished i feel better now
@bronze yoke im slowly learning XD
i saw you typing haha
glad you got it!
lets just hope it works when i need it to clone the delta and there are 2 of the same items with two dif deltas >.<
i actually found it in the base game code for adding a battery to a flashlight
OnTick, OnTickEvenPaused, OnPlayerUpdate, etc.
It really depends on what you need
ontick is usually the most useful but everyoneminute can be useful if the effect is slow and you don't care about having perfectly consistent timing
so im actually working on that same code with rush and captain what they are trying to do is get it where it ticks every 5-10 seconds and happens like 4-6 times before the function ends
you can use GameTime's getMultiplier() to get a delta
the implementation of this kind of thing is usually pretty manual and annoying
Hi, in a MP mod, on server side, I wanna get info on a random grid square of the map that is very likely not to be loaded. How can I get the info ? Alternatively, how can I force part of the map to be loaded on the server side when no player i closeby ?
@bronze yoke sorry for the ping but wanted to see if you knew the answer to this, that item that gets added threw the function is there a way to set that items delta to the item used in the recipe?
char:getInventory():AddItem(type, useDelta)
also if you're checking fulltype you don't need to check the module, module is in the fulltype anyway
so like char:getInventory():AddItems("VapeMod.GreenVapeBurnt", useDelta) ?
AddItem not AddItems
in place of useDelta use item:getUsedDelta()
looks right to me!
going to test it now!
Thank you, do you have any cue on where I should look to hook the data load from a lua ?
LoadGridsquare event
your amazing it worked thank you!
so i'm having trouble getting my mod to use the model and texture i have for my pen. I've copied the vanilla pen model and altered the texture, but it won't use the model and texture I have in the mod.
It works for the cooler I did, but for whatever reason its not working for the pen. I used the same template as the vanilla items with some altered stats. I'm not sure what I'm doing wrong.
I've been asked to get back into modding PZ, so I've been going through my code from before and it appears I have forgotten lua
Oh no
suddenly a lot less resistant to the idea of that Typescript precompiler thing that one guy was working on. I'll have to have a look for it
I've just renamed everything but it seems to work still, I plan to finish it in the next days to test with the solar panels mod. Maybe you'll find it useful too.
I'm not sure about loading existing parts of map. I have script to load map that is used as default for that square. If you need access to squares data of unloaded parts, it's usually done with global data / global objects.
I heard someone has or had worked on a discord bot for some server interactions... has anyone coded one that can interact with rcon or the server directly in a way that would allow users to initiate a server restart without intervention from the server owner? For mod updates and such
Hey, I'm trying to modify food tooltips. I'm trying to wrap around the ISInventoryPaneContextMenu.addEatTooltip method like so:
local base_tooltip = ISInventoryPaneContextMenu.addEatTooltip
function ISInventoryPaneContextMenu:addEatTooltip(option, items, percent)
print("custom addEatTooltip called")
base_tooltip(option, items, percent)
end
It's never printing to console. The other functions in the same file are working correctly. Is this the wrong method to wrap?
I don't see it being called from anywhere.
also it's declared as
ISInventoryPaneContextMenu.addEatTooltip = function(option, items, percent)
which means you would have wrong parameters in the example above.
that function is just dead code? Where are inventory tooltips created?
Hello awesome people. Anyone know a way to determine if "strong" was earned, or selected at character creation.
Looking at https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#getTraits() seems to just return them all, and I don't see any indication if it was automatically applied or choosen ๐ข
i doubt the game keeps track of this
you can keep track of it yourself but it won't work with old saves

Wtf
This is why I work on tools and not mods.
Can anyone help me with this?
Hello. I had a problem with uploading a mod to the workshop for the game Zomboid Project. Please help me solve this problem. screenshot of the error.
wasnt my intention to make it do this
https://imgur.com/a/jBfT6fS
i dont understand why its going back lol
I think it shows as burnt if it doesnt have some key working parts. As for being invisible, double check the model and texture paths and names
is there anything wrong with my item script? still can't figure out why this model isn't displaying :/
Did you declare the model?
maybe check here
https://partner.steamgames.com/doc/features/workshop/implementation
https://partner.steamgames.com/doc/api/ISteamUGC#SubmitItemUpdateResult_t
you can also search for that result on discord, google. Seems like it might be related to slow internet.
Are there any good cannibal mods, I might need to chop Zeds into meat chunks.
What I actually need is a way to make compost from corpses, I think somebody already made a mod like that.
Do you know a mod I can suggest for this?
I am trying to make a new category to "AttachmentType" to be able to change the location on the back of a weapon of my mod, I add it to the back list in my respective file "ISHotbarAttachDefinition.lua" and in "AttachedLocation.lua" add the definition of modelAttachement group, in the "ISHotbar.lua" file I know that I have to add the functions to add the item, I tried adding part of the code, all the code, tried to see if the NoirsAttachment mod helped me understand what to do, but it is beyond my understanding can someone tell me what i did wrong and what to do to make it work?
Hi,im trying to get all items in the game but it keeps returning a nil everytime. I have seen many examples of people doing it and they just use this, but when i do it, i get a nil. Any ideas?
local allItems = getScriptManager():getAllItems()
print(allItems[4])
ohhhhhhh, im such an idiot. And i already did on others parts too....
Thank you!! ๐
tables
getKey(),_G,scripts,vanilla perks,vanilla traits,permission,lua events,WearClothingAnimations = {},getWorld():getAllTilesName(),getScriptManager():getAllModelScripts(),OnPlayerGetDamage,getBeardStylesInstance():getAllStyles(),getHairStylesInstance():getAllFemaleStyles(),getHairStylesInsta...
i know youre asking for the code but just wanted to share this .. ive been collecting arrays
this is posted here https://discord.com/channels/136501320340209664/1070852229654917180
feel free to modify it and add to its. its for the whole community
Thats actually really helpful! Thank you for this

Will do, thank you!
Hi, I wanted to ask if there is any project or just a tool that could render the current server map and live display the players on it on the web? Kind of like the dynmap in Minecraft.
I changed a few things on the mask and the file path names but it still is invisible and burnt
Anyone who has done car mods before please could you help me out? I'm really bad with this ๐
Not that I know of - but there's a few people here that might know how to go about it.
Not going to ping them, but you can try DMing: M3ss, Dane
What I imagine would be the best way to go about it would be to have the server print a text file of locations periodically and have the website pulling it's data from the text file.
The discord stuff is also a possible route -- but I don't know how well scoped it is or isn't.
Are you setting lastX and lastY with setX setY?
That's basically a teleport, no?
Also laughing at the model size declaring the shadow size
Cars do that too
Are you the main author of the mod?
What directory path does GetModFileWriter use?
The mods' installation folder
Speaking of which... Steam is not able to scrub files properly if the files aren't part of the download.
You're probably better using the other file writer function
The other file writer?
Which places it in the Lua folder of the cache
Is it just GetFileWriter?
I think it's just refered to as FileWriter
Actually its just animation
Its not doing any tp
And for now its bound to shove
So the the slide back is part of the animation?
But will change it
Should make it fun to play with like how levitate mod feels
Shove is not a bad place to have it
Yes theres a keyframe i wasnt able to remove
Or maybe its just how i teanslated the body too
O should have just translated the translate bone
Do you know perhaps the syntax for the pathing in GetModFileWriter?
Like the arguments?
Yea
Iwas thinking of crawlong walk
Sprint is leaping
Sneak his grabbing the ceiling
But needs checker if there floor above
Im trying to access an existing file but i think my pathing is wrong
Im trying through mod_name/media/folder and in there is my .txt
getModFileWriter(modId, configSavePath, true, false)
Shouldnt modid be the name of the file you trying to access?
You're thinking of requires
(which im not even sure why that argument is called modID)
Here the modID should be your mods ID as found in modINFO
And the config path starts of in media or before that?
The save path is inside the mods install folder - I forget if there's an added directory
May or may not be media
May be outside of contents
Iโll try with both
You don't have to add media or the beginning
Start with what you want it to go to
It will dump into the directory
Well i did one before media and it did read the file correctly
The getmodwriter reader
Access files that are on the lua folder of the server not the media lua
It doesnt access the files that comes with the mod
Well i pointed it towards a custom folder
Its only to manage cache
There's two writers
Ah didnt know that
i think the other one is GetWriter is the one for the vanilla
I havent tried that
Also, I just wanted to clarify, you don't need to start the path like "C:/username" etc
It starts in the mod directory
Or if you're using the other writer, in the Lua directory of the cache
Did not use it either
Not root wait
Just checking, as I think there's a language barrier
Root is applicable I think
Yey
Does it append the changes on file:close()?
I dont get it to actually write it in there
Ok nvm i found the issue
I was just stupid
Man... I'm about to just start slapping tooltips all over character creation for Skill Recovery Journal
Do you guys think this is a good layout:
https://user-images.githubusercontent.com/6071161/235355151-ae4d9c1a-42c4-433e-8827-46dc282ec564.png
Would also be eliminating the [ More ] button at the bottom
looks noice
Just getting tired of people asking me why my mod doesnt work cause they don't actually have it enabled on their on-going game
can you make as tooltip that lets you know that you are now seeing your game main menu and are not on your desktop anymore?
hm?
Not sure if that's meant as a joke against the players - but I don't really fault them for not knowing there's a mod menu for each save
Most people just hit continue
I'd probably remove the continue button as all it does it load the latest save
Sorry gamers ๐
Not even that, they might not even know they are in-game
Not sure what you mean tbh
one day you will, and then you chuckle quietly in your bed, but you won't elaborate to anyone
"players are idiots, and you should treat them like it"
you said that!
I am an idiot myself, and I play games, so it tracks.
most of the time I am as well, its easier that way
I'd say it's 50/50 in this case
Most people who use my mod are new players
I get at least 1 comment a day about this
At that point I'd say, yes they aren't looking hard enough around, but at the same time -- going through Load > More... > Mods when they always just hit Continue is also not that intuitive.
Plus if they just keep creating characters on the same save - I'm sure they've never ran into some mod's content cause they're not actually enabled 
but I get them, most come from hard day of work/school, power up the PC, click PZ next next next and gaming time, no time or will to read or do anything else that is not pure entertainment
tbh it happens to everyone, I spent the past 20 minutes losing my mind, forgetting that lua is 1 indexed and java is 0 indexed.
Better than the old days of "you load a save with the current list of enabled mods" that usually meant you're wrecking your save unless you take the time to re-enable the list you were using
Wasn't aware of that tbh
Explains the lack of mod profiles
The same way traits and sandbox can have profiles accessed in the process of setting it up
It was a pain, specially for modders working on different projects in different saves
I can imagine, I still have issues trying to play the game ๐
Fortunately, using an alternative cache for development helps starting play
But going back I still have to unsub from my mods
The times I've had to boot up a server several times cause of a file conflict
Or forgot to unsub and scratched my head in confusion
yeah, heres my model script
sorry is it too blurry? didn't want to spam chat by copying the whole thing
you could have easily copy pasted it here if you put it after 3 "`"
you'd need to call the model TactPen for the pen
tysm, i'll try that, and sorry, I'm not super familiar with discord commands
```
CODE
```
If it's not blocking the continue button, it's a hidden menu.
ty, i'll copy that for future reference
hm?
Try it out, if you put a language after the first ``` you can color-code it
module TheyKnewMoreTest
{
model MysteriousCooler_ground
{
mesh = WorldItems/Cooler_Ground,
texture = Clothes/Bag/TheyKnewMore_Cooler,
scale = 0.4,
}
model TactPen
{
mesh = weapons/1handed/TactPen,
attachment world
{
offset = -0.0050 0.0600 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}
}
changing it to TactPen didn't fix it
what about that attachment?
this was copied from the vanilla pen script
for my model i didnt had any attachments
i think they use .x models so maybe thats why they have it
do you use .fbx models?
yeah, I copied the .x model
i'll try removing the attachment, is there an easy way to convert the .x to .fbx?
cooler works perfectly fine, just this pen wont work
is the cooler a .x model?
its .fbx
try giving your pen a texture it could be invisible without texture
module TheyKnewMoreTest
{
model MysteriousCooler_ground
{
mesh = WorldItems/Cooler_Ground,
texture = Clothes/Bag/TheyKnewMore_Cooler,
scale = 0.4,
}
model TactPen
{
mesh = weapons/1handed/TactPen,
texture = textures/weapons/TactPen,
}
}
something about the .x file is just being stubborn. If I leave the script exactly like the vanilla script, it'll use the vanilla pen. If I try to path it to the model/texture in my module, it simply doesn't work
model/texture?
models_X/weapons/1handed/TactPen.X
textures/weapons/TactPen.PNG
the model is copied straight from vanilla but renamed, texture has just been the vanilla one but recolored black
Do you havr both of the folders in the media folder?
yes
.x have textures imprinted in them i believe
Atleast they reference them so maybe thats why
Try making that .x model into fbx
And then place it there instead
that probably explains why im having so many issues........is there an easy way to convert?
I think there are some converters online
k, i'll do that, tysm again!
Hey people, where/which variable do you get in game clock data form? I remember that there should be like having a few of them, I really need the one with counting in game world minutes to make my mod works.
I've try getdate but it doesn't seem working, can't pull out minute data into a new variable.
getGameTime() returns the gameTime object - which has a bunch of useful stuff
getGameTime():getMinutes()
There's a lot of functions - some of them are as old as the game, so their names may not match current behavior.
Also if you want player's survive time that's a different thing.
I was thinking of getting current time of in game world, I was thinking about doing a variable that copy the in game world time data into my mod and checking if the minutes of every hour reached at 0,15,30,45, would run my custom function.
Not survival total time or gameplay session time.
I think getMinutes is the clock minutes
you can use everyoneminute to query it every minute
I do want to sync in the timedata in my mod to somewhat near the base game though. But I guess if everyoneminute would do......
You can specify which minutes fire the event using
local interval = minute % 15 == 0
This would fire it on 15 min intervals
Oh thanks.
But wasn't 0 to 59? If given count to 60, wouldn't 0 and 60 be both firing?
shouldn't matter - the for loop in this case is a test example
all you'd need is to add a function to the every minute event
and include this before what you add lua if minute % 15 ~= 0 then return end
Oh, right, my bad.
minute being getGameTime():getMinutes or whatever it is
Is it appropriate to try to hire someone to make a mod for me in here? ๐ I have no idea what Iโm doing when it comes to lua but I need a simple mod made for my stream
I want a mod that will bind some keys to input specific admin commands.
INSERT = will give me a bag of chips and a water
HOME = will give me me a meat cleaver
PAGEUP = will give me a revolver with 6 bullets
DELETE = will spawn 1 zombie at my location
END = will spawn 5 zombies on my location
PAGEDOWN = will spawn 15 zombies on my location
If anyone can help me make this or point me in the right direction for some tutorials Iโd be forever greatful
How soon do you need it?
No time limits
is it for a server? i assume since you say those are specific admin commands
Yes I host a server that Itโll be on
also with zombie on your location do you mean it like right on top of you or somewhere around you?
Either one is fine preferably somewhere really close to me
i could cook up smth in a short while and give it to you if you want to test it
I would love that!!
also I'd need some clarification on the button like is insert meant to be enter or a custom button?
ahh i work on a laptop and dont have those
you wouldnt mind mappin them somewhere else maybe?
Yeah you could map it to whatever you want too honestly
Iโll DM you for further discussion if thatโs okay?
yea sure
local toClear = {
'Base.Apple',
'Base.Orange',
'MOD1.GreatestSwordEver',
'Base.Sledgehammer',
}
function clearDistrib(item)
RemoveItemFromDistribution(Distributions[1], item, nil, true);
RemoveItemFromDistribution(SuburbsDistributions, item, nil, true);
--RemoveItemFromDistribution(VehicleDistributions, item, nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, item, nil, true)
end
Events.OnPostDistributionMerge.Add(function()
if not isClient() then
for i = 0, #toClear -1 do
local item = toClear:get(i)
clearDistrib(item)
end
end
end)```
will something like this work
i recommend not using RemoveItemFromDistribution
it's extremely slow
it doesn't matter too much if you just have a few items but it scales horribly
What do i use ?
for a mod i'm finishing up i put the items into a lookup table and then crawl the distributions table and check every item against the lookup table and remove it if there's a match
no but i might make an api/another mod out of it
The issue with RemoveItemFromDistribution is that the argument should be a list of types
i think it should put everything you put into it into a list and only operate on the table once during distributions merge or something
yeah
could just forloop the argument and generate a temporary table of type=true, so you can parse faster too
yeah, that's part of my implementation
iirc it also iterates by 1 and has some weird handling for the spawn chances (since distributions are item, chance, item, chance) instead of just iterating by 2 and removing both
oof
@ancient grailyou can see how True Music Containers does it.
it doesn't use table.remove does it?
Well this is sapphs current proj so im not sure we can wait for api
@fast galleon right
Thnx
it does use table.remove but i'm not sure what would be better in that case
i tried niling them and then cleaning it up afterwards but in my implementation at least that turned out to be a lot slower
so i use table.remove too
using table[i] = nil and literally shifting values over as needed is better apparently
yeah, that's what i went for since i heard the same thing but the performance was a fair bit worse
shouldn't be - it should just be 2 separate for loops
my guess is that java is so much faster than lua that unless the data set is really large it's slower to clean it up in lua than to let table.remove redundantly do it multiple times
Alternative to table.remove snippet (incomplete)
local function compressTableOfNils(tbl)
local n = #tbl
--prepare new index for tbl
local newIndex = 0
--iterate through and overwrite nil entries
for i=1, n do
if tbl[i]~=nil then
newIndex = newIndex+1
tbl[newIndex]=tbl[i]
end
end
--overwrite rest of entries to nil based on newIndex
for i=newIndex+1, n do tbl[i]=nil end
end
changed table argument to tbl to avoid issues with the table
supposedly this is faster than table.remove ๐
i agree with the logic that it should be but it just didn't seem that way in my testing
Only works for numeric keyed tables
it might be that it just happens to be slower with the way the items i was removing were spread throughout the distributions
and is usually faster or something
could also be a kahlua thing
i imagine if you remove only one item from a table that table.remove would always be faster for example
@sour island so the thing abt the clothing thing
Your ways will work right it wont turn them to naked zed
O was also thinking of making em zedDmg
It is the zombie outfit - so no
O believe that will work too
No as in no it wont work or no ot wont turn to naked zed lol
It won't make them naked
Any idea why here i can use getDisplayCategory but when i use getCategory its crashes?
local allItems = getScriptManager():getAllItems()
local weaponItems = {}
local ammoItems = {}
local magItems = {}
local weaponsPartItems = {}
for i = 0, allItems:size() - 1 do
local item = allItems:get(i)
print(item)
if not item:getObsolete() and not item:isHidden() then
if item:getCategory() == "Weapons" then
table.insert(weaponItems, item:getFullName())
end
if item:getDisplayCategory() == "Ammo" then
table.insert(ammoItems, item:getFullName())
end
if item:getDisplayCategory() == "GunMag" then
table.insert(magItems, item:getFullName())
end
if item:getDisplayCategory() == "WeaponPart" then
table.insert(weaponsPartItems, item:getFullName())
end
end
end
there is no getCategory method of Item
So i cant retrieve the category from an item? wow
i think i should use isFirearm intead then as Glytch3r said
isHandWeapon
isRanged
IsClothing
Stuff like that but i moght be wrong witht he syntax
Just check it on the context menu lua
Thats where you will get all of em
in the games files?
the item you are "getting" is the script item
not inventoryItem
the methods for each are not always named the same
InventoryItem has getDisplayCategory and getCategory
Item has getDisplayCategory as well actually
Item has getCategories instead which is an array, this is because items (InventoryItems) can have multiple categories, but they get compressed into a string iirc
Shouldnt rely solely on categ anyways
display category is also translated between languages I believe - so using that might be unpredictable
Yes in the lua folder
I believe its in client folder
i see.. now it makes sense
Search for onfillinventory
Blahblah
Its the event for context menu
There are 2 types one handles the world obj the tiles and another for inventory
You should look at the inventory
i only found IsWeapon() to get the same as i was looking for. I hope that works
because i couldnยดt see it on the methods from BaseScriptObject
https://projectzomboid.com/modding/zombie/scripting/objects/Item.html#method-summary
declaration: package: zombie.scripting.objects, class: Item
Didn't work neither... Sometimes i got stuck in what seems the most "simple" things
nvm, that method is for inventoryitems too
Do you guys know if i can use something like getWeaponSprite() so if i get something in return that means its a weapon?
nah, i just have the BaseScriptObject
You dont need to check for sprite
yeah, i only need to check if its a weapon to add it to a list that i will be using for the events
Have you looked at the vanilla lua file?
Files*
U should
Ah wait
I have that on our server
We have a library of debug tools
Links in the description
Imean profile
yeah i did, but couldnยดt find anything that works directly on scriptObjects
That link says "no access"
@bronze yoke
local test, token = {}, "abc"..10
function test.buildTestlist()
local count, testList = 0, {}
for i=1, 49000 do
local rand = "abc"..math.random(1,10)
if rand == token then count = count+1 end
testList[i] = rand
end
print("count:", count)
return testList
end
function test.compressTableOfNils(tbl) local n = #tbl local newIndex = 0 for i=1, n do if tbl[i]~=nil then newIndex = newIndex+1 tbl[newIndex]=tbl[i] end end for i=newIndex+1, n do tbl[i]=nil end end
function test.run(func)
local _Start = os.time()
local product = test[func]()
local _Timing = os.time()-_Start
print(func, _Timing.." ms","\n")
return product
end
test.list = test.run("buildTestlist")
function test.copyList()
if not test.list then print("ERROR: no test.list") return end
local u = {} for k,v in pairs(test.list) do u[k] = v end
return u
end
function test.tableRemove()
local tempList = test.copyList()
local tempListLen = #tempList
for k,v in pairs(tempList) do if v==token then table.remove(tempList, k) end end
print("pre:",tempListLen," -"..tempListLen-#tempList)
end
function test.tableNil()
local tempList = test.copyList()
local tempListLen = #tempList
for k,v in pairs(tempList) do if v==token then tempList[k]=nil end end
test.compressTableOfNils(tempList)
print("pre:",tempListLen," -"..tempListLen-#tempList)
end
test.run("tableRemove")
test.run("tableNil")
count: 4939
buildTestlist 0 ms
pre: 49000 -4470
tableRemove 1 ms
pre: 49000 -4939
tableNil 0 ms
I didn't figure out how to properly copy a table it seems, but nil is slightly faster
however, given the structure of distributions and such, there could be an inverse effect
+kahlua might translate the lua in a way that avoids the 'table.remove' thing
@tacit plover
You might want to look into this tom just needed to note it
Probably not significant enough of an impact, perhaps all the drama on forums were exaggerated idk
most performance debates are pretty minor anyway, i've been agonising over code that take 0.04 seconds during loading time
๐
(although 0.04 would be very bad during gameplay!)
I'm pretty sure that's what the tooltip/crafting menu lag is from
been working on this:
p happy with it
how bad is it, to use versions based on date e.g. 23.5.1 or 23.05.01
I just threw that on the name so I could distinguish which version threw errors at some point. It went straight from 0 to 23 ๐
I do that lol
used to use arbitrary numbers and arbitrary reasons to do sub versions
but the date of update + hotfix number is sufficient
never thought of the year first though, that's interesting
could do hour (and if needed .minute) for hotfixes ๐ค
I wonder if there's a github action that can write into a lua file
would be useful for the community thing
looking pretty cool
by the end of this month i will finally have enough time for modding again
I've seen co` uses makefile to change things.
guys i m trying to make an audio mod, it would replace msot of the zombie sounds, i have got a folder full of wav files, al with correct names so that they ll work properly...... I NEED TO TRANSFORM THESE WAV FILES INTO A .BANK FILE, help
I used Fmod to unpack the game .bank files and understand the layout
as for the performance issues with the crafting menu its several things
it rebuilds the entire ui and recipe list every time you open it
the vanilla rendering function of scrolling lists is horrible
searching and sorting is also not well implemented
is there a way to force the character to sit on the ground?
I have an idea for a mod where the user consumes and item and it knocks them on their butt and they have to sit down

ive actually been playing games for once instead of just making mods
for the first time in like a month
(ive been modding no mans sky instead)
lol
Made a heroin and meth mod
you used the sitting zombie anim for the heroin injection right?
i think i remember you sayying that
The heroin makes players stay on the ground for certain time
Meth adds temporary traits
Ahhh yes
i kinda want to combine that and also look at the immersive overlays mod to see if i could make them have a cool overlay
Hey how are you udderly saw you typing
like taking lsd will cause a glow on the screen or something idk
https://steamcommunity.com/sharedfiles/filedetails/?id=2909488957&searchtext=Community+Modding Trying to launch this baby, since it was hidden for a bit would appreciate any love it can get.
which one of you
๐
what's actually in the project these days?
Just debug tools still
but I polished up the github page, steamworkshop, and figured out the upload actions
will update every friday and anytime a branch with 'hotfix' in it's name is pushed
so theoretically, the mod can be anything the maintainers allow
There's also a bounty list of sorts: https://github.com/Project-Zomboid-Community-Modding/pz-community-modding/issues
Going to be adding more ideas as I go
Did you figure out how to make it public or do you do that manually?
I enabled 2fa made it public then disabled it
hopefully my house of cards don't fall
The options to spoof through 2FA don't look ideal
There's probably a valid way to do it with steam API but I cba
If this breaks I'll look into it
We have lift off
I was reading over your comment earlier regarding "local interval = minute % 15 == 0"
Basically something that could iterate several times over the span of one hour. What I'm not understanding is the update. If I call a function and it has a do while loop in it, do I need any other code to make it continue to run or is it really just that easy?
local gameMinutes = getGameTime():getGameMinutes()
local i = 0
while i < 5 do
if gameMinutes % 15 == 0 then
print("minutes :", gameMinutes)
i = i + 1
end
gameMinutes = getGameTime():getGameMinutes()
end
My next question is more about overhead: Is this something I could get away with in PZ or am I looking at bogging down the computers resources with a while loop that could last up to an hour? Time Complexity is not my strong suite. MY CODE MUST BE BORG-LEVEL EFFICIENT!
this won't work because your entire function runs in the same game frame
if you want to do something over time you need to attach a function to an event so it gets called repeatedly, in the 15 minute example you'd likely attach it to EveryOneMinute
if you do a while loop like this the game will crash because the game minutes won't ever change in the same frame, and the loop will never end so it can't advance to the next frame
I see. I think "attach a function to an event so it gets called repeatedly" is the part I'm failing to understand.
Are we talking about Events.EveryOneMinute(), or something akin to that?
If there's a mod you can think of that actually does this, I can scan the code to figure it out.
yeah, something like this```lua
local function checkTime()
if getGameTime():getMinutes() % 15 then
-- do something every 15 minutes
end
end
Events.EveryOneMinute.Add(checkTime)
EveryOneMinute will call your function every in-game minute, and your function then checks the minute to determine if it's a multiple of 15 or not
OH! I've seen this! How much overhead will this introduce? Are there a lot of functions getting called?
assuming getMinutes() is in fact the of hour minutes
About that... half the game runs in the tick() loop
So don't use Events.Tick.Add(MyStuff)
I'm saying don't worry about it
Ok lol
you can definitely write bad code that lags the game, but it won't generally be because of using a spammy event (though avoid them if it's easy to)
EveryOneMinute is triggered in Tick, it's actually doing something similar with counting seconds passed
There's also a EveryTenMinutes event
if 15 is negotiable
Now lets say I do that addition of an event. Can I have the function remove the event at a certain point?
local function checkTime()
if getGameTime():getMinutes() % 15 then
-- do something every 15 minutes
end
end
Events.EveryOneMinute.Add(checkTime)
Events.EveryOneMinute.Murder(checkTime)
Maybe introduce a function that checks every ten minutes and then removes the checkTime event?
I'm assuming there's no rule to using Events.EveryOneMinute.Slay(checkTime) inside a function.
yeah, you can Remove() them from the event
local Murder = "Remove"
Events.EveryOneMinute.Murder(checkTime)
I like dis one better.
Thank you both for the assist. I think I can probably figure it out from here with minimal face into wall smashing.
Do worry about what you add to these fast events. It isn't hard to throw a dart in the workshop and hit a popular mod that causes performance loss due to these things
@nimble spoke
And yes indeed. I'm going to try and use comparison values.
Get the game time, and then do a check about an hour later to see if the time increased enough.
That is easy to do
I was hoping to help a friend out with a stim mod that would gradually increase health, but I'm thinking I'll adjust the healthFromFood or some other such health restoration value and then change it back after a time.
one thing i'll caution about removing functions from events is that if you remove a function from an event while that event handler is executing (the most common case of this being the function you added to the event removes itself) it causes issues
it usually doesn't really matter if it's an event that gets spammed like ontick but if it's something that only gets called once or every now and then it can cause difficult to diagnose compatibility issues
I should maybe do a % check that gets a different value?
Have the event add when gameMinutes % 15 == 0, and then remove when gameMinutes % 15 == 3, for example.
it's still going to be happening during the handling of EveryOneMinute either way
Good point.
Ahhhh right. One of my commissions was a stim pack to recover health
- Check to see if an event should be "active". Add event if so. Avoid using the EveryOneMinute to eliminate removing an active function.
- Let event run and then use a check to see if it should be removed. When it returns true, remove the event at an interval that can never overlap.
Would I find the Event.EveryOneMinute file in the media\lua folder or the java code?
events are java
Hmmm... Not really feeling like modding PZ much these days.
Going to see if I can at least get this VSCode extension to a point where I want it.
Hey y'all, so you know this guide to decompiling PZ? (https://github.com/Konijima/PZ-Libraries) Decompiling it was failing with the error
Unable to find method
''org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'' 'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'
and modifying the gradle-wrapper.properties file with distribution URL fixed it for me:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-rc-1-all.zip
Gradle 8.0 seems to mess with it
Manually download and install java 17 and install the other version of Gradle (not 8, whatever the other option is)
I've modded PZ for 10 years and I haven't used any of these guides.
Use fernflower CLI or use IntelliJ IDEA's wrapper plugin for it.
(Coming from the guy who has the most released Java patches and most time spent modding the Java side in PZ)
the tools the guide points you to are supposed to do some automatic annotation stuff, but i'm starting to question if they're actually any good
I'd argue otherwise, even with a close friend making one of the guides.
It's not useful if your goal is to read into the Java alone.
Along with my documentation in PipeWrench, TIS has updated their official JavaDocs, rendering the vast majority of decompile purposes void.
If you simply need to know what's going on, import the .class files as a packaged zip file renamed to .jar and double-click the class in the library tree for it when referenced in a IntelliJ IDEA project.
Automation here is redundant.
i'm not sure why but it fails on some lua files (and i think java files? but not as sure about that one) so you end up working with incomplete libraries
Even then it's not needed by 95%+ of the time.
I know how to fix this issue yeah, but that's because I'm on the fringe with Java work for PZ.
the type documentation is the only benefit i'm seeing - though inheritance isn't implemented so it's limited in usefulness
When working in the Typescript environment, issues that normally takes several hours to resolve can be resolved in minutes.
There's use beyond documentation.. when you use TS to code.. Nothing much past that if only referencing.
Intellisense is a ride.
yeah, i'm still not yet willing to switch to typescript but i might drop the libraries if i'm going to spend all my time crawling the javadoc and the source anyway
If I had one benefit to suggest as a reason to switch, it'd be compiler-time errors.
Migrating a major build might show this feature the best.
API changes would render b41 code broken.. Finding and fixing these errors would take a bit of time manually.
Compiler errors shows them right away. Fixing them would be referring to the intellisense present as well.
I'd be working on improving PipeWrench right now if I wasn't working on the VSCode extension for ZedScript.
That takes precedence since the majority of modding is scripts.
It's also fun to note that I am the only support for ZedScript as of right now.
i often forget that, with my experience being so code heavy
No worries. All I did was watch this chat while working on the new Lua transpiler earlier in January.
With a functioning support extension in VSCode, all you'd need to do is point people that direction instead of redundantly answering the same question every so often.
honestly all you need to do is get it to check commas and it'll solve 80% of the issues posted here
Working on the linter.
I had to throw a thousand or so lines of code from the first attempt however the 2nd attempt seems promising
The fun thing about the linter is instead of only defining what is valid syntax, I have to check for all invalid syntax situations, or as many as I can.
In this linter I:
- Remove all whitespace, newline, and comment tokens to only have syntactic and phrased tokens.
- Define rulesets for scopes
- Define rulesets for properties
- Define patterns for properties
- Define the patterns for scopes
Working on the extension has helped me understand how to implement full language support for IDEs and rich text editors.
Crazy.
The good thing is that ~75 or so people are using the extension right now. Hopefully it'll help solve problems for people before they come here.
=)
I'm surprised that up until this point there have been no attempts (no known attempts), to address this issue of no support for scripts in IDEs and rich text editors.
Also brackets
{}
I check for that and commas
I'm trying to alter the unhappiness/boredom of different foods dependent on a trait. My current approach is like so:
local base_tooltip_render = ISToolTipInv.render
function ISToolTipInv:render()
local origUnhappyChange = self.item:getUnhappyChange()
local origBoredomChange = self.item:getBoredomChange()
if self.item:IsFood() then
if getPlayer():getTraits():contains("example") then
self.item:setUnhappyChange(1000)
self.item:setBoredomChange(1000)
end
end
-- Call original function
base_tooltip_render(self)
-- Reset item
self.item:setUnhappyChange(origUnhappyChange)
self.item:setBoredomChange(origBoredomChange)
end
I have a similar wrapper around ISEatFoodAction:perform. This mostly works, but there's a lot of subtle bugs and I keep running into specific food items where there's some discrepancy between getUnhappyChange and the real value so it causes the value to shift continuously every time ISToolTipInv:render is called. Is there a better way to do what I'm trying to do?
is this value shift some minor decimal thing or more significant than that? i'm not sure if you're describing some java->lua conversion inaccuracy or an actual bug
signif climb toward negative numbers. it's like during the reset lines it overcorrects
and this only happens for certain items? that's really strange
my actually code is a bit messier than the example I gave. might be a bug hiding in plain sight. that aside, is wrapping those two functions generally the right way to accomplish what I'm trying to?
yeah, that's usually the only way
changing the actual stats of the item is unfortunate but doesn't seem avoidable here
my guess is the bug is in part of the code you didn't include, or it's haunted
Hello ๐
I'm interested in making an add-on pack for the Ellie's Tattoo mod. These instructions are included in the mod files. It looks fairly straightforward, buuuuut I have no background whatsoever in coding or modding, so I'm not actually sure what these instructions are telling me.
Could anyone point me toward somewhere I could go/someone I could talk to/something I could read to give me some very basic understanding of how to get started with this?
ISTimedActionQueue.clear(player)
Does this force to cancel the currently playing action? If not, How can I force it to cancel if there is an action playing?
The mod you downloaded for the template has all the files you need to modify
the guid you generate you use for each tattoo, keep the same guid of that tattoo across the XML and lua files
anyway..
Im trying to get a mod working to create "zones" of no zombie spawn.
local zData = zombie:getModData()
local square = zombie:getSquare()
local NoZedSq = isNoZedSquare(square)
if NoZedSq == true then
zombie:removeFromWorld()
zombie:removeFromSquare()
end
end
Events.OnZombieUpdate.Add(onZombieUpdate)
^ this is a bad method im hoping for some tips. currently the zone creation works, but the zombies inside the zone just flash in/out of the game
I dont neccesarily need to remove zombies, I just need the zone to stop respawn of the zombie
(while still respawning zombies as normal, outside of the defined zone)
maybe if there is a way to get the zone to count as "seen"? Because I have it set to no zombies on seen chunk
I have e an idea for an api but not sure if its worth it or if actually is useful
The idea is to add a checkr that sees if its lagging idk how exactly but maybe the fps since thats expose afaik
Then if it's lagging then dont run the function
if isLagging() then return end ```
Maybe useful for loops that only does visuals
This is the worst way to go about lag-detection. Use a timestamp delta.
No API like this for lag will ever work optimally and the implementation wouldn't make sense.
It would if im making every zed skin change ontick as an animation
So basically the skin is animated
local timeThen;
local timeNow;
function onTick()
-- Calculate Delta.
timeNow = getTimestampMs();
timeDelta = math.ceil(timeNow - timeThen);
checkLag(timeDelta);
timeThen = timeNow;
end
function checkLag(timeDelta)
if delta >= 1000 then
-- If greater than one second (1000ms), handle.
end
end
Simply saying there's lag with a boolean-implementation will never be enough.
Use integer-based delta timestamps.
What I would suggest is that PZ's Java code would send the delta to the function so you won't need to calculate it.
This is how you'd do it.
more like:
Events.OnTickEvenPaused.Add(function(timeDelta)
-- ...
end);
os.clock isn't exposed right?
os.clock doesn't exist in Kahlua IIRC.
Was it removed or is it cause PZ uses an older Lua?
You can get the UNIX timestamp value from the PZ API.
Oh nice
Neither. It's Kahlua.
I wonder how difficult it would be to recreate the Lua testbed within PZ
getTimestampMs()
I have concluded that even if I were to perform updates to Kahlua, TIS wouldn't adopt them.. even if the changes are very effective and performant.
They have a very modified copy of Kahlua2.
The engine itself can be optimized, quite a bit actually..
It was developed during the JDK 1.6 era.
I mean, I can't speak to TIS' priorities but Im sure updating the Lua is in there somewhere
I have an archived fork of Kahlua2 where I updated the reflection invocation calls with some benchmarks...
But that was JDK 1.7 / 1.8 optimizations. We're at Java 18 ATM.
Isn't 1.7/1.8 = 17/18?
No.
There are 10 major versions between 1.8 and 18.
Java 18 is also 1.18.
I also believe that around JDK 1.9 the major versioning standards changed.
A lot of people still use JDK 1.8 because Oracle's licensing for using java for commercial products changed around 1.9 / 10.
I wonder if it changed again after.
I have no clue lol
I've used Java 1.8 and JDK 18 in the intelliJ library compiler
And was told it's interchangeable but maybe they meant compatability wise
IIRC TIS's Kahlua2 fork has serialization / deserialization & enum changes.
Probably compat.
New mod idea: Make a battle royale mode utilizing steam remote play / co-op to create a match of 100 teams of 4.
anyone who has any idea on how to make a custom mug (i.e. make an entirely new item entry, not just a reskin on spiffomug) and make it have all the same features as a normal mug?
i can't for the freaking life of me figure out how to make the evolvedrecipe -thing for beverages work
That's one of the pitfalls of the current script system -- buuut, if there are tags for Mugs the recipes might use those.
so the answer is "no, coffee isn't possible for custom mugs, unless i dedicate 2+++ weeks to rewriting entire zomboid recipe system" ?
Do mugs have a 'Tags=' ?
They do. Coffeemaker.
I took the vanilla mug itemscript and tried just replacing the models in it, but I'm missing something somewhere.
Youd have to post what you have
item MugCustom { DisplayCategory = Cooking, Weight = 0.2, CanStoreWater = TRUE, Type = Normal, DisplayName = Empty Custom TestMug, ReplaceOnUseOn = WaterSource-WaterMugCustom, Icon = MugCustom, RainFactor = 0.2, Tooltip = Tooltip_item_RainFromGround, StaticModel = MugCustom, WorldStaticModel = MugCustom, Tags = CoffeeMaker, }
They are apparently looking into variants to items next few updates though
What's the recipe for coffee?
hold on
After defining in a similar manner also water etc filled versions, I also include this line to the same script.txt file
evolvedrecipe HotDrinkCustom { BaseItem:WaterMugCustom, MaxItems:3, ResultItem:HotDrinkMugCustom, Cookable:true, AddIngredientIfCooked:true, AddIngredientSound:AddItemInBeverage, Name:Prepare Beverage, CanAddSpicesEmpty:true, }
Both of the abovementioned snippets are verbatim, one-to-one, taken from the basegame mug files, with just some name replacements here and there to point to the custom mug
The worst case scenario is you'll have to add a script for each state the mug and coffee can be in
Yes, I'm already having mental damage from that thought
Hello, world!
what result?
Like what is happening with your mod
I get mugs that work fine in terms of filling them with water and showing the custom models properly, as well as drinking the water -- tooltips work fine, all that is missing that i'm aware of is the recipe to make a beverage
For your comparison, the basegame mugl:
item Mugl { DisplayCategory = Cooking, Weight = 0.2, CanStoreWater = TRUE, Type = Normal, DisplayName = Empty Cyan Mug, ReplaceOnUseOn = WaterSource-WaterMug, Icon = Mugl, RainFactor = 0.2, Tooltip = Tooltip_item_RainFromGround, StaticModel = Mug, WorldStaticModel = Mug, Tags = CoffeeMaker, }
But it may not be
So is the evolvedrecipe blablabla just nonsense distraction, or not? ๐ค
That might be used for teas
Have you tried heating your mug of water in the microwave?
No, for I am trying to make this goddamn survivor pour some coffee from the goddamn coffee-item into the mug, which works fine for basegame mugs even if the water is cold
(all the goddamns are sourced from my frustration at this code, dont take it personally please)
What does the item turn into when you add coffee to the base game mug
It may be the hotCuppa item still
HMM, now we're talking, this one I don't remember verifying -- wait a sec
The recipes and crafting are part of one of the next big update - so hopefully the tags system and evolve recipes get broader scopes
nope, no hot cuppas
looks like the evolvedrecipe -stuff to me
!!
A-HAA
Is this the source
item Coffee2 { DisplayName = Coffee, DisplayCategory = Food, Type = Food, Weight = 1, Icon = InstantCoffee, ** EvolvedRecipe = HotDrink:5;HotDrinkRed:5;HotDrinkWhite:5;HotDrinkSpiffo:5;HotDrinkTea:5,** FoodType = Coffee, Packaged = TRUE, FatigueChange = -50, HungerChange = -30, ThirstChange = 60, UnhappyChange = 20, Calories = 2, Carbohydrates = 0, Lipids = 0, Proteins = 1, WorldStaticModel = Coffee, }
Do I actually need to change the freaking coffee -item whenever i add a mug :D:D:D
What the fudge is the tag even there for
I assume it's one of the oldest recipes, and probably one of the first evolved recipe
So yes, you'd have to use scriptManager to modify it safely
Unfortunate
Or you could create a secondary Coffee item
With evolved recipe pointing to yours ๐
could somone please help me with my code
ive been tryna fix it for a week or 2
and noone could help
Do you have a more specific question?
What's a scriptManager
yeah it doesnt apear ingame
like the item
Doesn't spawn, or doesn't appear in the item table in debug either?
apear in debug
Have you checked console.txt
i havnt started dist yet
how do i do that
I believe it's in your User folder within a subfolder called Zomboid
It's a text file called console.txt
needa start the game first
If you don't see anything relevant, a good next step is posting your item script here so people can see whether there's anything off
@upbeat spindle Right now you would need to create a new evolved recipe that uses your item, then add it to all ingredients for that evolved recipe, but as Chuck said b42 may bring changes so it isn't the best of times to work on that idea
Evolved recipe system doesn't use the tags
no can do, the mug demands to be made
and i must suffer
how does one change entries in basegame scripts?
shit anyone remember the size of icons?
i.e. items_food.txt , if I want to replace the coffee2 definition here -- is it even doable
the first part of this is exactly what I've done, and the second part is exactly what I'm trying to do
item icons? 32 x 32
yes tysm (i also love your mods)
you could do it through DoParam, there's probably some guide bout it by now
What handles the scripts in loading, you can use Lua to do stuff there.
Whoops discord didn't update
Hmm, so mmmmaybe something like this?
local scriptItem = ScriptManager.instance:getItem("Base.Coffee2")
if scriptItem then
scriptItem:DoParam("EvolvedRecipe = HotDrink:5;HotDrinkRed:5;HotDrinkWhite:5;HotDrinkSpiffo:5;HotDrinkTea:5;[CUSTOM MUG RESIPPY HERE]")
end
Oh, I didn't evolved recipes don't use tags
That'd explain it
Do evolved recipes offer anything more than the tag system?
evolvedrecipe HotDrinkCustom
{
BaseItem:WaterMugCustom,
MaxItems:3,
ResultItem:HotDrinkMugCustom,
Cookable:true,
AddIngredientIfCooked:true,
AddIngredientSound:AddItemInBeverage,
Name:Prepare Beverage,
CanAddSpicesEmpty:true,
}
Seems like tags and onCreate() are more versatile
in this case you can just do your custom one, you don't need to include the whole vanilla thing
probably the whole ingredient mixing thing?
I.e.
local scriptItem = ScriptManager.instance:getItem("Base.Coffee2")
if scriptItem then
scriptItem:DoParam("EvolvedRecipe = [CUSTOM MUG RESIPPY HERE]")
end
?
yeah
Okey, so each parameter definition in basegame files adds a separate entry per each input separated by semicolons ( ; )
EvolvedRecipe isn't actually a property that is stored on the item, it's handled as soon as the game reads the script/doparam, so you won't overwrite anything from vanilla by doing that
Surprisingly the entire frigging game crashes when I try to edit Coffee2 by replacing all of it via script that is almost entirely equal to the basegame coffee :-D
::::::---DDDD
So it looks like that aint an option
DoParams it shall be, hope this works
Sounds like something that can be handled through onCreate tbh
Or similiar
evolved recipes work pretty well for the whole 'build your own sandwich' stuff but they basically never make sense outside of food (and were never meant to)
I want evolvedrecipes for gasoline and sugar
Yeah, that is what you're going for, You can do that for all ingredients and your mug will work just like the existing mugs
yeah, just booting a testrun here, fingers crossed it will work ๐ฌ
nnnope, but this time it didn't crash the entire game either
should i have a specific name for the script lua -file for this to work ๐ค
No specific name, but you should place your file inside the shared folder
Anyone here familiar with the exercise fatigue system?
grkngrkhmn so what else does the luafile need than these lines
local scriptItem = ScriptManager.instance:getItem("Base.Coffee2")
if scriptItem then
scriptItem:DoParam("EvolvedRecipe = HotDrinkMugCustom:5")
end
I'm like 15000% sure that this is an improper way of adding this recipe there
15000% sure
jokes on you, im 15001 sure!
that seems correct
theres no jokes only violence 
how goddamn hard can it be to teach a goddamn survivor to open a goddamn instant goddamn coffee can and pour it into a goddamn mug that aint red or cyan
oh great news! evolved recipes only work in the base module 
:::::::::::D
Did you create that evolved recipe? Sorry if I missed that part
if your evolved recipe isn't in base you'll have to move it there
You should also not overwrite the param like that
it doesn't overwrite
EvolvedRecipe is not saved
it's acted upon immediately when the parameter is read
Oh?
when it reads that parameter it adds itself to the recipes' items list
so evolved recipes work backwards... backwards
allright ---- now even the basegame mug aint working
i'm starting to wish for a lobotomy
what does the error say?
Hmmm... am I using wromg itemdefinitions after all
something null pointer, I'm starting to think I've been misled by "hot drink" -items
no, it cant be, basegame evolvedrecipes point to hot drink -items 
What is the actual error?
Null pointer just means you're trying to access something null
Also I wrote a mod 'errorMagnifier' that makes the errors a bit easier to copy paste
to me it seems like this is a symptom of something else than the resultitem not being defined: it breaks also the basegame items
Unless the recipe searches only for the base module for the items, and doesnt find all of them there
I'm gonna punch a wall if this is the solution
it just keeps the item's name as a string at this point so that shouldn't be it
Moving the newly added recipes and mugs to the base-module fixed the basegame mug, but not the custom mug :D
:D:D:D:D:D:D
im gonna punch a wall anyways
do i need separate files for custom evolvedrecipes?
i'm entering all these in a single file now
``
--this is how you do discord lua codeblock
``
@upbeat spindle
it shouldn't really matter how your scripts are distributed
good.
Yes, tags are very recent, b40 if I remember correctly
is it possible that my character doesnt know the recipe for some frigging reason?
not possible
yeah, it isnt: debug-mode set all recipes known doesnt fix it
if the vanilla mug recipes are not working you probably broke the ingredients or the evolved recipes themsevles
the vanilla mug recipes are working
I feel like tags have been around just not really used
is there a length limit in item / recipe names that break it?
the problem is tags are least useful to tis in comparison to anyone else
they were created mostly to fix recipes and tools, specially those created by mods, and have been updated slowly to cover more areas
I feel like it scales just as well for TIS
this works in debug mode but i cant get it to work in normal single player not in debug mode?
There's still a few mechanic UI stuff that's hard locked but otherwise it checks for tags
what is the regular player referred to as in reference to player:getAccessLevel()?
None iirc
debug mode is covered in that if, in single player you don't have admin access so it is working as intended
we have the problem that if we add zombies through the same commands as the ISSpawnHorde in mp it adds them and then removes them from the square
well a guy in here made it for me but it wasnt working as inteded and i didnt wanna bug him anymore so i was trying to edit it
oh thats him right there lol
it works perfectly in debug mode in singleplayer i just need to remove that restriction
i figure its something with the sendToServerCommand
No, you need to re-do the first if line
whats the string for the accesslevel if you are admin?
is it administrator?
i looked at the java code and those were the lines
yes but you said it isn't working in single player, in that mode you will not have admin access and that is the issue
it only works in sp in debug mode
Are you guys admins
well it should be only accessible for admins
That was not what I asked lol
it should be accessible either way if you're in debug mode
that too
PZ needs an interactive GUI for recipe progress.

Would love a journey / progress tree map.
"it cant be that hard to add one mug into the game"
oh past me, you sweet summer idiot
we'll try with ```lua
if isAdmin() or getAccessLevel() == "moderator" or isDebugEnabled() then
how the fuck is it possible that there is no way to make custom items link to evolvedrecipes :D:D
Thought getAccessLevel() is now numeric.
Because the first if was made that way
nope, still string
Lemme check.
pretty sure it does
It returns a string
Global access level expects lowercase
Players expects proper case

man.
looks like i have to fucking hardcode an entirely unique recipe using only my specific item, in a way that bypasses the basegame evolvedrecipe mechanics completely :DS:AD;FG
No, all you have to do is to add your own working evolved recipe
well please enlighten me how this working evolved recipe is not working when it is copypasted from basegame evolved recipes for the mugs, with relevant itemnames changed appropriately and also the relevant "put this in the mug" -items edited
i cant for the life of me figure out what there is hidden anymore
if it's in base did you import your module/use the full type for your custom items?
i moved my items to basemodule
Keep in mind that adding your own evolved recipe includes providing translation entries for a few things, at least in EN which is the language used in case there's no entry for the language you're using at the moment
w h a t
where do you people read this stuff from
thats a step forward, thanksssss
surely it still works without them
maybe it works but it doesnt get updated to the UI
next thing to figure is where are these translations ๐ค
media/lua/shared/Translate/EN/
ty!
literally the one folder i crossed out in my mind because "how can it be a lua script instead of an .xml or .txt" ๐คฆโโ๏ธ
just wait until you find out what file type they are in the lua folder
EvolvedRecipeName_EN = { EvolvedRecipeName_Base.CannedBologneseOpen = "Canned Bolognese", EvolvedRecipeName_Base.CannedCarrotsOpen = "Canned Carrots", EvolvedRecipeName_Base.CannedChiliOpen = "Canned Chili", EvolvedRecipeName_Base.CannedCornOpen = "Canned Corn", EvolvedRecipeName_Base.CannedCornedBeefOpen = "Canned Corned Beef", EvolvedRecipeName_Base.CannedPeasOpen = "Canned Peas", EvolvedRecipeName_Base.CannedPotatoOpen = "Canned Potato", EvolvedRecipeName_Base.CannedSardinesOpen = "Canned Sardines", EvolvedRecipeName_Base.CannedTomatoOpen = "Canned Tomato", EvolvedRecipeName_Base.Teabag2 = "Tea", }
Aha.
Even the basegame evolvedrecipes arent in the obvious file, but instead some goddamn canned foods
xD
googling on proper custom evolvedrecipes bring basically nothing, "yayyy"~
Not those, those are how some items are called when used in a evolved recipe
check Recipes_EN
and ContextMenu_EN
!!!!!
ContextMenu_EvolvedRecipe_HotDrink = "Beverage",
ContextMenu_EvolvedRecipe_HotDrinkRed = "Beverage",
ContextMenu_EvolvedRecipe_HotDrinkWhite = "Beverage",
ContextMenu_EvolvedRecipe_HotDrinkSpiffo = "Beverage",
<3
<3<3<3
still not working :::D
after adding the appropriate line to this file, that is
How can I make a code recognise a weapons attachment?
``
local scoped = 0;
local inv = player:getInventory();
local weapon = inv:getFirstTypeRecurse("VarmintRifle");
local attachment = weapon:getAttachmentType("x8Scope");
if attachment then
scoped = 5;
end
print(scoped)
``
... :D I went and downloaded some cooking time -mod, and looked through it, didnt figure out what the frick am I still missing, thought I should ask the modder for pointers
And lo and behold if it isnt "Soul Filcher's Cooking Time"
I guess I'm beyond help then
didnt imagine a simple fucking mug would turn out to require a phd in zomboid programming
Okay so SoulFilcher also modifies coffee. Via DoParam:
manager:getItem("Base.Coffee2"):DoParam("EvolvedRecipe".." = ".."HotDrink:5;HotDrinkRed:5;HotDrinkWhite:5;HotDrinkSpiffo:5;HotDrinkTea:5;Muffin:5");
What if I edited my own DoParam to match this exact syntax...
is that exactly how it's written? there shouldn't be any difference between concatenating three hardcoded strings and just using one, except performance
some shorthands and a function definition above it:
local manager = ScriptManager.instance
function SFCook_Tweaks()
manager:getItem("Base.Coffee2"):DoParam("EvolvedRecipe".." = ".."HotDrink:5;HotDrinkRed:5;HotDrinkWhite:5;HotDrinkSpiffo:5;HotDrinkTea:5;Muffin:5");
hi guys, im looking for an exemple of lua code that make the x8 scope, even attach to a m16, wont give the m16 any bonus
aaaand also in the end of the file:
end
Events.OnGameBoot.Add(SFCook_Tweaks)
Yeah, I kept them concatenated because I copied over what I used for Item Tweaker
Maybe adding it all to a function and using the event is what you're missing?
Yeah, I'm now pivoting to trying to do this exactly as you did in your mod!
events usually shouldn't matter for script edits since scripts are loaded before lua anyway, so nothing scripts can usually do should be unavailable at lua load - but it's worth a try
Don't worry, you will get it working eventually
the thing i'm worrying is that your coffee edit involves a basegame item, muffin, whereas i'm trying to smush a custom item into the evolvedrecipes
!!!!
!!!!!!
UAAAAAAAAAA
party time
!!!!!!!!!!!!!
\o/ \o/ \o/ \o/\o/ \o/\o/ \o/\o/ \o/\o/ \o/
after eight (8) excruciating hours, the mug is DONE
thanks to everyone who helped, my crumbling sanity needed each and everyone of you
praised be soulfilcher who made the resippy mod
๐
the solution indeed was to insert a function, in which the DoParam blablabla is handled, to Events.OnGameBoot
Nice
Since evolved recipes are handled so differently maybe they can't be handled preboot or in Lua execution
``
local scoped = 0;
local inv = player:getInventory();
local weapon = inv:getFirstTypeRecurse("VarmintRifle");
local part = weapon:getWeaponPart();
local partType = part:getPartType("x8Scope");
if partType then
scoped = 5;
end
print(scoped)
``
Also tried like this. I'm lost ๐
getWeaponPart takes a string argument
Hey everyone. Need some help figuring out how to create a .pack file. Whenever I try to create one, TileZed is giving me an "error creating .pack file" ( couldn't pack ..)
If anyone can help I would greatly appreciate it. Thank you
Search Daddy dirk on PZ map making tutorials, he has it all!
Yes I saw one of his video, was following but when it came to the files under ".tiles files" he already had files there that I don't have so I thought I might be missing something
Heyo... 2D/3D artist/game dev here; long time PZ player, but looking to get into modding some cool things. Looks like I gotta spent some time going over all the guides, hey. ๐
Going over what people say, and what I read, I'm gathering there's a lot of inside quirks and behaviors that only experience can teach.
tiled -- tools -- .pack files --- create
then in this pictured view you define both the pack filepath, and choose a folder whose contents you wish to put into the pack
the .tiles -files are unnecessary for making .pack -files, or at least I havent needed it
Maybe your chosen folder includes some files that are not properly defined? Try perhaps putting a basegame spritesheet into the folder, and only that, and then try packing it
anyone here that is willing too make a mod with me ill pay of course if its not too pircy XD
so this is what I get everytime I try to create it so I think you might be right. My tiles might not be properly defined
@ancient grail
Ok so yeah that is it, I've placed a vanilla spritesheet into the directory and that worked just fine. Knowing that now I wonder, how do I define my files? I think I might've missed a step.
Nice!
The thing that comes to my mind is that perhaps your .png has dimensions which not a multiple of 128x256
Besides that, I've no idea.
Oh well I'll check that out then, that might be it. Thanks a lot for your help
Cheers, gl!
Hello everyone! I'm trying to get into PZ modding and learning LUA along the way.
My 1st objective is to figure out the best way to debug things in PZ.
To start with, I've recently figured out the PZ LUA number mapped to Keyboard Keys...
It is uploaded on GitHub for those interested in adding KeyBinds to their mods.
https://github.com/shadowhunter100/Project_Zomboid_ModTools/blob/main/PZ_KeyMapping.lua
^ I couldn't find the number to keys on the wiki, so I created it on github.
My question is, how can I create a text file via the PZ LUA or Java API?
I am getting quite lost in console.txt and would prefer writing logs to mod-specific text file for debugging purposes.
local file = getModFileWriter("player_coords_online", "/media/players/player_coords.txt" , true, true)
file:write("Hello World\r\n")
file:close()
thats how you can write to a file that is in media/player/ through lua
that is an example taking from my mod where i use it
@neon bronze thanks! I am going try it locally now
1st is the mod id, second is the path, 3rd is i dunno, 4th is if appends to the file if false it'll overwrite it
also it will create the pathing if it doesnt exist together with the file
come to thing of it you could repackage probably a mod like that
Good good, modders starting out using GitHub
thnx spoon
Yeah, LUA is a PITA so far... I'm trying to figure out try-catch blocks so bad code aren't executed and an error is written to a text log file instead.
that being said, does pcall() actually work?
i don't recommend writing to the mod folder, it'll inevitably lead to checksum issues
Thats true
it's good enough for my purpose currently, I don't intend to ship the debugger output / logs with what I'm planning.

