#mod_development
1 messages · Page 158 of 1
haha
it aint happening unless PZ releases source code to public domain.
i was pretty amaze last time i ask it how to mod
you can decompile it - that's how the documents are made
For a noob like me It kinda helps for errors in console.txt when I am lazy but otherwise I don't think so 
but its not accurate enough
the modding tools and using an IDE will help avoid alot of issues
using pipewrench is the next step to detecting errors and having complete intelisense
ChatGPT documentation stops in 2021, we will have to wait I guess
we can train a custom model
got invited to gpt-4 recently after applying to the whitelist
please, if machines can feel pain, I would consider teaching it LUA to be cruel and unusual...
But honestly i wouldnt train gpt to code mods, but more to be a documentation helper
Let's go, my first mod will be a complete abomination 
Konijima suddenly regrets having helped Pseudo
happiness -60, "a little sad"
Well when you are hungry you gotta eat what you got...
is there already a blinking synchronization mechanism in PZ ?
edit the bowl icon to have worms coming out of it
... apparently he wants to double down.
what do you mean?
Like on the ground? Or inventory highlight?
on complex interfaces, if many things can blink, you need a blinking synchronization. if you do not have one, users are bothered and have more difficulty to follow things. E.g. in planes all the things that can blink are synchronized
Events.OnRefreshInventoryWindowContainers.Add(function(_self, event)
if event ~= 'begin' then
return;
end
local playerObj = getSpecificPlayer(_self.player)
if _self.onCharacter then
local it = playerObj:getInventory():getItems()
for i = 0, it:size()-1 do
local item = it:get(i)
local fullType = item:getFullType()
local isWallet = fullType == "Wallet.Wallet" or fullType == "Wallet.Wallet2" or fullType == "Wallet.Wallet3" or fullType == "Wallet.Wallet4"
if item:getCategory() == "Container" and isWallet then
-- found a container, so create a button for it...
containerButton = _self:addContainerButton(item:getInventory(), item:getTex(), item:getName(), item:getName())
if(item:getVisual() and item:getClothingItem()) then
local tint = item:getVisual():getTint(item:getClothingItem());
containerButton:setTextureRGBA(tint:getRedFloat(), tint:getGreenFloat(), tint:getBlueFloat(), 1.0);
end
end
end
end
end);
oh like blinking lights
so its not quite working, maybe my item script isn't matching up?
yes, lights, texts, all visual stuff
module Wallet {
imports {
Base
}
}
module Base
{
item Wallet
{
DisplayCategory = Container,
Weight = 0,
Type = Container,
DisplayName = Wallet,
Capacity = 1,
AcceptItemFunction = WAcceptItemFunction.Wallet,
Icon = Wallet_01,
WorldStaticModel = Wallet,
}
item Wallet2
{
DisplayCategory = Container,
Weight = 0,
Type = Container,
DisplayName = Wallet,
Capacity = 1,
AcceptItemFunction = WAcceptItemFunction.Wallet,
Icon = Wallet_02,
WorldStaticModel = Wallet2,
}
item Wallet3
{
DisplayCategory = Container,
Weight = 0,
Type = Container,
DisplayName = Wallet,
Capacity = 1,
AcceptItemFunction = WAcceptItemFunction.Wallet,
Icon = Wallet_03,
WorldStaticModel = Wallet3,
}
item Wallet4
{
DisplayCategory = Container,
Weight = 0,
Type = Container,
DisplayName = Wallet,
Capacity = 1,
AcceptItemFunction = WAcceptItemFunction.Wallet,
Icon = Wallet_04,
WorldStaticModel = Wallet4,
}
}
your items are in module base
you closed the wallet module and then opened module base again
add them to module Wallet
it wont overwrite the base wallet but you can replace the Base.Wallet in the distribution later
So your custom one spawns
I was overwriting the base wallets, should i not do that?
then make sure you actually have the Wallet.Wallet1 in your inventory and not the Base.Wallet1
You can but from memory i had trouble doing it that way
you can also change this:
local itemType = item:getType()
local isWallet = itemType == "Wallet" or itemType == "Wallet2" or itemType == "Wallet3" or itemType == "Wallet4"
cause anyway we check if its a container first:
if item:getCategory() == "Container" and isWallet then
ty, so i changed the item script
and now its working
wallet container shows up in the players inventory
haha, found a weird visual bug though
you can equip the wallet and then you get two loot icons
oh easy fix
if item:getCategory() == "Container" and not item:isEquipped() and isWallet then
This is disgusting
Unfortunately, I can't think of a better way to determine if one is eating a bug. Apparently Insects don't have their own FoodType
and while their Icons have the prefix "Insect_" There doesn't seem to be a way to access that. Therefore.... ifs. lots of ifs
you can use if condition or condition or condition instead of chaining elseifs
that's fair. I didn't know if that would get prohibitively long
I was hoping I could get away from writing so many conditions lol
you can add newlines in the middle for readability, or make it a function that returns true
a way i solved a similar issue recently was to parse the items during game load and add a tag to all items that matched the pattern
and then just check for the tag
you know? That's a better idea. It would look a lot better if I could write "hasTag("Insect")" or "IsInsect(foodEaten)" rather than.... that
thank you Albion
and actually, while I have you here, do you know much about foods resulting from evolvedRecipes?
FoodType for those is also lacking. I could search the display name for a vegetable or "vegetable" for example, but it would look much the same. The tag idea wouldn't work as well for that I think
i think they store their ingredients in an array, if you mean you want to include for example a soup with vegetables in it - i'd have to look into the source to see where exactly that's handled though
I have it decompiled on my machine, if you have any clue what the class name would be, it could help?
getExtraItems() and getSpices() (but you probably only need the former?)
not satisfied yet by my photoshopped icon but it will make it for now. I have to see how I can add the worms to the recipe now
Hm, you can create a mapping table...
["Caterpillar"] = charBodyDmg:setUnhappinessLevel(BeforeUnhapiness),
["Larva"] = charBodyDmg:setUnhappinessLevel(BeforeUnhapiness),
}
You can try searching on stackoverflow too
https://stackoverflow.com/questions/71954245/is-there-an-alternative-to-an-if-statement-in-lua
so calling
return BugTable["Catepillar"]
should return
charBodyDmg:setUnhappinessLevel(BeforeUnhapiness)
that'd call it when the table is initialised, not when you access it
the table would store the return value, which is probably nil
a lookup table wouldn't be a perfect solution in this case since it checks patterns as well as checking for specific values but i do still recommend using them whenever you're checking a value more than once
Hm, my approach is initialize all the Global variables (config-related) first and have all subsequent functions refer to them or update them as needed.
but yeah, you're right, i'm not sure what the context of his mod is.
i just saw "if-else" is disgusting and offered an alternative :P
It could be an acceptDisplayName table above though
alternatively, he can assign an integer value to each of those ... bugs as "keys" and simply call set it as such
["Caterpillar"] = 60,
["Larva"] = 50
};
charBodyDmg:setUnhappinessLevel(BugTable["Caterpillar"]);
if acceptDisplayName[foodDisplayName] then
--do the thing
end
a lookup table should be used but the pattern usage means it's only part of the solution
oh i wasn't even thinking about that, display name definitely shouldn't be used
well... lua doesn't have type check by default... but if you have VScode and the extensions installed, it'll give you warnings.
trying to use a custom weapon mesh and it doesnt seem to be working, do i need more than this model definition script
Messed up a bit with naming yesterday, resulting in my doughnut mesh not showing. Problem solved by fixing name duplicates, well, that is if that was the actual issue. Don't remember what the conflict was between though.
And you may have to add 'scale = x' to your model script if your custom weapon mesh ain't correctly scaled at export.
Right now it’s just invisible
here's what a functioning model would look like
model FishFarmCraftMagazine { mesh = WorldItems/Magazine, texture = WorldItems/FishFarmCraftMagazine, scale = 0.4, }
*mod example
I set the scale to be similar size as machete in blender and copied the model file from the machete, adjusting mesh and texture, but it isn’t working
start with exact copy of vanilla woking model, change things 1 by 1
Case sensitivity? Name duplicates?
I mean script model
That’s what I did
It’s the machete script model
With the mesh and textures edited
I’m in bed rn so I’m not going to do more until tomorrow because 3 am by me
start with non edited values
Does anyone know if the latest mission systems framework is out yet? I read a few weeks ago that they were going to release it in a few days. That it was simpler than the previous one.
query; what is the max non lethal sickness value? i’m sure someone in here knows
hello, person with non offensive nickname. I think it depends on the person's health, traits and other factors?
Hi there, Is there any place has all pz lua functions and documents as well?
Steam\steamapps\common\ProjectZomboid\media\lua
some lua functions exported from java might not be shown there...
They are not Lua function, they are java function.
anyone know if someone has added Marmite already
If you're considering food sickness alones I think it is 90
Hey. It isn't public yet. I delayed it because I have the opportunity to include my own code for mannequin npcs and make that part more plug and play for servers
Is there a mod that let's you use custom maps with challenges that are set on the main map?
*can easily be done by setting ```lua
challenge.world = "DEFAULT"
It is mainly done through an editor called TileZed
#1070858800501891172 message
hi i made a shortcut for creating lua files
does it just add the file extension?
Is there any kind of documentation that we can see so we can learn how it works or should we wait for the final version to be released? Especially to know if it is friendly for the players or not. My idea is to finish the map and through the quest mod and the tarkov inventory mod, create a "tarkov sp in zomboid project".
how do i fix this
i see some models use .fbx instead of .x, can they be used interchangably
Yeah. No problem
i dont know whats going on with this, the model isnt loading
Is your texture inside the textures folder with that name? Is it a proper png image?
its a png directly in the mod texture folder
no subfolder
okay this one which is literally just the machete script renamed isnt working
do i need to fuck with xml
so when I tried retexturing a pen that was a .x file I couldn't get it to work :/
but then again I don't exactly know what I'm doing
No. It is either the model itself or the texture
can i dm you the relevant files in a zip
cuz i genuinely have no idea what im doing wrong
hey guys! do you know something about the cell loading? I try to make the game load cells in front of direction player is moving when moves at 30 m/h or more
Hi, I tried to use the lua native command 'next' but it was not recognized as a valid keyword in my PZ mod. Do you guys think I made an error or is there a specific reason for it not to be available in PZ lua ?
if you find a solution to this, I am very interested
no next, but we have table.isempty
where can i find all 3d models of wall, zombie ??
If you want to access the sprites, you'll wanna install the zomboid modding tools (through steam). TileZed gets you access to all the games tile sprite sheets. You can find a ton of really good tutorials for that online
And yeah, the file path Albion mentioned will take you to the actual 3d models used in game :)
How do I transfer poison power from one food item to another when it changes "states" via recipe system, I tried OnCreate and the way fish gets chopped up but doesn't seem to work.
``
function PoisonA_OnCreate(items, result, player)
local sjbulp = nil
for i=0,items:size() - 1 do
if items:get(i):getType() == "SJBulp" then
sjbulp = items:get(i)
break
end
end
if sjbulp then
sjbulp:setPoisonPower(sjbulp:getPoisonPower());
end
end
``
You need to set it to the result i think?
yeah, you're setting the item you found's poison to its own poison
@winter thunder can you give me link for download TileZed ??
Do you have PZ on steam?
Go to your library, top left
Make sure this is clicked on
Then search for the PZ modding tools
I actually tried it first as a result but didn't work either.
ok, but I thought that TileZed and WordZed are only for creating maps, so you can also create models and program things for the game there, right? e.g. weapons
Hey sorry to add on to this but just 1 question. Can those tools help me make clothing mods?
I'll let you help those 2 out first (so it doesn't get confusing) but just curious
No- You can use TileZed to specifically get access to the sprite sheets. Those are how all the little item icons in the inventory / the world tiles are stored. If you want to work on creating models, you need to use a 3d modeling software. Blender is the most common, easy to learn (from what I have heard), and can be downloaded for free online
No those are for mapping
@coarse sequoia
Do you have any estimate of when the mod will be finished?
Nah, tho- Read my last message too :)
All you really need to make clothing mods is a basic IDE -> Like Notepad++, VSC, IDEJ, (etc). And something to make your models in, like Blender

The pressure
I lit wanted to ask that 2 weeks ago but I didn't want to till you say something more about the mod hehe
sorry if that adds more pressure btw, take your time
@coarse sequoia @hoary widget
Here is my little collection of stuff for PZ modding :)
(also- If anyone else has anything that you think should be added to that, please lmk! I want it to be a bit of a living doc for good resources haha)
Well I was following one of those guides but for some reason I can't see my model and idk whats wrong
In game
Did you make sure it was properly scaled?
It shows up on the list but it appears as a blue question mark
What were you trying to make?
I was trying to make a standard jacket
I was following this guide but idk why its not showing up
So you made the model. Did you also make an item file, model/texture file, and the xml file?
ALSO also- did you put a 3d model in both the model locations?
Also also also- It shows that ? because you didnt designate a sprite for it
I put one in the world and one in skinned/clothes
did you make the other files? You had to have made an item script, since it showed up in game
Yes but I'm thinking I made something wrong
I have a fileguidtable.xml, a Jacket_SteamGuide.xml , and SteamGuide_modelsItems.txt scripts
Well, if you wanna post your item scripts, your model scripts, and your xml - I can help :)
THANK YOU
Start with the Item and model scripts tho :) You know how to post inline code?
uhh no
Put these ``` on the first line. Paste in your code. Then end with another set of ```
<clothingItem>
<m_MaleModel>media\models_X\Skinned\Clothes\Jacket_SteamGuide</m_MaleModel>
<m_FemaleModel>media\models_X\Skinned\Clothes\Jacket_SteamGuide</m_FemaleModel>
<m_GUID>ad678279-fc59-41c9-91d7-fd39033dbe1c</m_GUID>
<m_Static>false</m_Static>
<m_AllowRandomHue>false</m_AllowRandomHue>
<m_AllowRandomTint>false</m_AllowRandomTint>
<m_AttachBone></m_AttachBone>
<m_Masks>13</m_Masks>
<m_Masks>14</m_Masks>
<m_Masks>3</m_Masks>
<m_Masks>5</m_Masks>
<textureChoices>Clothes\Jacketpadded\WhiteTexture</textureChoices>
</clothingItem>
Is there anything wrong with it, or should I just post the next one first?
Did you add a texture called WhiteTexture to that location?
I have a question, can I make a 3D model from this photo in blender?? because this is UV Mapping because I would like to change the appearance of the zombie
like this right
You can get the 3d models of the actual zombies from the game files
i can't find localization 3D zombie
Yeah, looks good. The base game xml files dont capitalize the word clothing. I dont think that would effect anything tho. So yee, post those scripts :)
\media\models_X\Skinned\MaleBody.X
in scripts, or scripts/clothing
module Base
{
item Jacket_SteamGuide
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = My First Jacket,
ClothingItem = Jacket_SteamGuide,
BodyLocation = Jacket,
Icon = SteamGuideJacket,
BloodLocation = Jacket,
RunSpeedModifier = 0.89,
CombatSpeedModifier = 0.96,
BiteDefense = 10,
ScratchDefense = 20,
NeckProtectionModifier = 0.5,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 0.60,
Weight = 1,
WorldStaticModel = JacketSteamGuide_Ground,
}
}
hey guys! do you know something about the cell loading? I try to make the game load cells in front of direction player is moving when moves at 30 m/h or more
can't find any mod that uses similar mechanics or mess with cell loading
certainly there's one that works, but I don't know the name
Ok yeah- That tutorial kinda 😬
So. The line "Icon = SteamGuideJacket," is looking for a sprite. Which, going through the tutorial- I dont think they had you add one...
If you wanna try it, I made a little tester icon that you can use. That way it shows up as something ingame too. Make sure the item is named Item_SteamGuideJacket.png and drop it right into the textures file of your mod
damn i need itttt
attempted index: addSongs of non-table: null
The code is as follows:
RadioWavs.lua:
require "SoundFX/SoundFX"
local RadioWavs = {}
local RadioWavs.soundCache = {}
local RadioWavs.files = {}
function RadioWavs.addSongs(_guid,sound_name)
RadioWavs.files[_guid] = sound_name
end
//Other local functions that dont matter
return RadioWavs
VRTVs_SoundTable.lua:
local RadioWavs = require "RadioWavs"
RadioWavs.addSongs("ce2f8a16-5c34-45ab-a0fc-42a45bae457d","29f94658-1439-4dce-b764-828960ae641a")
does anybody know what is wrong?
are they in the same folder (client/shared/server)? and RadioWavs is the full directory (ignoring the lua/client/ part)?
the load order of the folders can cause requires to fail
the folder is as follows:
lua/client/RadioCom/RadioWavs.lua
lua/client/RadioCom/VRTVs_SoundTable.lua
you should be requiring RadioCom/RadioWavs
Albion, you have any experience messing with the chat? Have an idea I wanna play with but I havent done much with it lol
yeah its not the best, I tried your sprite buy sadly it didn't work
Modded items dont have icons i the item list
Hi Haram
Oh, true. Those are a separate sprite sheet with their own distinction. Try adding it to your inventory
Hello 🙂
this should work. my friend is running it and I watched working @abstract sable
asked him and he's saying is good
thank you !
I did, I just didn't post the screenshot
ops, not in MP. he was playing SP. btw the original developer is back so its working, updated 2 feb
Yeah it doesn't work in mp
It also can cause several errors and conflicts so be aware of that. The mod is awesome though
@bronze yoke the issue persists
I have removed almost all local declarations from the first mod
I've changed my code a little and removed all local declarations
how can I change the files load order, to make sure that is not the issue?
the code would be:
RadioWavs.lua:
require "SoundFX/SoundFX"
RadioWavs = {}
local RadioWavs.soundCache = {}
RadioWavs.files = {}
function RadioWavs.addSongs(_guid,sound_name)
RadioWavs.files[_guid] = sound_name
end
//Other functions that dont matter
return RadioWavs
VRTVs_SoundTable.lua:
local RadioWavs = require "RadioWavs"
RadioWavs.addSongs("ce2f8a16-5c34-45ab-a0fc-42a45bae457d","29f94658-1439-4dce-b764-828960ae641a")
load order isn't an issue with require except for the client/shared/server folders thing
require can actually be used to force a certain load order
^^^
ah, sorry, i popped out right before you sent that! sorry but i don't have any experience with it
All good. Though, is it cool if I still post my idea? Just so you can tell me if it sounds sane lol
sure!
you should check your log for a require failed message
Does anyone know if ItemZed still works because I have problems
basic idea is that I want to take information from an item that can be edited in game, and use that to post things to the chat.
In practice it would look like-
- Admin gives themselves the item.
- Writes a message that they want to quickly be able to send in the chat
- Right clicks the item, custom context option to "Activate"
- Posts the message that was typed on the paper in the chat
And bc of the way that pz handles written things, I could make it so that one page is the message, and the other page determines the formatting. First page says "Hello World", second page is a rgb color value that would be set for that chat.
@bronze yoke
yeah that's probably pretty doable
but the logs say that it fails on line 2 of the VRTVs_SoundTable.lua
it doesn't count as a lua error, just a failed message somewhere in the log
where can I read the logs?
@winter thunder So is there an issue with the xml, is it named wrong?
Also this is the blender model for anyone wondering
so i got most of the thing done but I want to know how i can have a constant gas hissing noise while the fire is active. i dont want it to be several sounds overlayed on top of each other if i can.
I only posted it here because the model isn't showing up in game, and im showing what im using (becuase I was asked if it was scaled right). This is the default (I think?) project zomboid jacket model thats already being used.
I don't know if the mods set up right, or if it was the model
my bad
anyone have a link to a blender .x extension that works??
No you're good! I could have and should have used that channel yesterday and I will def need it's help later
hey, one question
how can I add logs to my mod?
to check what my lua functions are doing
You can use .fbx and it’ll still work
you can just print() whatever info you need
mmm
but it isn't showing up
in the logs
i have print("RadioWavs mod: Checking if " + _guid + " is on the table") but it doesn't appear
in console.txt
What happens when you put that uv map down there on that image? Also
ok, I kinda made it work but I've got a big issue
somehow, I dont know why, OnDeviceText isn't passing me the _guid parameter
when I try to print it it says nil
I decided to expand the types of zombies and I have a question if anyone knows how to implement a zombie that has changed objects on its body, i.e. some bulges, etc.
@bronze yoke @red tiger @abstract raptor I have a problem with my mod, no line is giving me their _guid value. they are all nil
Im using the OnDeviceText Event, which is supposed to pass the _guid, _interactCodes, _x, _y, _z, _line
Well, just after the function starts I try to print the _guid like this:
function RadioWavs.OnDeviceText( _guid, _interactCodes, _x, _y, _z, _line )
print("RadioWavs mod INFO: OnDeviceText called")
if _guid ~= nil then print("RadioWavs mod INFO: Playing line " +_guid) end
But it never prints
I know that the mod is properly loaded because I can see the "OnDeviceText called" line in the console
Does anyone know if it's possible to hide/remove the default PZ Professions so that only my custom profession is available?
And if so, how?
if you're using profession framework i think it has something built in for that, otherwise you should overwrite the vanilla function for adding professions
Gotcha, I'll check it out
Hahaha I wish I was that useful to modders here.
I help people here by writing tools, not insight unfortunately.
God im pissed
WHY DOESN'T IT SAY THE GUID?
I've found other code where they use the _GUID parameter in vanilla (RadioCom/ISRadioInteractions.lua), so it isn't like it should be empty
hmm yeah, i'm not getting guids either
mmm
@bronze yoke @abstract raptor Do you happen to know where is the code that saves the lines the player knows to the /Saves/{Difficulty}/{World_Name}/radio/data/RADIO_SAVE.txt ?
because it does save the Guid (of the broadcast IDs at least) there
So I know whatever is calling that function is passing the guid correctly
@winter thunder Good news I got it to half work, the issue was I had it setup like a steam workshop item instead of a mod item. So now I can see the Icon you made and it shows up...it's invisible so thats not good BUT at least its actually there!
ZomboidRadio:Save()
it's java
I guess I can't read it then....
mmm, im getting kinda desperate :v
@abstract raptor Im starting to think that the only logical solution to make a modular framework would be:
Make the user add the GUID of the line and the name of the sound to a function.
This function then SEARCHES ON ALL THE FILES inside /radio, and finds the guid there.
It also opens and saves on a text file the number of lines added.
It then modifies the .xml file, adding the appropriate DRU code
And adds one to the count.
Then, it works just as you made it :v
can't you just modify the codes in memory?
if you go that route, you don't have to use dru - you can put whatever string you want in codes
i wasn't aware you could modify the xml file from the game itself
yeah, that's definitively smarter
I asked techsupport anyway if there was a way to get the _guid because I don't like the idea of modifying the xml files on boot
I feel it could probably break a lot of stuff :v
How can I scale this issue to the developers of the game? It feels like they should take a look into it
you can report it on the forums
i wouldn't expect much though, they generally don't seem to care too much about bugs that don't affect vanilla content
Congrats
I've never written a report there
@bronze yoke @red tiger do you know how can I open and parse an xml file from lua?
Because LUA is in /media/lua/client/RadioCom/RadioWavs.lua and the .xml is in /media/radio/RadioData.xml
there's probably a lua xml library out there somewhere, but i don't think you'll be able to get into the vanilla media folder
you can get into a mod's directory with getmodfilewriter/reader but i don't think you can get into the vanilla directory...?
I dont need vanilla
kinda
my mod modifies the file in /media/radio/RadioData.xml
and it overwrites it with a modified version
can I access that?
I would need to do that on game world init I guess
for the parser, I tested the following line:
local data = xml.parse(<code>example</code>)```
And it loaded the main menu, so I guess it does have the library
what issues could I expect?
i don't know whether the radio xml gets checksumed or not, but if it does then it might kick players before they join because the code that edits the file hasn't run yet
this is for a SP mod, If i want to make it multiplayer i'll get to it when I get to it :v
besides, this is more of a 'quality of life' feature for other modders, instead of having to set every code on your .xml file, you just have to write the guid and it sets it for you
I guess I could easily make it work with them running a custom py script that does that from their end before they release the mod.....
Again I can't help you.
I work on tools for modders, not mods.
Am a career programmer but haven't content modded PZ since 2017.
@red tiger how do we ipairs kahlua table in pw?
const [key, item] of items as LuaTable<string, InventoryItem>
compiles to:
for key, item in pairs(items) do
@bronze yoke thank god the custom tags works perfectly
I can't get the GUID from the game, but I can at least write it to the codes
yeah, codes are just a string, you can put whatever you want in there
I'll make a quick python script that reads from a SoundTable.lua file, goes to the apropriate GUID, checks if it has the UID code and sets the UID code
Been too long for me to know. Ask TSTL
well i think i found it
D:
I put so many hours into these tools. I do worry if me not being around means that these tools that I wrote won't be useable.
Hopefully I am overly concerned over nothing.
Am rly ill tho
Going to publish all my pzpw mods here https://github.com/PZPW-Mods
Ok
@bronze yoke The good news is that it works
I adapted my mod to use the new system
now I want to release it
What i'd like to do is split it into 2 parts
Is there a way to do this? like, make a collection where a mod requires another mod to work, and if I update the framework to fix some issue, it is fixed for all the mods that use it?
You can set requirments both in the mod and on steam
with in the code you can use the require function to properly load needed files in order
yeah, you already made it modular so you just need to separate it into two mods
and how can I set my mod to require the other on steam?
and is there a way to set it in my project?
in modInfo
i'm not really sure what you mean by in your project
Setting the require in modInfo will require the mod to be qactivated
Setting is on steam will require it to be downloaded
If your 2nd mod uses functions from your first you need to ensure you're loading them in the right order
they've made their mod modular already so they know about that
anyone knows why TIS uses generated guid for VHS title and texts ids ?
i'd imagine for mod compatibility, and also because recorded media are generated from a tool and it would be more work to have manually written ids than generated ones
They could have generated from title.
IT is pretty much how they did all the rest before.
they could have, you can just set anything as your 'guid', the game doesn't ever check if it's a guid or anything
but setting guid as the standard is nice for mod compatibility
I respectfully disaggrea. the same mod compatibility is achieved with type_title_line generated keys
and it is less verbose and it is easier to use
well, since they're generated from a tool, it doesn't matter what they are
it only matters if you're manually writing them, which they don't do
it also matters when you analyse them or analyse with them which modders do when they have to start modding.
and when debugging
media guids are saved into the player's save file - I imagine traditional guids are good for compression and hashmaps and such
where strings may not be
who is to say though -- they could have just wanted quick and dirty IDs
for quite alot of lines - as each can be stored/applied/call events
a guid basically guarantees that you'll never have a conflict, even when you really should, and they're quick and easy
@sour island @bronze yoke on the require in mod.info, what do I have to write? the mod ID?
yeah
thank you
I'll follow this tomorrow, but before leaving, is there a way to prevent the people who already downloaded my mod to have issues with this update? since it does split it into 2, and they will have to download (and activate) the new framework in their worlds, which might already have my old mod.
btw @abstract raptor once I release the framework I'll give you a bunch of py scripts that should adapt your work to the framework. It should make the mods compatible.
(I advice you to copy and make a backup of your mod, then check if everything works correctly with the new framework)
alright. What am I doing wrong here
function GiveTraitItems(player)
if getActivatedMods():contains("trineVFExpansion1") then
local Inventory = player:getInventory()
if player:HasTrait("hunk") then
AddNewItem(Inventory, "Base.MP5SD")
for i = 0,9,1 do
AddLoadedMagazine(player, "Base.9mmClip30")
end
AddNewItem(Inventory, "Base.Pistol3")
for i = 0,4,1 do
AddLoadedMagazine(player, "Base.44Clip")
end
end
end
if getActivatedMods():contains("RE2_Hunk") then
local Inventory = player:getInventory()
if player:HasTrait("coldblooded") then
AddNewItem(Inventory, "Base.RE2_Hunk")
end
end
end
function AddLoadedMagazine(player, magName)
local Inventory = player:getInventory()
local Mag = Inventory:AddItem(magName)
Mag:setCurrentAmmoCount(Mag:getMaxAmmo())
Inventory:addItemOnServer(Mag)
return Mag
end
function AddNewItem(inventory, item)
inventory:AddItem(item)
inventory:addItemOnServer(item)
end
The GiveTraitItems function only grants "Base.MP5SD" but not anything else. At first I thought maybe there was an issue with AddLoadedMagazine but when I call this function on its own it works
no :(
adding dependencies is kind of a nightmare
Is there at least a solution to fix broken worlds because of the update? That way I can at least write instructions and pin them in the workshop to do that.
Something like activating the new framework on an old world
alright I figured out the issue
all they should have to do is enable the new mod
Inventory:addItemOnServer requires a different object than Inventory:AddItem
so I have to get the Item returned from AddItem and add that to addItemOnServer
just a nitpick, but you don't need to call addItemOnServer for player inventories
even for multiplayer compatibility?
yeah, player inventories don't even exist on the server
huh
player inventories only exist on that player's client
this is going to change since it's kind of a security flaw, but not for a while
i mean there should be a reason why all the other mods i'm referencing additem to player inventory and onto server
is this why?
they probably just don't know
most people are copying from other mods or just guessing what things do, so they don't know when things like this are unneeded
any way to debug? my lua script is crashing and im pretty sure i know where but i wish i could get some sort of useable stacktrace
you can breakpoints to your files
you would still have to attach this to like a debugging instance wouldnt you
like how do you debug a lua script on project zomboid
so far all im using is sublime
well prints and breakpoints are easy and don't require other tools / knowledge
In-game press F11, filter for your file, double click to show it, double click the line you want.
It will pause at that line and you can advance by one action slowly after that.
your game needs to be in debug mode if it's not
there should be a stack trace in console.txt either way but debug mode will give you breakpoints and in-game stack traces
alright
also
im trying to host a server with my custom mod
i have tested this in singleplayer
but it keeps saying "Server has stopped during launch (NormalTermination)"
OK this is what I suspected
mod visibility has to be set to public. I had it on friends only
yeah, the server has to download its own copy of the mods and for some reason it does that anonymously
I wish Steam descriptions new what sizes image they wanted to use
Hate seeing a giant black box lol
16:9 on website, squared on mobile
Is there any way to edit the message you get when you have made a character and the world is loading, and/or put a video instead?
You can replace it using the translation files
If you want more control over it you'd need to recreate it - and blank the vanilla lines.
With a mod, without having to replace files manually.
Adding a video - not likely lol
Translations are mods, you can provide overriding translations.
There is no way to put a video inside the game then? I was thinking that when you start with a new character, it will play a "cinematic" (I put it in quotes because it can be a loop of an event and that is activated each time you start with the new character).
Honestly, I would like to see when I create a new character, the death of the previous one. Like the "typical cam kill" of some games.
There's nothing in the game that supports a cinematic - so creating one would probably require a ground up approach and some luck with exposed methods.
The body is still attached to the player when you die -- I guess you could have it show up somehow but the load in screens are pretty java sided.
Is there a way to decrease chance of police cars spawning as civilian cars without having to edit the entire zone distribution file?
More precisely I want to have it in a new file that just changes a single value (chancetospawnnormal), but doesn't contain all the unnecessary stuff I won't be editing
If it's not possible then I guess I'll just copy the entire file and edit this single value
Not familiar with vehicle zone spawns, but if it's a Lua table you can redefine exact entries
Thanks
I'll see if that'll work (I'm brand-new to LUA so I'm not that knowledgable about how it works)
https://steamcommunity.com/sharedfiles/filedetails/?id=2944744886 this is top notch
im starting from rly little knowledge here but any idea if it would be difficult to make a mod for mp that causes fog or other weather to set in for like 12h/day?
Sounds possible
I don't think it would be difficult based on what i know about the Climate Manager, which is very little
also. Silly question for y'all
how does one check if the game is in debug mode?
just wanna use it for some prints
getDebug()
stupid question, as my googlefu has failed me. how do I store and retrieve a world object from mod data upon coming back from leaving the game? storing the object directly seems to not be correct, so is there some index or id?
combine the co-ordinates of the square and the index of that object on the square (IsoObject:getObjectIndex())
you can then get the object using IsoGridSquare:getObjects():get(index)
if the object moves to a new square, anything you can do to catch that?
index will also survive if objects are added/removed to the square?
(thanks for the answers, appreciate it)
you'd probably need to update the saved data when it moves, i don't think there's any kind of specific object identifier
odd, not how I have implemented game entity systems in professional games. thanks again.
one last question (maybe), is there a mechanism to find all objects by type within a radius, so do you have to go through square by square?
if im not wrong you could get the cell and go through its lua objects list which is detailed here https://zomboid-javadoc.com/41.78/zombie/iso/IsoCell.html
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoCell
i think that's only movingobjects if that matters for you
i am actually suprised that getLuaObjectList gives you an actual LuaTable
While i know that i can open .pack files and export them as png's using project zomboid moding tools, is it possible to make my own .pack with it so i can use new sprites for remote/motion/timed bombs when they're placed when armed, or perhaps there is more straightforward way to add them?
exactly what i wanted to hear lol
Hi, I am forcing visual for a zombie. It works as expected, but when I reload the game, that visual is overriden. Someone knows how I can force my visual to be the one reloaded instead ?
Like an outfit? Or special item not usually on the zombie?
I am not forcing through an outfit. Can I force skin texture and hair style through outfit ?
Yeah
And yes my zombie has an outfit
To clarify, you're changing the zombies worn items or you're assigning it an outfitId?
Zombies don't actually save much of anything -- everything is loaded from definitions -- so changing stuff on the fly won't save even from unloading chunks
I was doing both (and the outfit was overriding my settings of HumanVisual -not worn items-) Now that you tell me I can set everything through the outfit
I want to use outfit for everything and just need to find the hairstyle ans skin texture guid I guess
You'll have to assign it an outfitId with corresponding outfit XMLs OR just set reanimatedPlayer to true which then saves everything
You can set hairstyles to outfits as well
Shark and I did it for the aliens in super weird heli events
Awesome, I'll look at the alien exemple
Unfortunately zombies don't have a saving modData - so stuff has to be done this way
setting the vanilla hair style guid as an itemid guid in the outfit does not work (or I messed up trying). I guess you have created special items for zombies skin and the like in your mod.
I have not detected where yous et hairstyles looking at https://github.com/TEHE-Studios/SuperWeirdHelicopterEvents/blob/main/Contents/mods/Super Weird Helicopters/media/clothing/clothing.xml
Hair isn't an item thing, you define hairstyles allowed for the outfit
is there a way to change terrain properties? I'd like cars to be fast on dirt, but not by changing all cars one by one (for obvious reason)
anyone has any idea on how to associate the skin color of a zombie to its outfit ? my goal is to have the same controlled skin color of a zombie with outfit when I create it and when I quit and reload the game.
Hoping someone can tell my why suddenly stinkyDistance doesn't have a value when referenced
You can see in here that in here it's coming out as nil. I don't see it being formatting...
Not the save file, just started a new test file and coming up with the same error
I'm pretty sure I know the answer to this, but can the required field in a fixing script accept anything but an item name? i.e item type
Can anyone tell me why its invisible?
go to #modeling
Its a modeling issue? I didn't code it wrong?
hey @abstract raptor I just released the framework I was working on, this should allow our mods to be compatible with each other:
https://steamcommunity.com/sharedfiles/filedetails/?id=2973493897
it is both, but mostly modellers have this problem. It has something to do with masks
Its not the masks defined in the xml?
im not sure. There's a guide somewhere in this server...
yeah, that reference guide picture that goes from 1 to 15 are what I wanted to refer to
This is a good one:
https://theindiestone.com/forums/index.php?/topic/37647-the-one-stop-shop-for-3d-modeling-from-blender-to-zomboid/
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid. Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Ble...
Yeah thats what i have in my xml
so i guess its a model issue of some kind
Neat. Seems like a lot of work for me to implement however and I doubt people would be inclined to download a new dependency.
well, I just used my scripts to automatically adapt your mod (As I did mine). I'll send you the files and if you want, add the framework
@abstract raptor I just tested it and it seems compatible
I'll send you a zip if you want to check it out 
it seems the zip file is too heavy
I need help with a cool mod name. My upcoming mod will remove vanilla vehicles, 100% (normal, burnt, vehicle scenes), and replace them with modded vehicles. What should I call it? I was thinking "Dynamic Vanilla Vehicle Replacer" but it could be better i think.
Modded Vehicle Events
does this code to change menu music no longer work?
Menu music is handled by Java code. It sits in a BANK archive, unlike the OGG sound effects used in Lua
if you change required items for a mod, they are not auto enabled 🤔
so currently theres no way around having people have to manually install music mods? just trying to change the menu music
yeah... I did it myself, can give you a link to quickly insert your own music
How hard would be to make a mod that won't let you climb ropes when you are too tired, too weak, not fit enough or too fat/think?
I think it would be pretty easy.
pretty easy
DO I have to do it or did I convince someone to do it? 😄
Hmmm reminds me of SS13's search mechanic
That'd be a neat mod to do
Timed action to bring up a UI of what's visible on the other player, and more timed actions to open their bags and such -- then a timed action for each item to be taken. The other person can interrupt it by moving or doing something to the searcher.
I remember working with some timed actions and changing that one. There is one action that is handled by java, but I think it is the action for climbing tall fences not ropes, so it should be just a matter of overriding a few functions for a timed action
Probably have to change this one
function ISClimbSheetRopeAction:isValid()
if self.down then
return self.character:canClimbDownSheetRope(self.character:getCurrentSquare())
end
return self.character:canClimbSheetRope(self.character:getCurrentSquare())
end
The timed action is barely used. If you climb from keyboard key press it's not even considered.
That is what I was trying to remember. I knew there were some of these movement timed actions that had exceptions
if my memory is good Co' did the same with the mod Ladder : https://steamcommunity.com/sharedfiles/filedetails/?id=2737665235&searchtext=Ladder
pretty sure there's nothing like that there. Only a bug that makes you not climb the final step and make you fall.
oh that never happened ^^ I must be lucky I always used his mod on my server
I need help fixing that mod
You have to hook the function that allows you to validate when the player goes up the ladder ":valid" you get the value of the stamina and depending on ... it can go up or not
function Ladders.OnKeyPressed(key)
if key == getCore():getKey("Interact") then
local square = getPlayer():getSquare()
Ladders.makeLadderClimbableFromTop(square)
Ladders.makeLadderClimbableFromBottom(square)
end
end
Thisone I think
the timedAction ^^
You could try to eat / consume the key, but I'm not sure if it will work.
for the ladder mod, I was wrong, he hadn't done the feature yet
I have some snippets to reverse the climb but it bugged and causes players to fall.
Now I remember, I actually have already tried it once and I got this to work but then the issue with pressing E came up and I gave up:
function ISClimbSheetRopeAction:perform()
if self.down then
self.character:climbDownSheetRope()
else
self.character:climbSheetRope()
end
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self);
end
There should be a key press event for climbing
I added some basic stuff to it to test, like ... endurance I think
Yes, it is from that file
function ISClimbSheetRopeAction:isValid()
if self.down then
return self.character:canClimbDownSheetRope(self.character:getCurrentSquare())
end
return self.character:canClimbSheetRope(self.character:getCurrentSquare())
end```
hook this ?
ig by hooking you mean overwrite the entire file then I got you 😄
and add the conditions to know whether or not the player can go down... after you can hook the perform and do a ZombRand() so the player has a chance to let go of the rope if he gets too tired
Noooo
from what I remember it's triggered from player doContext in java
For when you hold down E?
I'll mess with it a little and then let you know of the results
Not sure about holding, I was testing with short presses.
i will send you an example when i back to my home ^^
Hmm, but... climbing over a fence should have the same stuff attached to it - can't climb when too tired. But I can't seem to find it on it's timedaction file. So I think it's maybe only defined on what Chuck and poltergeist were talking about?
Could be partly in the anims xmls
Started messing with those, and they're pretty potent for features
Made a mod that turns off tree scratches just using the xml
And a mod that stops zombies from tripping when sprinting
whaaaaaaaat, let me go look
You could call a fail animation and set/check for conditions
I'll just mention this in case you didn't consider it.
if player:isClimbing() then
--stop climbing
end
True, in the player update
I wonder if there's a way to break down the fencing climbing to 2 steps
Climb up and climb down, being able to sit on the fence
God damn this scrathes thingy was soo simple Chuck? I would have used it back in the day when I released my map and made all the bushes, tall plants and and some trash have the movement restriction but it also gave scratches so I was figuring how to change that but had to remove some of that stuff instead
Yeah there's a lot of stuff the animation system can handle
The issue is there's a lot of stuff from before still around making it bit convoluted
Like I'm pretty sure isClimbing probably checks for an animation variable
Not home so can't confirm
If not it's using a pre-anim field
Yeah you could set a variable when you're tired
Have the climbing animation transition to a slide down animation or even fall
But I don't don't modders can define new animation states
I think I saw that in vanilla already 🤔
You can call on existing states
a check for mood level of endurance
Could be for fences
I'll look into the fence anims too, I don't even want to go too deep with this, only a simple check for if the person is generally too weak would be enough
The issue is the E call
as a avid junk food enjoyer I can tell I can't probably climb a sheet rope into a second floor
If that can't be properly prevented messing with on update could lock the player
While trying to finagle the sprinters to not trip I ended up with frozen zombies
And zombies running in slow motion
reminds me of max payne
so you could Neo yourself out of a sticky situation?
Yeah, you just set a condition to lock up the animations
I’m making a profession and how do I do the lua code? I’m using profession framework as a base and im super confused on where I put the files for it all ;-;
subscribe to a mod similar to what you are trying to do and follow their example
Alright thanks! : D
@dusty wigeon would you mind if I sent you a direct message on discord to discuss your mod being used on a server?
Has anyone already made or know of a way to make a mod that reduces overall cooking time needed for recipes. On a real time server it can take 30 minutes to cook some recipes and wondering if there is a way to speed that up.
@jaunty dirge sure
that's nearly the only way to trigger a good old fire event. are you sure you wanna remove that ?
We run with fire spread off anyway. Our Fire Department wouldn't be able to keep up with the pyros on our server.
Pyros? 🙂 My mod ? Yey

no, didnt know there was a pyro mod. We just have a lot of people who like to play with fire.
30 minutes to cook what?
Anyone know how food is cooked/rots?
I can't seem to make any food rot or cook
Steaks been in the oven for 3 days 
So the inventory render code is somehow responsible for cooking/rotting
nice
Ah, ISInventoryPane:drawItemDetails
The item doesn't actually change, the inventory just needs to render it appropriately
SetAge i think
ISInventoryPane:renderdetails is the one doing it
Not sure but
You can get all the syntax from the contextmenu lua
I think I just gotta add a few calls to my own render loop I suppose
Theres a part there wheere it handles cooking and evolve recipe
Nice didnt know that
Ah so you just want to render it specific way and has nothing to do with its properties?
The problem im seeing is with my grid inventory nothing is rotting/cooking/ getting wet/ etc
renderdetails
has things like this strewn throughout though:
if instanceof(item, 'InventoryItem') then
item:updateAge()
end
if instanceof(item, 'Clothing') then
item:updateWetness()
end
So I assume thats my issue
I dunno how youre handling the ui so im not sure if vanila applies to it
Maybe try drawdirty i think it was?
Like a render refresh thing
Im on mobile so i cant check
I thought it was a bigger problem when leaving a steak in the oven didn't burn the house down
Items only update when seen then?
That feels off
Makes sense from a performance perspective but I'd assume fires would be started with out the need of being seen
Hmm, a fire did start eventually when I wasn't looking
I guess my incorrect rendering was breaking it
Freezing the items in an uncooked state, preventing the fire or something
is learning enough java to make a simple mod for zomboid hard? Considering that i know c++ and python?are there like support tools for modders, or do i basicially have to know entirety of java well? thanks for any advice
So this code snipped works for the person holding the item but for other players on MP, they don’t see the visual change. Is there a way to change that?
I’ve tried having the update hand model be called for all players instead of just the user by running it in OnPlayerUpdate but that didn’t work either.
you'll most likely be using lua, not java
zomboid is half and half and the official mod support only allows for lua mods
you might want to get familiar with java so that you can read the source code to see how the java api actually works but you don't really need to know too much about it
@sour island you’re the guy that made EHE, right?
The Spiffo event gave me an idea for a mod but when I tried figuring it out it didn’t work. I know the gist of it is spawning a zombie with a specific outfit and making it immortal if it’s wearing a specific thing of clothing but I’ve never been able to get it to work. The zombies always spawn with default outfits when I do it.
Don’t have any footage atm and I’ve shelved the mod for a while because I couldn’t figure it out, how did you get the zombies to spawn with the right outfits?
oki thx
Found the issues after looking at it with fresh eyes. No comma at the end of the default value
Greetings everyone, anyone know if there is a mod that shows the clickable items, Like fences? something like a "show click-box" or something like that, im having a hard time dissasembling small wired fences. The icon for dissasembly doesnt work on fences.
I don't think you can disassemble those in vanilla and that's why using the icon/tool wouldn't work. Think you need sledgehammer.
Anyone know where I should start when I want to modify the UI?
Specifically item stat pop ups on hover
You actually can, but the clickable part sometimes work and others not
thats why im looking for a mod to see the clickable part of items, i dont know if its a bug or the clickable parts its super small
I think I'm familiar with the issue. I sometimes notice when trying to right click a sink with a window+shades facing west it is randomly not right-clickable.
well, It is, but it does not show 'wash' etc
yeah something like that
but finding a magic pixel will bring it up sometimes.
can i send a link of a yt? shows the issue with the normal wired fence, the tall one, its easier with that one, but the small one its almost impossible
I dont know of a mod that does that though, I'm sorry.
no problem, thanks anyway 🙂
sure go for it. my friends seem to come across this sort of thing, not with fences but random assets, so it could be worth looking into a fix for
Hope this helps ya out bud.
thank you
You mean item tooltips? That can be found media/scripts
If this is what you ment
I know you said you used the button, but you meant you tried it like this? and also using R to cycle the objects in the tile etc?
Use this tip to disassemble things faster in Project Zomboid.
▶TWITCH: https://www.twitch.tv/Aidanomic
▶TWITTER: https://twitter.com/Aidanomic
▶DISCORD: https://discord.com/invite/scZpGMq
Ambient Music By Epidemic Sound
#projectzomboid
#projectzomboidbuild41
#aidanomic
#zombiegames
#shorts
I think so. Problem is I want to modify it via lua 💀
Like, check if the player viewing it has a trait and change the item description (but not the actual properties of the item itself)
Right now i have a trait that if you eat chocolate it poisons you. I'm just trying to think of a way to forewarn a player that they'll be poisoned without them, you know, discovering it by accident
Use onfilinventory context menu
i think there's an ISTooltip or something
#1070858800501891172 message
Shared it
this seems like it could be incredibly useful
did you upload the wrong file? this just contains a clothing mod
how do I make it so my weapon cannot be equipped in both hands, only primary or secondary?
{
DisplayCategory = Weapon,
MaxRange = 1.23,
WeaponSprite = DragonScimitar,
MinAngle = 0.75,
Type = Weapon,
MinimumSwingTime = 2,
KnockBackOnNoDeath = FALSE,
SwingAmountBeforeImpact = 0.02,
Categories = LongBlade,
ConditionLowerChanceOneIn = 30,
Weight = 2,
SplatNumber = 2,
PushBackMod = 0.5,
SubCategory = Swinging,
ConditionMax = 25,
MaxHitCount = 2,
DoorDamage = 7,
IdleAnim = Idle_Weapon2,
SwingAnim = Bat,
DisplayName = Dragon Scimitar,
MinRange = 0.61,
SwingTime = 3,
HitAngleMod = -30,
KnockdownMod = 2,
SplatBloodOnNoDeath = FALSE,
Icon = DragonScimitar,
RunAnim = Run_Weapon2,
TwoHandWeapon = TRUE,
BreakSound = MacheteBreak,
DoorHitSound = MacheteHit,
HitSound = MacheteHit,
HitFloorSound = MacheteHit,
SwingSound = MacheteSwing,
TreeDamage = 10,
CriticalChance = 20,
critDmgMultiplier = 5,
MinDamage = 2,
MaxDamage = 3,
BaseSpeed = 1,
WeaponLength = 0.3,
AttachmentType = BigBlade,
DamageCategory = Slash,
DamageMakeHole = TRUE,
Tags = CutPlant;SharpKnife,
}```
I pretty much copied the vanilla machete but for some reason mine has the equip in both hands option
yes I'll correct that
I see TwoHandWeapon = TRUE, is that not it?
you're welcome. Yesterday I gave up because I was missing a comma and it was breaking everything
so you're not alone lol
it's up, shame on me and my broken processes
TwoHandWeapon = TRUE right there in your script
Using my extension to write scripts? That should show up when typing.
so I'm finally getting around to this, what exactly is the function that I hook into to add a tag? Or do I have to do that myself on the init of the game?
Additionally would this affect multiplayer at all?
you have to do it yourself, and it shouldn't affect multiplayer as long as the code runs on both sides
Alrighty, thank you.
I have to say you're consistently one of the most helpful people here, and as a new modder I really appreciate you! Thank you for all your help.
😇
is there a way to make a weapon only useable in both hands? so theres no equip primary or secondary option
Have you checked the sledgehammer option? I think it works the same way
RequiresEquippedBothHands = TRUE,
Alright i'd like to get an opinion on this: what's the best way to get a list of items to tag?
- Put the list of items in a sandbox var, reference
- Put the list of items in a .txt file in the modfiles, parse and reference
- (be a monster and) hardcode the items in said function
My goal is to make it easy for another modder, if they ever decide to add on to this mod, to add items easily
if you want it to be for modders specifically you can just make it a table
What do you mean?
if your mod is already modular then it's pretty simple to add it to the module, otherwise you could just return that table e.g.```lua
local items = {"Base.Apple", "Base.Banana",}
-- code that actually uses the table
return items
then other modders can just do```lua
local items = require "Path/File"
table.insert(items, "Base.Pear")
I'm kind of leaning towards the txt file idea-- is that similarly easy for modders?
they'd have to overwrite your file, unless you make it read from the same file in every loaded mod's directory or something
🤔
Or if they'd like, I could make a table with the items I get from the file. They could either hook into my function or I could add another var they could access that could take their additions in before I assign tags
or am I just making this too complicated. lmao
I just want it to be easy. Maybe a table is the way to go.
i have a soon to be released mod that looks for a file in every loaded mod's directory as well as the Zomboid/Lua/ directory, but that's sort of a whole system, i'm not sure it'd be called for in your case
Things to think about!
depending on your objective an item tag could work
local function addItemTagsFromFile(path, tag)
if not fileExists(path)
then
print("Cannot find file");
return {};
end
local lines = {};
local foundItem;
local itemTags;
for line in io.lines(file)
do
lines[#lines + 1] = line;
end
for line in lines
do
foundItem = getScriptManager().instance:getItem(line);
if foundItem ~= nil
then
itemTags = foundItem:getTags()
if not itemTags:contains(tag)
then
itemTags:add(tag);
end
end
end
end
function ATOnInitWorld()
addItemTagsFromFile("....ATCarnivoreTag.txt", "ATCarnivore")
addItemTagsFromFile("....ATHerbivoreTag.txt", "ATHerbivore")
addItemTagsFromFile("....ATInsectTag.txt", "ATInsect")
end
This is what I have so far. Anything glaring wrong? And I made the ATOnInitWorld global so it can be more easily extended
idk how I could make this easier for other people.
i don't think the io library is available in kahlua, we usually use java BufferedReaders
i'm also not sure what path fileExists works from, it might not match that of the get reader methods
i've historically used local reader = getFileReader(params) and then if not reader then return end to check if the file exists, not sure if there's a better way
No idea what the intention is but reading through all script files sound vaguely unnecessary
Damn. That'll really throw this off haha
Basically I want to add tags to items on the initialization of the world. Currently I'm adding them line-by-line from files. I want to use these tags later to modify some stats after the player eats food.
you want to add them this way so that you dont need to update the mod ?
yep. IO isn't a thing
I did it in that way exactly, but the small wired fence doesn't show the option to disassemble
for your usage getModFileReader would be the most appropriate
unless he want to reads from the /lua/ dir
from my understanding the person want to read tags from a file so that he can update it later, probably so that it doesnt require a mod update (if it was written directly into the code)
That's a benefit, for sure. I'm very averse to hardcoding stuff
then try getFileReader and getFileWriter they will write into the lua/ dir of your cachedir
C:\Users\Konijima\Zomboid\Lua
IO is not exposed as it would be a security issue for malicious mod
use getAllItems() in lua and do you changes from there. that's what I did in No Hat Drop mod
but keep in mind that anything in the Lua folder won't be a part of your mod
yeah so you may want to create a default file if none exist.
local function fileExists(path)
local reader = getModFileReader(path, "r");
reader:close();
if not reader
then
return false
else
return true
end
end
local function addItemTagsFromFile(path, tag)
if not fileExists(path)
then
print("Cannot find file");
return {};
end
local reader = getModFileReader(path, "r");
local lines = reader:lines();
local foundItem;
local itemTags;
for line in lines
do
foundItem = getScriptManager().instance:getItem(line);
if foundItem ~= nil
then
itemTags = foundItem:getTags()
if not itemTags:contains(tag)
then
itemTags:add(tag);
end
end
end
reader:close();
end
function ATOnInitWorld()
addItemTagsFromFile("ATCarnivoreTag.txt", "ATCarnivore")
addItemTagsFromFile("ATHerbivoreTag.txt", "ATHerbivore")
addItemTagsFromFile("ATInsectTag.txt", "ATInsect")
end
This is what I have now
I'm assuming getModFileReader looks in here?
wait. not here... further in?
it looks at AnthroTraits
okay bet
No issues are popping up. Just running some tests now
Is there a way I can check tags on an item? I forgot to print that somewhere
hi i want to do java modding, is
https://github.com/Konijima/PZ-Libraries
this guide for how to do it still good to use?
i noticed the library pzstorm hasn't been updated since 2021 according to the github page i found so i want to make sure
that guide is for lua modding
lmao not working well at all, nvm
602 is this lovely number
iiiiii'm gonna double check the docs
getModFileReader(String modId, String filename, boolean createIfNull)
you know. I was wondering what arg1 and arg2 were
decompiling is simultaneously so useful but can also be, uh, misleading
is there a guide for java modding?
I don't think we really do java modding here
btw, reader:close() might cause issues if the file wasn't found
i'd move that next to the return true
actually i should doublecheck that...
yeah, that's correct
i think there's an attachment editor? but not really my area so that might be unrelated
would that be in modeling? idk since this part is coding
but i doubt thats right
I will ask in modeling 
#modeling his right. You will get better response there. But you can technically post here too..
can I ask why you're looking into it?
I want to mod in trains
lua won't give me enough flexibility/functionality alone
Hmm. Problem is with modding with Java (afaik) is questionable legality, inability to use the workshop, and having a terrible, terrible time decompiling
I'd highly recommend trying to prototype in Lua. People add in new vehicles all the time. you might be able to make a different model and restrict it to the train tracks
not legal advice, but legality shouldn't be an issue afaik
I mean, to my knowledge, if people can somehow get boats working, a train is only so far away, yeah?
I've worked it through, there are plenty of resources on lua modding
Fair enough. You sound like you know what you're doing
I have not heard of this, I would be interested in looking at this mod
i haven't used the boat mod but i assume boats are just cars on water, trains behave a lot more uniquely
Fair, though would it not be possible to try and constrain a vehicles movement to tracks?
I don't know much of the IsoVehicle stuff, but it's just interesting. I feel like there'd be a way.
🤔 does lua have access to the tiles underneath?
i can't think of a way to do it from lua without it being very janky
I have a specific idea of having a special type of "path" that the train would follow around the map.
yeah restricting it to rail tiles would make it "janky"
it can be done, but it would not be... clean
Hmm..
I feel like it would have to have access for some things to work, stuff like digging graves and the like need grass.
Hey this is really silly
Why is this giving an error?
I've been unable to test the file input because of this lmao
okay well I wanna know what mod this is lmao
Im guessing map mod or trait mod
could be an npc mod?
When asking about errors, it's a good practice to show the uncropped stack trace
next mod idea: demon-spirits do creepy things
oh oops
sorry! I should know this
[10-05-23 00:55:54.994] LOG : General , 1683694554994> -------------------------------------------------------------
attempted index: ATModID of non-table: null.
[10-05-23 00:55:54.997] LOG : General , 1683694554997> -----------------------------------------
STACK TRACE
-----------------------------------------
function: addItemTagsFromFile -- file: AnthroTraits.lua line # 613 | MOD: Anthro Traits
function: ATOnInitWorld -- file: AnthroTraits.lua line # 645 | MOD: Anthro Traits.
[10-05-23 00:55:54.998] ERROR: General , 1683694554998> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: ATModID of non-table: null at KahluaThread.tableget line:1689..
[10-05-23 00:55:54.998] ERROR: General , 1683694554998> DebugLogStream.printException> Stack trace:.
[10-05-23 00:55:55.034] LOG : General , 1683694555034> -----------------------------------------
STACK TRACE
-----------------------------------------
function: addItemTagsFromFile -- file: AnthroTraits.lua line # 613 | MOD: Anthro Traits
function: ATOnInitWorld -- file: AnthroTraits.lua line # 645 | MOD: Anthro Traits.
[10-05-23 00:55:55.035] LOG : General , 1683694555035> .
This line is really harmless though, only thing that could cause an error is if there's no table 🤔
Is the file with the table loaded at that point?
Probably not. I was under the impression I could just stick global variables I might need in that file and they'd just... work.
folders load in this order sherd -> client -> -> server. If you want to cross reference something in same folder during Lua Loading, you can use require "Globals.lua" for example
Makes sense. So like this then
?
Hei its that possible to delete all specify items from world with a mod?
mm. not quite
...what am i missing? Intellisense worked. Was making it required not enough to make the table load?
move it inside one of the lua subdirectories, unless you want to manually load the file.
the simple way: globals in shared, then client / server files don't need to use require
can someone help me make nested radial menus in the q menu? like if I wanted to add another submenu inside of the 'Friendly' emote menu, how would i go about doing that? ive been doing a lot of trial and error with no success
You could look at how IbrRus did on their Dance mod. https://steamcommunity.com/sharedfiles/filedetails/?id=2648779556
the dance menus aren't nested, they're only regular menus
what i mean is
q menu > emote submenu > subsubmenu
Radial API by browser8
getScriptManager():getRecipe("Recipe Name"):doSource("NeedToBeLearn = true")
Why won't this work? Trying to make a patch to set some recipes to be learned
Ughhh whats do source aagain? Albion mentioned this before
it should be a doParam for recipes as I read from your quote:D I think
Maybe you need to check the lua that handles these things
Kust type needtobelearn
Just*
Search the lua folder
my win search has always been broken as F
but I got this issue covered already, used something else, I just needed to make a temporary patch between three mods
Used these :
recipe:setIsHidden(true)
getScriptManager():getRecipe("Butcher Small Animal"):findSource("Base.DeadMouse"):setCount(69)
It seems the setIsHidden(true) alone won't cut it, as the recipe still gets shown when done from inventory and you have the materials, so I had to use that other line as well 😄
You can search for recipe yeet
there is no such recipes
wups i mean, I was already doing another thing with poison 😄
now I have a problem where the poison level transfer only when there is one item as input and 1 item as result, but if there are lets say two items, one is poison and one is not and the result is only one item then that one item won't get that poison level
Use visual code or notepad++
Just make sure to set the lua* folder as your workspace then search
Oh THAT yeet 😄
i have no idea what lia is
I got that issue solved already anyways, im messing with the god damn poison level arghhhh
but I FEEEEEEEL IT, I FEEEEL like im close
dont put anything inside the /lua directory, there should only be client/ server/ shared/, your global file add it to the shared so it is loaded both on client and server.
Lua
ohhh 😓
also instead of using globals, simply return it at the end of the file and require it where you need it.
shared/myModSettings.lua
local settings = {
modId = 'myMod'
}
return settings
client/someScript.lua
local settings = require('myModSettings')
print(settings.modId)
IT WORKS!
function PoisonA1_OnCreate(item)
if item:getType() == "BerryGeneric1" or item:getType() == "BerryGeneric2" or item:getType() == "BerryGeneric3" or item:getType() == "BerryGeneric4" or item:getType() == "BerryGeneric5" or item:getType() == "BerryBlack" or item:getType() == "BerryBlue" then
if item:getPoisonPower() > 0 then return false; end
end
return true;
end
If even one berry is poisonous then the recipe won't work.
to optimize this a little you could do this, this would stop calling the function numerous time.
local itemType = item:getType()
if itemType == "BerryGeneric1" or itemType == "BerryGeneric2" or ...
Thx! I'll add it. Im usually just too excited when something works that I'm afraid to change anything 😄
got tag teamed by team orbit
I think the game stores which berry is poison somewhere
I recall there being a function like 'getPoisomBerry'
It worked with my earlier method too but the problem was that if the input item is more then one and the output is only one then it didn't transfer over correctly.
Ahh you are right, there are one for berry and mushroom too
welll... why do it easy way when you can do it hardway too
😅
There's been a few times where I've written complicated things and had to troubleshoot issues only to find out there's a utility function buried somewhere
typical
once when adding/tweaking animations in .xml I constantly reset lua in debug mode and thought why the thing won't work, then I realized i need to restart my game for xml changes :S
took me a hour tho
I previously write long if else if then refactor
But if its too long then i start with table
But now im used to writing tables so i start with that
Question is it possible
To include function inside a table? I doubt..
local function doBlackCard()
if isDebugEnabled() then print('test Black') end
--do stuff here
end
local function doBlueCard()
if isDebugEnabled() then print('test Blue') end
--do stuff here
end
local function doGreenCard()
if isDebugEnabled() then print('test Green') end
--do stuff here
end
local function doRedCard()
if isDebugEnabled() then print('test Red') end
--do stuff here
end
local function doYellowCard()
if isDebugEnabled() then print('test Yellow') end
--do stuff here
end
if spr and tilecolor and SZC.isCardAvailable(tilecolor) then
context:addOption('use ' .. tilecolor .. ' Keycard', v, function()
print('Swipes '..SZC.CardVariation[tilecolor].card)
if tilecolor == "Black" then doBlackCard() end
if tilecolor == "Blue" then doBlueCard() end
if tilecolor == "Green" then doGreenCard() end
if tilecolor == "Red" then doRedCard() end
if tilecolor == "Yellow" then doYellowCard() end
--TODO if you have something that will run no matte what color card you use then add that code here . for example audio or emote
player:playEmote("sneaksignalok2H")
-- if sq:getModData()['isCallZeds'] == nil then
-- Events.OnTick.Add(SZC.callZeds)
-- else
-- Events.OnTick.Remove(SZC.callZeds)
-- end
end)
end
Cuz the keycard item , the color and the tile is inside a table
It would be nice if the function too
SZC.CareVariation[getTileColor].function
You can include functions in tables
Needs to be defined before it's referred to
Gotcha thnx . Ill use that
This came up some time in pz_chat a while back & I was informed that more than that one berry can be poisonous
I think it was something like that one is guaranteed to be poisonous, but others may still be poisonous
Unsure bc I forgot to look into it
Careful reading anything in pz_chat lol
It was from vets; I had the same assumption as what you said based on looking at the code
Vets or not, a lot of players work on conjecture
Fair
I imagine they had experience in this case from seeing other berries be poisonous though lol
Afaik it's 1 type of berry, but there's a random chance for unknown berries to be the poison one
So maybe they're conflating it
Maybe that was it, could just be me misremembering. Still haven't looked into it so dunno
Yeah, I kind of hope the game gets a more complicated identification system
Although I might be in a minority lol
Basically not know what food is right away unless you're skilled or made it
Same for medication descriptions if medical gets expanded
Barotrauma (the game) does this a bit where you get incorrect suggestions for which medicines to use
Total agreement here
Even for people who know the information by heart they need to manually select it and can't rely on quickly hitting the suggestion buttons.
Really slick design balancing in-game and real-world skills
They may be a team of modders pumping out a ton of mods however Team asledgehammer has been core-modding and tool-writing for nearly a decade & team member count: 1.
No one ever knew that at one point PZ had its own Bukkit mod for the server that fully supported Java plugins & Lua modules that communicate with them.
(No one knew because I suck at advertising my works)
A little unrelated to modding, but you guys probably know. If i deleete a user from whitelist, does that delete their char? Just want to reset pw 😛
What is the bukkit mod?
Bukkit is a core-mod for Minecraft that allows people to do what they do with the Java edition.
It forwarded and interfaced the game's obfuscated code with human-legible API and allowed for multiple mods to be loaded as plugins that can play with each other nicely.
I used my own framework to build things like a custom chat solution & factions back in the day. =)
No one knew about it though, even though the server using it thrived for a bit.
If I felt like the multiplayer of PZ were to dramatically take off for a bit I might revive that project.
The best place to core-mod PZ is the server.
i started messing with making area copy/paste and realized ... how much math is involved and why i didnt pursue academic programming
Makes sense. That's most people's reaction when maths gets involved.
having to copy an area based on coordinates then make a grid within a grid that copies the items in your area, their rotations, etc then pasting it somewhere else by saving the previous math and using the new location as the starting value
brain hurty
I'm a career programmer.
i'll pray for you
My brain hurt when trying to copy all the render cache data from Minecraft when I wrote an exporter mod and import script for Blender.
I know a bit of UI/UX.
revive the project
do it... DO IT.......
is that old uhhh whatstheirname chat, the chinese dev
from 2018?
gatewayroleplay used it i think
The last UI thing I worked on was a core-mod to support GPU Shader support for UI and a React-library for PZ via Typescript.
i forgor whose chat that reminds me of, i assume it's theirs
I made that lol.
there was a ye olde complete overhaul of chat around 2018 that fell into obscurity
carry the torch.........
yeah it was ... a whole thing
Chat today has tabs but doesn't look as clean as my design.
I wrote a new chat network protocol and abandoned the simplistic one back then.
Now chat has dynamic tab support for vanilla.
The code for that old thing is still up on my GitHub org however it won't work with anything today.
i haven't made tabs for my chat mod yet, can't be hecked
maybe someone will PR them.. one day..
👵
I see that you've made your own Discord bot too.
nah i fork stuff i think is cookl
am a forker.. we do a littel forking....
It would be cool to have NPC bot in a very hard-to-reach place that once interacted with gives your Discord account a special role in a Discord server.
it would be cool if we had basic httprequest in our kahlua implementation
how simpler life would be..




