#mod_development
1 messages Β· Page 255 of 1
oh, change character:getBodyDamage() to player:getBodyDamage()
OHHHH I'm dumb I was wondering why that part wasn't the right color
WOOO!
That did it
The infection is waterborne
im so confused its literally just a regular png file at 256x256
Send the file ?
Open it in paint, copy the image and create a new file with the image
Perhaps you used a weird old file or idk
this is after i did just that though is the thing
in an attempt to fix it
actually the entire mod i made isnt working wtf maybe i messed somethin upπ
Wrong folder order
probably
is this a roblox character?
yeah lol
is there something up with the anthro survivors mod making tool?
hey, when its necessary to import base in base?
never
hmm. i saw it quite a lot in mods
wait are you the player shop albion? patching that mod rn lol. i like it but doesnt work out of box π¦
what's wrong with it? it was a commission so i haven't touched it in a while
buy orders are broken, there is flipped (<) comparsion for price chcecs, after i fixed that, when i sell to shop, whatever is the price, i get 1 dollar. Then if you pickup the shop, it cant be locked again, so i added context menu locking without need of padlock. also it can be sledged and dismantled
yeah, the server that commissioned the mod already had security systems for stuff like that in place
the first few things are new to me though
are you using Base.Money or whatever? the server used their own money mod too which had a bunch of different denominations so that was the only way i tested it
i use immersive currency, but money are still items in stack.
i think this loops only once, but i didnt dive into it yet
local items = self.container:FindAndReturn(SandboxVars.PlayerShops.CurrencyItem, price)
for i = 0, items:size() - 1 do
local item = items:get(i)
self.container:Remove(item)
self.container:removeItemOnServer(item)
inventory:AddItem(item)
end
not sure if price is set to 1 or method return only 1 item
hmm, weird to return an arraylist with just one item in it
FindAndReturn is a weird method name, i wonder if i should've used getSomeType instead
nope, FindAndReturn is just a wrapper around that anyway
maybe price is set wrong, i didnt debug yet. also i made the window smaller so people with extra text and ui scale can see whole thing
if u have it in git i can make PR with fixes once im done
i'd appreciate that, it's on github here https://github.com/demiurgeQuantified/player-shops/
ok, should be finished and tested during the week
it's in the decompiled java code
Hello, first of all, I'm starting the program and I wanted to go straight to the mods, how did I start the program, what folders should I create? Another thing my goal with the mod is to make it span some stone when using the pickaxe it drops stone and other things that will be used for the benches I'm going to create, can you help me at the beginning?
any way to add a completely new translation file to the menu? and also any way to only apply that translation when picking a specific trait?
Translator:setLanguage(Languages:getByName("")) and then you might need to Translator:loadFiles()
I never modded for PZ before, right now i am trying to add compatibility for a mod with another mod named Customizable Containers, however i don't know where to start. Any advice?
as is usual, start with looking at its source code
Sadly i cannot find it because of no obvious github. And if it is possible to get it just from the workshop, i do not know how.
All normal mods can be just browsed into. And if it's a java mod, you can decompile it.
Will try thanks
hi, any idea why this wouldnt work? what im trying to do is to integrate build menu glasswork with kentucky car overhaul mod. its lots of parts so i made list and some script to generate the file but it seems like zomboid is refusing to load it. Is it because of the recipe name is same as item? filesize (71kb)? tabs? this mod is loaded last
is there a way to check if the user is in the main menu or inside the game? other than listening for OnMainMenuEnter and OnGameStart? in other words can I retrieve that information at any time without using events or manual state keeping?
declaration: package: zombie.gameStates, class: GameStateMachine
is that even exposed
If it's in the documentation, it's very likely
ooh that might do if it's accessible in lua. I see MainScreenState and IngameState as classes inheriting GameState
ye
You can access fields
how, I thought they werent exposed from people saying that ;-;
idk why tf Albion would tell that without saying you can in fact access them
I just use her mod, which makes them accessible very easily
oh ik that
But can you just write JavaClass.field in lua?
without using her mod*
I don't know the detail but yes
Ofc her mod is not mandatory
But you can easily access the fields with like getPlayer().field
Let's say I want to access isSpeek from player
local isSpeek = getPlayer().isSpeek

huh
With her mod
you can't, that's what the mod does
so they're exposed but you cant access them via . notation?
only with the mod you can use dot
Yes that's what I said
i wouldn't say they're exposed at all, the exposer never touches them (except public static fields)
it's just that the game exposes a wrapper around some java field reflection stuff for debug purposes
accessible fields just twists around the syntax so it isn't absolutely insane to use (and to my knowledge runs better than any similar mod)
I use it constantly but haven't exactly verified its performance impact
it preprocesses all fields as early as it can to save performance as much as possible
wait so it's only possible because of this^ ?
yeah
java field accesses are still a method call so they are more expensive than the syntax might imply but still not tremendously
wat is the syntax to access them??
like original syntax without mod
just curiosity, I don't actually plan on using the raw syntax will just depend on your mod where necessary
Hello, first of all, I'm starting the program and I wanted to go straight to the mods, how did I start the program, what folders should I create? Another thing my goal with the mod is to make it span some stone when using the pickaxe it drops stone and other things that will be used for the benches I'm going to create, can you help me at the beginning?
is this translated? if not, please rewrite this I cannot understand anything
im big dumb
He means he's starting to code and he wants to learn how to make a PZ mod, the folder structure for example. He wants to make a mod where you spawn rocks by using a pickaxe but wants to expand that to other features like branches
ooo
well I'd recommend you look at the pzwiki for mod structure, https://pzwiki.net/wiki/Mod_structure
It really depends the way you want to go with this and what exactly you want to do. Do you want to break a rock tile to get stone ?
pzwiki saves me every single time
Or just use a pickaxe and poof it pops stone out of fin air ?
something like:```lua
for i = 0, getNumClassFields(obj) - 1 do
local field = getClassField(obj, i)
if string.match(tostring(field), "([^%.]+)$") == fieldName then
return getClassFieldVal(obj, field)
end
end
I can see why you created the mod now
I want you to find some stones in the forest and when you go there with a pickaxe you can go and it will drop x amount of stone and other ores@bright fog
Actually there's a mod that does that
I believe ?
There's a few mining mods
That one is the one I find the best bcs it doesn't require map modifications for ore nodes
As it's simply about finding items with the search mode
Also why the heck does this not work:
local tbl = {}
tbl.subtbl.mykey = "hello"
--- Expectation: tbl = { subtbl = { mykey = "hello" } }
--- Reality: tbl = {}, error on second line
subtbl is not a table
like this has caused more problems for me because I type this on instinct
yes, but why does it not allow assignment like that
can it not infer that subtbl has to be a table if there is a key being defined inside of it?
Because this doesn't work either:
tbl.mykey = "hello"
if tbl is not defined as a table
That's the exact same thing
No, pretty sure that could cause problems
i feel this would cause more problems than it would solve
Yeah
hmm maybe im just lazy lol
I hate having to define all my table subtables before I actually assign anything in them* like:
local tbl = {
subtbl1 = {},
subtbl2 = {},
subtbl3 = {},
subtbl4 = {},
-- ...
}
or
local tbl = {}
tbl.subtbl1 = {}
tbl.subtbl2 = {}
tbl.subtbl3 = {}
tbl.subtbl4 = {}
local tbl = {}
tbl.subtbl = "hello"
-- does subtbl become a table now? reassigning keys does work that way so it would be inconsistent if it didn't, but probably annoying if it did
tbl.subtbl.mykey = "hello"
-- no error or ide warning because this is completely valid, but obviously the user wanted to add to subtbl and not create a new table
tbl.Subtbl.mykey = "hello2"
print(tbl.anothertbl.mykey) -- error or nil?
true
i'm so confused
what about?
about what all of that is about
btw it's an example using my thought process before
like showing why it is a bad idea
well, if you wanted to see an example of what happens when you take "execute implicit operations if that's what necessary to make the code work" as a principle, you can look at the whole clusterfuck of JS
and much moreso HTML and CSS
there's so much egregious crap added purely for the sake of making even badly composed code work, or at least not crash
something like 99.9% of websites, including the major ones, are not W3C compliant, and that compliance already includes astronomical amount of silent fixing of user errors
it's like GPU drivers shipping fixes and optimizations for AAA games shaders because they release broken and slow, but turbocharged, and I mean really
because at least AAA devs are competent coders, websites are made by people who can barely follow a youtube tutorial
though that's enabled by web browsers fixing their errors so that's kind of a positive feedback loop. But that's enough rambling for today.
does zomboid not like mp3 files for sound effects?
i'm looking at another mod for reference and im seeing that its using .ogg
i'd rather know before i start testing it
I don't think so, I know ogg is the standard for the game
where can i find a list of applicable eattypes?
Would it be possible to add a new fishing rod item that will modify the line break chance?
You can literally make a for loop of that
theres no way im wasting a for loop for all my tables that have subtables
I'll stick with the annoyance and just use #region like in C++ to collapse them
Yeah I have that thing too
Tbf idk what you're achieving with your code
But the table within a table is a thing I do a lot and I don't have any problems with that
Tho I dynamically define them
also if im resetting the infection timer in the code, what should i do?
like the player is still infected but the timer is reset
not sure how to send code blocks in discord
I used "They Knew" as a guide for that stuff.
use `
or 3 of them to make a block
I feel like that was how much "damage" was being dealt but I would have to dig it back up. I think I used that in my "fake" cure code to kill them in 30 seconds if they didnt have a real cure on hand.
if playerdata.ZomboxycyclineHours > 0 and playerdata.unprotectedinfection == false and infectionStatus then
local bodyParts = playerBody:getBodyParts();
if playerBody:IsInfected() == true then
playerBody:setInfectionLevel(1)
end
end
haven't changed the names of stuff yet, theres alot of commented out code
this is pretty much my first time ever messing with lua code in zomboid
theres a whole lot of useful functions but i dont know more than a few
I'm a rookie also. I just poke a it with a stick and hope for the best.
jolly
Im just crossing my fingers a fishing rod mod isnt java like generator code ; ; Lua I can explore at least.
i know a decent bit of lua from roblox coding
but roblox coding =/= zomboid coding since iirc roblox uses a unique kind of lua
found out why one of my errors was happening, i forgot to add commas in the items script
does the "IS" prefix for many of the file names stand for Indie Stone?
Small tip, you can put in lua code block by writing lua after the three first `
thanks
how do you set how long it takes to use something
is there any way to make a zombie perform a custom animation? I dont mean in the way of replacing one, but i want to add stun animations to zombies that are being electrocuted by whatever means. im new to zomboid lua scripting, but it seems like zombies are too hardcoded to do anything fancy :/
I'm working on an improved version of a computer mod I previously did for my life RP server https://i.gyazo.com/d61999528739b3118db6f6d4e2f546db.jpg
Can you play doom 2 on it?
#mod_development message it was the encoding of genarated file (utf16) π¬
not so lore friendly, but nice
True. We're only semi-serious with our own developing lore that progresses through time, so we're not too strict about things
pretty cool man, you guys have a nice server too iβve checked it out recently
anyone know if they have eat times in the game files? canβt find em
Durations are probably connected to ISEatFoodAction if I remember the name right
I would investigate what determines the length of that action
Can anyone drop some guides for modding zomboid? All I can find is videos on how to download mods
thanks bro ill remember this for future reference. i ended up just doing a stopwatch on my phone lmfao
got the same exact time like 3 times so i figured that'll work
It really depends on what kind of mod you want to make but if you check the threads of this channel, you'll find Modding Resources.
I wanna start with something simple, any recommendations?
Traits are easy, and I wrote a trait mod tutorial. https://steamcommunity.com/sharedfiles/filedetails/?id=2929985581
This workshop item links to a repo
The repo explains how to set up the mod and submit it to workshop
And has the code with lots of comments
If you wanted to make an item I think there's a nuka cola video tutorial on YouTube.
Oh yeah I saw that. I saved it to my watch later
I think it's still 99-100% correct
I don't think game has fundamentally changed since that video in any ways that would matter
K
Reading other people's mods is among the best ways to learn
Iβd love to get into map making too. Is that super difficult or?
Just time consuming afaik but I'm not a mapper
K
Alright. I do have a good bit of time on my hand cuz Iβm gonna be moving in a bit so not gonna be in school for a while
Well I say go for it. The people in mapping will surely point you the right directions
it's super tedious more than anything. You'd be surprised what sheer amount of menial labor goes into making a map like rosewood.
with lua, can I change a field in a IsoGameCharacter if it doesn't have a setter?
You can't
darn... as a followup, is there any way I can change bDead or rez a dead player via lua?
oh wait I can with setOnDeathDone
I realize that's probably not the right thing to rez though
Trying to use Fmod bank tools to repack the bank files for audio modding but it gets stuck on building fmod bank files
Anyone know whats wrong?
ok, imma be real with you my idea for my complete overhaul mod is gonna be crazy
imma be real with you nobody likes complete overhauls π
imma be real with you it's just your opinion πππ
i ment complete overhaul in one mod. nobody likes that, unless you want to use that specific mod alone or waste some time patching
hello guys! is there any way to add or remove tags from an item? I want to identify specific Items to make it exclusive to a certain player, so I want to block it from use to other players, I was thinking about adding tags to know who it is from, is that anyway I can do this? thanks!
there is no setTags code or anything, so I was wondering how could I identify who the owner would be
Yes
getTags returns arraylist which you can simply modify, the original object still uses the same arraylist object so the changes carry over
I think you have 2 solutions:
- tags like you mentioned, which you can set but I don't remember how exactly, but you can
- mod data
can items have their own mod data?
I was about to test that to confirm if it works
I tested and it didnt work, adding mod data to an item, when I tried to check the selected item for the mod data gave me an error
im going to try using getTags
i think it's important to establish if you're trying to do this with Item or InventoryItem
yeah true
I think im doing it to handweapon
whats the difference between handweapon and inventoryItem?
is it like a subclass?
Item is the stuff you define in item scripts, it's a template to create InventoryItem objects which are the stuff you see in the game.
i see, I want to add this ingame so it would be inventoryItem
inventoryitem should have moddata working
but from what I know the equiped item you get in xp when hitting someting is a HandWeapon
does that make a difference?
since its probably a subclass of InventoryItem it should have it work right?
yeah it's a subclass
its giving me an error when I do table.insert on it
try code like this
data.MYMOD = data.MYMOD or {}
data.MYMOD.info = 123
that's how you set mod data in general
so I would do weapon:getModData().MyMod_VariableName = Identifier?
i tried that but didnt work
you read it about like so
if data and data.MYMOD then
info = data.MYMOD.info
end```
using flat table like this should've worked, can you show the exact code?
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
it returns an error when I try to do primaryItem.getmoddata
I think the issue is how do I check for it on my inventory when right clicking it?
the code I use to check for the rightclicked item is that one, but when I tried to access modData() from it it doesnt work
how do I add code her again?
it should be a couple of lines, you can just paste it
local equipPrimary = context:getOptionFromName(getText("ContextMenu_Equip_Primary"))
local equipBack = context:getOptionFromName(getText("ContextMenu_Equip_on_your_Back"))
local equipSecondary = context:getOptionFromName(getText("ContextMenu_Equip_Secondary"))
local equipTwoHands = context:getOptionFromName(getText("ContextMenu_Equip_Two_Hands"))
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
if primaryItem.getModData().owner ~= player then
equipPrimary.notAvailable = true
equipBack.notAvailable = true
equipSecondary.notAvailable = true
equipTwoHands.notAvailable = true
end
im trying to have the item that is right clicked by someone who isnt the owner it wont be able to be equiped
I also had a primaryItem.getModData().owner ~= nil as well
well to start with you need to use colon notation to call the function on an object, you use dot notation there
the difference is subtle but it causes errors if not done correctly
sorry what is the colon notation?
it's when you call function by using a colon as separator
weapon:getModData() is calling getmoddata using colon notation
i'm just assuming that what you pasted here is the exact copy of what you wrote in the actual file
I deleted cause I was trying something else
so I rewrote to send you
if primaryItem:getModData().owner ~= player and primaryItem:getModData().owner ~= nil then
this is how it was before I deleted it
it gave me an error there
allright well the only way this can not crash is if moddata.owner already exists
maybe its because im saving it to handWeapon?
no it's because you're effectively checking for primaryitem.modData.owner so if modData doesn't exist then the next item in the table chain causes an error
ahh i see
Yes
wait let me rewrite it then
Did you read the error ?
I think the error is that if that specific item doesnt have the mod data it would crash
right?
you normally work around this by putting if item:getModData() then before doing any other checks
okay let me try then
or you can put that as the first check in your if-and-and-and-then chain
uh, that's not a thing
Did you READ the error ?
Bcs if you read it, you'll realize it points out to the specific reason getting the mod data didn't work
Like "trying to access key from a non-table" meaning you'd have done modData.yourkey with modData being nil
This example would fix that for example
Tho it should NEVER give out nil
So I highly doubt that is the problem here
does it? I didn't reall check but the source gave me an impression that it starts off with a null as a table reference and it would gladly give it out without creating an empty table
GetModData should be an empty table - the nil error comes from assuming owner exists. Those checks should be inverted if anything.
if md.owner and md.owner == player then
i checked and at least for InventoryItem it does creates a new table.
There's no check for primaryItem exists in that second if statement ?
That could also be an issue
probably but i operated on assumption that the data structure isn't broken in relation to the decision tree
We just don't even have the full code here
We got no idea what their working with
- seriously, read the god damn errors in console, they exist for a reason and are fairly informative on what the problem is usually
Gives exact line + reason 99% of the time you get an error
true but gotta start with strong evidence and once that fails then continue to speculation
Strong evidence of what lmao ? Their code failed and mod data ALWAYS naturally creates a table
Imagine if it didn't, modders would fight for mod data
Player could also be nil here, you should probably store the username
As a reference can't be saved
Doesn't online ID change?
No idea ? Does it ?
I assumed it was the slot number - username in eithercase doesn't change.
And you could double its use for displaying the owners name.
No idea
it pretty much does this for InventoryItem and IsoObject which covers most of the stuff probably.
Yeah
Every mod data does that
Nothing new, really didn't need to check the java tbf but at least it's proof
Im basically using Events.OnFillInventoryObjectContextMenu.Add() to change the option to equip an weapon to not avalible, the full code of this part would only be
local function addTooltip(player, context, items)
local primaryItem
local playerObj = getSpecificPlayer(player)
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
if primaryItem:getModData() then
if primaryItem:getModData().owner and primaryItem:getModData().owner ~= player:getDisplayName() and primaryItem:getModData().owner ~= "Nobody" then
local equipPrimary = context:getOptionFromName(getText("ContextMenu_Equip_Primary"))
local equipTwoHands = context:getOptionFromName(getText("ContextMenu_Equip_Two_Hands"))
equipPrimary.notAvailable = true
equipTwoHands.notAvailable = true
end
end
don't know why i thought it wouldn't do this. I guess probably because this means any time any code at all checks for mod data, it's filled in. So basically if you have any mods installed that do this, you rapidly fill up all the moddata tables for all objects in the game even if they hold absolutely nothing.
You can put your code in lua code block with this
Makes it hard for us to read your code rn
```lua
<Code>
```
@tacit carbon π
this is the error
yeah you'll have to check the console.txt file
I dont know where that is in my keyboard im sorry
That error means it's calling something that doesn't exist
this error log doesn't shows what was the actual error, only the stack trace
its not 7 for me
I did
The error doesn't mention this code at all
addEnchantment
Including the Lua part also colors it. But yeah that error isn't from this snippet.
Check the line I indicated in the error
That I put in red
These are the informations you want to look at:
- line and file
- problem
that line is
weapon:getModData().owner = player:getDisplayName()
I'd guess players don't have display names
this means either weapon or player was nil
No that sounds right
wait no
Pretty sure it's not lol
I use that for other things and it works
It mentions addEnchantment
to make this name I use the players display name
IsoPlayer does have getDisplayName tho
yeah that is the line I added trying to identify who is the owner on that function, everything else is working and its for storing data in player:getmoddata
It's the name of the character
im trying to get this update where the item you have ascended cant be equiped by other players
Heh isoPlayer does have a getDisplayName - never ran into that before.
well one of the two functions there was nil
What is weapon in this case?
so player is some kind of object that doesn't have getDisplayName or weapon is some kind of object that doesn't have getModData, but neither of them are nil, or so it seems
But again, the error doesn't even mention that shit at all lmao
Where is addEnchantment in that part
That can't be right
Object tried to call nil in addEnchantment, isn't that the name of the variable ?
Weird
We really need the full code here
full code of the function addEnchantment anyway
call = calling a function - it knows addEnchantment - so whatever is line 394 is calling a function that doesn't exist
Yeah
one sec
if its weapon:getModData - that means weapon is nil or something else
i think if it was nil the error text would be different
Although if it was nil I think the error would look different
something like trying to get field getModData of non table nil
here is the code of the mod
if you want to take a look
its too long to post here on discord
Which line is 394 can you take a screenshot of that area in your IDE?
up to here, add enchant basically add the name to the item, then saves all the base values of the item so I can restore it to normal after its removed
You changed the code
then I added the last line to try to make this update work
yes
Did you make sure to unsub from the original mod ?
im adding this update
is 394 right?
yes
yes
Where is addEnchantmentTwice called?
addEnchantment is only used once in addEnchantmentTwice which is used nowhere else in this file
There is no check for primaryItem
called when the enchant item is used to overide not being able to enchant an weapon if you already have one
Your functions get called from the context menu, and you retrieve the primary weapon but there is nothing that verifies primaryItem exists
From your function addContext
oh weird my IDE didn't find those right away
which is when a person has no enchanted items and the free enchant is marked
on sandbox options
idk why you'd get the primary item by accessing the first item in the inventory of the player, that sounds scuffed asf
it was working for everything else
The reason being that, how do you know that's the item you want
That's not the first item in the inventory
but to check if has an owner its not working
Right click context on the UI brings up the header item and it's items
items[1] is the first item within the header's items
The header ?
Hmm I see
The first one isn't actually an item it just mirrors items[1]
Yeah
But yeah if weapon works earlier in the code
albion helped me with that code to actually be able to use it on contextmenu
it is working fine, this update is giving the error
before I used that part of the code, I was just checking for the items and not actually saving them to use it
Can you change that line to
local owner = weapon:getModData().owner
local playerName = player:getDisplayName()
owner = playerName
I'd be curious which line is breaking
Cause I don't see how or why either should
let me try that
thank you very much for the help!
ops
im going to correct this part
thanks for the help guys, its working now @sour island @bright fog @drifting ore
π
What was not working?
No I mean, why was that line not working lol
local function addTooltip(player, context, items)
local primaryItem
local playerObj = getSpecificPlayer(player)
if instanceof(items[1], "InventoryItem") then
primaryItem = items[1]
else
primaryItem = items[1].items[1]
end
if primaryItem:getModData() then
local owner = primaryItem:getModData().owner
--print(owner)
if owner and owner ~= playerObj:getDisplayName() and owner ~= "Nobody" then
local equipPrimary = context:getOptionFromName(getText("ContextMenu_Equip_Primary"))
local equipSecondary = context:getOptionFromName(getText("ContextMenu_Equip_Secondary"))
equipPrimary.notAvailable = true
equipSecondary.notAvailable = true
end
end
this is how I made it
it was the check for owner π
Glad you got it working π
thanks for the help !!
empty tables have essentially zero memory footprint and aren't saved so i don't think this really matters
you can check if an object has a moddata table created before trying to read it but it's wasteful of performance
IDK it's just my instinct of avoiding being wasteful. A little waste here a little waste there, and then you need to cut the amount of stuff in the game by a very large factor because otherwise it runs in single digit fps.
(because the alternative is to microoptimize the entire codebase and remove small amounts of waste everywhere, and that's just not gonna happen)
Are fishing rod break/catch chance locked in like generator code?
i haven't seen how hardcoded that specifically is but fishing is almost entirely lua so it will be at least possible to change it
I've seen a lot of the options for the fish, lures, sizes etc. but the standard rod vs crafted rod as well as line vs twine have different settings that I didn't see in lua but i might be looking in the wrong spot
I was hoping do to some final fantasy XI stuff and make some rare fish drop items that can be crafted together into a strong rod but if i can't edit the rod stats all they'll get is a fancy new model lol
i dont know why but its not finding the function to administer the effect of the pills
item PhalanxPills
{
DisplayCategory = FirstAid,
Weight = 0.2,
Type = Drainable,
UseDelta = 0.5,
UseWhileEquipped = FALSE,
DisplayName = Phalanx Pills,
Icon = PillsPainkiller,
Tooltip = Tooltip_Painkillers,
StaticModel = PillBottle,
WorldStaticModel = PillBottleGround,
Medical = TRUE,
CustomEatSound = AdministerPhalanxPills,
CustomContextMenu = Take_Pills,
EatType = pills
}
this is the item
module TheyKnewNMRIHaddon {
imports
{
Base
}
recipe Take Phalanx Pills
{
PhalanxPills=1,
Result:PhalanxPills,
RemoveResultItem:true,
Time:30.0,
OnCreate:Administer_Phalanx,
}
}
and this is the code
the player is able to take the pills but the function is never found to apply the effects
Administer_Phalanx must be a global Lua function
i'm not really sure what that means
you need a Lua file that creates Administer_Phalanx and does so without setting it as local
function Administer_Phalanx(items, result, player)
playerdata = player:getModData();
playerdata.ZomboxycyclineHours = 24;
end
this is what that function looks like
im using they knew as the base
ok well is it in /server/ or /shared/?
its in client
put it in /server/
alright i'll try that
also how do you know exactly that it's not working?
in the output it says that the function is not found
when i check the characters infection level its still rising
weird but allright
and not going down
one possible reason this could be an issue is because your Lua file name is the same as some other file, so it's not actually loaded
its still not finding the function
in your log you should see a bunch of Loading: filename.lua lines, is your file there?
eat paper mod when?
brick layer more like break eater π§±
yeah only 10 engine parts, can you imagine lowballing so hard
wow
christ
17k subs
2022 was 98 years ago. Feel old yet?
the game's last update was like two weeks after this?
yeah it's just a simple crafting recipe mod it prolly does work
infact no it was three days after
well nobody's complaining that it doesn't work
you need to keep in mind when you judge mods by their age that the version of the game we're playing is actually quite old itself
Yea I thought the last update was early last year
recipes rarely break with updates anyway
bro thinks he's a comedian i guess
to play devil's advocate, making a joke based off racial stereotypes is not at all the same thing as being negatively racially prejudiced

nah fs im not a witch hunt kinda guy i just thought it was wild as hell
caught me off guard
plus it's steam so what can u really expect
thats why i said he thinks he's a comedian cause usually they get those immunities but this is just a mod lol kinda unnecessary
wdym immunities? nobody's immune from getting flagged
yk what i mean, usually when comedians make jokes about racial stereotypes they get more leeway cause it's kinda their job and they usually know their audience
the good ones at least
so what are you saying that the deciding factor in whether it's ok to make racist jokes is if you're a professional comedian?
come on now
nah that's what you're saying im saying. I'm saying I just wouldn't expect to see that on a steam mod
true, true
π€
and there's a difference between a joke and just "This mode is called Jew mode because you get more metal for cheap than normal mode"
it's still a joke, but in a bad taste. But i don't think there exist a joke in NOT in a bad taste whatsoever if it's based off stereotypes.
yeah nah fair enough
so it's kinda the default for this kind of jokes
u right
though i will say that it's unfunny and it doesn't fits the setup or the punchline, it kinda reads as an excuse to use the stereotype
Ah yes, the pinnacle of logic. Dude need a slap to the back of the head.
thats what im sayin pretty much
the joke is entirely that it is in bad taste, he said a naughty thing now everyone laugh
it's the kind of thing you usually grow out of around age 14
Yeah it's not even a good joke lol - racial jokes need to come from a place of understanding otherwise you're just mocking.
it's one of those dog whistles for other edge lords
i think it's a dogwhistle for the group of people opposite of edgelords
not intentional i mean
Lmao his comments are off and his discord link is missing. Yikes.
being a federally and internationally certified edgelord myself i didn't find it worth mentioning
brother was reading chat i guess lmao
Nah the 'link removed' usually comes from reports.
ahhhhhh god damn it must have gotten a lot of reports within the 10 minutes i put that screenshot
Play stupid games, win stupid prizes. lol
i didn't know reporting actually did anything, steam is usually pretty apathetic towards this kind of thing
the difference between people who play videogames and people who chat on discord about videogames π€
It's automated - removes links (usually) and disables comments.
@bronze yoke Unfortunately I've been reported falsely a few times lol
I also have this experience too lol
Impressive. Very nice.
@earlier convo: There's not much sense in differentiating between making a joke rooted in racist stereotypes & being racist when the end result is effectively the same: reinforcing those stereotypes. We have no way to know their intent; we can assume it's an unfunny, failed attempt at edginess but ultimately it's a harmful stereotype regardless
at face value, the stereotype of being exceedingly efficient is hardly harmful. But if you view "harmful" through the prism of evoking untrue assumptions then any and all stereotypes are harmful and calling them such is redundant.
it plays into and around a lot of more overtly harmful stereotypes + not to mention racist conspiracy theories
yeah well flat earth conspiracy exists so at this point one need not even care
Yeah, racial stereotypes of βgoodβ things are definitely still harmful
There are plenty I can think of
nobody wants to be pushed into a box like that
Re. the second part of that message though, some stereotypes based on things that aren't immutable may not be harmful (or as harmful)
like what
Stereotypes about lawyers, for exampleββlawyerβ is not inherent to anyone's identity. Still probably inaccurate
Replace lawyer with whatever profession, or any other aspect of a person that isn't related to their unchangeable identity
i'm asking because it sounds awfully like "some stereotypes are true"
Well that isn't what I said so π€·πΎ
I'm just saying calling a stereotype harmful wouldn't be redundant, even if the premise were true
This isn't really the place for this convo anyhow though & I probably shouldn't have revived itβjust wanted to give my two cents since it rubbed me the wrong way. Plenty of resources for learning more online
if we're agreeing that all stereotypes are hurtful then saying "hurtful stereotype" is like saying "dead corpse".
very technically this is a discussion about modding so very technically it's not out of line i gues
Lmao yeah I guess on a technicality it's related, but still probably something I should've just left alone since the chat had moved on already
Nobody's question about making a mod was interrupted so i figure it's fine.
my bad i had to leave for a while, i'll go check.
its just in the output log?
in Zomboid/console.txt
Hey so, I'm a pretty bad and inexperienced modder. Last time I made a mod was a few years ago so I don't remember everything.
I'm making a mod that just changes the forageDefinitions file, and in particular just modifies the forageCategories part of it. I can get it to work if I put the full file in, both the unchanged and changed parts. However, from what I remember that would make it incompatible with other mods that change the forageDefinitions file, even if it changed a different part like forageSkills.
How would I make it so I can only implement the changed parts?
yeah it looks like it found what its supposed to look for but also theres a severe error in that same script
i need to get a program fully intended for coding
i recommend vscode
so this happened because something in the code was incorrect and causing an error
good to know
yall know why i have the ingridients to craft something but cant?
nvm i fucked up by putting keep as Keep
same^
I plan on making a vscode extention for all scripts like item, recipe, model scripts, sandbox options etc to give highlighting and errors too so you can find out before you load into the game and it doesn't tell you literally anything
I'm working on a mod that creates a new item and for now, I just want that item's icon to be the same as the tv remote. How do I specify that in the script .txt file?
function ZomboxycyclineMonitor(player)
local playerdata = player:getModData();
local playerBody = player:getBodyDamage();
local infectionStatus = playerBody:IsInfected();
if playerdata.ZomboxycyclineHours == nil then
playerdata.ZomboxycyclineHours = 0;
end
if playerdata.ZomboxycyclineHours > 0 and infectionStatus == true then
local bodyParts = playerBody:getBodyParts();
local bodyDamage = player:getBodyDamage();
bodyDamage:setInfectionMortalityDuration(-1);
bodyDamage:setInfectionTime(-1);
bodyDamage:setInfectionLevel(0)
for i=bodyParts:size()-1, 0, -1 do --the game is erroring on this line of code and i dunno why
local bodyPart = bodyParts:get(i);
bodyParts:setInfectionLevel(0)
end
print("Balls")
print(bodyDamage:getInfectionMortalityDuration())
return;
end
end
this for loop is wrong in some way
Icon = Remote,
if its lua cant i just do #whateverarrayitis?
no, # only works on tables
so its not a table, darn
LOG : General , 1723683816601> Object tried to call nil in ZomboxycyclineMonitor
on that line where i've got the comment
bodyParts:setInfectionLevel(0) should be bodyPart:setInfectionLevel(0)
anything else?
the rest looks fine from here
alright time to test
thancc
np
after this i need to make the usage of the pills make a sound then make my custom model and its textures shown and
i'll just figure it out as i go
function: ZomboxycyclineMonitor -- file: TheyKnewNMRIHaddon_TakePill.lua line # 35 | MOD: They Knew NMRIH addon
LOG : General , 1723684238247> Object tried to call nil in ZomboxycyclineMonitor
for i=bodyParts:size()-1, 0, -1 do
local bodyPart = bodyParts:get(i);
bodyPart:setInfectionLevel(0) --this is line 35
end
something is wrong with this loop in some way
oh, there's no such thing as infection level on an individual body part
so this loop is pointless then and i can remove it?
ya I use it but it feels not polished enough to rely on and is very not updated, and it only supports item script and model script, not all the other
if you're trying to remove infection i think you need bodyPart:SetInfected(false)
is that for zombification or like wound infection
zombification
im trying to make this just stall the infection by resetting the timer for a period of time
not remove infection entirely
so i'll see what happens without setting the infection of the body parts
if you set the main bodydamage not infected but not the parts i think it'll just reinfect them when the game reloads
if you want to delay it i think you don't need to touch this yeah
great, thanks
and it looks like its working how i want but i'll just run the timer down to see that it works fully
also does setting infection mortality to -1 reset its timer or does it just make it not progress
it resets it
perfect
https://imgur.com/t6ts8kW
manage to remove / move the shadow
my first mod is almost to 100 subs lets go
just recorded the most satisfying soundbite for it too
https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=3309563418 Credits to Gabester
yall whats the order that i need the mod in to upload it
wdym the order ?
like uh
you know
C:/Users/User123/fawdwadafa
Just check the mod template
is there a little thing i can use anywhere?
uh
alr
ill try
ig i messed something up
cuz i tried that
:renderShadow(0,0,6000)
i spammed it,

it also applies to zombies
Would there be any use to it ?
if you want to hide like a camera perspective mod
cuz doing invi still doesnt hide you from your own screen
but if you apply clothing that masks everything then shadow , name, admin tag will remain
same with the admin tag i spammed it
for the username i just set it to blank
maybe useful for streamers or admins idk..
oh cool
Hello everyone. Iβm trying to add a command in Project Zomboid to remove a specific item from a playerβs inventory, but the command doesnβt work.
Iβm adding the Lua script to the Project Zomboid\media\lua\server folder, but I canβt get it to run in the game.
Tell me what am I doing wrong?
Hereβs the code:
server and client commands are internal commands, RCON commands are a different thing
Will the client also need to download this mod?
i guess so? if you run a modded server, all clients download all server mods
I want to run a server without mods
well this sort of thing will run as a mod either way
since it's not a part of the base game
There is no way to add a command to Lua to delete items from the inventory? Cheaters create 10,000 generators in the player's inventory. I am trying to create a script for moderators to delete them. Without access to Lua
if that's the issue then you're focusing on the wrong aspect of it
the appropriate solution here is to ban cheaters
in any case, as I said, since this functionality isn't in the base game, it will have to run as a mod
The server is Nosteam, so there is no way to ban them by steam ID.
This is a mod. I would like it if the server didn't require downloading mods. I wrote a script that removes an item from the player's inventory. But I can't create a separate command to call it.
the script you wrote is already a mod
if you just add to/modify the game files it'll make the checksum fail for all players
so I can only use the script via lua? Here is an example of a script that worked via the console. It removes Fenrir Generators from the player
That's just lua
I think you're conflating terminology due to Lua being a scripting language and there being "scripts" in PZ
There is a way to have Lua on the server alone, but it would be a problem in any case where the code needed to be available to clients.
Is it impossible to add a command to the server such as additem only which will do the opposite? So that the client does not need to download it as a mod
The game is effectively p2p any code meant to interact with players will need to be on their client
What's the issue with mods anyway?
The server is non-steam. And players need to add mods manually. That's why I'm looking for solutions so that the moderator on the server could remove unnecessary items from players
I mean, you could send stuff over network but to do so for an entire mod is not practical
It's not really feasible
I can't understand why the game allows the moderator to delete any number of items from himself. But it only deletes 1 from the playerπ€¨
I feel like I've missed something
Regardless if you want to modify the way the game works it would need to be a mod. You could load stuff for server-side use, but as an admin you're a client.
Which is where sending code through network would need to happen - but even the loading stuff through network would need to be a mod.
So short answer to "can you just change stuff for server only" no
I understand. Thanks for the explanation. And thanks for your help.
π
so i'm setting up distribution for a thing and I want it to draw from and array list. Does this look right? I have no idea what i am doing and am throwing things at the wall based on another piece of code. ```require 'Items/ProceduralDistributions'
local DakimakuraWeapons = require("DakimakuraList")
local OpaiZList = require("OpaiZList")
--Dakis
table.insert(ProceduralDistributions["list"]["WardrobeMan"].items, "Base." .. DakimakuraWeapons:get(rand));
--Manga/Doujinshi
table.insert(ProceduralDistributions["list"]["WardrobeMan"].items, "Base." .. OpaiZList:get(rand));```
the file is read at game load, so the random values would change when quitting / reloading, allowing the player to restart until satisfying distribution.
how would I stop that?
in concept tho this is correct?
I have something similar but it's for the items actually spawning on a tile in the world. This persists without rerolling
can i ask why you're using an arraylist?
because my mod has an addon system for players add their own content.
think like true music
but for degenerates
you don't need to use RNG at that stage, you need to set up probabilities for all your items in the distribution list and the game will draw items randomly according to settings
you should just use a table, they're native to lua so they're much faster and the syntax is less weird
I didn't make the system and idk how to change it. I comissioned this a while back and and trying to toy around with it on my own
ok that's fair
you probably just want to loop through your arraylist and add all of them to the distributions rather than randomly picking one
local wardrobeMan = ProceduralDistributions["list"]["WardrobeMan"].items
for i = 0, DakimakuraWeapons:size()-1 do
table.insert(wardrobeMan, DakimakuraWeapons:get(i))
table.insert(wardrobeMan, 0.001) -- this is the spawn chance, this should probably be quite low since you're presumably adding lots of items at once
end
ok, yea I'll try this
thank you
and also thanks for the table suggestion. I am working on trying to find someone to update my addon system so I will maybe add that to the commission request if it's better
i don't know exactly what you use that list for, if it's just stuff like this it might not be critical since it doesn't hugely matter how fast you do distributions stuff (it just makes the game take longer to load, which isn't a big deal compared to laggy gameplay), but using an arraylist is just overall really strange
the list is mainly just used to make the addon process simple. all user made content creates an array list of their items and that gets pumped into my mod so it can use my models and spawn in world with my custom bed scene
if that makes sense
I probably explained that as poorly as possible
lol
that's good. I worry about loot saturation since it's my main gripe with true music but one step at a time. if you are running enough addons to have thousands of anime body pillows thats on them and they should get their head examined
lol
yeahhh the loot saturation issue is a massive pain to fix
one build42 releases it will be a god send. rather than having to have each body pillow varient be it's own unique item I'll be able to just have it be one with multiple texture options
i've done it for a couple other mods in the past, i keep meaning to just write a framework for it
(though i got paid both times so maybe i shouldn't π)
the best way I've found it to have things spanw in packs of some kind. I actually comissioned a mod to do just that for true music
I use a lot of music addons and it was making it hard to find skill books
yeah, i use a similar concept but it kind of opens itself when it spawns?
with mine you have to open it yourself but yes i've seen other music mods do that
I like my method since it's like a loot box
have you used music for the end of the world? that's where i originally wrote it
gamba addict
pomp's items uses some similar code too
yep, i've talked with the creator of it a bit about it in fact
ironically i've talked with them a lot to since their pony jar thing uses my bed scene
I say mine but I didn't actually code. it you get it.
oh wow, i had no idea that was from another mod
that explains it using an arraylist LOL
so if I understood this correctly then this here should spawn one of the items from my arraylist in each of these spawn locations?
local BookstoreBooks = ProceduralDistributions["list"]["BookstoreBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(BookstoreBooks, OpaiZList:get(i))
table.insert(BookstoreBooks, 0.001)
local ClassroomDesk = ProceduralDistributions["list"]["ClassroomDesk"].items
for i = 0, OpaiZList:size()-1 do
table.insert(ClassroomDesk, OpaiZList:get(i))
table.insert(ClassroomDesk, 0.001)
local CrateBooks = ProceduralDistributions["list"]["CrateBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(CrateBooks, OpaiZList:get(i))
table.insert(CrateBooks, 0.001)
local LibraryBooks = ProceduralDistributions["list"]["LibraryBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LibraryBooks, OpaiZList:get(i))
table.insert(LibraryBooks, 0.001)
local LivingRoomShelf = ProceduralDistributions["list"]["LivingRoomShelf"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LivingRoomShelf, OpaiZList:get(i))
table.insert(LivingRoomShelf, 0.001)
local LivingRoomShelfNoTapes = ProceduralDistributions["list"]["LivingRoomShelfNoTapes"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LivingRoomShelfNoTapes, OpaiZList:get(i))
table.insert(LivingRoomShelfNoTapes, 0.001)
local SchoolLockers = ProceduralDistributions["list"]["SchoolLockers"].items
for i = 0, OpaiZList:size()-1 do
table.insert(SchoolLockers, OpaiZList:get(i))
table.insert(SchoolLockers, 0.001)
end```
is this the loot pools for certain zombie types?
hm, well im trying to find where outfits are for certain zombie types, as well
I think those're defined in XML in media\clothing\clothing.xml
I doubt I can take two already made mods and combine them into one and change things when I have to separate them. I was thinking about taking the miners mod and the table mod and making them into one and adding craft to the tables
I feel like you're trying to ask something here, but it's being lost in translation. The first sentence doesn't make sense as written... I am guessing what you mean is that you doubt two separate mods can be combined into one?
If so, I don't know why you doubt that. It is often possible to combine two mods into one. But I would wonder why you would want to do that.
The second sentence makes me think you're trying to ask how the "miners mod" options could be associated with some sort of crafting table from another mod.
I would suggest to try to be specific about exactly what you're trying to do, and also which mods you're trying to merge...
Whatever you're trying to do, I would suggest you try to ask specific questions if you want to increase likelihood of someone responding quickly with a specific answer that moves you forward.
anyone know if it is possible to disable an occupation with a sandbox option?
my mod adds a custom one and I want players to be able to disable it if they don't want it
No
Oh wait sry
Read that wrong
But the answer is still no
The problem is that the sandbox options are not loaded when you create your character
yea that makes sense.
So you can't delete a profession or trait that way
The way I did it with Susceptible Overhaul is with a secondary mod
Sadly
not a big deal. I just wanted to know if it was possible to condense my mod with just sandbox options
Yup
never played around with sandbox options so I am just seeing what I can and can't do
if you don't mind could you tell me if these look like proper uses of my sandbox options?
thought of that to but yea wouldn't work on servers
making it a second mod just makes the most sense
Yeah but when you add tens of professions it's tough
Yeah just send em
thankfully I only have the one
local DakimakuraWeapons = require("DakimakuraList")
local OpaiZList = require("OpaiZList")
--Benni & PowPow's
table.insert(ProceduralDistributions["list"]["FreezerTrailerPark"].items, "Base.BenniPow");
table.insert(ProceduralDistributions["list"]["FreezerTrailerPark"].items, 0.13);
table.insert(ProceduralDistributions["list"]["FreezerGeneric"].items, "Base.BenniPow");
table.insert(ProceduralDistributions["list"]["FreezerGeneric"].items, 0.16);
table.insert(ProceduralDistributions["list"]["FreezerRich"].items, "Base.BenniPow");
table.insert(ProceduralDistributions["list"]["FreezerRich"].items, 0.1);
table.insert(ProceduralDistributions["list"]["FreezerIceCream"].items, "Base.BenniPow");
table.insert(ProceduralDistributions["list"]["FreezerIceCream"].items, 2.6);
table.insert(ProceduralDistributions["list"]["TheatreKitchenFreezer"].items, "Base.BenniPow");
table.insert(ProceduralDistributions["list"]["TheatreKitchenFreezer"].items, 1.5);
--Dakis
local wardrobeMan = ProceduralDistributions["list"]["WardrobeMan"].items
for i = 0, DakimakuraWeapons:size()-1 do
table.insert(wardrobeMan, DakimakuraWeapons:get(i))
table.insert(wardrobeMan, 0.001 * SandboxVars.BigDegens.DakiSpawnRate) -- this is the spawn chance, this should probably be quite low since you're presumably adding lots of items at once
end
if SandboxVars.BigDegens.Manga then
--Run-N-Tug
table.insert(ProceduralDistributions["list"]["BathroomShelf"].items, "Base.RubNTug");
table.insert(ProceduralDistributions["list"]["BathroomShelf"].items, 0.13);
table.insert(ProceduralDistributions["list"]["BathroomCounterNoMeds"].items, "Base.RubNTug");
table.insert(ProceduralDistributions["list"]["BathroomCounterNoMeds"].items, 0.13);
table.insert(ProceduralDistributions["list"]["BathroomCounter"].items, "Base.RubNTug");
table.insert(ProceduralDistributions["list"]["BathroomCounter"].items, 0.13);
table.insert(ProceduralDistributions["list"]["BathroomCabinet"].items, "Base.RubNTug");
table.insert(ProceduralDistributions["list"]["BathroomCabinet"].items, 0.13);
--Manga/Doujinshi
local BookstoreBooks = ProceduralDistributions["list"]["BookstoreBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(BookstoreBooks, OpaiZList:get(i))
table.insert(BookstoreBooks, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local ClassroomDesk = ProceduralDistributions["list"]["ClassroomDesk"].items
for i = 0, OpaiZList:size()-1 do
table.insert(ClassroomDesk, OpaiZList:get(i))
table.insert(ClassroomDesk, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local CrateBooks = ProceduralDistributions["list"]["CrateBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(CrateBooks, OpaiZList:get(i))
table.insert(CrateBooks, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local LibraryBooks = ProceduralDistributions["list"]["LibraryBooks"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LibraryBooks, OpaiZList:get(i))
table.insert(LibraryBooks, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local LivingRoomShelf = ProceduralDistributions["list"]["LivingRoomShelf"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LivingRoomShelf, OpaiZList:get(i))
table.insert(LivingRoomShelf, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local LivingRoomShelfNoTapes = ProceduralDistributions["list"]["LivingRoomShelfNoTapes"].items
for i = 0, OpaiZList:size()-1 do
table.insert(LivingRoomShelfNoTapes, OpaiZList:get(i))
```
table.insert(LivingRoomShelfNoTapes, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
local SchoolLockers = ProceduralDistributions["list"]["SchoolLockers"].items
for i = 0, OpaiZList:size()-1 do
table.insert(SchoolLockers, OpaiZList:get(i))
table.insert(SchoolLockers, 0.001 * SandboxVars.BigDegens.MangaSpawnRate)
end
end```
Anything that uses sandbox options, needs to run on a save launch
So here you're using it but the sandbox variable still doesn't exist when you load lua
The problem is that inserting a table like this would insert everytime you load a save, thus creating duplicates of the items
My guess is the best way to do that would be to reference a value within your own table, and this value is replaced OnGameStart with your sandbox option value
Thus it's also replaced within the distribution
That can happen 
I won't bother posting the other one because that's even more complicated and likely to be wrong
it is possible
sandbox options are always loaded when making your character
think about there being sandbox options for extra trait points, and sleep traits depending on sleep being enabled
for distributions you can just do it in an OnInitGlobalModData handler and call ItemPickerJava.Parse() at the end
Hmm true
So how would you go about that ? What trigger should you use for the professions and traits ?
i have a setup for sandbox-dependent traits but i haven't had to touch professions with it
Professions are similar to traits
there isn't really an appropriate trigger, you have to patch the trait to return the sandbox values
since you can't change traits at runtime you can't really have them respond to sandbox option changes
mind if I send you a dm to show you what i'm trying to do?
you might be able to help me with the bed spawn portion since you worked on that for creep
sure!
yeah you can, dynamic traits does exactly that
my wording was a little unclear but what i mean is you can't actually change a trait object after construction so no 'trigger' to set its values would be appropriate, what you can do is patch its getters to return the sandbox values
they only get accessed from lua and everything is enforced by the ui so it doesn't matter that the 'real' value isn't changed
anyone know why a zombie created with createZombie function crash the game if touch a fence?
[16-08-24 17:30:51.057] ERROR: General , 1723822251057> ExceptionLogger.logException> Exception thrown java.lang.NullPointerException: Cannot invoke "zombie.characters.BodyDamage.BodyDamage.getBodyPart(zombie.characters.BodyDamage.BodyPartType)" because the return value of "zombie.characters.IsoGameCharacter.getBodyDamage()" is null at ClimbOverFenceState.shouldFallAfterVaultOver line:587..
ok, I removed line by line, happens when I set z:setRunning(true) and touch the fence
That's weird how would running null body damage
hello how do you make occupation mods?
or can you not
i couldnt find thier code in the wiki page unlike other stuff like items
yep, don't know but since I remove the line didn't crash
also another question lets say i made new items for mechanics like idk a tempered glass winshield if i list it as heavy duty can i install it in those cars
Workin on my mod again today. This time it's on the Dispatch menu https://i.gyazo.com/cb103e6d8b0559e83893def88532e111.jpg
guys can i make a mod where i use universal vehicle partsfor vanilla vehicles? or anything like that
like i wanna add tires and some suspension
is that possible
how does getFileReader works on the server?
exactly how it works on the client, but on the server
if you wanted to know what it does in general, it opens a file in the game's cache's Lua/ folder
You can refactor Straw Hat Ronin as an example.
I don't know anything about vehicle modding
I just have an occupation mod that afaik 100% works bug-free and could be used as a basis for others
Has special foraging skills defined, special outfits defined, and has similar perks to vanilla Veteran
Howdy, I've never made a mod for Project Zomboid, but I had an idea to solve the indoor weather issue. The mod would add a new floor tile, that is invisibile, and has no clipping. This way, you can have a "floor" in order to satisfy the room sealing requirements, but you can still have the freedom to build in a way that should by all means be possible. Does anyone have any tips for the best way to go about making this?
I'm asking because I have this ridiculously complicated config screen which saves its own sandbox settings file because sandbox text entry length limit is chump change compared to save string length. So this file somehow needs to end up on the server and be loaded properly. If I generate this file on a local machine, it puts it in /Zomboid/Lua, could I copy it to the same folder on the server? Also, server sandbox settings are saved through an .ini file, could I just dump 20 pages of text into the text entry field? I mean would it load? Would it not get clipped by the game afterwards?
Hello. Could you please tell me how to display a player's (client's) inventory through the command console so that their inventory is printed to the console? Is there a ready-made script for this?
Anyones know what I'm doing wrong? I render for example an square like this:
local function renderSquareAt(x,y) local floorSprite = IsoSprite.new() floorSprite:LoadFramesNoDirPageSimple('media/ui/FloorTileCursor.png') floorSprite:RenderGhostTileColor(x, y, 0, 0.0, 1.0, 0.0, 0.8) end
called in the OnPostRender event. But despite x and y didnt change on some frames its rendered in another location.
I attach a video to show the problem:
Pretty sick of having to reload the entire environment every time I make a change to my mod.
Is there any way to reload specific .lua file while the game is already loaded?
I've used the debug menu to do so, but my changes to the file aren't actually reflected when doing that. Seems to cache them in some way, and I'm not sure we have access to clearing specific .lua from the cache
If you press F11 to go debug and reload the file, should work.
I wish it did. Doesn't seem to. Even changing something as simple as the string of a print statement is not reflected. Still prints the old string.
Same thing when using reloadLuaFile
If you have functions that are triggered by a specific event, make sure that the event is properly triggered, or if the function is anonymous, consider converting it to a named function.
global state changes like adding event handlers won't be reverted by reloading the file, it's best to not use file reloads when using them
or if your code loads from events like OnGameStart, you will not see any change, since it will not be triggered as Elyon suggest
Someone had the same problem as you last week on the pz modding server https://discord.com/channels/136501320340209664/1125248330595848192, but I don't think they solved it.
I'm starting to think its a problem of the game, because if you open the chunk debugger, you can see the same problem
I'm reverting back to the closest version I had to working, will post some code\images for reference.
So, although I am using events. The only event called (while in debug mode) is to generate this UI. I have my reload function destroying and rebuilding the menu in itself, so the need for the event to be retriggered is a moot point.
Hmm a new development. It seems it's only the print statements WITHIN functions that aren't changing after the reload. Maybe I just need to clear those functions from the cache somehow.
Regardless, here's what I'm working with at the moment.
The text I've been trying to get to change is the simply the string the test button outputs.
you are using OnGameStart xD
Indeed.
this event is not triggered when you realod the lua
ah this is the other lua i dint check it , let me see
testButtonUI is a local variable, it still refers to the original local from when this function was compiled, not the new one in the reloaded file
yes
I think you can change testButtonUI to global and add a testButtonUI:onGameStart() after writeCustomLog("BuildingMenu_Creative_Debug_UI.lua has been loaded."). At least for dev process maybe make the work?
Hmm, are you trying to remove objects and tabs from the Building Menu? I was going to rewrite the whole mod to give users more control, but that for B42.
Well. I started just adding a few appliances he was missing. Propane barbecue, coffee makers, toaster.
I also kind of wanted to make a Vanilla tab so you could do all the vanilla builds with the building menu as well.
In that process I realized there are an awful lot of tiles that aren't in it.
Then I realized there is some demand for a creative mode, so I decided to try and make a a tab that simply adds everything dynamically. If you've ever looked at his code he's added each individual tile statically. Props for the dedication, but what a labor that must have been.
But I got super hung up on having to wait a solid two minutes every time I made a small change. So for the past two days I've been focusing on getting this reload button to work. Hopefully this local vs global thing is the issue
Hi everyone! Sorry for my bad English...
I'm creating a mod that overwrites the Vannila professions with those created by me. Is it possible to insert a skill-cap for certain skills??
For example, I would like a fighter not to be able to exceed level 5 of carpentry.
Thanks to those who will dedicate some time to me
That awkward moment when you realize the person you are talking to is THE guy you're talking about.
(β―Β°β‘Β°)β―οΈ΅ β»ββ»
@tropic oriole @bronze yoke
Simply removing "local" when declaring testButtonUI did indeed work.
I should've come here two days ago.
yep but you need to do two clicks yes? reload lua and your reload button, right?
Nope. Make your changes. Press my button. Changes are reflected. Bing bang boom.
i recommend changing it back when you're done testing, globals are bad practice
It really took a long time (about 6 months to add all the objects
). Some objects are added dynamically because not all tiles follow a consistent pattern in the tile sheets. For the next version, Iβll have to manually add each object to allow admins to modify the recipes.
Ah yes i see you reload with code, then its fine
Because of polluting the namespace I assume? I'll just have to make it something much more unlikely to be used by someone else.
that is one reason, but also because they're slow and enabling of weird code
local is also faster and has less overhead
I was hoping to maybe piece together some way of determining which tiles go with which from tile and item properties rather than patterns in the tilesheet. Obviously you have a lot more experience in this area, and I assume you're right. Feel like giving it a crack though. Will see hw it goes
Valid. It's only necessary for debug mode. So perhaps I can wrap is in an "if IsDebug" and only declare it globally in debug mode.
I just hate the idea of having to remember to go back and change it
try something like this at the end of your file:```lua
if isDebugEnabled() then
testButtonUI_debug = testButtonUI
end
Does anyone know which file the "getPlayerCraftingUI(num)" function is defined in?
client/ISUI/PlayerData/ISPlayerData.lua
this will just set the value of the local, if you want to globalise it that way you need to either use a different name or use the syntax _G.var = 0
thanks @bronze yoke 
Is there a way to clear the error log in F11? At the moment I have to full restart the game to do so. Since I can't copy and paste from there I've had to restart the game, recreate the error, and send a picture to Chat to relay error messages out of it.
Sometimes I use the debug log, but it doesn't seem to display identical information.
stack traces go into console.txt, that's usually what i check
(not least because the error menu opens at the top but the latest error is at the bottom??)
Ah true. Guess I've done that a few times too. Will become the common practice I suppose.
Is there any verbosity settings for console.txt? Or is it always everything all the time
it's always everything all the time (some stuff is suppressed in non-debug), there's some divided logs in the logs folder that might be better
Good to know. Appreciate the tips
I was wondering if you could play in two different mods and combine them in one and Dynamic Mining in this mod I would remove the gold, salt, silver, and aluminum and put in the copper. And the second mod is this Crafting Enhanced Core. This mod only has a table. Is making crafts with the first mod possible and how did you do it?
Is there any resource on making new skins for existing vehicles?
There's mods that do it, you could most likely check them out
Mods that add skins? I already know a few. Im asking cuz I wanna make my own
Hello, is zomboid lua capable od http calls? I would like to create mod that depends on PlayerShops and would post listings trough webhook.
Yeah but did you check these out ?
Check these for what exactly?
opens the steam browser
cant really interact with it
To see how they do it :|
How they add more texture options
Howdy folks, I have been working a ton on map modding and tile creation so far, but would like to get a bit more into mod development. Is there a source I can use to get started with lua and the PZ specifics attached to it? I have some experience in programming, not much with lua yet though.
I already have a mod idea, but I have no clue where to actually start
What are you trying to do?
Simply put, I have built a power plant (originally for my town, but now I want to use it for a specific mod first) that I want to use in conjunction with sub stations in order to power certain regions (cells) on the map. The Restore Utlities mod already does a lot of what I need, but for the entire map instead of certain regions.
I do not understand enough of the PZ lua stuff yet on where to start with this
Sadly I'm not sure it's possible to do
From what I understood reading some conv about it
What exactly is not possible? Would it not be possible to emulate power generators in specific large areas perhaps?
Sadly I don't think so, I believe the reason is that any handling of electricity is locked behind the java (which if you mod, that requires a bit harder coding and also manual installation from players)
So increasing the range of a generator for example, I don't think is possible without the java part
ik there's some that know more than me/have more detail
But that's the main reason you haven't seen any system reworking the electricity system yet
What is the PZ code which gets the current month in-game in no particular preferential date format? (For an if statement)?
local gametime = GameTime:getInstance()
gametime:getMonth()
Thanks
In theory possible, but not that easy to do then. Sad...
In theory, yes, viable ? No
Bcs you'd have to make a java manual install
And that's if you manage to use the java
any particular reason it needs to be cells, and you can't just use the same thing as Restore Utilities does?
I want to be able to control the areas where I restore power
well IsoGridSquare has setHaveElectricity so you can work something out with that
not sure how would it interact with generators because they use the same function to toggle grid square powered status
by the way what happens if you turn a generator on and off while the grid electricity is still active?
nothing
grid electricity is baked into the method that checks for electricity, it's not state of the square
then this is only an issue if you use this manual power override in conjunction with generators
Turning on square electricity after power turns off will only work for lights iirc, stuff like fridges and freezers won't work still and need generator
In this episode of Project Zomboid Mods Done Quick, we take a look at three amazing map mods that are joined together and deserve your attention!
Enjoy!
------------------------------------- Important Links -----------------------------------------
Patreon & Server Whitelists: https://www.patreon.com/mratomicduck
My Discord: https://discord....
(if you're that Simon_MD)
Yes that is me π
Got my own short too, AtomicDuck giving us some love :3
So is there like a wiki or guide for getting started on modding? I'm trying to create a poster pack just to get started and I'm completely lost.
wdym by a poster pack ?
Like... adding posters to the game
ty β€οΈ β€οΈ
Does anyone know if it is possible to modify the randomly generated stories, like for example adding or removing items from the randomized table stories to include or exclude other food items?
You can even look at that mod you linked for help too. Just subscribe to it and go to C:/Program Files (x86)/Steam/steamapps/workshop/108600/content/<workshop_id>/mods/<mod_id>
that path may not be fully correct since i am unsure if I remember fully but it should be mostly accurate
you can right click on project zomboid in the steam library and open the local folder from there and just go up until you see the workshop folder
True, I just include the full path so I don't have to type out the steps like 5 times
ok, awesome
sorry, this is just my first time modding anything so I didn't even think of that
Hi guys. Sorry for the noob question.
How do you create mod dependencies in the workshop? I see some mods require you to subscribe to some other mod in order for it to work. How do you do that?
after you upload your mod you can add them with the Add/Remove Required Items button on the workshop page
thanks!
Good evening everyone, I have a question.
I made this specific tile have an ambient sound
and it works perfectly.
However, when the player leaves the sound range, the sound ends abruptly.
and it doesn't go down smoothly, is there anything that can be done?
Is there any way I can smooth this out? so that the sound slowly disappears and doesn't cut out of instantly?
Specifying a distanceMin and distanceMax, the volume will naturally fade out from min to max.
For example, you need to be in the range of distanceMin to distanceMax tiles to be able to hear the sound. I think you can make distanceMin to 0 if wanted.
Hi guys,
I'm looking to make a simple mod that allows you to change in the settings the range that you can plumb sinks and appliances with rain and barrel collectors, but I have no idea how so I was looking for guidance (it would also be nice if I could get it to plumb through 2 floors, but that's just a bonus)
content and 108600 are the other way around
It's funny because I switched them around last minute figuring I was wrong ;-;
π
guys how can i make music mod?
You can use True music and you have the steps in the description
note: if you add it to an existing save it will only start spawning in previously unloaded chunks
ermm, not me makin a mod, but my frien, does anyone have the normal female playermodel, wuh
as blend. or smh
file type
The instructions Adrian is showing you are here: https://steamcommunity.com/workshop/filedetails/?id=2613146550
Well, I have thought about my mod idea and I am going to adjust it a bit that power will be on everywhere. Only difference is that several substations must be repaired for this to work. I still do not know though how I can access the necessary data from PZ in lua. What functions I have available, which classes/objects etc.
Right now I would need the info of where (which square) the player action has been executed on, so I know the sub station location and can set this one to be repaired (if the repair action was successful). I am looking in the PZ wiki, but not sure if it is in the correct area I am looking in...
package index
I invite you to join the modding Discord too for even more technical aspects
Yeah I found that one - How do I use it? π
Any object has a class associated to it
And a class can have a subclass
Let's say at the top right in the search bar you search for IsoZombie
declaration: package: zombie.characters, class: IsoZombie
You get this
That list on the left means that IsoZombie is an IsoGameCharacter
And IsoGameCharacter is an IsoMovingObject which is an IsoObject
It means that IsoZombie inherits most of the methods and fields from the previous classes
yeah
In the same way, IsoPlayer is also an IsoGameCharacter, and thus zombies and player objects have things in common but also have their own unique methods that only work for them or subclasses from themselves
(which I don't think there are any subclass for these 2 specific examples)
so, if I were to look for the class that can give me data from the iso world, I would need to find that
yes, the square where the action has been executed on
- from X Y Z coordinates
- from another object (getSquare() retrieves the square the object is on)
- from the context menu (right clicking a tile will give the objects in it in a list for you to use)
So in your case you would want to give the player the ability to right click a specific square and interact with it ? You'd have to use the context menu
Well, the mod I use already does that. I have assigned some coordinates in a file, where the action can be executed
99% of the time, mods will use Events to link to specific actions in the world, the context menu is such an action
https://pzwiki.net/w/index.php?title=Category:Current_Lua_Events
Now, as there are different locations with different coordinates, I want to know which one it is
This is what you'd use to utilize the context menu
https://pzwiki.net/wiki/OnFillWorldObjectContextMenu
and get these coordinates. THen I know in which sub station the player currently is trying to repair
Yeah I get what you're trying to do but first you have to know how to access your square
Once you get your square, getting the coordinates and verifying they are the right one is easy
local function OnFillWorldObjectContextMenu(playerIndex, context, worldObjects, test)
-- Your code here
end
Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)
This gives you the playerIndex, which you can retrieve the player that right clicked, the context menu so you can add new options to the context menu being opened by that player, the list of worldObjects (and test idfk what it is)
You'll be interesting in worldObjects here
Because you're square will be accessed from it
What I would suggest you do, is run that code, and print the values that are given to you
local function OnFillWorldObjectContextMenu(playerIndex, context, worldObjects, test)
print(playerIndex)
print(context)
print(worldObjects)
end
Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)
In the console, this might give you some informations on what you are working with
If those are java objects for example, it will tell you for the player for example:
local player = getPlayer()
print(player) -- prints IsoPlayer:a_number
So you know player is an IsoPlayer object
Thus you go in the documentation, and look what you can do with this
Well you do the same here with your context menu event
Okay thanks - I'll have to do some more research about this as I do not fully understand how these functions (and where they) are called yet. Been only working with Java and C++ so far
To take back the player example and how to use a method on it:
local player = getPlayer()
local ghostMode = player:isGhostMode()
isGhostMode() being a method than can be applied to IsoPlayer
And yeah don't hesitate to check out the modding Discord
https://discord.com/channels/136501320340209664/1125248330595848192
We still don't have proper tutorials but you might get better help on some more technical stuff
Thanks!
Thank you so much
just to nitpick a tiny bit, distanceMin is the distance at which the sound begins to fall off, not the minimum distance you can hear it
you can't be too close to hear a sound
There is a mod that has a function as a recipe code. If I make my own function and load it later, will it override the original mod function, as long they are the exact same name?
Basically I want to mod a mod
yes
Thanks
I am adding the 4 missing dance cards for true actions v3, Dancing
Since currently as it is(at least the version I am using), you cannot get 27,28,29 or 30
Me again
Do I need to add the items.txt to my own mod or is there a way to make my mod spawn items from another mod?
Because I did overwrite the function, but now its giving no items instead of the items I wanted. I'm not sure if 'require' can load other mod items
you don't need to redefine the items
But I do need to import them somehow, right?
not to call them from lua
if I do a .txt inside scripts with imports { TAD } is enough? Or does it need to be imports { base }
the whole game shares a single lua context
I mean, I did override the function, but it didnt give the items, so maybe I did something wrong. I'll check a bit
I honestly dont know what I did wrong
It did override, considering that when I right click the Ceral Boxes it still allows to open the box, and it stopped giving dance cards, that means that something changed and something broke
However it SHOULD give dance cards, since there is a dictionary with the full list of items
pro tip: never override any functions
besides breaking the game in subtle or obvious ways, like you just did
it also kills mod compatibility
if you need to, you can decorate an existing functiuon
make it run itself and then your code (or the other way around)
function Game.Code.Function(...)
yourFunction(...)
return oldFunction(...)
end```
return the old function
Make sure to do that or every other modders will hate you for your entire life
they're trying to override the entire functionality of the original function though

