#mod_development
1 messages ยท Page 267 of 1
Don't think he needs to, container is not an array
the code is not the problem
its the explanation on the problem/situation/goal is
It's ok
-# Use this format for easier reading:
```lua
<code here>
```
@modern hamlet for code blocks
hmmm.. cuz when i removed stuff from my functional atm mod
i used reversed forloop
then send something to server code cant remember exact syntax
Also that just won't even work here
ill check
its' working now lol
The problem here is that you loop from 1 to stuff, then try to access stuff[i]
except for the inventory window.
That won't even work
?
it is working
Then you didn't show us the right code, bcs that won't work lol
i put stuff in, stuff gets removed
I just explained why
You are looping from 1 to stuff, meaning stuff is a number
But then you try to access entry i from stuff, meaning stuff needs to be a table
So either stuff is a number or table, but in both cases it will error
Or it's just not even running through your code here
This is what it should be
for i = 1, #stuff do
local item = stuff[i]
container:Remove(item)
end
You're running this server side ? Then you should see errors in your coop-console if host or dedicated server console
sadly i just dont know enough to communicate it in a non dumb way
lol
i appreciate the help
local totalSellAmt = 0
local pl = getPlayer()
local piecePrice = 0
for i = atm:getItems():size(), 1, -1 do
local toSell = atm:getItems():get(i - 1);
piecePrice = FunctionalATMs2.checkQty(toSell)
if toSell and piecePrice > 0 then
print('Sold ' .. toSell:getType() .. ' for ' .. piecePrice)
pl:setHaloNote(tostring('Sold ' .. toSell:getType() .. ' for ' .. piecePrice))
totalSellAmt = totalSellAmt + piecePrice
if isClient() then atm:removeItemOnServer(toSell); end
atm:DoRemoveItem(toSell);
end
getPlayerLoot(0):refreshBackpacks()
end
return totalSellAmt
You seriously need to improve your variable naming oh god ๐ (nvm, it's good)
Also caching that atm:getItems()
Anyway, DoRemoveItem sound like a more plausible method to remove items
Or I'd feel like it would properly sync stuff
thanks both of you ๐

maybe refresh backpack only once after the loop ?
Not sure what it does
im already used to it plus my snippets / shortcuts / hotkeys
are all sets
str = string
int = integer
flr = floor
sq = square
pl = player
targSq = destination
spr = sprite
wpn = weapon
zed = zombie
car = vehicle
targ = otherplayer
sprName = spritename
obj= object
dmg = damage
opt = option
func = function
inv = inventory
tab = table
clan = faction
sh = safehouse
hp = health
bd = bodydamage
im aware i should make it readeable
i truely am but nah
Nah just I was confused at wtf atm was lmao, as it seemed to be an inventory
But then realized it's just an ATM
I should do something like that actually
yea understood it after
burryaga hates reading my code code cuz of this
at some point i really tried and used player instead of pl
but yeah...
Yeah I'm more in the team that full name is way more readable
Actually make your variable properly understandable with a simple read
Tho I should put myself some naming conventions in my code, as I sometimes tend to go wild lol
cuz pz is already confusing right
like type should be variable type but its used in scripts
and thats not the category type
like type is the Base.Type
Tbf PZ naming is really not bad
well, i'm so dumb with modding, that i gotta get smart to know if pz is dumb
Overall what things seem to be, is usually what they are
then theres object vs items
lots of different items too
and inventory can be container or panel
it requires research and debugging for me to get familiar with it
so yeah it creates confusion really
but we get used to it in the long run i guess
btw when the player dies how do we fetch the player post death? hve you tried?
like during the death menu?
I think I saw something about that, that the player just no longer exists on death
i wanted to set its outfit to special zed
but i couldnt
tried corpse tried player
figures..
Go through every zombies, check if reanimated
Maybe you can identify the player there
maybe neet to fetch all the zed from the list and try and identify
albion mention the moddata gets transferred so that might be the solution
Iirc when you view zombies in cell you can make player zombies show up as a different color. One of the admins in our server does it to hunt for player corpses that wander off.
Reanimated zombies
Anyone know if there's any documentation / tutorials to adding custom zombie types?
No
I've made a framework for it however
The mod I made with it
And ik another person managed to make custom zombies themselves too, but they haven't posted it as a public mod and is linked to their server modpack
My guide on how to use is incomplete
Haven't had any motivation in the last 2-3 months to do any work on it
But you can do things with it, easily
Hi guys, im encountering some weird issue where the game is throwing an error on this specific piece of code in this recipe, not sure what im doing wrong, despite it throwing an error, the resulting items still receive the correct values im looking for
Thankyou!
Can you show the line numbers please
player
Not sure, but might be player
Vanilla never gives IsoPlayer for player argument
Always a number which is linked to split screen players
Javadoc Project Zomboid Modding API declaration: package: zombie.Lua, class: LuaManager, class: GlobalObject
Use that
local player = getSpecificPlayer(player)
That's my guess
(I guess you can replace player)
Use it before your for loop
its throwing an error on the setHungChange, setThirstChange, etc, actually everything except the player part works
Then the problem is result
Maybe I'm not familiar enough with it
One suggestion when this kind of things happen
Just add a print of your variables
And in the console, look what it prints
You can do that for player, you can do that for results
You can do that when for result:getHungChange()
And see what it outputs
Don't hesitate to print
That way it can tell you what type of variable it is
this works?
No +
any tips for testing this? i always have to restart my game
gotcha, thanks
Always run your variable through a tostring as if it's nil for example you will error due to not being able to concat "Item" and nil
if you tostring you can never get this problem
So it's a good habit to have imo
gotcha
Or do like me and half the time don't even bother to concat strings lol, just directly print the variable
print(item)
Just for a big chain of prints it can be a pain to determine wtf is what
Also you're interested in checking result here
Not item
As I think it's what is causing problems
yep i also added a print for result
hmm, it got fixed after i explicitly checked for the type
if item:getType() == "PancitPot" or item:getType() == "PancitPan" then
weird
because you are looping over all the ingredients, which includes your 4 bowls
If I was using getFileReader to read a .txt file in the folder "Zomboid\Lua\Logs\Chat" should that be possible? because I can write to that folder in a .txt file. Any help would be super.
it's possible, what problem are you having?
im getting a stacktrace error from it. I'd use getModFileReader but since its outside of my mod I didn't think that'd work.
"-----------------------------------------
STACK TRACE
Callframe at: getFileReader
function: monitorChatFile -- file: ChatLogger.lua line # 104 | MOD: ChatLogger
function: Add -- file: ChatLogger.lua line # 128 | MOD: ChatLogger.
[24-10-24 12:41:48.510] LOG : General , 1729788108510> ."
is it because of the monitorChatFile specifically?
can you show the line/function that calls it?
dooooooooh i know why I think its a read/monitor issue (not enough coffee) "Events.OnTick.Add(function()
LMSWindow:monitorChatFile()" So what I'm trying to do is monitor for new entries. Then send new entries to a chat window I made in single player but I want it to update as often as possible so I probably did OnTick, any suggestions for something close to real time that won't conflict?
ahhh that makes a lot of sense, thanks
would using something like this local checkInterval = 2000 prevent that or do you think I need to make the time between monitoring longer?
How do I test my mod? I've made my changes on my github and want to test it locally..'
C:\Users\YourUsername\Zomboid\mods
there sure be an example mod folder there to show you how to set up the structure if you have problems
dont forget to setup the mod.info file as well
then when you boot up pz it should populate with your mod to enable
if everyTenMinutes is too long a trick i've seen is have a counter added to OnTick and once that counter reaches the desired amount then add your function to OnTick removing it in the same function
I tried a work around checking os.date ontick until it hits my desired time. my latest issue is I have a problem reading from a file and displaying it in my custom chat window, I for the life of me can't figure it out. I'm pretty sure I made it work once in the media folder* I had it monitoring OnTick though and manually typed in the text file, but monitoring OnTick was blocking my reads if I remember correctly*. but I'm using another program to write to the file. So to avoid read/write/access issues I had to setup some form of delay before my event fired off.
So pretty much user types in text chat box, checks if its focused and when they press enter. it starts the on tick os.date pull till 15 seconds has passed to limit the use of ontick and also using monitoring on tick for changes in the file for similar issues (read/write/access). Then when it stops, it ends the EveryOneMinute and reads the txt file and puts it in the chat window.
been working on it for three days and everytime I get close something else breaks.
So if anyone has any suggestions I haven't tried i'd love to hear them!
I'm not sure what your issue is exactly. my suggestion would be to put a print() at certain points that will be easy to find and you can see what parts are working and what is not. I have not messed with the file reader but here is an example from a mod i have messed with that uses it. the .ini file it is reading exists in the mod inside the media folder.
local function readAirdropsPositions()
print("[Air Drop] Loading air drops positions...")
local fileReader = getFileReader("AirdropPositions.ini", true)
local lines = {}
local line = fileReader:readLine()
while line do
table.insert(lines, line)
line = fileReader:readLine()
end
fileReader:close()
airdropPositions = loadstring(table.concat(lines, "\n"))() or {}
print("[Air Drop] Positions loaded");
end
`function LMSWindow:readLastChatEntry()
local reader = getFileReader("C:/Users/thegl/Zomboid/mods/ChatLogger/media/chat.txt", true)
if not reader then return nil end
local lines = {}
local currentLine = reader:readLine()
while currentLine do
table.insert(lines, currentLine)
currentLine = reader:readLine()
end
reader:close()
if #lines == 0 then return nil end
-- Join multiple lines to form one chat entry
local lastEntry = table.concat(lines, "\n")
return lastEntry
end`
Thanks, mine is like this because of my crazy delay system I setup. Out of curiosity where did you have your "AirdroPositions.ini" file located at in the mod structure for it to read?
I tried saving to \media to write instead of the Lua folder (where I could) to see if it would read from there, but now I can't have my external program write there
I keep getting "Error saving response to chat file: [Errno 13] Permission denied: 'C:\Users\thegl\Zomboid\mods\ChatLogger\media"
it was in the mods media folder
Yeah I thought so, so you can write to Lua folders, but read from media :X
im actually not sure where the mod makes the files. I'm looking but it doesn't start with it i don't think, it makes it on game start i think
I'm wondering if there's no folder that has both read/write, but I figured my program outside of pz would have access to write, after all I can manually edit a .txt file in media and it let's me and works. So it's a bit confusing
so getfilereader will write a file there if it doesn't exist
not that that helps whatever program. i just thought thats neat lol
reaaaaaaally, thats interesting. I'm actually doing another python script just to write "hello world" to text files in different folders to test external write abilities.
it is
thank you again I might end up using it eventually ๐
hmmm my other python script worked... so i must have messed up formatting my directory on my other script lol
that's pretty cool. Probably how people have made things like streamer integration where chat can spawn enemies
yeaaaaaah i'm doing something sorta like that. I was working on a api to actually connect a AI LLM to PZ but it's a lot of work and a bit beyond my skill level right now. So my work around is I wrote a command prompt interface in python, my character uses the single player custom chat window to type in chat > then its saved to a log (was in Lua folders) and then the python script passes that to Koboldcpp and triggers a reply which should write back to a text file which gets read and sent to the custom chat window. This is just Part 1 of my crazy idea...
I was working on it and almost had it, but I was up for like 30 hours straight, erased my code by accident had to start over :X
oh no. rip in piece to all lost code everywhere ๐ซก . i like to think When something like that happens that i was just wrong and i'm doing it the right way this time
Yeah I had some bad file management that night and thought it was like version 17 and not version 20 of my code and deleted old versions and realized I deleted the good version lol... this is like day 4 for what I thought would be a one day project.
Oh jeez I forgot to put my .txt at the end of my path for saving on my other program haha it worked to media, now I just have to fix my code to pass it to the chat window... again
lack of sleep is great โ
Sooooo I tried your method of ("AirdropPositions.ini", true) with my chat.txt file... fixed my errors so that's nice... I just gotta get my logic straight now to pass it to the window.
So thank you โค๏ธ
no problem, also note that the boolean parameter in that function is what makes it make the file if it isn't there, if i'm reading it correctly
I premade the file, had the boolean already just in case i did something dumb like hmmm... delete it? Not that I would ever do something like that... ๐คช
Yeah, Im not very sure how functions work or how to properly name certain aspects to make it work properly
i guess go open write close on the same event call.. but thats heavy
Hi guys, got an inquiry, how do we define if a world object is thumpable (destroyable) or not? Im trying to
- make an admin-spawnable version that shouldnt be destroyable, and
- i want to adjust the health values of the non-admin version of the object im modding so they dont get destroyed quickly
if instanceof(obj, "IsoThumpable")
just saw this
guess you already did that
I swapped back to monitoring now that I realized one of my main issues was a save file path in my external program, still working on getting it to display in the window, cant remember how i did it a couple days ago
isnt this just checking if the item is IsoThumpable per se?
item? or object?
object sorry
thats what you asked. guns gave the right code
that's the opposite of what they asked lol

i already have the checker for isoThumpable for regular destroyable objects, however right now im figuring out how to make the object indestructible essentially
im not exactly sure how the code assigns IsoThumpable to objects i place, though im guessing thats the default behavior for player-placed objects
setThumpable?
usually it spawns the object with the properties assigned to the tile/sprite itself based on .tiles file
moveables are thumpables by default
ah
ohhh so its based on the tiles file?
you could probably try and mess around with the tile properties via tilezed or play around vanilla tiles using lua console debug
just to learn about it
it would still depend on how you spawn it
i see, im guessing if you spawned it as a tile directly its not thumpable, but if its obtained as an item then it would be?
you can spawnit and bypass the properties too . there lots of ways doing this
1 example would be spawn something else and then change its sprite
You know the worst part? when your tired, messing up, have debuggers running, no stack traces and it still doesn't work ๐
Instead of filereader you can try getFileInput(filename).
So something like this:
-- file path starts from %UserProfile%\zomboid\lua\
-- in this example: %UserProfile%\zomboid\lua\externalChat.txt
local file = getFileInput("externalChat.txt")
Events.OnTick.Add(function()
-- unexpected if file is nil
if not file then error("File is not defined.") return end
-- if nothing remains to be read, we don't need to do anything else
if not file:available() > 0 then return end
-- do whatever you want with it here, ex.:
print(file:readLine()); -- reads new line whenever a new line is added.
-- if using readLine, ensure ideally that every entry for the chat ends with a linebreak
-- otherwise you'll receive an empty string on the next addition
-- (so text + linebreak instead of linebreak + text)
end)
I appreciate it, im adding debugging statements to make sure im not sanitizing all my text accidently (thought I had enough debugging) but if thats not the issue I'll try that
Welp it took me like 4 days but thanks ya'll because I got the first half of my idea done. Gotta finetune the ai personality but this assistant persona was easier for testing.
some finetuning and polish but this part is almost done Thank you again everyone!
you're making an AI?
๐ mb
we'll see how motivated I am after taking this long to do this and I still have some cleaning up to do on it
wizardry
But a AI chat interface is a great start already.
no sh*t
I think im the first, its a crazy work around but making a API comparable to discord is... tedious
I started but i don't know enough.
wdym comparable to disc
and thank you, im going to smoke a bowl finally and like maybe play a game for the first time in a almost a week
Sooooooo discord's Api is pretty similar to what I accomplished but way better.
you mean like discord bots?
there's like an officially supported api where you can connect full discords servers to game servers
chat, death logs you name it pretty much
can i get a link?
i havent messed with discord stuff
im gona post the link on the mod tools thread
https://zomboid-javadoc.com/41.78/zombie/network/DiscordBot.html I didn't favorite anything when i found it but I found it in the class files and deep dived for like an hour
Javadoc Project Zomboid Modding API declaration: package: zombie.network, class: DiscordBot
you can open the classes and see the code, theres some websites that mention it, and old posts but I'd have to dig between the old ones before this and the newer ones
when i was digging through the classes they even coded their own color in servers ๐ that was cute
Because yeah I thought about running it through discord but honestly I wanted more functionality game wise if I expanded my little project here
thnx posted it
#1070858800501891172 message
great hopefully it helps someone, you can use JD-GUI to peek at the class files in zomboid if your curious
whats that? tho we have ways to decompile already
sure can you post it there too
JD Java Decompiler
If you have problems opening a class in a folder, copy one, paste it, rename it to a .java In the folder, open it with JD GUI and all the classes are accessible.
also this is helpful
https://theindiestone.com/forums/index.php?/topic/9799-key-code-reference/
Just thought I'd share this with everyone. Comes in handy when working with the OnKeyPressed event:
and if anyone is wondering the whole javadoc website is 107mb ๐
It's a decompiler for Java. I wouldn't recommend it for long-term viewing of the game's files, fernflower would do better justice
It's not bad for single-class decompilation to quickly check stuff though
item Drink
{
DisplayName = "Blue Fanta",
}
Why in game is it referred to as "Blue Fanta" and not Blue Fanta, im not really sure what type this if it doesnt treat "" as a string
remove the "
already posted on the mo resources i think
It is possible to get it to accept strings in the "" format, I want to use lua bytecode as the name for the item and have lua interpret it to kind of "hide" the name, like if you ran print("\101\120\97\109\112\108\101\95\115\116\114\105\110\103") it would print example_string and not the raw bytecode
i dont know anything about bytecode
hopefuly someone comes along and answer your question
thank you for help
that will surely print
\101..
wdym ?
A key to toggle on off foraging ?
yeah, it's "search" in the settings so i missed it
Hiya, I've got a question regarding tile definitions... what exactly does the blocksPlacement setting do? I've got something attached to the wall, but not noticed any placement blocking with other items, so I'm unsure what it does.
it is not possible
keep in mind that despite the name, pz's 'scripts' format is not a scripting language and it won't do anything intelligent
you may have some luck renaming the item from lua, but doing it through scripts is a dead end
you can place items i think
but its better to ask #mapping
i was wrong
you cant place anymore tile objects (not items)
Thanks for that.
any clue about what causes this error? i'm testing a recipe change for The Only Cure locally
Whenever I click on the crafting menu it throws an error and doesn'tdisplay
the result item of a recipe does not exist
the items do exist though, i havent' changed the result
really not sure what's causing the error here
...i was missing a comma
anyone have a suggestion of how I can check what tile a player right clicks on? want to make it so a context menu appears on specific tiles
You can add your own function to OnFillWorldObjectContextMenu lua event and check position of the worldItems it returns. It seems to return IsoObjects even when the square is empty
local function AddToContextMenu(playerIndex, context, worldItems, test)
for _, item in ipairs(worldItems) do
print(item:getX(), ", ", item:getY())
end
Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)
it is often recommended to grab the square from the first object in the list and then loop through that square's object list
Why that ?
the list it returns contains the first object it finds of a couple specific types, so many types of objects will simply never appear in it, and you often do actually want to find these duplicates (and if you don't then ignoring them is easy anyway)
Well the loop is kind of pointless in that case. I just copied it from my code (which actually uses it)
Oh I see what you mean. Is it faster to loop the items from the square even if that list already contains everything I want?
no, if the event's list works for you it's a bit faster that way
ok. thanks
so I would do this? trying to make a context menu pop up if there is a doghouse on the tile.
I would like to spawn a guitar that's hanging on the wall, but the procedural generation lua doesn't seem to be spawning any, as I've checked many, many houses. Is there something I'm missing? The items are attached to the wall, so I'm adding the items to the WallDecor list.
table.insert(ProceduralDistributions.list.WallDecor.junk.items, "HMW.AcousticBlack_Hanger");
table.insert(ProceduralDistributions.list.WallDecor.junk.items, 3000);
The number is high just for testing.
Should they go in the "junk" or normal list?
Any help is super appreciated
A guitar that's hanging on the wall ?
local function AddToContextMenu(playerIndex, context, worldItems, test)
local player = getSpecificPlayer(playerIndex)
if worldItems[1] ~= nil then
local square = worldItems[1]:getSquare()
local objects = square:getObjects()
for i = 0, objects:size() - 1 do
local obj = objects:get(i)
local properties = obj:getProperties()
if properties:Is("CustomName") and properties:Is("GroupName") then
if properties:Val("CustomName") == "House" and properties:Val("GroupName") == "Dog" then
context:addOptionOnTop("There is a doghouse", player, ClickedDogHouse)
end
end
end
end
end
Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)
local function ClickedDogHouse()
print("Clicked a Doghouse")
end
not sure if that is the optimal way, but it was the only way I could figure how to determine if the object was doghouse
Hi guys I'm new to the game only played about 2hrs can I play with some one to show me the ropes and have a but of crack with
holy shit thank you
np

My mod let's you hang guitars on the wall with a hanger, but I'd like for them to be generated on the walls around the map. I looked at how a posters mod did it, as it's pretty much doing the same thing.

ProceduralDistributions is loot spawn
Oh ok. Do you know how the game distributes vanilla items like the flags/posters/etc?
i would've guessed they're just part of the map
you'll want to add a function to the event LoadGridsquare, find a wall and make a new IsoObject on it. that is how most mods do it, then if you want guitars to spawn in them you'll add it to ProceduralDistributions
Hello a friend made a mod for Roleplayining systems (chat improvement, narrative in character improvement in game for MP matches based on roleplayining games)
same as sa-mp or san andreas multiplayer
/me command
/do command
/say improvement
ยฟHow can i upload this to Steamworkshop and share it?
there is an example mod in Users\username\Zomboid\Workshop. make a file structure with your mod like it. then start the game and click on the workshop button and it gives options to upload
Hey. I don't suppose having choices in a crafting recipe with different amounts is possible, right?
Like how recipes have MetalPipe/MetalBar=2 to do something like MetalPipe=1/MetalBar=2
to do more complex recipes like that i'd use OnTest and OnCreate. OnTest to check the contents of the inventory and see if they have the ingredients, then oncreate to do most of the recipe. The result needs to exist so you do an item from the recipe or if the options change the outcome then RemoveResultItem:true so the result doesn't matter and is handled in your oncreate function.
Gotcha, thank you. Works for me ๐
that won't work, those functions aren't really able to select ingredients - ontest just checks individual ingredients and oncanperform is checked before ingredients are even tested
if you want to do something like that unfortunately you just need to have multiple recipes - the game allows multiple recipes by the same name for this
https://steamcommunity.com/sharedfiles/filedetails/?id=3354283869&searchtext=zomboid+crossing it's finished! version 1, more to come soon
you are right. i was not remembering quite right. I believe i have used oncanperform to achieve something similar, though the actual required ingredients aren't visible
yeah, i guess you could implement that with oncanperform but it would display weirdly in the crafting menu
i can see why they're replacing the crafting system ๐
just adding some or's to the pz script would be pretty cool. I'm actually a little excited for the liquid system since i remember the mod i did a mixed recipe with was for mixing dye, and i think it sucked the way i had to do it
making sources mutually exclusive would be helpful too
if you have two sources that can take the same kind of item, one item can fulfill both sources
i think it would be fairly complex to implement that with the current way crafting works though
Thanks! I've got not idea what that would look like though ๐ฆ Any clues on what that would look like, or whereabouts in the vanilla code should I look? I feel like I've gone through most of it but can't figure it out...
hey, my code for an item mod just, isnt working?
would anyone be able to see if there is anything just, obvoisly wrong with my code?
module Base
{
item nanitetail
{
DisplayCategory = Junk,
Weight = 0.01,
Type = Normal,
DisplayName = nanite injector,
Icon = icon_nanite_tail,
WorldStaticModel = items_nanite_tail,
}
model nanitetail
{
mesh = nanite_tail,
texture = nanite_tail,
scale = 0.00015,
}
}
attached is all i see in game
first off https://pzwiki.net/wiki/LoadGridsquare
provides an example on how to add a function to the event
Thanks!
the square parameter passes the current square being loaded. square:getObjects() will return an array of all of the objects within. iterate through it keeping in mind it is an array and its index starts at 0. find a wall with the properties you want :getProperties():Is("WallN") then make a new object and add it to the square square:AddTileObject(IsoObject.new(square, spriteName, objectName, false)). i think i actually haven't added isoobjects directly just modified existing
my only assumption is the icon name is wrong and the mesh name is wrong at least. if your icons are stored in the textures folder then they need Item_ at the start of their name
yeah the icon works now
item doesnt appear still but ive got an idea
the model should just be nanitetail
the issue im having is that nothing shows up in game
module Base
{
item nanitetail
{
DisplayCategory = Junk,
Weight = 0.01,
Type = Normal,
DisplayName = nanite injector,
Icon = icon_nanite_tail,
WorldStaticModel = nanitetail,
}
model nanitetail
{
mesh = item_nanite_tail,
texture = item_nanite_tail,
scale = 0.00015,
}
}
current code
is the model named "item_nanite_tail"? and is it in models_X folder?
For the icon file, do you have Item_icon_nanite_tail?
Have you double checked the point where you export the fbx from? i.e. if you're using blender, making sure all the right boxes were checked?
I had a time where I didn't select the item I was exporting, so it didn't show in-game
i can do that
yeah there doesn't appear to be a mistake. i would guess try exporting the model again or even looking at that one to see if it is even there
the model should still appear if it was the texture, it would just have red/white checkers instead
The file is 36kb, which sounds right.
ah right, with vehicles it just wont show anything lol
are you restarting the game when checking this? i think models need to be loaded atleast when a game is started
yes i am
Have you added an item before and got it working, or is this 1st time?
i have in the past
try different scaling?
twice actually
i dont know how the game does it but i would assume if the scale is too different it would default to icon, i have made massive models before though
hmm okay
now it shows the icon and no model
yea a scaling issue could cause it to not show, I've had that where it was too big
Are you using blender to export to fbx?
๐
MIGHT be a bt large
It was there!
its got such an odd scale
try working on tiles. individual. pixels. very visible
I would look at the units you have the blender object using, and the scale of the item, and the scaling export settings...
that's at 0.00015 ingame scaling 
one of the few models i've done is at .000063
Yea, that is crazy. Have a look at scaling it properly inside blender, so that you don't need to adjust it that much in the code
nono that was at 1.0 lol
ah lol ok so that other one was too small
im fine with slowly adjusting
just need to try and find where it is at after eath tings
I find you need to change the export setting in blender to 0.01, even if the units and object scale is correct
atleast you figured it out ๐ . i always have issues getting models to show
yeah!!!!!
thanks!!!
this work is, slightly in vain because its gonna need to be a weapon in the future but it definatly helped me
making a murder drones weapon mod, which will probably have some non-weapons in it as eastereggs
It all adds to the experience gained and knowledge learned ๐
yes!!!! this!!!!!!
goated
perfect size
need to change some stuff but
thanks again!!!!!!
Pausing work until tomorrow btw
Tired
Gonna do the weapon stuff tomorrow
I'm having a bit of a weird issue. I have an itemname with a - in it. This seems fine in the txt file, but lua can't detect those. Any way around it aside from removing the -?
what do you mean lua can't detect them?
I have an array with a list of items
Base.Axe for example
It loops through the list and tags them. That works fine.
In that array I have an item called Base.Magazine-Flowers
That doesn't get picked up by the code. I noticed the same thing in the PZ item list viewer, typing a '-' doesn't make the items appear. Figured if it's being used as some kind of escape key?
i don't think there's meant to be any limitation like that but as a rule i would avoid internal names with weird characters in them
Yeah ๐ I'm trying to do something with an item from a mod, so I don't have much choice in the matter. Found a way around it, albeit not as performant.
what is it
Itโs the nanite injector-syringe thing from disassembly drones tails from the indie animated show murder drones
ive got the weapon part working but, ive noticed this happening
not ment to be angled like that
better pic
I have a problem with my True Music Addon. When I'm trying to publish it to the workshop it can't. I already checked what does result=9 means, but I think my mod structure is correct. I really don't know what to do, can anyone help me?
The mod itself
Close the game, remove the id from workshop.txt , save and start the game again and try again.
Aside of that, I'd have no clue either.
How might I be able to override restoring clothing with tailoring to require a recipe? I'm making a specialization-based recipe system (handed out by staff once players have declared a profession) for a server I'm currently developing and have no clue how to manage this, any ideas on at least where I find the action of restoring? A file path would be appreciated if you could figure one out.
It worked. Thank you a lot!
lua\client\ISUI\ISGarmentUI.lua - line 108 - function ISGarmentUI:doPatch(...)
huge props, I'll see what I can do with this
I've made a lua file for this, do I need to put anything in the mod.info file to require it?
I think I might be able to frankenstein this, do I need to define the recipe elsewhere so it operates on a recipe where it didn't before? The NeedtobeLearn parameter could work in making this require a recipe
if not thread or not needle or (not fabric1 and not fabric2 and not fabric3) then
local patchOption = context:addOption(getText("ContextMenu_Patch"));
patchOption.notAvailable = true;
local tooltip = ISInventoryPaneContextMenu.addToolTip();
tooltip.description = getText("ContextMenu_CantRepair");
patchOption.toolTip = tooltip;
return context;
end
I know base game code is formatted a little differently so figuring that out is my biggest issue rn
Oh also, how do i get the mod to override this file in specific?
I'm not new to programming but I'm really new to file interactivity and this perplexes me a bit
You can nicely have code display with three backticks, "lua", line break, code, three backticks. ex.:
```lua
print("Hello world")
```
print("Hello world")
```I think the learned recipes are actually just strings that're stored instead of definitely requiring a recipe for it.
So if you do want to just lock it behind something like that, you could check for that (untested, but worth a potential try):
```lua
if not self.chr:isRecipeKnown("ValidTailor") or not thread or not needle or (not fabric1 and not fabric2 and not fabric3) then
--...
end
I'll give it a shot, would I be able to just implement that into the mod alone or would I be doing a modified version of the ISGarmentsUI.lua file?
(The hello world is a check for functionality, right?)
OOH you were talking about displaying code in the discord, nevermind
lua print("Guh")
ok no I did it wrong lol
I think you could make a lua file in client with a custom name and patch the doContextMenu, then get the context it added for patching, and disable it if the recipe isn't known ๐ค forgot how the get context options again
lua right after the three backticks, then the linebreak!
I need to have it be a mod, wouldn't inserting it into the base code just make it apply for me?
DoContextMenu is definitely the right thing to edit though
yes, hence a custom lua file to make a "patch" for it in your mod.
local originalFunction = ISGarmentUI.doContextMenu
function ISGarmentUI:doContextMenu(...)
local context = originalFunction(self, ...) -- we run the original and get the context from it
local option = context:getOptionFromName(getText("ContextMenu_Patch"))
if not self.chr:isRecipeKnown("ValidTailor") then option.notAvailable = true; end
return context; -- return original return
end
I've been able to override base game recipe requirements but only for items
you''ll need to check though, it seems to add sub-options to it or with different text if it's actually valid, but it should be something along those lines.
I'll give it a shot
If you do want to check available methods and all for the context, lua\client\ISUI\ISContextMenu.lua
So you could also iterate the options instead of by name and check if part of the name is what you want (just be sure to utilize the getText, as it changes with language selected)
gotcha
I'm guessing I put this one in the lua folder instead of the scripts folder?
(Probably doesn't matter actually)
gotcha
Recipe still isn't required, guess I've some tweaking to do
does it need to be within a function itself?
probably not but maybe I fucked the formatting
Does anyone know if you make a custom lua file does it need to be referenced in the mod.info file?
I don't think so, it just needs to go in the lua folder. Info file is mostly for the mod displpaying properly in the in-game mods page
Ok kool beans. Thanks!
nah, doesn't.
My example likely doesn''t work as it adds other option(s) which're likely required to be disabled seperately if normally valid.
Hence the idea to just iterate them and check parts of their name for a match.
(Essentially the example likely just "disables" the main option, but not the suboptions which actually do the thing)
gotcha, I'll have to find out which others to override then
Oh that's right, I just have to find the one that returns true
Ok I've figured it out, I need to modify this line to have the requirement in it
tooltip.description = getText("IGUI_perks_Tailoring") .. " :" .. self.chr:getPerkLevel(Perks.Tailoring) .. " <LINE>" .. ISGarmentUI.ghs .. getText("Tooltip_FullyRestore");
else
tooltip.description = getText("IGUI_perks_Tailoring") .. " :" .. self.chr:getPerkLevel(Perks.Tailoring) .. " <LINE>" .. ISGarmentUI.ghs .. getText("Tooltip_ScratchDefense") .. " +" .. Clothing.getScratchDefenseFromItem(self.chr, fabric) .. " <LINE> " .. getText("Tooltip_BiteDefense") .. " +" .. Clothing.getBiteDefenseFromItem(self.chr, fabric);
end```
isn't that just for the description? ๐ค
It's so that the option pops up to be able to do it, with the description attached
could also make a similar "patch" to the doPatch function ( I reckon) and before returning disable the option in case the character doesn't have it? ๐ค
Or, potentially, not do the context menu function in the first place if requirements aren't met ๐ค
I mean, it's an if/else about whether the character has the ability to fully restore, and if they don't it gives them the option to patch instead. If I could add the isRecipeKnown("ValidTailor") line to the parameters it that would do exactly what I want it to
yes
making a dungeon mod and heres my idea
i used set skeleton to all zeds when player is inside the dungeon
they have random properties
and they reanimate forever and will have new set of properties
๐ค considering the fully restoring occurs in java, it might be easier to limit the perk level to 7 and below to prevent it then.
doesn't leveling people manually with admin override the skill limiter?
not really knowledgeable about xp and perk levels and such, so I can't comment much here.
But if the perk is above level 7, fully restoring will be an option
I feel like this is just a better option
But doing the change in lua would just change the description or disable patching in general
so yeah, probably best to somehow limit xp gain past level 7, but not entirely sure how to approach that.
me neither
Can anyone who's a whizz with custom lua files check my code please? It's to do with spawning wall objects on game load. It's not working, and the debug logs aren't showing...
feel free to dm me ๐
you just want the player to not be able to patch unless they've learned a recipe? i think this does that but it may need to go deeper into the context options idr i haven't modified the context menu a lot
local function OnFillInventoryObjectContextMenu(playerIndex, context, items)
local option = nil
option = context:getOptionFromName(getText("ContextMenu_Patch"))
if not player:isRecipeKnown("ValidTailor") and option then
option.notAvailable = true
end
end
Events.OnFillInventoryObjectContextMenu.Add(OnFillInventoryObjectContextMenu)
you can also modify the function from here by removing the option and then adding your own with
context:removeOptionByName(getText("ContextMenu_Patch"))
context:addOption(getText("ContextMenu_Patch"), player, --yourFunctionNameHere--, parameters passed after player up to 10 after this)
Iโm trying to specifically lock restoring clothing to the recipe, which complicates things
But if that canโt be done I could try implementing this and giving the tailors the magazine regardless of level
(Though non-tailors wonโt be happy with not being able to patch their clothing)
i do see the issue. looking at addpatch in java though i don't see anything so far that doesn't say you couldn't just copy it and rewrite it in lua, then replace the context option with yours instead.
Learned lua 2 days ago, kinda just been frankensteining until things work as intended without spitting errors
ah may be a bit much. Another thought i had was sending through false xp info somehow on the isocharacter
i doubt that would work though. or atleast it wouldn't be simple. i would think make a fake player send that through maybe use some event to steal from your fake characters inventory... or can you set 2 players inventory the same? and multiplayer doesn't like players having multiple selfs so idk how that would act
Hi guys
I'm having trouble with modding a timed action, getting an NPC to fill a water container, anyone know about this?
Are there any mods that fix the bug where you die instantly upon being bit if you've cured the infection once before?
what are you trying to build?
i believe theres a vanilla setting for that if you set it to to instant then the moment you get infected you die
can you post the snippets code here?
is this for SP?
Yes I'm trying to fix superb survivors
farming is completely broken right now
sorry dont have any exp with SP npcs
๐ซก
best of luck to you
local ItemString = exchangeList[maxEmptyContainer.getFullType()]
ISTimedActionQueue.add(ISTakeWaterAction:new(self.parent:Get(), self.parent:Get():getInventory():AddItem("Base.WaterPot"), 100, obj, 100, maxEmptyContainer))
I tried something like this it didn't crash but it always spawn a new water container
ISTimedActionQueue.add(ISTakeWaterAction:new(self.parent:Get(), maxEmptyContainer, 100, obj, 100, maxEmptyContainer))
if I do something like this it just outputs error
you want it to pick up the thing?
then remove it from the world
I want to fill an empty pot with water
and instead of using its fulltype use the item itself
getItem()
it's kind of painful because I think empty pots are not drainable and pots with water are
check out the vanilla time action as to how they refill water container
I have this maxEmptyContainer as item reference
Yeah I think I probably have to go through some examples and see if I have any luck
thanks man
When infection is on but you use mods like first aid expanded's Antizin to cure it, upon the next bite the player will instantly die since internally their infection stage hit maximum.
it's not something that's easy to fix on a global basis, it's not really a bug with the game, it's a bug with poorly made cure mods
gotcha, I'll check the mod's patches to see if antizin doesn't do that anymore
if the mod is actively developed then go complain about it because it takes literally one line of code to avoid
The last mention of the bug was over a year ago and they've made changes to antizin since so I gues we'll just have to see.
@long beacon spoiler: don't expect Braven to fix it
I'm sure I've seen that problem still be a thing
And Braven will not update it
What would I need to add to fix it? I'm already using a modified version of the mod for the server so I can just add it in on the antizin use code
Wait ok this code would imply that it works
since it resets infection level
I think it needs to reset infection time too ? Not sure
bodyDamage:setInfectionMortalityDuration(-1)
Or something like that
bodyDamage:setInfectionTime(-1)
OH 0 is the first stage of infection rather than no infection at all, I see
oh wait I misinterpreted that, fat-eyed it
should work now
should I set the rest to -1 for safe measure or will that fuck shit up
i'm gonna be honest i don't think the other lines even do anything LOL
Infection level might have to do with the antibodies mod
at the very least setting sickness doesn't do anything because sickness is calculated every frame based on some other factors
It's where I learned how to modify infection
infection level i think gets reset when you disable infection anyway
I'm not doing immunity, I'm having players require a cure, which will require a doctor with the custom recipe to make antizin
Already dealt with the whole recipes thing
Doesn't matter
It's the same shit
You want to remove infection
Immunity removes infection
Go check it out -_-
OH you're saying look at the code to see how it does it, my bad
Yes
yea
Bcs time keeps ticking down even when not infected
And the moment you get infected once more, the time is 0 and you're fucked
While if it's -1 it gives a timer
Is my guess at least
no, it's a timestamp
the game doesn't exactly accumulate infection, it just calculates what it should be based on how long ago you got infected
so if you don't reset it, as soon as you get infected again it thinks you've been infected since the first time you got infected and you're supposed to be dead already
I mean it's basically the same thing anyway
sure
while on the topic of infection
any ideas how to capture the last attack that infected the player inorder to prevent it?
like prevent bite
mostlikely based on the time it happened
i mean what is the default time when it inflicts the injury?
is it fixed? is it random?
What is this for? Canโt think of a mod where that would be necessary data, but you can make and use a timer function for when the zombie latches if youโre trying to take advantage of the moment between the latch and the bite
oh like for example special zed that dont bite
so any bite wound would be weird
or armor that cannot be scratched
so any scratch wound should be nullify
I mean, if you already have custom stuff for a special zed, using setNoTeeth should work, assuming this would actually prevent bite attacks, no clue.
ye i tried it but i think it didnt work or it auto sets back to false
forgot
ill look into it again when i need similiar function
have you tested that?
Nope, otherwise I'd have a clue instead.
was just a guess as I remembered that method from glancing over stuff

as for armor, I'd assume you could just give clothing ridiculous scratch defense? ๐ค (Never made clothing items, so... that'd need to be checked or answered by someone who did)
But I do think I've seen mentions of terribly unbalanced item mods quite some time back - unsure if it was for this part though or weapons... uncertain.
oh no not just scratch defense
like an active function
also the armor thing was just a spontanus example
maybe trait perhaps
if not armor
How to I make recipes give out a fraction of an item?
Like, 1/10th a jar of gunpowder?
Since I know some recipes can do it, see the thread drops from tailoring
function Recipe.OnCreate.RipClothing(items, result, player, selectedItem)
local item = items:get(0) -- assumes any tool comes after this in recipes.txt
-- either we come from clothingrecipesdefinitions or we simply check number of covered parts by the clothing and add
local materials = nil
local nbrOfCoveredParts = nil
local maxTime = 0 -- TODO: possibly allow recipe to call Lua function to get maxTime for actions
if ClothingRecipesDefinitions[item:getType()] then
local recipe = ClothingRecipesDefinitions[item:getType()]
materials = luautils.split(recipe.materials, ":");
maxTime = tonumber(materials[2]) * 20;
elseif ClothingRecipesDefinitions["FabricType"][item:getFabricType()] then
materials = {};
materials[1] = ClothingRecipesDefinitions["FabricType"][item:getFabricType()].material;
nbrOfCoveredParts = item:getNbrOfCoveredParts();
local minMaterial = 2;
local maxMaterial = nbrOfCoveredParts;
if nbrOfCoveredParts == 1 then
minMaterial = 1;
end
local nbr = ZombRand(minMaterial, maxMaterial + 1);
nbr = nbr + (player:getPerkLevel(Perks.Tailoring) / 2);
if nbr > nbrOfCoveredParts then
nbr = nbrOfCoveredParts;
end
materials[2] = nbr;
maxTime = nbrOfCoveredParts * 20;
else
error "Recipe.OnCreate.RipClothing"
end
for i=1,tonumber(materials[2]) do
local item2;
local dirty = false;
if instanceof(item, "Clothing") then
dirty = (ZombRand(100) <= item:getDirtyness()) or (ZombRand(100) <= item:getBloodlevel());
end
if not dirty then
item2 = InventoryItemFactory.CreateItem(materials[1]);
elseif getScriptManager():FindItem(materials[1] .. "Dirty") then
item2 = InventoryItemFactory.CreateItem(materials[1] .. "Dirty");
else
item2 = InventoryItemFactory.CreateItem(materials[1])
end
player:getInventory():AddItem(item2);
end
-- add thread sometimes, depending on tailoring level
if ZombRand(7) < player:getPerkLevel(Perks.Tailoring) + 1 then
local max = 2;
if nbrOfCoveredParts then
max = nbrOfCoveredParts;
if max > 6 then
max = 6;
end
end
max = ZombRand(2, max);
local thread = InventoryItemFactory.CreateItem("Base.Thread");
for i=1,10-max do
thread:Use();
end
player:getInventory():AddItem(thread);
player:getXp():AddXP(Perks.Tailoring, 1);
end
end
This is onCreateFunction that is used for ripping clothes, last one is for thing you asked.
huh
It seems to do literally nothing
Only place it's used is the getter and setter, nowhere else -_-
is there an easier way to just give units of an item instead of the whole thing?
i'd like to just make a recipe like this give less powder
like, 1 unit instead of one jar
Without lua? Most likely not. You need onCreate Function. The one i've pasted is an example, but if you just want it to for example always give 1/10 of jar, it can be simplified
Yeah, that's what I'm looking for
Just gotta figure out
- overrides
- fractions of items
- lua
Im no lua genius, but i'll try to help you with it
For overriding recipes i'm sure there was recently talk about it, you could search in here ctrl + f while i test lua thing
is there a way to override/remove an item's evolved recipe? (i want to override a base item that another mod modified, but the evolved recipes are still there)
wiki says I could do this
require "recipecode"
function Recipe.OnCreate.onegunpowderunit(items, result, player)
local gunpowder = InventoryItemFactory.CreateItem("Base.GunPowder");
gunpowder:setUsedDelta(0.1);
player:getInventory():AddItem(gunpowder);
end
create lua file in lua>server and paste it there, then
recipe Gather Gunpowder
{
Bullets38/Bullets44/Bullets45/Bullets9mm/556Bullets/308Bullets/223Bullets/ShotgunShells,
RemoveResultItem:true,
OnCreate:Recipe.OnCreate.onegunpowderunit,
Result:GunPowder,
Override:true,
Time:30.0,
}
It might work? Lua code does work
If you want it to be diffrent than single unit, change setUseDelta for other number
will this override the vanilla recipe?
I think it should? There is module thing but if youre using module Base, it should work. I haven't really overriden any recipe yet
so after the recipecode thing
do i just copy paste the recipe there?
like this?
I don't really fuss with lua, so I'm not 100% sure of anything
@tranquil kindle I think I messed up, I'm still getting full jars
oh wait, maybe i make that it's own recipe in the mod's recipe script
yeah nvm i have no clue what im doing here
Is there a way for InventoryItem to get the recipes of an item, i.e. what recipes use that item?
aight, perfect, thanks
put it in a text file, it's made a second recipe and it doesn't give any gunpowder
but it still executes the recipe
did you try crafting it?
i did, a few times
It uses removeresult=true so in this helper it might not show result, but lua code should give it to you
zero gunpowder given, but i have a feeling we're on the right track
oh my b
i forgot to remove the recipe from the lua

the bit supposed to go into text
a silly blunder on my end
i'll correct and try again
Is it lua file, or txt file opened in vscode?
i got both open in vs code
but yeah my mistake was initially putting both into a lua file
and forgetting to move the text half out after moving it to the text file
again, silly blunder on my end
lua now looks like this
and txt file?
modules?
but?
oh i see i see
i need to add base to the modules
so the override works
i think
should look like that yeah?
thanks for being oh so very patient with me btw
It would be easier if you'd show whole file, if its short
it's very not short
Like this screnshot doesn't tell me much 
part of a private edit of scrap guns, some balance choices i'm trying to make hinges on reducing how much gunpowder the vanilla gathering recipes give
Whats this?
module SGuns
module TW
module Base
scrap guns, the workshop, and hopefully base game
Never have i ever seen more than one module there
ah, see
It does work?
i was doing a mod tweak for a server
couldn't get smth with scrap weapons and SOMW to work
so a buddy of mine, he asks to give it a go
i go "fuck it, i cant do it"
so i send him the file
he tells me
"yeah i fixed the spears"
i ask how, and he shows me that
he just added the second module to it
and it worked
it would read from the other mod
I'm gonna be honest, i have no idea bout it. I don't really make tweaks to other mods so it "might" work?
the recipe is very functional
it just really really wants to co-exist with the vanilla one
so it makes that the one thing i gotta fix
Could you try making separate txt file with just module Base and put that recipe there?
I feel like other modules do mess with this
So new file with just that recipe might work?
you're so smart i should do that
something like this to start?
i saw the others have like "module_SGuns"
No, thats just name of file
module Base
{
recipe Gather Gunpowder
{ Bullets38/Bullets44/Bullets45/Bullets9mm/556Bullets/308Bullets/223Bullets/ShotgunShells,
RemoveResultItem:true,
OnCreate:Recipe.OnCreate.onegunpowderunit,
Result:GunPowder,
Override:true,
Time:30.0,
}
}
Thats all that you need in new txt file.
thank you so very much
it works
even though it'll be in an unlisted mod's change log, should the change be approved, you'll still get an added thanks
I'm looking for the file that defines what outfits zombies can spawn with in certain places. Does anybody here know where that is?
media>clothing>clothing.xml
I'm looking for a file that defines what GUID outfit can spawn in a location
Not the outfits themselves
Ty
media\lua\shared\NPCs >ZombiesZoneDefinition
Perfect thanks
but is it synced? like when you set it everyone else sets it too
no need to sendto server?
cuz if it is then i might find other use for it
not that way but importing multiple module works
You learn something new every day
ive done climate mods before but i forgot all about it
can someone confirm if this will work?
also i dont need it to be global,. actually i want it to be local only
Extend_PZD = Extend_PZD or {}
function Extend_PZD.SetAmbiance(bool)
if bool then
local ActiveAmbiance = SandboxVars.Extend_PZD.ActiveAmbiance or true
if ActiveAmbiance then
ImprovedFog.setColorR(0.150)
ImprovedFog.setColorG(0.150)
ImprovedFog.setColorB(0.700)
ImprovedFog.setBaseAlpha(0.950)
ImprovedFog.setRenderEveryXRow(1.000)
ImprovedFog.setRenderXRowsFromCenter(0.000)
ImprovedFog.setSecondLayerAlpha(0.300)
ImprovedFog.setTopAlphaHeight(0.510)
ImprovedFog.setBottomAlphaHeight(0.980)
ImprovedFog.setOctaves(6.000)
ImprovedFog.setAlphaCircleAlpha(0.000)
ImprovedFog.setAlphaCircleRad(1.650)
ImprovedFog.setMinXOffset(-20.000)
ImprovedFog.setMaxXOffset(20.000)
ImprovedFog.setMaxYOffset(-1.000)
ImprovedFog.setRenderOnlyOneRow(false)
ImprovedFog.setDrawDebugColors(false)
ImprovedFog.setRenderCurrentLayerOnly(false)
ImprovedFog.setEnableEditing(true)
ImprovedFog.setHighQuality(false)
ImprovedFog.setRenderEndOnly(false)
end
else
ImprovedFog.setEnableEditing(false)
end
Extend_PZD.isAmbianceActive = bool
end
cuz i fear that it wont work for non admins?
hi, i am looking at starting pz modding and just wanted to know if the game's modding capabilities support custom networking & sending packets between client and server?
I haven't been able to find any examples yet, so thought I'd ask here first
hi guys, where in the game files i can find the code for park ranger/lumberjack wood walk skill?
i looked at MainCreationMethods but didn't find anything
thanks, exactly what i was looking for. I guess the next question is how good are the networking capabilities - are there any limitations with just using those two methods?
you can't send commands directly between clients, if you need that you have to go client->server->client, and i think there's technically a max packet size of 1mb
you can't send objects, just basic lua types
eh that's no problem, seems pretty standard for multiplayer games. thanks
yeah, i don't find it very limiting at all
yeah seems alright from what you've told me. the goal is to see how easily NPC surivors can be networked with lua
so the problem with multiplayer npcs isn't networking, that should be possible, it's that they straight up refuse to render at all
interesting... so even if you spawn a IsoGameCharacter/IsoSurvivor or whatever the type is on all clients - they just don't render?
IsoPlayer is used, and yeah they just don't render
that's sad. do you know if there's a workaround for that?
I have seen the popular Bandits mod uses zombies instead of IsoPlayer but it seems too hacky
it's not something i've looked into myself but i know a lot of people have and nothing's come up
oh ok well looks like I'll be holding off on that idea then for now
what i do with that bro?? i'm not a modder, just started to learning about pz modding/programming some days ago
I think it's a PZ game data spreadsheet will all the profession/skill traits that you can modify, and the one you are looking for is somewhere on it.
Perhaps a better follow up question would be "I'm new to modding, can you help me read and understand that spreadsheet?"
if i remember right the movement speed through trees is hardcoded, it's applied somewhere in the java
it's done by setting an animation variable so you can *probably* do the same thing through lua if that's what you're trying to do
youre looking for the traits, i gave you a spreasheet with random tables and lists
and the traits are there too
first i am trying to figure out how the code that give the park ranger/lumberjack tree walk bonus looks like, then i was thinking in turn that bonus in a real trait because im using trait purchase system mod and that profession bonus doesn't seem to be considered a trait, also the marksman trait doesn't seem to work 100%(only foraging bonus seems to work) and i will want to modify that trait too in the future
i looked there but didn't find anything ๐ฆ
the problem is that i don't know exactly what i am looking for, i think albion gave me the first 'light' that i needed haha
anyways thx guys for trying to help
ayt
best of luck
Not sure. if fields are automatically synced then yes, otherwise no.
they are not
thats at javax or jre/jre64 folder?
zombie
if you want to change hardcoded Java you're gonna have to make a Java mod which is not as simple as lua
where i can learn that?
if you just want to add the effect i'm pretty sure it's been done with lua before
maybe i can do that with the professions framework mod?
๐ still needs some tweaking but my franken mod works. Thanks again ya'll.
Now I have someone else to blame when I die in PZ ๐ and I can argue with them haha
can you ask it to write code for pz? lol
Actually depending on which AI model I load yes and it could.
will you be able to control i
it
like come here
or ask
are you hungry
cuz if it has access to its own stats inventory moodles etc then damnnnn
So it uses someone elses NPC framework, I modifed a custom survivor template and made it my companion. I've been wanting to set it up so based on in game events it responds based on what's happening, but I havent done that yet.
i can zed spotted 3oclock then it rushes to defend at that position lol
So it does some of that stuff already, I just need to set it up to send the status of what's happening in game to make the AI aware and respond appropriately
but the NPC framework is pretty good already even without that
wizardry
work with slayers bandits mod that would be so cool
question!
would they be able to interact with themselves?
npc to npc
Yeah, I used PZNS for the Ai-framework which is like a triple modified version of nolan's survivors mod, then a template from someone who worked on PZNS to make a custom NPC, then a mod for cheats, stripped it down rebuilt the window for single player, made a python script to connect to it, made my own script to connect the AI and my character to the chat window and then downloaded the cosmetic mod for Ada Wong.
Cuz i didn't really need the cheats part just the window

The hardest part was getting the ai and my character to send text to the window after reading text files it was saving stuff too
I did the npc part in about 3 hours this morning (formatting issues with text still need to be done and a persona for Ada Wong needs fleshed out more) but no errors thank zombie jesus
and mind you I don't know Lua really so it was like me asking AI a thousand questions and using the knowledge I already had from modding to figure out what to add/modify.
So I used AI to make an AI mod, so I can argue with AI...
I doubt anyone would go to these lengths, but it really makes feel PZ less empty and I've always enjoyed ai companion mods in fallout 4 and skyrim so I was motivated I guess.
Sentient AI NPCs before build42
Yeah, well gotta work with what we got if we wanna have some fun before we get too old eh? ๐
True, if you're uploading it to the workshop can you drop the link here aswell? I've been running superb survivors, bandits npc and shortwave survivors in my playthrough atm
but this would take it to a whole new level
I would but since I've modified like 3 other mod's to make it including a python script running through windows command prompt im not sure how much people would appreciate that... so I'd have to include the python program as well too (don't know how I'd do that besides setting up an external link).
But if I get it fleshed out some more to where I think it's in a good clean state maybe I'd reach out to them and see if they mind. But knowing how long it takes for people to reply on steam workshop...
would be awsome if its mp compatible
i mean even more awsome
I've made stuff and had people re-distribute it without credit on there, so I know how that can feel.
I don't think survivor mods are sadly.
ye
That's why I had to make that silly chat window for single player
Bandits is but it's far less complex than the survivors mods
Yeah I got lucky I was crusing github last night and found that PZNS page for teaching people how to make custom NPC's for their mod and I was like THANK YOU because I looked at nolan and others code for NPC's and it's.... advanced
Something like 14,000 lines of code at least and just for a companion mod I'd have to figure out how to strip all the un-needed stuff out to make mine.
https://discord.com/channels/136501320340209664/1243139137561952316
i was making this
like a test at first
but when i saw slayers version i stopped
basically hacking the zed and turning them into npc by custom animation and behavior
but they cant do timed actions so its very limited
Sounds cool though.
I'd carry on with it tbh, the only thing that I have a gripe with concerning the survivor mods is their lack of sitting down when set to relax, they just wonder about opening and closing doors
If I had any coding knowledge at all I'd add some options to get them to read a book or just sit tf down and chill
oh i can force zeds to stay put
like what i did with psycho zed mod
but it was reported to be buggy so i stopped
They've always been that way tbh, but honestly I've always been happy that Nolan made the first mod. He doesn't get enough credit, mostly just annoyed and shat on.
The survivor mods are dope tbh, I don't think I'd still be playing without them
cuz theres no way for them to ignore target
only way for that is for player to ghostmode
or ignore is set
oh and setuseless
but like albion and burryaga mentioned setuseless can cause issues
Well you can tell survivors to stay but they dont sit or anything
the ones in this mod just stand still pretty much
i basically used the force eat corpse thing
but replaced the animation with the crying one
I've been playing since the tech demo/desura so yeah i'm a bit over waiting for npc's
I looked at the .class files and it looks like Nolan pretty much rebuilt zombie ai as NPC ai... when I saw what length he went too my apperciation went up tenfold
Yeah I bought it shortly after release, the reason I picked it back up was solely because of the current survivor mods
Yeah I really have been looking forward to NPC survivors for yeeeeeeeeears. So I feel like I finally got what I wanted now.
hey Nik, really sorry to bother you again, but it turns out things got a little bit more complicated
see, i gotta make the recipe compatible with firearms B41 revamped, and it doesn't quite seem to be working even after trying to override the recipes of the mod
What seems to be issue?
Gives full jars instead of the tenth jar
Up there's the edit I made trying to replicate how you did it with the vanilla recipe
the B41 Guns recipes don't have their own module, they seem to override base too
Correct me if im wrong, but isnt this mod making it so you don't have partial jars and instead makes it so "full jar" is actually 1 unit?
Uhh, I don't think so
I still have a few tenth full jars from testing
Gunpowder's unchanged, still has a delta total of 10
This file has all the recipes I'm trying to override (ignoring the non-gunpowder ones)
I'm not sure how you could override those recipes, if they share same name
if you want to override a recipe with multiple definitions you need to do it through lua
i see
if only i actually knew lua
but thank you regardless, now i know a place to start
turns out this is way harder to study than you'd think
does anybody know if there's any mods i can find with inspiration for this?
like, any that override a lot of recipes via lua?
I think the problem is just with this game's documentation, but if you ask chatGPT sometimes it gives reasonable response.
if you don't know how to write lua chatgpt will make your problems worse not better

like i just have to override 13 recipes with the same name
you can check vanilla lua file and overwrite them in your new mod
overriding Firearms B41 Revamped gather gunpowder recipe
i have a vanilla override that functions in text, courtesy of Nik
but it only works with vanilla, i need it to override the FB41R recipes too, but I've been told that's lua only
like this function right here, i just need them to do this instead of giving full jars
I haven't checked the mod so don't take my word for it but seems the gunpower jar you are using is a drainable item
it is, delta use total of 10
i want the recipes to give me a jar with one unit in it
have you refered to this API doc
https://projectzomboid.com/modding/zombie/inventory/types/DrainableComboItem.html
declaration: package: zombie.inventory.types, class: DrainableComboItem
maybe you could find an API that set the amount used?
like the lua code i posted moments ago?
yeah, that works
i just need to override the recipes
so they give me the gunpowder the way that lua code sets it
these ones here, all 13 "gather gunpowder" 's
sorry if I'm not understanding this correctly, are you trying to modify a code so it gives you a tenth of a jar instead of 1?
yes, that's what I'm trying to do
the lua adds a thing that gives me the tenth of a jar
try this```lua
local recipes = ScriptManager.instance:getAllRecipes()
for i = 0, recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getName() == "Gather Gunpowder" then
recipe:setRemoveResultItem(true)
recipe:setLuaCreate("Recipe.OnCreate.onegunpowderunit")
end
end
i now need to override the firearms b41 revamp recipes to use said lua function to give me a tenth of a jar when they're used instead of a full one
should i add that to this lua file, or make another file for it?
it doesn't matter, up to how you want to organise things
I suppose, if you just load your code after the B41
alright, i'll store them in the same file, since they're both for gunpowder
anyone have a good way using guard case?
it seems lua does not support goto with label
and no continue
so I see huge chunks of if everywhere
there's a weird thing you can do with a repeat to use break as a continue
coding with lua in PZ be like: 
for i = a, b do
repeat
if condition then break end -- acts as a continue for the for loop
until true
end
i don't personally like it though
You could pretty much just use this for the Firearms gunpowder
just put your oncreate in the recipe (however you manage to do that) and then it's pretty simple after that
i tried, it didn't quite work
again, apparently it has to be in lua, which i'll test soon
wait albion literally already showed ๐
I love it because it lets you not indent 500 times in a for loop
I tried local function, also works but seems bit confusing when you are looking for it
i'd definitely appreciate a continue but i don't like how this approach reads
it's not intuitive at all what it's doing from looking at it
true, the readability of it suffers
but imo not as much as having so many indents that your code goes off the ide lol
for some reason compiler does not accept this ::continue::
that's the main reason why I use them, kinda like returning early in a func instead of doing 20 if checks
that is lua 5.2
zomboid uses 5.1
๐คท
woot almost done! i just need to configure the cooldown and the treasure chest then my dungeon maker mod is complete...whew.. tookme almost a week for this one
that ui looks good ๐
it changes color based on the mode
if youre overwriting , adding, deleting
first time adding texture icons to panel
i thought it was hard
im still not used to the sizes . buttons auto change width
i think theres a property to set that off somewhere..
that is soooo true omg but there are modders who are so good with it... wizardry...
THANK YOU
all i need to do now is make the vanilla recipe disappear
which i think i can do with obsolete:true
after that, it's all good
hey anyone here know where electronic stuff are stored?
trying to make one of the items in my mod scrapable
dungeon maker mod? you've sparked my curiosity.
and yeah i like the ui colors too
How do I actually upload my mod to the workshop?
Here's the file path
Don't you have to make the ID the first folder, then the folder with the separate mods in it after that
Zomboid\Workshop\MyMod (etc)
It doesn't follow the same path as the Steam workshop content folder
also it should be MyMod/Contents/mods/
^ true
GOD FUCKING DAMNIT
WHY PZ DEVS WHY
?
.x files
cause they like the x factor.
-# Sorry... I know my jokes are bad....
๐ญ
Itโs just like 100000 year old files
Itโs okay I did what I needed
Hi guys. Whats the code for Cooking Level requirement in a recipe?
I think its SkillRequired:Cooking=X but I just want to be sure
Iโm gonna me learning recipe tomorrow:3
(sorry for unhelpful comment)
please tell me, recently my Umbrella addon for VS code stopped working. Having looked into the problem in more detail, I discovered that a different storage location is being written in new folders, please tell me how to fix this problem so that the correct path to the folder is automatically written. When manually replacing the path, the addon works as it should again
Is there a way for InventoryItem to get the recipes of an item, i.e. what recipes use that item?
you might want to ping albion
I think you can get a list of recipes that you can craft with RecipeManager.getUniqueRecipeItems(item, player, ArrayList<ItemContainer>)
But for getting all recipes that involves said item, regardless of whether or not you can craft it currently, I think you'd have to loop through all recipes yourself.
thanks
So I finally got Ada to stay in character with her responses, thankfully. I think my next step is situational awareness now that the AI is staying in character. Inventory info, zombies approaching, getting attacked, etc., I sent her a message indicating we were in muldraugh, ky and she rolled with it which is good. She also has access to conversational history so that should help. I don't think these NPC's eat or drink with this framework which is a bit odd... at least she hasn't yet.
Colby: Hey Ada, My Name is Colby. What are you doing in Muldraugh Kentucky during this new zombie outbreak?
Ada Wong: Hello Colby, I'm here to investigate the cause of the outbreak and find a way to contain it. As an agent of the Umbrella Corporation, I'm well-equipped to handle such situations. How can I assist you?
Colby: Probably a good thing we ran into each out lets team up and take out these zombies.
Ada Wong: That sounds like a plan, Colby. Let's work together to eliminate the threat and find a way to stop the outbreak.
Agh, the RE vibes are real ๐
Sadly she doesn't know what happened to Leon after Raccoon City though :x
so you have like instructions set it reads? im very curious how you manage to pull this off
you cant use this for mp cuz of the npc framework right?
so it means its still possible to use for mp as long as theres a framework?
Like I said I don't think any of these work with MP
so its possible to make your own player do auto pilot
or atleast talk by itself right?
ahh ok i thought its cuz of the npc framework
misunderstood that
but yeah I'd copy paste what it sends to the AI but its so long here's a screenshot of the text (im actually coding in a summarization feature for the AI so it reduces the text sent since each model has a context limit)
So every time it sends: AI settings to control how it responds (all AI programs to chat have this), the persona of Ada Wong (to keep her in character), The conversational history (to remind her of whats happened).
Well that's what my chat window in singleplayer is for, to send messages to my program to relay it to the AI then the AI sends it to my program to relay it to chat/text bubble above their head.
So my character doesn't automatically talk to her, it requires user input
But yeah the NPC framework is required for this all to run. That's the part that doesn't like MP
If I had more time or knowledge I could strip it all down remove all the other NPC's and features and then maybe it would work, but that would be weird because it would only work for 1 NPC
so each person would need to run the AI on their pc, my python script and then get all of that to sync on PZ MP which lets be honest... isn't the greatest at syncing even after the multiplayer rework of the code.
Itโs a dream of mine with the Expand Helicopter Events mod, in the scenario where the helicopter can shoot at the player, I can change the sound effects to add the ones from GTA San Andreas, specifically add in the helicopter quotes.
Is there a tool available where I can extract the audio from PZ and swap it out with other sounds?
ahh i get it so thats why it wont work with mp cuz it needs the 3rd party app you made
No its because the pzns framework and (npc mod) is needed for this to work
that doesnt support mp
use lua instead
detect the sound stop it then play a other sound
thats what im saying earlier
so my question was
if you use different framework it can work mp
(tho i know theres no such framework)
Well yeah, but why would you want too, you'd be the only one able to really use it on MP
what I mean is, the AI is hosted locally on your pc, when you interact with it, its sent by your pc, so others wouldnt be able to interact with it like you could. If you allowed server chat too, it would be replying to every message and pretty much overloading it trying to respond to each at the same time and your GPU would be like ๐ฅ
you could but you still have to factor in sync issues
and the likelyhood people are going to run their own AI each... when most can barely run PZ...
Like it would be cool if each npc had a dedicated AI but that would cost a lot of money in cloud ai hosting for each one.
if you could change its output or capture its output to string locally you can send the string to server
or use global chat
which is why one companion seems reasonable
thats also something possible
thats what i meant earlier but then every message people send in chat would force the ai to reply
like a server would have 1 pc online all the time
confusing multi turn conversations
so thats the one that does the chat
its a player but still
if they want to right
AI isn't really great at juggling multiple convos with different people at once
hmmm right
which is why i said each person would need an ai for each npc
otherwise it would literally probably crash or drive the temp of your GPU through the roof
how exactly did you send the strings from your app to the game?
how does the game recieve it?
you mentioned discord and python
im super curious
It's not like in MMO's where multiple people can trigger interactions with an NPC concurrently at the same time and all get different responses
So every text input is extracted out the game, run through an AI chat model and the response is imported in real time?
was just curious
cuz this could potentially branch out to something new
So in order for anyone else to use it they'd need to setup the AI model on their machine?
it doesnt use discord that was an option I explored. So it works like this: You run a AI model loading program (mine specifically uses one called Koboldcpp), it has a endpoint (url/IP address with a port) that my python program connects too. It takes the response trims and formats it to save to a text file in the zomboid directory. Then my mod sends it to the custom chat window.
My mod then takes user input from the chat window, sends it to the python program after saving the chat window text to a text file also in the Zomboid directory, which formats it if needed and sends it to Koboldcpp. This triggers a response that causes the AI to send the response to be processed and to the chat using my python program as explained above.
They could technically use it but it'd have to configured for the actual MP chat window, and if 2 people talk to it at the same time you'd get a very confusing reply.
brilliant
wizardry
yeah so its a delicate process and you have to have an understanding of AI limitations to get it to not break if that makes sense
thats fine
Like if i started talking to it suggesting its not Ada Wong that could be done, if I ask it about raiding the PD and another person talks to it about raiding the diner, it could offer conflicting answers while replying to the wrong person even
even if it replies with symbol
i mean as long as it interacts for now it can lead to other potential project
So symbols can seriously mess it up too
I actually have filters set in place for whats called sanitizing it, because some symbols and puncuation and even spaces can break it in chat.
if it has the potential to trigger lua function then the possibilities are endless
That part is possible, which is sort of how it functions right now just in ways that aren't visible
what im saying is
it can be used not just for conversation
it can evolve into something else entirely
So for example sending inventory info, and situational awareness (the pzns mod has custom dialogue that can be enabled if events in game happens) if I plug into this and how those Lua files trigger the dialogue responses but use them to send info to the AI so it can respond accordingly, then it could influence the NPC in game based on keyword triggers or code in my python program to send triggers to an lua file. either and/or both maybe.
But this requires a good understanding of PZ's system, code, the pzns lua code, etc.
much less Lua and python.
I mean technically nothing is impossible, there's always a work around, but when you involve other people and multiplayer that's a bit too many factors to work in without undesired results/behavior happening
is there a public repo?
Not yet, like I said I'd have to get permission from PZNS and if i specifically use the Ada NPC template, the guy who did that and then the person who did the Ada cosmetic (all different people) oh and the Chat window I stripped from a cheat mod and modified.
So that's like 4 people.
and with b42 coming up promising to break all mods, chances are all 4 of these people won't update theirs so .... it'll probably be broken by then anyways
it can be polished
esp if theres a community interested in developing it
and for me this is the first project i saw that i believe would have serious impact not just for sp
but for
management
lore
quests
assistant
auto pilot
unique boss
randomized scenario
npc
radio station
unique challenges
boss battle
100% unique weapons and items
ambiance
etc
theres alot that can be done i believe
if it can control a player account then omg
agreed, but again b42 might break everything I need to make this work. This is a work around technically. If there was an actual API network connection for PZ this would be more flawless for those things you mention. I started on one, but its beyond my Lua/Python abilities. I have a good understanding of Networking but it's a huge undertaking on top of all the AI/NPC related stuff.
yeah most likely
That's why I mentioned Discord, because I believe PZ made something similar for discord bots to connect.
So using that as a template for how, much like how nolan used zombie ai as a template for survivor npc's is possible
Discord has a rate limiter for bots, so if you've got an AI interacting with multiple users through it then it'll throttle
oh and server economy hell yeah thats something that the ai could do
basically only run it using admin pc and only when manually setting up shop
that will give dynamic prices but with real life data
Using one ai to interact with multiple people concurrently isnt even possible
yeah but still
like i mentioned even just 1 ai
that has admin controls
for simple task that needs calculations
Another way of connecting it and triggering events in game is to give it rcon access through the server console, that was my backup idea.
^
The lua extension of VSCode broke stuff recently, you have to manually modify the path or some shit like that I don't remember
@bronze yoke can explain it better
hell yeah thats gona be fire
Can you not limit it to one player interaction at a time, so it's reserved for one player for a set time before accepting requests from another?
But again I'm one person half assing python, lua and duct taping this all together soooooo....
You could but you'd have to code in a queue system which is another issue
The moment someone drops a decent LLM that can run locally, NPC mods are going to be fire
yeah you could probably do that via lua using the mod that connects to it
say maybe a cooldown or an item is required
plus you'd need someone hosting the ai whether its cloud based or local pc for someone and cloud costs money per tokens/ (amount of words)
Or don't, with local LLM
I am running locally
yeah there are servers outthere would be willing to spend for such feature im sure
I meant as each users run it locally, not on a cloud or anything
thats what i mean its possible
each person techically could run it locally and play mp and each have a AI companion
the problem is network sync mainly
because you cant drive cars without teleporting lol
That's always an important issue, but you can definitely do something about that
much less ai's walking and chatting
Each user would have to but would you not run into a performance hit with multiple AI NPCs, I'm guessing it would have to be limited to one to be viable?
Well that's more of a mod issue with survivor npc's
most of them all run on OnTick
and framerates vary alot too sooooo
good luck calculating that, even using deltas
the actual AI side of it wouldnt be the main issue most of it is the NPC mod part
What you can do is:
- users asks AI for something
- send a call to the server, servers tags this NPC has been talked to and sends back to original author to ask the AI for his prompt
- if another player does the same for the same NPC, the NPC is tagged as been talked to, and call is denied
But each AI would also need access to the server which creates a server security issue as well too otherwise no one would see anything happening and it would all be client side
I did something similar recently, tho not exactly, to scan for players being infected as each info don't know the other players are infected
This is one reason why for my purposes doing this alone single player was more practical
Also the python program to manage each AI requests to the server and back as a middle man would have to be extensive to manage concurrent requests to multiple users/ multiple ai's
So think how difficult it is to mod an NPC survivor mod (most just stole code from nolan and built on it) now imagine doing all this other stuff
There's a reason why skyrim's herika mod and fallout 4's mantella mod has a group of 10-12 plus people contributing different aspects
and that's still single player LOL
Believe me, everything is easier in SP to mod
Yeah factoring in multiplayer is honestly a head ache waiting to happen from so many angles
A lot of planning helps.
Bust out the UMLs.
Slayer with his Bandits mod is the best one out there, zombies were always the best go to for this kind of thing
Yup, it's been the main reason why my work on my TLOU Infected mod has been staling
you'd need to pretty much build a custom npc survivor system, a bigger python program, extensive understanding of pz code, events, netcode and networking and that's all just to start. You'd also need someone to work on the Api connection side.
Python + NPCs? :o
Well the middle man program i use is python
because you need something to communicate between the LLM model loading program and PZ
I didn't rewrite the event-access part of Pythoid but tis a thing.
the Api connection would alleviate some of that
You don't have much in networking to go with tbf, just PZ uses commands to do calls in-between server client
I'm sure your LLM runs in Python 3.
I made a mod to PZ that hooks up Jython, a Python 2 engine inside of the JVM to PZ as a full modding platform.
You'd have to create a Api for a model loading program like oobabooga's Text Gen WebUi or Koboldcpp to connect directly too, which requires you to know pz netcode, pz code
I've mentioned Jython to another person that was doing exactly that, NPC with AI
What are those for ?
running the llm
Then that's not a local LLM ?
It's available to whoever wants to use it. The typings are also there for people to see the runtime environment of PZ as well.
it is
I run koboldcpp locally on my pc
it connects to my python script which middleman's the responses to and from to pz because of a lack of api connection to open ai endpoints
Can you not fully run a LLM directly from Python ?
these programs are designed usually in python
That's what I'm thinking about tbf
