#mod_development
1 messages ยท Page 216 of 1
Then yeah that'll work unless it doesn't ๐
(Probably many times when it doesn't but the times I know for sure won't go well include files that decorate functions with behavior that cannot safely happen twice... If you decorate a function and reload that file, you'll decorate your new copy of the function, and that may cause stuff to happen twice. Also, if your file has functions that have already been added to events, you would need to remove them or you'll add new copies of those functions to the same events again.)
What values does rgb accept? Is it between 0~1 even though its type is number or can it be 0~255?
0-1
I wanna do something similar to this:
Ohhhh
Not integer
So it can also be float. I haven't used Lua in a while.
i have a dumb question, is there anyway to add a stroke to the uitext?
in the enum i only see size and type
large dialogue etc
RGB specifically is usually 0-1 and in fact there are cases where trying to save certain RGB states as numbers over 1 can cause errors to be thrown on game exit
my stats ui in the snow... is a bit unreadable to say the least
Your UI doesn't have dark background light font?
Mmmm afaik standard Zomboid way is to give things backgrounds... Never seen anyone with letter glow or anything
or perhaps a way to just change the text color?
if thats possible ill just run a check for snow
and change the text color when snow is active...
Is there a search feature?
Yes you can change text color in the functions for drawing the text
On the right
Huh.
Under white window
That's scrolling not searching xd
@thick karma last time i coded for a zomboid mod using ui was like... 2 years ago... can you provide me an example of how to alter the text color?
ATM i only have this: self:drawTextRight(alivefor ,self.width-40,10,1,1,1,1, UIFont.Large);
Iirc the order correctly the 1 1 1 1 are a, r, g, b
It could be rgba if that doesn't come out right
I think different parts of ui do it backwards from others.
trial and error will save the day... thanks for the help
Good luck
The empty box above the scroll list. Lol assume everyone here knows the diff between searching and scrolling.
Oh... Bruh.
I DID NOT SEE THAT
Thanks. Finally starting to learn.
Not gonna lie though, modding this game is extremely difficult. It requires you to look at other people's code whether that be a mod or the decompiled source code, you even have to look at a bunch of references from projectzomboid.com/modding and pzwiki.net/Lua_Events.
Look at vanilla code for reference
Also I use this so much I feel guilty for not adding co as a contributor on every item I've published
How do I make the character say something?
IsoPlayer:Say() does it but how do I use IsoPlayer:setHaloNote()?
Think its the same say as player:Say()
Takes a tick duration as well
Oh it can work both ways:
Maybe it takes RGB-255 in the 3rd version above. Not sure.
Haven't tried the 5-variable version.
Since arg2 arg3 arg4 are integers, it can't be RGB-1
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, interface: ILuaGameCharacter
Reason: Bad word usage
Yeah, it does take 0-255, no decimals. I don't know how that part of the code is still working but maybe they're calculated differently on those methods.
local InjuryRedTextTint = (100 - self:getPatient():getBodyDamage():getHealth()) / 100
InjuryRedTextTint = math.max(InjuryRedTextTint, 0.2)
local str = self.healthPanel.javaObject:getDamageStatusString()
self:drawText(str, self.healthPanel.x + 165, y, 1.0, 1.0 - InjuryRedTextTint, 1.0 - InjuryRedTextTint, 1.0, UIFont.Small)
y = y + fontHgt
```This part, it is responsible for the color of the "OK" text.
Yeah that drawText function is definitely RGB-1, not RGB-255. I've used it a lot.
How would you do something like os.sleep but isn't blocking for the game?
Well you probably don't literally want to make the program sleep because that would lock up Zomboid until your function finishes. What you want to use instead is probably either counting ticks, or during OnTick counting passed game time and converting it to seconds to figure out if enough seconds have passed before continuing the process you want to happen after the delay.
But what exactly are you trying to delay? The kind of event you want to delay will determine the best way to wait for it to happen
Btw I am at work but will be able to respond more freely in an hour.
playerObj:setHaloNote(bleedingText, 255, textTint, textTint, 200)
I just want to delay this everytime it's executed.
hey there, i was wondering how to change the location of where the sleepingbag model attaches to the bag?
Does the delay have to be temporally precise, or do you just want 2 or 3 seconds to pass before the message appears?
I'd like to be able to delay for even 999 seconds if possible.
Who knows, I might use it in other mods too in the future.
I believe some people have posted utility modules here in the past for telling a function to happen after a specific number of seconds, but I do not have one readily available. I think you get a time in milliseconds, convert to seconds, create the function you want to happen, store any necessary variables the function will require, and add an on tick event that waits for the desired milliseconds/seconds to pass before calling said function.
The javadoc I posted is searchable for functions that get time in ms
getTimestampMs(), yes, I've seen it.
-.-
Alright, I might make my own utility function. I'll even share it for other modders.
Really...
I think Tyrir posted some useful stuff for this in the past... You might try searching their messages. All of Tyrir's stuff is gold.
Hi! Does anyone knows whether the vanilla moodles have some type of priority system attached to them determining which moodle is displayed on top of the moodle stack? (I mean the vertical list of moodles which is displayed right hand side of your screen when playing the game.)
good question
I am asking cause I noticed that sometimes new moodles are appended to the list and sometimes new moodles are put on the top of the list. Wasn't able to figure out what the system behind this is.
Maybe you could find the code for the vanilla moodles ?
I already have a look at the java code for this in MoodlesUI.class (vanilla moodle display is only controlled via java not lua afaik). But I wasn't able to understand everything yet...
probably going to do this soon
but I'll wait a bit. maybe someone here knows more too
when i was rewriting moodles i never noticed any explicit priority system
i think they're just rendered in order of their ids?
Ok. Thanks for the suggestion. That was also my suspicion but was not sure about it! I am currently planning a mod which will touch the moodle system and I try to arrange stuff as it is in the vanilla game. Was therefore wondering whether there might be a special priority system or smth working in the background.
what are you working on? i rewrote moodles entirely in lua for statsapi if that might be useful to you
I started working on a mod introducing a hygiene system. I plan to use moodles for indicating that the character is dirty and other things. But the project is still in it's infancy. Have just a few fragments of code here and there (and not sure if and when I'll finish it).
I think that I may also do some rewrite of the vanilla moodle system to make it work smoothly (while still trying to keep compatibility with other moodle mods ofc). Already heard about your statsapi mod during my research on moodle modding! ๐
There's a moodles api
anyone who know python interested in helping me with the map generator thing I'm working on?
ya... we already talked about albion's StatsAPI. Quite helpful tool.
no, i mean there is a mod called Moodles API that makes adding moodles quite simple
Oh ok. So far, I just know the mod Moodle Framework which has a similar purpose. Never heard of Moodles API.
np ๐
Finally got it working. It ranges from minor, moderate and severe.
What do you think?
can someone help me with a math-related dilemma?
a very algebra question
i want to make an RNG that will increase as you survive longer and get closer to the power shutoff date
but, i dont want it to ramp up too soon for people who have later shutoff days, like 1 year
Depends on what you want, it could be linear, exponential, etc.
it should be exponential
im trying to see how i can make my blackouts ramp up if you are close to the shutoff date
What is the shutoff date? Is it number like 20, 30 or is it like a Timestamp()?
the shutoff date is a random number based on the setting u chose for the game. in some runs it can happen within a month (some within a week, but ppl using my mod probably would choose a longer setting) as long as a year
it is based on the day
So it could be 60 days or something?
yea
I see.
How do you code your blackout probability?
my variables would be
X: Blackout Chance (%)
Y: Days Survived
Z: Shutoff Date
it's a fixed Chance
if ZombRand(1, 101) <= blackoutchance then
that users of the mod can choose with the sandbox option
I see.
ideally, i'd like that chance to scale based on if they enable the option for ramping up blackouts
Let me do a few tests.
kk
i was gonna put this off but decided might as well add it since there was something else i needed to fix and while it is still on the front page
Yeah, yesterday it was on 400+ subscribers, now you're at 900+
Getting pretty popular.
i still havent gotten any comments confirming if it will work in multiplayer
How do you get the days survived?
what is each variable in this
a is the probability if ZombRand(1, 101) <= blackoutchance then
b is the steepness
x is the getGameTime():getNightsSurvived()
and c is the halfway point.
I'm not sure how to modify the x in this calculator but it and blackoutchance should be responsible for the height of that curve.
so the X axis on this graph is nights survived and Y axis is blackout chance?
Eh, not exactly.
it would be huge if it ramped up once you were very close to the shutoff date
maybe i can explain what im picturing
nightsSurvived/x and blackoutchance/a are the ones responsible for the height, the steepness/b modifies the curve and the halfwayPoint/c is the one modifying how soon the chances ramp up.
blackoutchance / (1 + math.exp(-steepness * (days_until_shutoff - halfway_point)))
Try to play with that formula.
is the halfway point a number i can choose/set
could i make it like shutoffday - 10 for example so it only starts ramping up in the last 10 days?
Yes, like I said, that modifies how soon the chances ramps up.
You can even ignore it and set it to 0 but that would be useless since that is also the day the electricity powers off.
i see. and what about steepness? is that responsible for the shape of the graph? or does it also affect the peak?
wait, is the blackout chance here measured by its peak?
ah wait i think im starting to understand
Yeah.
so i would need to add a tooltip saying this is the peak chance if you enable ramp up
can i control the minimum too? do i just add a number at the end?
like the formula with a + variable at the end
Yeah, keep in mind though that even if you modify different variables, the result could be extremely similar.
oh wait if i use a plus sign i think it would actually shift the whole graph up
I guess? I think that will multiply the height.
Well, I hope you figure it out. The mod is really nice, I can see it getting really popular in the future.
thanks! i'll play around with this and see if i can come up with something
Uhh, does anyone know how to make a settings tab in the pause menu option? Not the sandbox option when creating a save.
Like what modoptions mod does? There are a few mods like that including Chuck's config mod.
There was a tab called (mods) before, I'm not sure where it comes from.
is there a way to prevent the game from muting when im speeding up time or in ghost mode
i added a very simple version of blackout ramp ups to my mod since i still couldn't get the exponential ramp ups to work how i wanted - and i needed to update the mod to fix a bug before too many people get far enough in their runs to experience it
i'll have to give it another shot another day
someone suggested making weather affect blackouts so maybe i will look at those at the same time
You are referring to Mod Options, and I would recommend that one because many other existing solutions don't have controller support (but Mod Options tab does work on controllers).
Doesn't create your own options page but does let you create a category in that Mods tab you mentioned.
Finally got a comment from someone who used my mod in multiplayer and I can see if there are any problems
is there any tutorials on how to make a melee weapon mod?
ha
so is every community, zomboid has a blatant copycats lmao
some well-known dude literally copycated one of mods I made almost 1-to-1 conceptually, but I guess its his word against mine since he is like a bit popular it seems.
Did they reupload or just do exactly what you did by writing the solution from scratch or what exactly? What items are you referencing?
Nah, code seems like scratch but mod does replicate everything exactly the same. I usually don't bother with such as ideas do overlap, but when people randomly keep posting DMs with "hey bro you seen that mod seems like a copy of yours" randomly here and I come to check it again to know author deleted my message saying `Nice it seems like we had a similar idea" or something (non-derogatory at all or aggressive). Wanted to confront the guy but according to the comments he usually posts with content like "Wouldn't do that feature, mod didn't get too much traction, not effective" I came to realization that he is pretty miserable already and that's probably the only way to get any attention, so not gonna give him one.
Seen a lot of these before, just first time in Zomboid.
Gotta admit Zomboid so far is least toxic so far, people are more into creating than competing it seems.
I just do my best to make all of my mods trivially easy to patch and leave the rest in the hands of fate, tbh, but if someone does reupload your code you can definitely have that taken down.
Nah not THAT blatant unfortunately, but idea is completely mirrored there yeah. The funniest about that is that this mod "is not viable" in his eyes as "its unpopular". Well mate, stop copying other people ideas then, because ideas cannot be copied. 
I'm very curious which of your mods we're discussing. I see many on your page. Also I see you finished your Shops and even seem to have done some controller support; that sounds exciting, definitely gonna give that a try.
oh god
hopefully not to bad for your taste 
Bruh if you even got halfway there I'll probably fix it out of appreciation for the fact that someone tried to do their own controller support for a custom UI
โค๏ธ
are there mods that replace zombies with other things like monsters or such? is it even possible?
seems like my blackouts r still not synced across clients for all players
Bro I'm just getting a chance to read this carefully and follow your voodoo; does this work because the settings folder in your mod falls outside of the Lua checksum and you just load what you need serverside and pass it along?
(Seems like shopkeeper is not gamepad interactable for me... not sure if it's a conflict. Only prompt I can find is "TAB" on screen while near trader.)
i might need to see how the game codes the world power shutoff
i had a quick look at your mod, i think it'd work fine if you just moved most of it to the server and used a server command to trigger/end the blackout on clients
thanks! can you explain what you mean by moving it to the server and using a server command?
right now your code is in shared, which means it's running on the server *and* every client, if you want it to be synchronised you would want to have most of the logic only run on the server (the random chance etc) and just have the server tell the clients when to turn off the power
right now every client is rolling these random chances individually and blacking out their game only
ok, so the folder does matter.
so would that mean basically putting the main functions in server and keeping the event handler in the shared folder be enough for what i need?
i haven't written a formal guide on it yet but here's an explanation i gave a while back of how commands work
well in this case it doesn't, server actually loads on both too, you instead need to prefix a file with if isClient() then return end or something similar to make it server only
ok
the client folder is the only one that doesn't always load frustratingly
i'll have to look at this when i am on pc then
Is there's a way to change fire rate if TwoHandWeapon = FALSE?
i think i understand. so i need to make the roll happen on the server, and the actual blackout happen on all clients
i do this by making the roll server sided and using the result of the roll to send a server command?
yeah, that's right
looking at my files, are the server-sided stuff and client-sided stuff mostly already isolated from each other? or is there anything in either file that should happen on the other side?
for the most part yeah, the moddata stuff should probably happen on the server but the event handlers you use to start/end the blackout are mostly client stuff and the rest looks like it can be server stuff
ok. i'll ask more questions when im on my pc! thanks!
i mean i will see if i already understand first without asking and if i need more help i'll ask! 
good luck!
I had 2 people offer to create translations for my mod, I'm now going through and double checking that things appear properly, but the diacritics from other languages appear to be problematic in Zomboid's UI, but in Notepad ++ everything looks correct. Is this an issue with how the translation file is encoded, or is it that my system is set to English and not using the correct text formatting?
the file might not be saved with the correct formating
there's a table on the wiki showing which formatting to use for which languages https://pzwiki.net/wiki/Translations#Languages
This was the issue, all Notepad was defaulting to UTF-8 and German/French really didn't like it. Found a file with the right formatting and overwrite what was in it and renamed the translation file and now the text appears correctly.
I'll have to look in Notepad++ and see where exactly those encoding settings are or how to configure them properly, I couldn't find any encoder named Cp1252, Cp1250. The closest thing I could find was Windows-1250/Windows-1251/Windows-1252.
Hello everyone, I am new to zomboid modding and wanted to ask if there were any guides people recommend for weapon mods.
Does anyone know how to get context menu items to be unclickable if certain conditions are not met? For instance the option should show up but it cannot be clicked because you don't have a certain item in your inventory
Do items have metadata, where I can edit and add my own information?
Edit this event here and do your logic, https://pzwiki.net/wiki/Lua_Events/OnFillInventoryObjectContextMenu
You can filter and trim whatever you like
People have no shame, one guy made pretty much the same thing I do (a minor change mod) and when I said that this has been done before they proceeded to trash my mod for every tiny detail. Meanwhile everything they said was false and inaccurate and their mod didn't work.
Also when a popular modder made another copy mod and people called it original, I said it was done before and then a fake reddit user praised them for being popular and that justified it. Then they deleted the account.
yep folder outside media doesnot get checksummed
and there is no need too, unless you host. JSON is stored server-side anyways
client always requests fresh copy from server
Eh, makes complete sense, but there is one I always say to myself - if somebody copies you, that means you are good at it.
is there an equivalent of "SendCommandToServer" but for running a command directly from the server?
์ฐ๋ก โ ์ด์ ์คํ 9:44
heya guys
does anyone knows if GIF is able to be played in project zomboid ?
is there any way?
Does anyone know if a 3d object in PZ can have multiple textures? I see many FBX files with 2 or 3 texture files as opposed to just one. Thank you
You can make a script model that uses model A and texture B. So yes?
Thank you for the reply. I know that I can have multiple scripts to make one model, say a can, have multiple textures. maybe for 3 different sodas, but what I found was a single object fbx file that actually has 3 different texture files to load into it. simultaneously...
I would imagine the fbx file would need to be rewrapped with one UV map instead of 3 for it to work in PZ
You still need to make the script model no matter what a fbx file has.
Thank you ๐
at least I know what direction I need to go in... crash course in blender...
oh I see now
completely different topic, is it possible to change a sprite into a container during Events.OnLoadedTileDefinitions.Add()? I have tried doing it but it fails. Either I am missing a property or the way I am trying to set the values...
yes, with:
local props = manager:getSprite("location_business_distillery_01_0"):getProperties();
props:Set("container", "crate");
props:Set("ContainerCapacity", "50");
Np
Exception thrown java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "zombie.core.properties.PropertyContainer.Val(String)" is null at CellLoader.DoTileObjectCreation line:136.
tried this as basic as I could figure and it still pulls this error...
makes me think there is another value it needs to have set
properties:CreateKeySet() I find that you also need to do this in order for the properties to update and be able to copy properly into the square properties.
I would imagine before the values are set?
After
thanks, just tried before and it killed the chunk again. Nice to see half the house blown out though ๐คฃ
doh! same error... even afterwards
where did you put the script?
in shared ?
No, that's where it should be, I just don't know why it's giving you that error because I tried it and I don't have it
so weird, yeah... I saw this come up in the history on this discord for a bit and this was not my first test. I tried just about every way to write it and it hits the same wall every time.
Trying to get around calling this sort of change in LoadGridsquare
Reason: Bad word usage
i have a server im hosting and i was wondering if it would be possible to teleport between two map in the game. for example
map one would be the vanilla map, map two would be a standalone map. and the players in the world would be able to transfer between the two anytime. is this something that would even be possible ?
you cannot move between MAPS, but you can warp huge distances (so far away, even outside of the normally accessible play space, it might as well be a new map). I'm assuming this is how people do RV interiors, or basements, but I have no idea.
MrAtomicDuck has a video on doing an "elevator" that teleports players to a "dungeon". heres one of the vids where he talks about it. maybe this could lead you in the right direction...? https://www.youtube.com/watch?v=b_DLKU8-V0E
Thank you this is perfect
GM folks and thanks to @bronze yoke for mentioning BeautifulJava. Much easier than using Capsid.
Yes, vanilla admin/debug functions do this. You can search the vanilla lua to see exactly how they do it
I could use a little help understanding modData relating to world objects generated and spawned into the map. My intention is to create new kinds of generators, to allow propane and dual-fuel generator usage, but I'm not sure how I can set up modData to be assigned when the objects are generated. Sorry if this is a basic question or I'm missing the obvious reference/documentation!
Uh-oh. IsoGenerator inherits from IsoObject, where setModData seems to come from IsoThumpable extending IsoObject... Presumably that means generators can't have mod data set directly?
Maybe there's a way to hack it into the global mod data, but that seems inadvisable if there's another solution.
NVM, setModData isn't the way to do this:
does anyone know where in the code catching a cold is?
BodyDamage.UpdateWetness โ same class, setHasACold
I actually use a generator to force the power and give me usage data only and then control it through another sprite in the same square with moddata. That way I can piggyback a larger fueltank and create things like the auto start on the silo generators in functional appliances. All smoke and mirrors...
Clever, and Functional Appliances is the name of your mod? I'll check it out!
Hey guys. Hitting a brick wall a little bit here, was hoping someone might give me a direction.
Trying to make a mod connected to farming - an alternative to "removing furrows" of sorts. I started by just adding a copy of furrow removal action to the context menu, like this:
`function testShovel(player, context, worldobjects, test)
local sq = nil;
local currentPlant = nil;
for i,v in ipairs(worldobjects) do
local plant = CFarmingSystem.instance:getLuaObjectOnSquare(v:getSquare())
if plant then
currentPlant = plant;
sq = v:getSquare();
break
end
end
if currentPlant then
context:addOption("Worms test", worldobjects, ISFarmingMenu.onShovel, currentPlant, player, sq);
end
end
Events.OnFillWorldObjectContextMenu.Add(testShovel);`
The action gets added, it seems like the player and other global vars are being read correctly, but when I click on the new action, I'm hitting an "Object tried to call nil in walkToPlant" error (call to walkToPlant is the first line of ISFarmingMenu.onShovel that I call with my context menu function).
I did LUA modding before, but not in Zomboid, so if there's any guide that covers this particular topic, I'd appreciate it.
Your problem is naming ambiguity throughout the vanilla files ๐ฆ
In ISFarming.onShovel, player is a player.
(As, in my opinion, it should be.)
Meaning an object with data and functions and the whole shebang
The controller and holder of a player's data, position, actions
But in OnFillWorldObjectContextMenu event function code, player is (often/usually) only the player's index. ๐ฆ
My signatures (for OnFillWorldObjectContextMenu events) therefore look like this:
JukeboxMenus.load = function(playerIndex, menu, worldObjects)
That's a function that gets added to OnFillWorldObjectContextMenu in one of my mods.
You can then say local player = getSpecificPlayer(playerIndex) if you need the actual object.
Which you do
@jaunty glen
for test, v in ipairs(............
Try that
His problem is definitely the player reference unless he is hiding code above (because the player he passes is really playerIndex as described above).
Here, he calls:
context:addOption("Worms test", worldobjects, ISFarmingMenu.onShovel, currentPlant, player, sq);
which, as written would rely on player from:
function testShovel(player, context, worldobjects, test)
and call
ISFarmingMenu.onShovel(worldobjects, plant, player, sq)
The problem is...
ISFarmingMenu.onShovel = function(worldobjects, plant, player, sq)
if not ISFarmingMenu.walkToPlant(player, sq) then
return;
end
onShovel expects a player object for walkToPlant
which becomes increasingly obvious when you check its signature:
function ISFarmingMenu.walkToPlant(playerObj, square)
if ISFarmingMenu.cheat or playerObj:isTimedActionInstant() then
return true;
end
Again, realizing player is playerIndex in the context menu code and using it as such will give onShovel the info it needs. Although might also be wise to ensure you find a albion wins againsq before adding that option, too.
but there can't be a plant without there being a square
Player is passed down isnt it?
Oh NVM you're saying the player info being passed down is the player index number
@bronze yoke i found the exact house from the screenshot and recreated your thumbnail
LOL (context missing, spammer reported and kicked)
LOL, i think it was just my random spawn for the save i was last testing in
Does anyone know how to make the "WorldStaticModel" function work properly in relation to a clothing item??
The model path connects for the item itself when worn, but it's been having issues connecting to the model used for the floor. I suspect this is a coding issue?
Is there anyone that takes mod requests? specifically Weapons and clothing
ask in the modding discord
can i get an invite or?
unlock your dms
should be fixed
Wow. I did NOT expect so much input so fast ๐ Thanks a lot guys.
@thick karma , I actually noticed that "player" is just an index, not an object, just didn't know what to make of it. Now that you pointed to onShovel definition... It did become obvious.
So if I got you right, I should be doing this:
`function testShovel(playerIndex, context, worldobjects, test)
local player = getSpecificPlayer(playerIndex)`
Hey @bronze yoke, you mean that instead of if currentPlant then, I should be doing if currentPlant and sq then? Thanks. That was going to be the second problem after the current one I guess ๐
no, that's what burryaga suggested before editing his message - it isn't necessary
you use sq to find the plant, if there's no square you wouldn't get that far anyway
๐ค makes sense. Thanks again ๐
That's how I prefer it. local player = getSpecificPlayer(playerIndex). Some people prefer local playerObject or local playerObj (I personally don't like abbreviations in most situations). I strongly reject calling the player index player and find that style highly misleading but you will see it often so be mentally prepared.
And yeah, my bad about the sq confusion; I misread that part.
But the most important thing is to know the type of variable you're passing at all times (and how it will be used when it gets there).
Whatever you call it.
I agree, and the expected type as well.
There are actually quite a few playerObj's in vanilla code, ambiguity, like you said
Yeah, and sometimes character
...which makes even more sense than player come to think of it ๐
it is, after all, not a player, but a player's character
I can see the argument to be made for either word. I think a clear standard should have been set early but unfortunately it is very late in the game for that. I think most people would know you didn't mean playerIndex if you said character when reading your code. Usually, vanilla character only shows up in their classlike modules that are used to instantiate objects; so you'll access it e.g. as self.character. Some modules use the distinction self.player => index, self.character => object, where others use self.playerIndex => index, self.player => object, and I'm sure there's some using playerObj somewhere. A lot of functions I've seen seem to prefer playerIndex, player, but I haven't counted up the various uses or spent equal amounts of time in every file of the game by any means. The OnCreatePlayer documentation favors playerIndex, player, and for me I think that helped set a tone from the beginning of writing a mod involving players on what to use.
I would say self.character is less ambiguous in Zomboidland. Oh, and sometimes you'll see isoPlayer. That's fair enough but I don't love the way it looks lol.
isoPlayer is somewhat logical as the only referenced instance of an IsoPlayer in some generic context.
But... ugly? lol
I just don't love the weird abbreviations, they make my code feel less readable
I understand it means isometric
I just don't like it
Or I should say, honestly, I think know that it means isometric, but the person who initially wrote IsoPlayer has never personally confirmed this for me, so how can I really know, and that's why I hate it.
๐ญ
it's better than the lua
it's a pretty safe assumption that the iso- classes mean 'isometric'
but the lua IS classes?
also isometric? Indie Stone?
Seen a lot of those in the code, been thinking that as well. My money's on "Indie Stone"
well, they said way more than once that B42 is a complete overhaul, maybe some clarity will be introduced there?
I know whining about "b42 too long" is a bad tone, but they've been working on this update for over 2 years now. Honestly I can see them spending a week or two purely on renaming variables. Compared to 2+ years it's nothing
Reason: Bad word usage
uh-oh
Anyone have a guide to setting up spawn locations from map mods on a dedicated server?
We can dream. ๐
Refactoring their local variable names would be cool, but the problem is the object variable names. Countless mods reference those and to change them would break many unnecessarily. So I think they may feel a need to weigh value of consistency against value of stability for the playerbase.
I'm trying to make a mod that adds a book, I want it to affect two skills (Electricity and mechanics), but I don't know how to put it in the script in SkillTrained.
I thought about just separating both skills with commas, but it doesn't work lol
You will need a new custom lua read action for this.
Oh, is there any place where I can read about how to do that?
You could ask Albion who has a literacy mod maybe to add this functionality.
Needing to modify logic in ISWorldObjectContextMenu.createMenu is... rough...
Certainly wish more of this was broken up into individual overridable segments, if not dissolved into some kind of "handler" abstraction which would allow configuration closer to the type of objects.
Anyone familiar with modifying context menus and know if there's an easier way to hook into it?
There are OnFillWorldObjectContextMenu and OnPreFillWorldObjectContextMenu
Both fire when you right click in the world
So if you need to just add an option you dont have to hook into vanilla context menu
I need to override the vanilla code applying to generators, unfortunately
There are item predicates and other bits and bobs declared locally
Well in that case store tbe old function in a var and call it in your declaration of the create function for context menu you should have all the local stuff from the old one accessible in your new one
Unless they store such options in a global table
You won't have access to the variables local to the function by calling it in an overriding function, but it does define stuff as globals (unfortunately, I would argue) like generator
So do you expect that I can call the vanilla ISWorldObjectContextMenu.createMenu function, then go back to nip and tuck? I know how to add context menus, but haven't looked at possibly removing and reworking them.
Those are the options I can observe right now: Replace the entirety of the function, or run the original function and try to remove old generator entries + create new if applicable.
For reference, I'm trying to modify generators to sometimes run on gas, sometimes propane, and sometimes be dual-fuel to select between either. The use of local predicates related to petrol is problematic.
It's certainly possible to modify existing options in a context menu & that'd likely be a cleaner option than replacing the whole thing. I've done so for the chat context menu & others and I think in both cases I just added an event handler for the relevant event (this is not the case for the chat menu, since that had to override onGearButtonClick instead)
Do you have a GitHub (or other) link to an example I could look at, or would I need to download one of your mods to take a peek?
I'll grab a relevant example on GitHub, one sec
https://github.com/omarkmu/pz-omichat/blob/dev/Contents/mods/OmiChat/media/lua/client/OmiChat/Overrides/Menu.lua#L360-L385 May not be exactly equivalent to what you need, but you can modify options in this way as needed. See Overrides/Chat.lua for more examples of modifying/adding options
I appreciate you taking the time to help me out!
Hi! I am currently trying using TileZed to unpack some texture .pack folders in Linux. What I can do is opening them in TileZed's .pack viewer but I am unable to extract them so that they become a normal image file (for example .png). Is there a special procedure to accomplish this? I just tried the "Extract Image" option in the .pack viewer but no success so far...
In the "Extract Image" option, what am I supposed to write into the field "Prefix"?
How can I move items only on the server side? I need a way for the server to pull an item from the player inventory, and put it in a container
I know that I can use addItemOnServer to move an item, but do I have to remove it too from player inventory too, right?
Hey guys, me with the shovelling thing again ๐ฌ
I do this.
ISPlowAction:new(player, sq, handItem, 110)
It works as expected, one thing I want to do is to call a function after this timed action is finished. Is there an event I can subscribe to, or should I check every tick if this action still exists in the queue? (Seems sub-optimal so I'd rather use a better way, if there's any)
I know I can alter ISTimedActionQueue:onCompleted(action) to do what I want when the specific action is finished, but I'd rather not mess with vanilla functions if I can help it.
i'd probably just hook ISPlowAction.perform/stop
if your changes are significant you might want to just make a new timed action that inherits from it
You can call ISTimedActionQueue.addAfter, it's used in several places in the vanilla code
I also did some workaround stuff in Item Searcher where I pass through the table of "next attempts" for searches so the end of the current action can queue up what's next, but having seen addAfter I'm thinking it can be removed ๐
I do this...
Is there a folder/download for the file structure for hair mods? I have 0 modding/coding experience but am t try ing to see how possible it is to add some hairs into the game and I find the file structure from the guide to be uh. Confusing for my dumb ass.
And to add insult to injury Iโm on a Mac so ๐คข๐คข๐คฎ
If that makes a diff
Looks good, thank you
or if someone can confirm this is the structure that would be cool ๐ญ
(this is just empty folders btw)
You can also use RemoveOneOf("Popcorn") which will just grab a popcorn out of the player inv/backpack
Does anyone have a link to the female body model in PZ? The links i'm finding are dead :(
i can find the male one but not the female one ๐ญ
i found it never mind!

I'm trying to get the 'Sleep' slice in the vehicle radial menu so I can adjust the text in it's confirm dialogue to include additional info about the player.
The only getSlice method I can find is in RadialMenu.class but it's private. Is there a file that I can look into for an example of how this might be done? The only things I've been able to find so far is adding new slices :/
If you're trying to adjust the text in the sleep confirm dialogue, why not hook into the ISVehicleMenu.onSleep directly? (or edit the whole function in that case)
I'll give that a shot, I just had no idea where to look. If it's not on the javadoc (or I can't find it) I'm a bit lost at that point. Thanks for the pointer!
Search for the text string in translations inside the shared folder, once you find the text string search the client folder using that result and you will see what functions call that text string
Noted for future reference, thanks!
If I'm editing the whole function, is this the correct way to do so?
I more or less just need to change the string used from getText("IGUI_ConfirmSleep") to one I'd calculate in the function
This seems to just keep the old function however, the text remains the same
because you're calling the old function
another approach would also be simply changing the translation itself, though idk if its possible to easily overwrite vanilla translation
Also noticed that it was erroring out because I was trying to do local old_ISVehicleMenu.onSleep = ISVehicleMenu.onSleep instead of local old_ISVehicleMenu_onSleep = ISVehicleMenu.onSleep ๐
haha happens
does anyone know what to do w/ this? i've double, triple, quadruple checked my file structure and i'm certain it's correct i'm dying
What's inside the 'Contents' folder of your mod?
lmk if this isn't helpful but that's everything
aaaaaand i see i didn't expand the textures folder. but there's nothing in it.
JUST in the contents folder is the preview.png (which, when i deleted it, zomboid got mad) and the mods folder
Move preview.png out of /Contents to be at the same level as the Contents folder
Should look like this:
it is D:
Oh nvm
sorry i'm not good at explaining things but that's everything/the file order
and i'm like
SO CERTAIN it's right but please correct me if i'm wrong..?
i even double checked with another hair mod in the steam workshop folder to see what other ppl did and it's...this. shot for shot.
so clearly people are SOMEHOW successfully uploading with this structure..?
That's the issue
lol
i thought i could do the cmd+shift+. thing to find/delete those but NO!
That would be too easy of a fix for Apple
thank you and i hate apple. idk who the ceo even is. but i hope they have crumbs in their sheets.
this is what i get for trying to work on stuff while not at my home pc LOL
hahaha
i was literally thinking "doesn't mac do that stupid thing where it just makes random dumb files..? nah, it wouldn't do that..."
GRR! i've been agonizing over this.
THAT WAS THE PROBLEM WHY DOES IT DO THAAAAT!
AAAAAA once again i hate apple and this is what i get for having the inferior computer. thank you so much.
Pleasure!
I thought that might be it, so I commented out the line and forgot to save before resetting Lua. It now updates the tooltip and (thankfully) it creates the ui every time the sleep button is pressed. Thanks!
Glad to hear it works! :)
I need to ask how to upload a mod to the workshop
I finished mine but have no clue how to upload it
anyone interested in making a gambling mod? maybe simple slots players on the server could play to try there luck, possibly other types of gambling games like black jack not sure what the complexity would be of that. also i was thinking for pool tables allow players to challenge others in pool and bet money on it basically its a game of chance who comes out on top and the winner of it gets the money. this could also introduce a billards skill type thing and the more you win the more you level it and it slighly gives you a modifer to increase your chances of winning. if anyones interested in working on something like that let me know im willing to comission it.
You have a finished mod in mods/YourMod?
I don't quite know what that means
Sorry just seeing this. You said you finished a mod. Where is your mod saved?
To a folder that came from the workshop
I uploaded it and used the example mod folder
Uploaded it where? You mean downloaded it?
By where is the mod saved, I mean exactly where? What is your mod's filepath?
@gleaming sorrel
Ohh
I'm trying to figure out what level of organization you've reached when you say you have a finished mod but need help uploading it. It's clearly not finsihed in the sense of "ready for upload" so I am trying to figure out exactly what you mean. Are you missing the Workshop-level directory? Are you missing images? Are you missing the link from Contents to mods? Do you have workshop.txt filled out?
Or do you have a working Lua file in some other mod that needs to be entirely relocated to its own mod? Or is your file buried in a generic template directory structure that needs to be adjusted to reflect what your mod does?
I have everything I need
Mostly because it's someone else's structure that I used with their permission
It's saved to program86%->steam->steamapps->workshop->content->108600->3152792427
Then the inner files are
Mods->
Knox Infection->
Media, mod.info, poster, ReadMe.txt->
Textures->
Body
Then all of the textures
As that's all the mod does
Well, assuming you've tested and confirmed it 100% works (I thought several of those folders had to be lowercase, but I could be wrong), you have this. @gleaming sorrel
No they are
It's just auto capitalize is on my phone
Mods/Knox Infection (which I thought had to be mods/Knox Infection) is mods/YourMod
Okay cool
You need to put mods/YourMod inside a folder called Contents (written like that), then put Contents in another folder with your mod's name (Knox Infection if that's your original name), then put that folder in %UserProfile%/Zomboid/Workshop.
Then you go into %UserProfile%/Zomboid/Workshop/Knox Infection and you make a preview.png and a workshop.txt adjacent to Contents.
workshop.txt needs something like this:
version=1
title=Knox Infection
description=Your mod description on Steam.
tags=Build 41;Items;Misc;Multiplayer;Pop Culture;Realistic;Silly/Fun;Traits
visibility=public
(but probably remove / change some tags).
Do I make my own contents folder?
I know there is one already for the workshop
Yes.
This is going in a specific place.
I should have clarified that. create Contents, and then put that in a newly created folder named after your mod.
After you do everything above you can go into Project Zomboid and select the workshop tab and find your workshop item there and upload it through the available menus.
Thank you
Good luck!
Is it possible to make a mod to limit the gameplay to only Ravencreek, Pitstop and Rosewood?
And have the other maps blacked out.
if you go into the mod.info i think you can do like, "require=(whatever raven creek's id is)"
so they can't download the mod or use it without it
i'm new to this/learning so pls correct if wrong
Hey mate, just thought you may find this useful, it covers a lot of basics
https://youtu.be/N6tZujOPnDw?si=i7XX48hAJ22ktvPs
This tutorial video will show you how to make a simple drink in Project Zomboid. I will go into the steps involved from start to finish. Read more below.
0:00 intro
1:08 Start
1:44 Searching for images to use in game
2:30 Searching for the Sound Effect
3:06 Creating mod file directory
3:54 Creating mod.info
4:34 Creating a poster
7:14 Adding ne...
I already uploaded the mod
But ima watch this anyway
I'm actually surprised I was able to follow the steps without getting distracted and forgetting them all
I'm growing stronger
I meant to limit the map only to ravencreek
i kinda want to rip my eyes out and flush them down the toilet. but i made dis. this is literally my first Day using blender so any tips/gentle feedback is appreciated while i try to get this god damn hair mod off the ground...
pls use small words for toddlers and babies my brain is smol
not necessarily ๐ The problem with addAfter is that (as I understand it) all variables you pass to the next action nave to be already filled the moment previous action starts.
In my case, the thing I want to operate with in the second action is the plant that I create with the first action. So it's not there until the first action completes.
To complete the example, this is how I create timed action
local plowAction = ISPlowAction:new(player, sq, handItem, 110) ISTimedActionQueue.add(plowAction);
But I can't do this straight away
ISTimedActionQueue.add(ISShovelAction:new(player, handItem, CFarmingSystem.instance:getLuaObjectOnSquare(sq), 40))
Because until the first action is completed, CFarmingSystem.instance:getLuaObjectOnSquare(sq) will return nil.
So, if the thing you did allows to circumvent this, don't remove it yet ๐
u can do this trick:
local plow_action = ISPlowAction:new(player, sq, handItem, 110)
local plow_action_perform = plow_action.perform
function plow_action:perform(...)
local result = {plow_action_perform(self, ...)}
-- here u paste ur code and it will work as `ISTimedActionQueue:onCompleted`
return unpack(result)
end
tbh u can remove result part cos perform should never return anything but I did it due to some strange author can have a different view and added smth there
local plow_action = ISPlowAction:new(player, sq, handItem, 110)
local plow_action_perform = plow_action.perform
function plow_action:perform(...)
plow_action_perform(self, ...)
-- here u paste ur code and it will work as `ISTimedActionQueue:onCompleted`
end
here's full example
local function updateReadPerform(read_action, player, item, player_inventory, container, callback, with_transfer)
local read_action_perform = read_action.perform
function read_action:perform(...)
local result = {read_action_perform(self, ...)}
if not with_transfer then
callback()
else
local new_item = findNewItemInInventory(player_inventory, item)
if new_item then
local transfer_from_inventory = ISInventoryTransferAction:new(player, new_item, player_inventory, container)
transfer_from_inventory.onCompleteArgs = {}
transfer_from_inventory.onCompleteFunc = callback
ISTimedActionQueue.add(transfer_from_inventory)
end
end
return unpack(result)
end
end
hmm, thanks a lot! let me try that
actually I decided to create my own version of ISPlowAction after all, in this case it's just easier and removes the parts I didn't need anyway. But thanks for your tip, I'm sure it will be useful in some other task ๐
๐ค
Are there resources on adding placed item models to items? can't find it on the modding page
So I got the shoveling thing working ๐ It's better than I first had in mind actually. However, I need another advice on a thing I'm trying to add...
As it is now, player character walks to the furrow when they're about to remove it, fertilize it, etc. One thing they do telepathically though is digging furrow.
I think I can get a grasp why; in almost all actions, ISFarmingMenu.walkToPlant(player, sq) is involved, which in turn is a timed action:
ISTimedActionQueue.add(ISWalkToTimedAction:new(playerObj, adjacent))
Function ISFarmingMenu.onPlow is different from the rest though:
ISFarmingMenu.onPlow = function(worldobjects, player, handItem) local bo = farmingPlot:new(handItem, player); bo.player = player:getPlayerNum() getCell():setDrag(bo, bo.player) end
My understanding is that farmingPlot:new() creates a "blueprint" of a furrow, which is then placed on the ground, triggering digging action.
However, I did not find any declaration of farmingPlot; moreover, since ISFarmingMenu.walkToPlant(player, sq) is a timed action, it is always performed after the furrow is dug, even if placed at the very beginning like this:
function ISPlowAction:waitToStart() self.character:faceLocation(self.gridSquare:getX(), self.gridSquare:getY()) local adjacent = AdjacentFreeTileFinder.Find(self.gridSquare, self.character) ISTimedActionQueue.add(ISWalkToTimedAction:new(self.character, adjacent)) return self.character:shouldBeTurning() end
So, am I correct to assume that this part is happening somewhere outside of LUA and therefore is out of our reach? Or am I not seeing something?
noob question, whats the command to display some text above the player in a function?
That does that
This is for the same text as the level up thing
That's all from the modding Discord, can't tell you more tho
player:say()
player:setHaloNote()
are what you need to look at
Completely new to modding, just THINKING about starting - wondering if it was possible to change zombie behavior based on the outdoor temperature
Does the game have a variable that the temperature is set to (like 0.01 - 1.00) that the game then displays as Celsius or Fahrenheit? And is this variable able to be referenced?
is anyone able to alter the audio around certain areas
proposal: play The Gonk in malls over a loudspeaker or something
Yes it is possible and was already done by a mod I believe
Definitely doable
oh it'd be great to know what mod that was, if the work is already done haha
Give me a sec I'll try to find it
Cheers. I tried searching with no results myself
Oh fuck yeah
know anyone i can contact?
Ask in the modding discord
oh yeah i forgot about that 
ModData.getOrCreate() isn't synced between clients afaik. Take a look at ModData.transmit() or ModData.request(). The notes on these are buried about halfway down the release notes for version 41.51. It might help you with this issue.
thanks. i might actually try going through my mod and rewriting some sections
i could either add a folder for a multiplayer version or just update the base mod if it is better overall for both modes
i think any updates would overall improve the mod, but adding a multiplayer version might make it more clear to ppl who already downloaded it to revisit the mod (within the same workshop entry)
it'd put a maintenance burden on you to update two separate mods
I mean, you could just make sure in the server folder that the code is ran on a server and on client folder that it's run in solo tho idk exactly how your mod handles things
multiplayer code should usually be fine for singleplayer
Yes of course but if he wants to make two parts, instead of doing two mods he can still keep it in the same and it should automatically adapt to multiplayer or solo
Tho maybe I didn't understand the issue correctly from the few reads
Joy is deciding whether they want to add an alternate mod version, i.e. a literal second mod, to the same workshop item so that people can choose the version they want, or update the core mod to simultaneously support singleplayer and multiplayer.
I think it would acceptable to make a secondary mod that could be disabled IFF that mod depends on the core mod and interacts harmlessly with it in singleplayer.
However, I think in Joy's case a single mod would probably work. So my preferred approach would be to update the core mod and just make it work for singleplayer and multiplayer.
In that vein, @rancid panther, I have code that could be trivially refactored from True Music Jukebox to do exactly that if you want some help in DMs.
What I personally would never do is release two incompatible versions of the same mod in a single workshop item.
whether it is multiplayer or not, there are things that have to run on the client, so i cant just make a fully server-sided vs client sided mod. i just need to make the mod compatible with multiplayer with the advice i got here
i just havent gotten to because of school and family responsibilities
thanks for the advice. i'm going to take a nap so i'll pass for now. you can dm me the short of it if you'd like
i'm so busy that i dont even have time to think about or look at my mod rn
I mean again yes and no, really depends what you want to do
Also there's no point in making 2 different mods ? You can already have 2 or more mods for a single workshop page
Hey so I've noticed that drunk and food temp goes down waaay too fast, especially noticable on longer time scales.
I've written a script that can increase or decrease Drunkenness, but unless I trigger it consistently with a timer based on lastDrink age (which is counted in real life seconds, not in game hours), it's frankly useless.
I'm trying to make it so level 4 drunk takes at least 12 hours to go away, which would be 1hr IRL using default timescale. That's about a 10th slower than it currently goes down. But obviously if I just apply a modifier to my script, and only applies to my script. How do I change the base game decrease value?
And along that same line of questioning, what's the function for food temperature? Even on 4x time scale you basically have to eat food within 10 seconds after you remove it from the oven or it goes cold and you get the "better hot" debuff.
how can i use the OnCooked command to apply to every item im cooking? this is what i need to do extra things when something is cooked right? i left the parameter empty and it doesnt seem to work
this doesnt work, looks too simplistic to me to work but thats as much as the wiki gives me and i cant find the function in the files
`module OvenAlarm
{
imports
{
Base
}
OnCooked = SoundAlarm_OnCooked,
function SoundAlarm_OnCooked()
player:Say("My meal is done!")
end
}`
that i put in lua folder yea?
oh nice thank u
Hi! I am currently working with an object which is derived from ISUIElement. This comes with a render() function which is constantly executed to display graphical ui elements. Is it somehow possible to make it so that the render() function is called more often? Afaik, it is by default called on every three ticks. Is it possible to call it on every tick for example?
the ui has a separate framerate on purpose to save performance (rendering the ui is by far the most expensive part of the lua), you can change the ui framerate in your game settings or do what you need to on your object's update() function
update() function sounds good! How exactly is this supposed to work?
i'm unsure if it's safe to just call your rendering stuff on update or if there's some special context when render() is called but it's worth a try
do you know when the update() function is called?
it's every tick if i'm remembering right
kk. this might help. thanks!! I already tried to experiment a bit with the onTick event but wasn't able to transmit the "self" (which is required for rendering stuff). But update() might help then...
a trick to use events with self```lua
Events.EventName.Add(function(...)
object:method(...)
end)
-- Decrease Drunk Decrease
local lastDrunkennessValue = getDrunkenness()
function decreaseDrunkenness()
local currentDrunkeness = player:getStats():getDrunkenness();
local decreaseAmount = lastDrunkennessValue - currentDrunkenness
local modifiedDecreaseAmount = decreaseAmount * 0.1 -- Adjust the modifier as needed
setDrunkenness(currentDrunkenness + modifiedDecreaseAmount)
lastDrunkennessValue = currentDrunkenness + modifiedDecreaseAmount
end
This is the code I have currently written. Its not working as intended, I think I've missed a callout somewhere.
So smth like this???
-- function with a self
end
Events.OnTick.Add(function(data) MyCode:MyFunction(data) end))```
you'd need the object when you're adding the event, e.g.```lua
obj = MyCode:new()
Events.OnTick.Add(function(...) obj:MyFunction(...) end)
unless you're mimicking a singleton pattern, then what you had would work
kk. So obj is just the self I need for my function? And the brackets (...) may contain additional parameters?
yeah, ... stores all the parameters sent to a function
using it here to just pass it to the class function regardless of what event it is
in your implementation you might just prefer to write out the parameters
Many thanks! I just tried this onTick construction and it works like a charm!!
One last question: How do I remove such a function from the event? Is it the same command but just with Events.OnTick.Remove instead?
Hello! I just joined this server because i need some help with a school project. Iโm a game design major and my midterm project is re-doing some of the sounds for project zomboid and packaging it as a mod. I have no prior modding experience. My question regards a sound effect found in the tutorial that is attached below as a short clip ( sorry for the quality ). Does anyone know what the name of this file is in the sound bank? i have been searching forever and cannot find it. Any help is appreciated :)
Wtf is even that sound lmao
Also very interesting project to work on PZ. Tho one issue with bank files is that they need to be manually installed in case you didn't knew
I'm interested if you find a way for no manual install tho
I ... Might have something related to a tutorial zombie sound, check out the script file for zombie sounds and bottom should be a tutorial zombie sound but idk what it id, could be that ?
No idea if it'll help you find the sound within the bank file but hey that's something at least ?
iโll take a look! thank you! iโm also using Fmod to edit the bank files
Zombie dinosaur will be insane
its not packed.
\steamapps\common\ProjectZomboid\media\sound\fzombierand5.wav
what school btw @azure onyx
George Mason University 
think my group and i got it figured out, thank you all for your help :)
Hey, I'm only in PZ modding for a few days, so I can't offer you a confident advice, but I hope you'll get it - this sounds like a mod I'd use, things like food temp, drunkenness and highness
do pass too quickly in this game!
As for your questions, AFAIK food temp only influences the amount of happiness bonus. If I had to guess, I'd try to find and override the variable that defines how many ticks each state lasts, but again, I hope someone more experienced offers your some advice as well!
Hey guys, I'm just wondering (maybe veterans or veteran modders would know) if it would be possible to make a custom map to give to players, only containing writing, sort of like a pre written to do list.
I wanted to give them to players in a 10 years later world as soon as they spawn in with a new character. Maybe I could create a map and upload it as a mod, then edit the physical map.
I am no veteran but the steps I would take, if i want to make it possible:
-
Create an image item with custom designed map.
-
Create a item script and a script recipe that would run ISimage .lua
-
code the .lua to show the custom map image when interacted
-
use Event.OnNewGame.Add(function) to run the .lua function that would run a snippet code which add item to the character when game starts
-
Use functions like getPlayer():AddItem(args) within the item giving function
-
test in the game
And ofcourse there are much easier ways like using ingamemap items to call the image you saved etc etc.
you'll need to store the function somewhere before adding it to do this, running the same thing won't work as it searches for functions by their pointer and that would just create a new function that does the same thing
Hey dude. That's a powerful tool you got there. Should be pinned or something, can save a ton of monkey work
Doesn't work for me though ๐ฆ An error says:
< Translating mod: digworms > Traceback (most recent call last): File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 365, in <module> main() File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 357, in main elif try_translate_mod(root): ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 340, in try_translate_mod Translator(translate_path).translate_main() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 52, in __init__ source = self.config["Translate"]["source"] ~~~~~~~~~~~^^^^^^^^^^^^^ File "C:\Python312\Lib\configparser.py", line 941, in __getitem__ raise KeyError(key) KeyError: 'Translate'
Think I did it as instructed (although your readme says to run path_to_script/pz_translate.py while it doesn't exist, so I run path_to_script/pz_translator/translate.py)
I have Python 3.12.0 if that matters
Broken mod
Eh?
You mean the mod I try to translate? Any way to find out what exactly is broken?
I think there is a syntax error or {};
better don't use anonymous funcs while ur in dev stage cos it can bug and previous anonymous func won't be replaced
But the mod works, including localization strings :/ it wouldn't be working if there was a syntax error, would it?
check pm
Didn't find how to do that thing, so I decided to leave it out.
I think the "Shoveling thing" is ready to be published ๐
https://github.com/toomanynights/digworms
I would appreciate a bit of a code review though. it's my first Zomboid mod, so I imagine I did a lot of things wrong.
is there a way to make a loop to go through all food items and change the value of a variable or would i need to do it by hand?
wdym ?
Change what ?
i need to change the OnCooked parameter to all items that are cookable, im sure i can manage that check but trying to figure out the correct synthax for the loop
by default its blank for all i believe#
as in i can manage checking if the item itself is cookable but trying to figure out how to reference the items_food script and search it with a loop
Is that something in the script file ?
yeah its a vanilla file
I mean in the script file or lua files ?
item script is txt
projectzomboid/media/scripts/items_food.txt is the one i need to search
item:DoParam(โOnCooked = my_funcโ)
that will set it right? i kinda thought to do a loop of all food items just in case there is modded food
cos with this method id have to hard code each item separately right?
or am i just reading that wrong
you get ScriptManager i think and it can get every item
You then just filter by item type and add your oncooked func
sweet thanks ill get onto it ๐
function fires correctly already but i only have one item it works for for now ๐
how does it bug exactly? i've never come across this
if it's to do with file reloads (most issues like this are) i don't use them anyway
yea, with reload
idk what's more issues can be with file reloading
single issue that I got for all time is events with anonymous funcs
all event handlers are prone to issues unless you have specific handling for removing them if the file is reloaded
and it doesn't scale well with modules
yes that's what I'm talking about
if you do it globally you will also overwrite any recipes that have an oncooked function already
oh so i can somehow set it globally to all applicable items/recipes easily?
for this hair mod, is my lua correct for hats? I can get the hair to show up with no hat on, but hats make it disappear
i threw the same hairstyle in all groups cuz...testing.
actually, i'm noticing whenever I export the FBX file it's only exporting the armature even when I select the shapes...weird.
Hey guys! I am currently trying to make a mod that add hats, but somehow I ran into a wall. I got my item script, and the XML sheet in clothing/clothingItems. I must miss something - when I use an existing hat (I use ChefHat) with my script item, it works. When I rename the ChefHats XML file, and link my script item to the renamed XML file, it all stops working, even though it should just pull the ChefHats model and textures. What am I missing?
did you made an entry in your mod's fileGuidTable.xml?
fileGuidTable.xml What is this?
When adding a new clothing item, your mod must also contain a file called "fileGuidTable.xml" which lists all the new modded clothing items (in addition to the script.txt and the .xml files in clothing/clothingItems). Best idea might be to have a look at other clothing mods to get an idea of how it works.
Is the guid random? or does it have to be specific?
The guid number of your clothing.xml must be the same as the guid number in the clothing item's entry in fileGuidTable.xml. The number must also be unique for each clothing item but using a random guid generator should do the job. Such a generator can for example be found here: https://guidgenerator.com/
Free Online GUID / UUID Generator
Ahhhh! Awesome! Now my last question: does the file have to be named fileGuidTable.xml (exactly likes this)? Or should there be some variation? As in scripts, when I dont change the scriptname I override the vanilla scripts
Should have exactly this name and located in yourMod/media
to see how the fildeGuid has to be organized, check out some clothing mods from other people
Awesome dude! ๐ Thank you a thousand times for your help, thats awesome
how are you guys feeling about b42
its gonna make redundant countless qol mods and ruin loads of map mods
the performance optimizations are exciting imo. and i think i'd rather have to download less mods than have to keep layering them on, so i don't mind the redundancy.
Mods will be fixed after some one or two months for the big ones
I spent many hours making Wookiee Gamepad Support do what it does as well as possible... If Build 42 genuinely makes all of the things I did redundant, I would be literally overjoyed.
I WISH vanilla Zomboid had that level of gamepad support. Please make everything I ever did redundant, Zomboid Santa.
That's fine, there will always be something left to mod...
@rain rune @crystal oar
Bread needs to acquire a new file
Validating now.
So that could be significant to this issue.
was this supposed to be in #mod_support ?
all good lol
how would i get the size of an ArrayList? this doesnt seem to work
local items = getScriptManager():getItemsByType("Food"); local int se = arrayList.size(items);
items:size()
local items = getScriptManager():getItemsByType("Food");
local itemsSize = items:size()
print(itemsSize)```
perfect no more syntax errors, but size comes up as 0
should i make it global or something or do i need to import the file
with the food items
thanks by the way, im tired 
i don't think it'll work the way you're expecting it to to work since "Food" is more of a category
This is meant to be used for something like "Needle"
hmm so i have to getAllItems() and check for type variable? in the scripts food items have type set to "Food" thats why i assumed
yeah with getAllItems() i get 2285 size, thats disappointing
kill me this way doesnt work either ๐ without the if statement it prints out Food
`for i = 0, itemsSize-1 do
local c = items:get(i):getType();
--print(c);
local f = "Food";if c == f then print("Found Food, Loop: ", i); endend`
local items = getScriptManager():getAllItems()
for i = 0, items:size() - 1 do
local item = items:get(i)
local itemType = item:getType()
if tostring(itemType) == "Food" then
print(item:getName())
end
end
Should work
item:getType seems to return a IsoObjectType rather than a string
yess thank u so much
maybe i can make that other function work so
getitembytype
Good evening everyone, I would like to ask a question. A while ago I managed to download PNGS tile files
(I want to repeat the process to make a model with reference to this tile)
However, 70% of the tiles do not appear here in this tool, and I don't even remember how to download just one specific tile as an image
I probably don't know how to do the tile import process
The import is fine, those places are empty to organize the tiles better. As for downloading a single tile as an image you can't, you have to search for the tilesheet that has the image you want in Steam\steamapps\common\Project Zomboid Modding Tools\Tiles\2x and crop it from there.
Hello! Just wanted to say that after literally months of trying to fix an issue in my mod, where in multiplayer, if you try to change an item's name in a container that is not main inventory, the new name wouldn't stick, I finally managed to fix it by simply using the following snippet after setting the new name. :')
item:getContainer():getParent():transmitCompleteItemToServer()```
Edit: nvm solution duplicates the containers for some reason
That was me, I didn't know the config should've been put in a main folder. ๐คฆโโ๏ธ
Anyway, can someone pin the post about Poltergeist's tool? It's so amazing, all translations done in just seconds without any fuss.
@thick karma hey mate ๐ you've helped me with my mod so much already, maybe you could spend a few more minutes on a code review? I'd really appreciate it ๐
https://github.com/toomanynights/digworms
Hey guys! I am trying to get the hair textures, whom I guess are hiding in the characters.pack file. TileZ cannot open or display or extract this one pack for me. How do I get to the needed files?
I know about the F_Hair_White textures etc existing outside of the .pack, I am specifically looking for all the colored ones
Or maybe even better: Is there a way to implement the color-pick-stuff that we have in character creation to ingame itemcrafting? As in being able to pick on crafting, wether a shirt is red, blue or black?
About to get up for work but I can DM you later for sure
Reason: Bad word usage
Won't transmitModData work?
is there any one source of documentation for PZ modding? I'm beginning work on an Archipelago Randomizer integration for Zomboid and would like to know where to start with research
https://pzwiki.net/ ya can basically fien everything here and a bunch of references and libraries good luck ya got a tough one on ya
thanks. And thanks for the wishes, thankfully im not working on this alone
Hey again @frank elbow! I'm adapting my code from your example, and wanted to ask what your motivation was for grabbing the player off of the context menu option, instead of using the first param passed to your onContextMenu function (which you have wired into Events.OnFillWorldObjectContextMenu), as well as the isParamPlayer check that verifies player is an instance of IsoPlayer? I think my case might just be a little more complicated, and param2 for the context menu option doesn't always end up being the player, whereas you were always able to count on param2 being the player.
In that case, the player from the option is the player to trade with (since it's specific to the Trade context menu option). The one in the first param is the local player. You likely won't need to access param2 for your use case
Might be clear from context but just in case, the purpose of the snippet I sent is using player names rather than usernames in context menus (which is why it involves another player)
Aha, thanks again for the quick response. Chipping away at this as I get time, hoping to have a prototype working this weekend or so.
Reason: Bad word usage
where in the files can i find the getter functions? trying to get the value of IsCookable but getIsCookable or getCookable gives errors Found it cheers!
hi guys, don't judge too harshly, first question
I have a Lua code that runs on the server and creates zombies near the player. After that I want to add items that zombies will have after death.
a zombie is created, but after death the set of items is standard. I suspect that the problem is in zombie synchronization between the server and the client. How do I start the synchronization process?
local zombie = helper.createZombie(player:getX() + 3, player:getY() + 3, player:getZ())
zombie:clearItemsToSpawnAtDeath()
for i=0, playerItems:size()-1 do
local item = playerItems:get(i);
if item ~= null then
print(item:getFullType())
if (item:getFullType() ~= null ) then
zombie:addItemToSpawnAtDeath(item)
end
end
end
thank you in advance
why does this throw errors
local stk = getScriptManager():getItem("Base.Steak");
print(stk:isCookable());
Its isIsCookable
ugh.. thanks again!! can u tell me where do u find those?
In the javadoc for pz
Javadoc Project Zomboid Modding API declaration: package: zombie.scripting.objects, class: Item
oh i was checking InventoryItem tyvm again
you might want to flag the zombie with moddata, then use OnZombieDead function and check for the flag, if flag is true then you can add items to the flagged zombie that is killed
Not sure that is option for me, but thanks, I will try
Is any another option for sync objects/zombies with clients from server-side?
you might want to spawn a custom zombie that has its own loot table then
Another option for me is spawn corpse and add items. But I faced the same problem with sync.
Corpse appear on client only afrer relog user to server (
If you throw documentation on synchronization at me, I will be very grateful, I couldnโt find such a guide on the Internet
thanks :)
local zombie = helper.createZombie(player:getX() + 3, player:getY() + 3, player:getZ())
zombie:getModData().YourFlag == true
local function OnZombieDead(zombie)
if zombie:getModData().YourFlag then
zombie:getInventory():AddItem(item)
end
end
Events.OnZombieDead.Add(OnZombieDead)```
Thx, I ll try shortly
The items names are stored in their mod data which supposedly is transmitted automatically so there's no transmitmoddata method on them
do you know if putRequestSyncItemContainer() might work?
I never saw that method before. Could try it
public void putRequestSyncItemContainer(ItemContainer var1) {
if (var1 != null && var1.parent != null && var1.parent.square != null) {
this.putRequestSyncIsoGridSquare(var1.parent.square);
}
}
public void putRequestSyncIsoGridSquare(IsoGridSquare var1) {
if (var1 != null) {
SyncIsoGridSquare var2 = new SyncIsoGridSquare();
var2.x = var1.x;
var2.y = var1.y;
var2.z = var1.z;
var2.reqTime = 0L;
var2.reqCount = 0;
synchronized(this.requestsSyncIsoGridSquare) {
if (!this.requestsSyncIsoGridSquare.contains(var1)) {
this.requestsSyncIsoGridSquare.add(var2);
} else {
DebugLog.log("Warning: [putRequestSyncIsoGridSquare] Tryed to add dublicate object.");
}
}
}
}```
are there any server admin commands able to send an item to a specific container instead of a player's inventory?
for archipelago i was thinking of letting players designate a "checks cabinet" where all their received items would go
and since my intention is to have AP communicate with a locally hosted server, i think admin commands could simplify a lot of things
followup question: is it possible to make a backpack style item fit in any slot? Like say, a bag of holding type underwear? For nothing weird, just need clothing to store AP items being sent when in combat because i'd hate to see someone die because they got sent a sledgehammer while running from a horde and would like to not take up any actually useful clothing slots
to my knowledge clothing can have an inventory in any body location
Yes you can
Is there a get function for getting the 'Bloody' value of a player shown in the 'Wash' context option? I thought getPlayer():getTotalBlood() might be it, but it returns 17 instead of the expected 95. Looked at getTotalBlood() in IntelliJ and it seems to just be adding the blood level of clothing to var1 += ((HumanVisual)this.getVisual()).getTotalBlood(); (haven't looked at this part of it yet).
the value in this ui is calculated with this```lua
local visual = playerObj:getHumanVisual()
local bodyBlood = 0
for i=1,BloodBodyPartType.MAX:index() do
local part = BloodBodyPartType.FromIndex(i-1)
bodyBlood = bodyBlood + visual:getBlood(part)
end
bodyBlood = math.ceil(bodyBlood / BloodBodyPartType.MAX:index() * 100)
Thanks! By the look of it, visual:getDirt(part) is probably how they calculate the 'Dirty' stat too?
Will check later when I've got more time.
yeah, i cut out the dirt stuff to make it clearer but they do it exactly the same as part of the same loop
I imagine with the dirt calculations its basically just local bodyDirt, bodyDirt = bodyDirt + visual:getDirt(part), math.ceil(bodyDirt / BloodBodyPartType.max:index() * 100) next to where it does the same things for blood.
Thanks again ๐
Can't help but notice that this function returns the same value as the amount of water needed to clean yourself
Interesting, I hadn't even noticed lol
Was too focused on the blood & dirt part
Are there an workshop project on github that uses action workflow to upload to workshop? I want to use it as reference to setup mine.
I've made a script that transcribes Star trek TNG episodes to VHS tapes
Oh lord time to do literally every episode.
I have an ItemContainer reference for an oven, can i use it to access IsoStove class for this function? https://projectzomboid.com/modding/zombie/iso/objects/IsoStove.html#setActivated(boolean)
declaration: package: zombie.iso.objects, class: IsoStove
declaration: package: zombie.inventory, class: ItemContainer

Nice
Please do Enterprise & Voyager next (the objectively better-than-TNG shows)


wrong
But I'll probably make the tool public n MIT so community can just have fun transcribing all their favorite shows
Is there an nice list of codes that work on VHS tapes somewhere?
Im thinking about making a map, one that would be a perfect base in my mind and its based off of my irl work place. I have zero mapping experience for im looking for any pointers or tips.
All of season 1 complete 
I made the tool convert emojis on lines thrown into the transcript, that way I dont have to manually add all the codes for events I want other than the generic boredom
LootZed doesn't work for zeds, does it?
https://steamcommunity.com/sharedfiles/filedetails/?id=3161578967 done finally! preety basic for now, will see if i can add to it tomorrow. thanks very much to all who helped!
can you call other mods sanboxvars just by using SandboxVars.XYZ, or do you need to somehow tell game its not vanilla sandbox setting?
yup you can
How hardcoded is the health system?
very
I'm looking in the lua files (might have to crack open some java classes) trying to see if there's a way for me to add more types of injuries, body parts, etc
it's all hardcoded java stuff
What about death?
I've noticed the camera hooks on your body when you die
I want to see if its possible for me to use that system to allow people to knock you out, and pick you up like any other corpse
As well as reviving you, directly
i haven't seen the code for that specifically but i would imagine it's also java and as hardcoded
the longer something has been in the game the more likely it is to be crazy hardcoded
I'm better with LUA than I am with Java, buuut, at least it isn't C..... which I simply cannot do beyond edits
I know java modding is possible with this game
But, I have to learn how to actually do it
LUA is easy, you can just make a file and make sure the structure is correct
Java.... I dunno where to begin with that
it's usually done by decompiling a class, editing it, recompiling it and just replacing the vanilla class file with the modded one, it's not elegant at all
Im having some trouble Overriding recipies and i dont know why
The first file works perfectly fine and overrides properly, but the second file just doesn't override
My mod is finally finished, it supports Mod Options. I only need to make a icons now.
been wondering about something. You can knock a mailbox over with your car, but it won't react to melee attacks. Been wanting to mod that in for some time now for... reasons. Does anybody know where to dig? I've searched through LUA code and only found translation and loot distribution stuff. So, being knocked over is probably something that happens in java, right?
Maybe. Look for a function that handles vehicle collisions or something similar.
If it does exist in Java then it might be a bit difficult to read since some of the variable names are literally just varX.
Can a crafting recipe result in multiple things?
No, you use the OnCreate to add more items and add RemoveResult if you don't need it.
Alright, though so. Thanks
Wait, do generated VHS tapes not have an ID for spawning?
Wont be able to spawn it via craft recipie, oh no.
Unless there's some way to use the change recording function. Need some docs
uh
I'm trying to think of a mod that would do something with VHS like that but none comes to my mind
There should be a debug context option you can use to set the id, use same functions.
Yeah I found that debug option but I cant find a lua function
I think it's in InvContextMedia.lua
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
for i = 1, 26 do
player:getInventory():AddItem("VHS_Retail");
player:getInventory():getLastItem():setRecordedMediaData(TNG_VHS_S1[i]);
player:getContainer():setDrawDirty(true);
end
end
Blessed, potentially?
if the result is VHS_Retail in your recipe, then you can just do result:setRecordedMediaData(...)
you can just add them to the distributions, no?
I could but I dont want to bloat the spawn tables too much
178 episodes is a lot...
oh you're doing some sort of box-set item
I feel like you'll never all of them in one zomboid world with RNG I believe.
So gonna mix in some box collections in homes, yeah
never seen getLastItem()
Neither have i, copilot reccomended it, we'll see how far it gets
fairly certain it's not an actual function
Haven't gotten an error thrown yet but zomboid isnt able to find the lua function
If there's an error in the code like the getLastItem bit will it just not be able to find the function?
no it'll just pop the error when it hits that line
local TNG_VHS_S1= {
"TNG_S1E1+2",
"TNG_S1E3",
"TNG_S1E4",
... This continues up to 26 items
}
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
for i = 1, 26 do
player:getInventory():AddItem("VHS_Retail");
player:getInventory():getLastItem():setRecordedMediaData(TNG_VHS_S1[i]);
player:getContainer():setDrawDirty(true);
end
end
recipe Open Star Trek: The Next Generation VHS Collection 1,
{
TNG_VHS_Collection_S1,
Result:TNG_VHS_EmptyCollectionBox,
RemoveResultItem:true,
Sound:PutItemInBag,
Time:20.0,
OnCreate:Recipe.OnCreate.TNGVHSCollectionS1,
}
Not sure what im doing wrong here
is the mod file that contains the recipe function loading?
try removing the comma from your recipe name?
not sure if that matters, but nothing else looks wrong
you can change for i = 1, #TNG_VHS_S1 so the function will just adjust based on the size of the array, but i dont think thats an issue either
if you're in debug mode, you can see if the file is loaded or not - if for whatever reason it did not load it won't show up in debug when you press F11
Oh. It's not loading the recipecode.lua file
Should the lua file for recipiecode be in server or shared?
other mods Ive looked at for stuff like this put it in server
Put it in server
it doesn't really matter, but recipecode.lua is in server, but you don't need to overwrite recipecode or even call it Recipe.OnCreate.yourfunction
you should not be overwriting recipecode.lua though
Apologies, yeah.
Has it's own name TNG_recipiecode.lua as to no overwrite anything
yea, it doesnt matter if its in client or server, but most people will look in server for it since thats where the vanilla file is located
item:setRecordedMediaData(SeasonOne[i]);
throws an error
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
for i = 1, #SeasonOne do
local item = player:getInventory():AddItem("VHS_Retail");
item:setRecordedMediaData(SeasonOne[i]);
item:getContainer():setDrawDirty(true);
end
end
Scrapped getLastItem in favor of this currently.
Is seasonone declared somewhere?
Yeh, SeasonOne now.
local SeasonOne = {
"TNG_S1E1+2",
"TNG_S1E3",
"TNG_S1E4",
"TNG_S1E5",
...
}
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
for i = 1, #SeasonOne do
local item = player:getInventory():AddItem("VHS_Retail");
item:setRecordedMediaData(SeasonOne[i]);
item:getContainer():setDrawDirty(true);
end
end
setRecordedMedia takes MediaData as argument, that's probably why you get error.
this seems to be the way to get it getZomboidRadio():getRecordedMedia():getMediaData(id)
SUCCESS! 
Complete snippit for anyone searching for this in the future
-- Add VHS_Retail to player's inventory
local item = player:getInventory():AddItem("VHS_Retail");
-- get media Data for the related tape name
local mediaData = getZomboidRadio():getRecordedMedia():getMediaData((YourMediaID));
-- set the media data to the item
item:setRecordedMediaData(mediaData);
-- Refresh the inventory
item:getContainer():setDrawDirty(true);
is the inventory refresh necessary? what does that do?
Hey, anyone know how to get player by his steamid ?
you might be able to using the scoreboard
So I'm trying to add a custom option to the context menu when right-clicking on a zombie corpse:
TakeFromCorpse = {}
TakeFromCorpse.inventoryMenu = function(playerId, contextMenu, items)
local player = getSpecificPlayer(playerId)
local item = nil
for _, v in ipairs(items) do
item = v
if not instanceof(v, "InventoryItem") then
item = v.items[1]
end
if item:getType() == "CorpseMale" or item:getType() == "CorpseFemale" then
contextMenu:addOption("Take [Item] From Corpse", player, TakeFromCorpse.takeFromCorpse, item)
end
end
end
TakeFromCorpse.takeFromCorpse = function(player, corpse)
return
end
Events.OnPreFillInventoryObjectContextMenu.Add(TakeFromCorpse.inventoryMenu)```
This works when I pick up the corpse and then right-click it inside my inventory, but not when I right-click the corpse on the ground. Does anyone know why? Is there a different event I have to register it to?
you're using inventory object event
you need to use the world object event
Events.OnFillWorldObjectContextMenu.Add
thanks, i figured it was something like that
so i made a discord bot to monitor my pz server named Queasy bot . idk if its realavant to mod development but im willing to share the source code if anyone interested
You can just create a github repository
Hi, I would like help. I was trying to patch ones mod function using one guide, but it seems it doesnt work.
I checked that my lua file with patch is loaded after original. I even see that lua in debug.
original function:
local function getMaxSkill(character, perk, bonus)
new function:
local function new_getMaxSkill(character, perk, bonus)
At the end of Patch lua I have event callback which should overwrite original function
--if getActivatedMods():contains("SkillLimiter") then
local original_getMaxSkill
--local currentXPBoost = player:getXp():getPerkBoost(Perks[skillName]);
local function new_getMaxSkill(character, perk, bonus)
print("Running Patch version of getMaxSkill")
--local character_profession_str = character:getDescriptor():getProfession()
--local trait_perk_level = 0
--local currentXPBoost = 0;
-- Go through all traits and add their relevant perk level to the total
local perk_name = perk:getId()
local currentXPBoost = character:getXp():getPerkBoost(perk_name);
-- Go through the XPBoostMap of the profession and add the relevant perk level to the total
--if bonus then
currentXPBoost = currentXPBoost +1
--end
if currentXPBoost <= 0 then
return SandboxVars.SkillLimiter.PerkLvl0Cap
end
if currentXPBoost == 1 then
return SandboxVars.SkillLimiter.PerkLvl1Cap
end
if currentXPBoost == 2 then
return SandboxVars.SkillLimiter.PerkLvl2Cap
end
if currentXPBoost >= 3 then
return SandboxVars.SkillLimiter.PerkLvl3Cap
end
end
-- add a even callback that performs the overwrite
Events.OnGameBoot.Add(function()
-- store the original function. Note we dont store until we're ready to overwrite
original_getMaxSkill = getMaxSkill
-- now overwrite
getMaxSkill = new_getMaxSkill
end)```
You can save custom variables onto an IsoObject, by using setmetatable in its getModData().
Does this have to be a metaTable? Can't I just save a custom int, or string?
also, if this object is picked up, then placed in the world again, does the item have the custom modData, or is it created fresh, when dropped?
Question: If I want my mod to have a longer description (with pictures and the like), what do I need to do to the Workshop file so it doesn't overwrite any changes I make on Steam's end? Do I need to code/write the description in the workshop file..?
what are you using metatables for? you can just set data in the table
Hi. Explain the difference between the server, client, and shared folders?
I just keep my mod descriptions in a notepad++ document, push an empty workshop.txt when updating, and edit the workshop page & paste in the new info. you can use the workshop.txt though, if you don't want to edit the title/description of the workshop page
ughhhhghhghghhhhhh that's a lil on the ass side i'm ngl but good to know so I can at least save things ๐ thank you!
shared: loads at game startup on both the client and the server
client: loads at game startup after shared, only on the client
server: loads when starting/joining a game, on both the client and the server
thanks Is only the client loaded on the local server?
@bronze yoke
using WaterGoesBad + my patch, WaterDispenser + my patch ...
having fun playthrough, so thirsty......... exploring Dirkerdam, found 6 full WaterBarrels.
surprise 2400 units of clean water.
New mod is in the works, everything is going well. But ideally I could just save a variable into the modData for vanilla WaterBarrels, to know if I've already tainted them. Currently just saving a whole table
local modData = obj:getModData()
modData.idealCustomInt = 1
modData.customTable = {}
i think you're overcomplicating it
mod data is just a table
can I just remove customTable then?
if you don't need it, yeah
osnap
local barrel = SomeFunctionThatReturnsIsoObjectBarrel
if barrel ~= nil then
local barrelModData = barrel:getModData()
--code is happy, but look at these nested if's. instead, let's use 'inversion'. That's probably a better coding practice.
end
local barrel = SomeFunctionThatReturnsIsoObjectBarrel
if barrel == nil then end
local barrelModData = barrel:getModData()
--158,000 errors! attempted index: getType of non-table: null
Hi! Does anyone knows whether the game calles the render() functions you find in the java code more frequently than the render() functions you find the lua code?
then return end
i hate the fact that if i wanna rename a singular song (due to an incorrect spelling mistake) in my music mod I have to essentially reupload the entire mod and I know people are gonna rage when i do cause they'll all have to redownload a 7GB mod lol
I finished my zombie re-texture mod
But I want to try to make a custom animation
Does anyone have and sort of tutorial
I can use to find out how to do so?
There's barely anything about zombie animations
You have a few examples of mods that modify zombie animations
is there a lua event that can be used as a psuedo 'placed furniture' or 'finished carpetry craft' ? hmmm
doesn't steam just update the "things that need to be updated" instead of the literally everything in the mod?
well since i deleted every single mp3 file and put back new ones it will make people redownload it all
i had to do this because with true music you cant simple change the name of a file
it might break the mod itself due to the names not being the same
and well every time i tried for some reason file explorer would lock up and freeze lmao
its funny how doing the true music thing makes my cpu go at like 100 Celcius lmao
i had run my desk fan into the pc cause of that
LOL
but its all done i just gotta reupload but imma wait til the next batch of music
i also wish the workshop updated the actual size of the mod
wait hold up
it will only replace files that have been modified, if you replaced them with identical files with the same name it won't redownload them
it actually updated it
wow
that wasnt the case before
jesus hahaha
music is large

meanwhile my actual music collection
i like how im trying my best to add as much jungle/drum & bass music to these mods while respecting the year of release
wtf
I DJ quite often so it only makes sense haha
mostly just dnb and jungle though
Understandable then
I only see a few mods doing so
Though I can try to figure out what shenanigans they pulled to reanimate them
Depends what you want to do
Are you planning on replacing the animations for every single zombie ?
Or just for a few ?
To modify for a few zombies, go check this:
https://steamcommunity.com/sharedfiles/filedetails/?id=3012992497
To replace the animations of every zombies:
https://steamcommunity.com/sharedfiles/filedetails/?id=3046040846
https://steamcommunity.com/sharedfiles/filedetails/?id=2590814089
I had to reverse engineer those mods to fully understand how they work and how to modify the animations of zombies
Since I work on a mod that adds different types of zombies, I had to understand how to trigger custom animations for specific zombies and LeaperZed was the solution
@bronze yoke thanks, this is the 6th mod you helped me make
https://steamcommunity.com/sharedfiles/filedetails/?id=3162180459
I simply wish to add new idle and running animations to the zombies
New ones, without replacing the current ones ?
I want to replace the current ones
Not at all but I'll figure it out
I gotta learn somewhere
https://steamcommunity.com/sharedfiles/filedetails/?id=3035712003&searchtext=how+to+create+animation
There we go
Thanks for that
This guide won't answer 100% of your questions, but on the Blender part it's fairly good
Also it has an IK character for easy animation
I struggle most with blender so I'll definitely need that the most
Search for small tutorials on how to animation an armature
It's fairly easy to understand but can be tough to master if you don't know shit in animation
Luckily the animation isn't especially complex
At least I think
I just want them the twitch and claw at their face
So hopefully it's at least doable for a first animation
Out of curiosity, you're taking inspiration from something ?
Mostly 28 days/weeks later
It what has been inspiring my design choices
With a smidge of The last of us
๐
I'm working on The Last of Us Infected and explored custom animations to recreate Clickers the past 2 months
Currently rewriting the mod to make it more flexible and easier to modify + more optimized but once I'm done with the basics I'll code back in the custom animations, finish them
Oh damn that sounds awesome
Worked with a friend to make a couple animations, at first he was working in parallel but he can't work on it at all rn
This is amazing
I can imagine this animation playing on the zombies in game
I wonder
Is it possible to add an animation for turning into a zombie
Possibly yes
I believe almost anything is possible with animations
The issue is just the pure lack of documentation and examples on the subject
I'm basically the second guy exploring custom animations for different zombies after Glitcher with his LeaperZed lol
I can imagine that being nice to fill in the missing level of immersion
My zombies turn by throwing up, twitching and then ripping their jaw off
Which isn't present with the base textures
They just appear on you when you turn
If you're interested to maybe go more deeply in it, you could come on the PZ modding Discord, I explained a lot of stuff in the animation channel and talked a lot about it and how it works + added examples of the result in-game in the post for my mod
There's a discord for that?
Hell yeah
No UVs don't really have a size
Only the size of the texture matters
Hello, I'm trying to apply arsenal's attachment to the nerf gun I made. Most of the time, I put all the existing arsenal guns in DoParam() and then add my nerf gun, which leads to a messy situation in the code.
Other than DoParam, is there a way to simply 'add' the parameters of a specific script?
local gunfighter_rifle="MountOn= K13_SMG;M16A1; M16A2; M16A3; M4; M4A1; Bush_AR15_MOE; Bush_XM15; Bush_XM15_Custom;M723; XM117; H416; AR18; AR18_Fold; AR57_PDW; AR57_PDW_Fold; AR57_PDW_Long;LVOA_C; ColtM16; M16Tape; M16Wood;AK47; AKM; AK103; AK74; AN94; AK12; AK12_Fold; AK12_New; AKM_Gold; AKM_Custom; AK74_Custom; AK308; RPK74;G36; G36C; G36KV; G36_Fold; G36C_Fold; G36KV_Fold; SCARL; SCARH; SCAR20; SCAR_B; Shrike; XM8; XM8LMG; L85; L85A2; K2C1_PH; K1DEV; K2_C1; K2_1; K2_203; DR_200; K2_ADVK2; K2_Grunt; K1A_DEV; K1A_DEV_Fold; K1_1; K1_1_Fold; MK47; ADAR; KAC_M203; AssaultRifle,Nerf_gun_inc"
If it was like this, it wouldn't be beautiful.
Reason: Bad word usage
Anyone know how I can replace / add a clothing item to a zombie through a script
Or any mods that do this so I can reverse engineer lol
Also, giving a zombie an item on runtime works, but the item doesn't appear in the corpse inventory when it dies. Any way to keep the item in existence there?
Hey, I would like to change the loading music (when you connect to a server), do you guys knows how I can do that please ?
I tried to replace in file named preface.ogg in media/music but it doesn't work
https://steamcommunity.com/sharedfiles/filedetails/?id=3162609099
All 178 episodes, 12+ mb of just text
Probably about 1/5th of the episodes have codes for skills/emotions/ect throughout them. Maybe someday ill finish them all.
Is the lua event "OnGameStart" also triggered when the player joins an existing world with a new character (i.e. player dies and then chooses the option "Create new character")?
Hey all, someone made a game-night add-on, so I feel obligated to spread the word ๐ https://steamcommunity.com/sharedfiles/filedetails/?id=3161992240
Also slapped up this hot new spiffo for the occasion
--CurrentXPBoost -> 0/1/2/3 based on player:getXp():getPerkBoost(Perks[skillName])
if (CurrentXPBoost == 0) then
CurrentLimit = SandboxVars.SkillLimiter.PerkLvl0Cap
elseif (CurrentXPBoost == 1) then
CurrentLimit = SandboxVars.SkillLimiter.PerkLvl1Cap
elseif (CurrentXPBoost == 2) then
CurrentLimit = SandboxVars.SkillLimiter.PerkLvl2Cap
elseif (CurrentXPBoost == 3) then
CurrentLimit = SandboxVars.SkillLimiter.PerkLvl3Cap
end
Dont you know what I could be doing wrong?
I checked log using print and I get after this code
since CurrentXPBoost is 0 I was expecting to first if to trigger and fill CurrentLimit with 4
but it skipped all and just left CurrentLimit at default number
How do I recompile a decompiled java file from the vanilla code so that it becomes a .class file again?
nevermind already found out what was wrong and it works now
I wanna play a theme when a zombie is nearby, any way to do this? I know I can use zombie:playSound but how would I go about looping this
You could get a tick counter in an event ontick and after the amount of tick (duration of the song) is passed, play the sound
like a do while loop that checks if conditions are met
does anyone know how vehicle start chance is calculated and where i can find that info in the game files for reference?
`` -- LockForcingMod.lua
-- Function to force lock on doors
function forceLock(worldObject, player)
local screwdriver = player:getInventory():FindAndReturn("Screwdriver")
if screwdriver ~= nil and instanceof(worldObject, "IsoDoor") and worldObject:isLocked() then
worldObject:setLocked(false)
print("Lock forced successfully!")
else
print("Unable to force the lock.")
end
end
-- Hook into the right-click context menu
Events.OnFillWorldObjectContextMenu.Add(
function(_worldobjects, _player, _context, _worldobjectsMenu, _test)
for i = 1, #_worldobjects do
local worldObject = _worldobjects[i]
local option = _context:addOption("Force Lock", worldObject, forceLock, _player)
option.toolTip = "Attempt to force the lock using a screwdriver."
end
end
)
``
Why doesn't this work? I just keep getting a non-specfic error
what error?
``STACK TRACE
function: Add -- file: LockForcingMod.lua line # 18 | MOD: LockForcingMod
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@5d237c0
function: createMenu -- file: ISWorldObjectContextMenu.lua line # 1543 | Vanilla
function: createMenu -- file: ISMenuContextWorld.lua line # 50 | Vanilla
function: createWorldMenu -- file: ISContextManager.lua line # 28 | Vanilla
function: doRClick -- file: ISObjectClickHandler.lua line # 60 | Vanilla
function: onObjectRightMouseButtonUp -- file: ISObjectClickHandler.lua line # 379 | Vanilla.
[17-02-24 14:09:05.390] ERROR: General , 1708200545390> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: __len not defined for operand at KahluaUtil.fail line:82..
[17-02-24 14:09:05.391] ERROR: General , 1708200545391> DebugLogStream.printException> Stack trace:.
[17-02-24 14:09:05.392] LOG : General , 1708200545392> -----------------------------------------
`` That's all I can get
your OnFillWorldObjectContextMenu handler doesn't match the signature of the event
int playerIndex, ISContextMenu context, table worldobjects, boolean test,
Also to put things in code block you can use ` 3 times instead of just 1
Like this
this is a code block
if you read what i just deleted about addOption disregard it ๐ misremembered something
Okay so far so good, it doesn't cause errors right away
@bright fog
yes
So meta !
Vanilla has some code in \server\Map\MapObjects\MOGenerator.lua** which wires up a local NewGenerator function using MapObjects.OnNewWithSprite. I've created my own server\MOGenerator.lua file to replace this behavior and call my version, but I never see my function called even when I come upon a generator in the world, or add the item version into my inventory and drop it in the world. Can anyone offer some insight into what I might've missed?
I see the log message at the end of the file, so I know the code is executing/not bombing with a lex exception.
Sorry, the vanilla path is \server\Map\MapObjects\MOGenerator.lua. I'm not using a path like that but don't expect that to make a difference.
I have a change in a script file that mutes the RadioTalk by giving it a soundless audio file. But there is another mod that uses this file and adds to it. Is there a way that I can still suppress the vanilla file without affecting another mod? I tried this but obviously this kind of code can't run here...
trying to use OnFillWorldObjectContextMenu but this line throwing errors
local worldobjects_size = worldobjects:size();
send the errors too or don't expect much from people
object tried to call nil, but when i get rid of this line and just do print worldobjects it prints a list link
a table "link" you mean
yes
did you declare worldobjects_size before ?
no the file looks like this
looks like what ?
function NF_ISWorldObjectContextMenu_OnFillWorldObjectContextMenu(player, context, worldobjects, test)
local worldobjects_size = worldobjects:size();
print(worldobjects);
base_menu = context:addOption("Upgrade Stove", worldobjects, nil);
end
Events.OnFillWorldObjectContextMenu.Add(NF_ISWorldObjectContextMenu_OnFillWorldObjectContextMenu);
was formatting commented out stuff ๐
Why is your function name so long oh god
Anyway, try changing the variable name ? worldobjects_size
Also you don't have any use for worldobjects_size in your function
hmm no still the same named objectssize
i dont think there is a var inside the entire mod called that
and what i sent is the contents of the entire file
There's no point for local worldobjects_size = worldobjects:size(); to exist is there ?
i want to check for stoves, make a loop to go through the list of things, decide if i want to show my button or not, i think i need the size to make the loop
Brad Vickers From Resident Evil. My first attempt at a mod for Project Zomboid. (Otherwise just a model for blender if i can't figure out how.)
the mod is the outfit.
Sort of yeah, could also use ipairs or pairs tho I'm not familiar with what you are trying to work with
i just got this table that i cant even get the size of ๐ i want to be able to make upgrades to the stove, but not sure if you can do it with recipes when its a moveable so figured ill do it through the context menu, OnFillWorldObjectContextMenu is passing the list of worldobjects but cant figure out how to get actual container references from it so i can get to the isostove class or something
do #worldobjects to get the size instead
instead of worldobjects:size()
nice works thank u, gonna try figuring out how to get the data out now
Hello! I faced the "offset issue" with the addGridSquareMarker in calculating whether or not the player is inside the marker. I came across your solution with using the CircleIsoMarker. The only problem is that it creates an outline of the circle, and doesn't actually fill it. I tried to use a workaround where I create multiple circles while decrementing the radius by 0.01 till we reach 0, but that ended up just looking so ugly. I can't find anything relevant either in the docs. Have you ever figured out a solution to this?
reeeeally struggling to call a function in another lua file. lots of non-table errors.
here's an arbitrary example?
script1.lua
local RT = require("ReturnsTen")
local function TestFunction --works. calling this in game.
local myNumber = RT.MyFunction --attempted index: MyFunction of non-table: null
print ("should be 10 - " .. myNumber)
end
ReturnsTen.lua
function MyFunction --not a local function
return 10
end
local RT = {}
function RT.MyFunction()
return 10
end
return RT
you can also just return the function directly instead of putting it in a table but i'm guessing you're trying to see how modules work
nah, simpler would be better. I'm realizing I can just call the function, since its not local.
My code is working, but printing is not. super strange, maybe a lua thing?
local myNumber = FunctionThatReturnsNumber()
print("the number I was given is " .. myNumber)
What would be the correct way to print() and send this generated myNumber into the console?
edit: unless this is completely fine, and the issue is elsewhere
should be that, what's happening? error? no print?
I suck at reading stack traces. I think maybe myNumber is nil, hmm
try tostring(myNumber)
or if you do print("the number I was given is ", myNumber) it should do it for you
using tostring resolved the concat error! I'll go ahead and try out the 2nd method, as well.
they're pretty much the same thing
mathf.floor (10 * 0.1) * 1
Attempted index: floor of non-table: null
HUH
math.floor
wouldn't recommend using Notepad++ for coding
yeeeeeah. i use visual studio for C# in unity. i only meant to throw together one quick mod for zomboid. i just accidently keep making them
Hello, where can I find image assets used in the game?
such as?
Moodles, traits, professions, etc.
Not sure. But maybe here:
steamapps\common\ProjectZomboid\media\texturepacks
you'll need software to extract the .pack file format
-.-
in the top right of discord, theres a search bar.
you can Ctrl+F and type... in: mod_development extract pack
and theres 12 results, which may be promising