#mod_development
1 messages ยท Page 184 of 1
um
i picked a random image and resized it, dont judge me
You skipped the contents folder
C:\Users\userName_Here\Zomboid\Workshop\TurnScrewsIntoNails Mod\Contents\mods\TurnScrewsIntoNails Mod\media
whats that
Thats the correct pathing
look at this example mod, to ensure you are following the correct folder structure
C:\Users\userName_Here\Zomboid\Workshop\ModTemplate\Contents\mods\ModTemplate\media
i dont understand
you put your mod in Zomboid\Mods... this is the wrong folder
the example they gave is the file structure, you might need to create some folders like "contents" that dont exist now
he wrote you out how it should look like
so I make a new file called contents, put everything inside of that
then make a new file inside of content and put everything inside of that
no. you're not even in the Workshop
C:\Users\userName_Here\Zomboid\Workshop\ go there, create your mod name folder, create contents folder, move mods folder into that
you skipped the mods folder
Isn't the folder mods
also, you have two folder names... "turn screws into nails" and "TurnScrewsIntoNails mod"
choose one.
so both folders have to be called the same thing
Contents\mods\TurnScrewsIntoNails Mod\media
right ok
they don't need to have the same name
?
its just confusing this way imo
i've never seen it without one
not sure, but usually it does have the capital
So i guess there's no easy way to play around with how it works at all?
not at all
give it a shot, it looks I think
alright i'll give it ago
I was thinking about creating a seatbelt mod to prevent damage from crashes. Since that's apparently not doable, maybe the damage can be reversed after being applied? If there's a way to check the cause of the damage. Still though it doesn't seem like a viable method considering the damage may be so severe you just die lol
onplayergetdamage should be able to do that
turn mod on > accept
and it doesnt work
it still disables it
Hmmm I'll mess around with the idea. Thanks
maybe because you have .txt instead of .lua?
lemme try that
its a recipe
@vital wave go to
C:\Users\userName\Zomboid\Workshop folder
there was already a folder in here. it's called "ModTemplate" -- you see it, right?
oh okay, then txt is the way
If we are doing comparisons to that
im missing preview.png and workshop.txt
but apart from that it is pretty much similar
copy ModTemplate exactly.
im not doing a map mod tho
forget the stuff in the 'media' folder
how do you activate your mod?
you could have bad brackets or something in your .txt file too which is why it would see it but not activate it if it cannot load the scripts folder. Not positive but double check the contents of the .txt file for correct format and brackets.
whats for you save file that you use?
I use a new one each time
to test it
thats the file that has the .txt
should I try changing it to .lua?
do you enable in there the mod?
Shouldn't the content of recipes be:?
module Base
{
recipe MyRecipe
{
(...)
}
}
for singleplayer, i have already turned it on,
module can be whatever it can
missing bracket on line #1
module base is bad practice
module TSINbyEndy {
right
go into the pause menu and in the lower right corner click on the mods button
pause menu where?
when you are in the game you press esc and then you are in the pause menu
I know that
fix that bracket on line #1 and give it a shot
but it isnt enabling on the main menu
i did
this is on at the moment
but the second i press accept
then leave and relook on th e screen
it disbales itself
go in the lower right corner and click the mods button there it will show you all the mods enabled for that save
@bronze yoke if I wanted to make zed clothes 100% "bloody", for example, I cannot use Events.OnZombieDead, as you've informed me, (some clothing items are not visible, perhaps a shirt under a jacket or something), is there a way to affect starting int holes, float condition or float bloody?
These variables are randomized, for each zed walking around. but maybe that happens under the hood, in java?
I know, but it isnt even enabling from the main menu, nevermind any saves
it been like this since it first appears in the mods section
Are you restarting the game after you are doing your fixes?
yes
i'd imagine the not visible clothing should still be there: before that event fires it creates the zombie's inventory and copies its worn items into there
Can you repost your txt file after modification?
Isnt that mp?
no thats singleplayer
Interesting. my Events.OnZombieDead strategy is working 80% of the time. but 20% of the time, Military Boots are skipped. super strange.
should I be changing the .txt to anything?
Make a new game in single player and when you make it click the mods button and enable there your mod
that is what i am already doing
but it automatically disables the mod the second I accept it and get out of it
It looks good to me on on the format of the file
yeah but it keeps autodisabling after pressing accept
it doesnt even say reloading lua
which it normally does when u enable a mod and leave the mods screen
Seems like id problem
oh snap, i think i figured it out
Maybe when you moved it over to the new workshop area it wasnt done correctly, and you are still seeing the old one. Is the old one still present that was giving you issues before?
I was using return in my ForLoop, when I should have been using break, assuming that's a thing in lua. hell yeah.
i deleted the old one out of users > Zomboid > mods
ok good, so then we are seeing the new one at least, is the contents of the mod the one .txt file is there more?
i dont understand
Is the only bit of code you have added the contents of TurnScrewsIntoNails.txt or are there more files that you have added that have code or blocks in them (like in the recipe file)?
actually, break doesn't work either. maybe... continue, if lua has that.
@elfin stump thats my full file for it
(i tried even removing the workshop.txt / preview.png)
What is the contents of workshop.txt?
exact same as the example mod one
I can't remember how that file gets generated, or if we copy it over, it has been awhile since I have created a new mod folder. I don
't think that would break it but someone else might be able to chime in
Btw you can use Zomboid\mods for local testing.
both wouldnt let me enable it (this is how u use mods in singleplayer) and when i went back to the mods page, it would go back to disabled
as much as people said they didnt want to, should I send the full file here and u can check it further?
come to think of it, I do not recognize the screenshot I am seeing where you are selecting your mod with the hide/favorite/off - where is that?
NRK Modselector
its a revamp of the mod screen
it does not affect it at all
Can you disable it and test without that?
yes that is the mod way
its called NRK modselector
but i cant seem to disable it..?
even when its on disable, it doesnt turn back to the vanilla version
i've never heard of the vanilla mod menu not actually loading mods you've selected
so i think you just have a buggy mod menu
Yeah it seems like you got your install all wonked and zonked
aight lemme reload my game, i removed the nrk modselector mod
Does anyone know in the recipe blocks for things like this "[Recipe.GetItemTypes.Spoon]" - How would I tell a new item that it should be a spoon?
Not vanilla one
You proably need to unsubscribe at the staem level or reinstall, that is a mod you are seeing
nuke it
what u mean
save your mod and reinstall if you can't get that thing stripped out of the current install
i dont remember having another mod manager
Is there a guide on how to create a desktop icon of PZ, where it starts with debug, without making every game launch start with debug?
you removed the nrk one, this one is mod manager
this one should behave properly, i never turn it off and i've never had issues
You can make a shortcut for debug - and then add the target modification to that
ProjectZomboid64.exe -debug on the end of 'target' in the properties of the shortcut
You will need an icon for debug and one for not debug
oh, so i create a shortcut on the exe file and add -debug in the properties?
Lemme try
yep, in the shortcut, then you can rename that shortcut or even change the icon if you want
Like that? 
Looks good
no problem! happy to help 
<3
Looks like it
Quick question - Could I have multiple mods in the same workshop item?
We have a server where we have our own dev team, and we pool our mod resources into one mod and workshop item.
Though, the one managing it has to insert the contributions of the others into the mod files.
Could we just put our separate mod folders into the mod folder of the workshop item? like in the picture?
yeah
@elfin stump
I used utopia as an example
it should say reloading lua when its loading a new mod
thats what keeps happening
It looks fine, I am not sure. I suspect you could still have some issue with your directory setup or maybe even though the menu looks ok your other mods could be causing an issue. It is hard to say without trying to enable only your mod on a fresh install or reviewing the entire directory.
sure
do u see the issue with it?
Yes it looks like there are issues, I am seeing if they are the cause
ahh ok
I had it once, it prevented me to use specific id which was unique* for some reason.
I think it is the directory format
Let me double check though
there was another copy of the media folder and duplicates of a lot of files, i removed them but it still seems to have hte issue, ill see what else i can find
ok
I feel as though I have asked this, but I need to keep some configuration info outside of sandbox settings
How do I do that?
if it's per-save, global moddata, if it's cross-save, reading and writing a file
Ok I got it. The issue is really silly haha
oh no what was it
in mod.info there is a tab character at the end of the id=TSINbyEndy and it was breaking the id check because it was trying to include the tab character
the first folder called TurnScrewsIntoNailsMod also had a duplicate media folder, a duplicate icon, mod.info and poster, you should delete those too, they only need to be at the folder of the same name that is lower in the hierarchy.
yep, the tab character was breaking that, you likely wer egoing to get other errors tho if you do not remove those duplicates
yup
Okay good luck, it should load up fine now. I recommend getting notepad++ or some other mode advanced editor and turning on the setting to show all characters. That one was invisible without it.
ima test rq
do I delete one of them
it was in teh zip u sent
yeah the .txt one isnt doing anything you can get rid of it
also i think it broke again
I just double checked, I did not include the mod.info.txt I think you opened the zip you sent to me instead of the one I sent to you
renamed so it had a different zip name
No problem!
Anyone have a list or know how to get a list of the top languages of PZ users?
Right, File IO... I'll look into that... I suppose I want it more persistent than ModData
One way, a bit ugly but it works, is to create an additional mod that has config settings for your original mod. Then if people want to adjust those settings they can essentially copy your config mod, adjust settings and publish that and use it instead. If you are trying to write out, I am not sure, but if it is just reading in config stuff you can do it this way.
Sounds too ugly for my taste, thanks
Np, it is definitely a work around
can i trust modData wont mess up my objects if i were to store em?
If youre not using an existing moddata from other mods then it should be safe
sweet
moddata can't save objects, only basic lua types
so numbers, string all that standard stuff only
yeah pretty much
maybe that's why im having trouble retrieving my obj back, ty for the info.
Early days in modding feels like jumping straight to season 3 of a TV show that you never watched or know anything about, but the story unfolds one bit at a time
wait we can store tables right? Its a basic data type i believe
yeah
alr
the only lua type i can think of that can't be stored is functions
Is there any built in way to make an item spawn only one time in the world and never again? I think I have a way to do it if I don't use the loot tables and spawn it on zombie death and check a global mod data, or something like that. But before I dive into that, is there any built in way to limit how many times something spawns?
Hey, I'm new here so I'll present myself before anything else. I'm a 27 dev (mostly web since my graduation, although I have a strong C / C++ background) and I've been playing a lot of PZ lately (absolutely love it). Huge props to the devs!
So, I came up with a few mod ideas since I started playing. One of them, which I started to work on for a few days, may require some network features like being able to make POST request to an external server. Is it something feasible in the game or is it fully sandboxed? (This might be a dumb question but I've never really done that before)
we can't make post requests
Thanks for your answer, this might be what killed my idea tbh 
I can't think of anything else than relying on a 3rd party app running in the background then
i was about to suggest that ctually
if you write an external program, you can have a mod that writes to file to send it commands/data, which gets around most things like this - though it does shrink the audience of your mod
Yeah, that's why I was trying to do it via a Lua script, this "subscribe" feature for mods is so smooth compared to a lot of games
Or generate a local website (as some minecraft map mods / plugins) during game launch but that's probably my last resort
i think you can send GET requests, but apparently this is kind of a deadend because of how it's implemented
Hmm, that might help but what do you mean exactly by deadend, is it deprecated or something?
i haven't played with it myself, but apparently a lot of the logic is based on catching and handling exceptions, and lua can't do that
if your collection is non-public it won't show up for other users
Ho that's interesting, I was not aware of that lua limitation (barely touched it tbh). I don't think it would be a huge deal for me since it's just to send data, it doesn't really matter if the request is successful or not.
Now I need to figure out how to do that, thanks!
i'm not sure if lua's exception handling equivalent (pcall) would work in kahlua for handling java exceptions, but either way, TIS rewrote errors and pcall doesn't work at all anymore
teh debugger stops here for some reasons, im trying to get a square using cell.getGridSquare(double,double,double) method. CoordsTable contains both x and y coords. Is it because the values are passed are of type int?
should be called with a :

ty, always fall for this trap. Java ruined me.
wow finally all these function calls reach to the final chapter without any hiccups
finally les go, now just need to make the code pretty
much better than finding every tile around the player
what would be appropriate trigger for this kinda functionality?
I'll check this out, thanks! I can't rely on external packages, right?
gonna add some more on days, for now it is just mod template.
https://github.com/Kamer5555/PZ-Modding/tree/main
@trim mist would you mind sharing an example of your tooltip rework? I've been trying to change the text of string to be red. I started by just adding <RED> to the localization .txt version of the string. While <br> works that didn't work. More specifically, I'm trying to change the tooltip of "unread" for skill mags to be red.
I've looked at ISInventoryPaneContextMenu to use dangerous meals as an example, but I'm finding it a bit overwhelming. I have have a general understanding of Lua, (if you know the mod for minecraft called ComputerCraft I've made my own tree fellers and quarry scripts) but its a pretty safe sandbox to get your feet wet. Where as here, I feel over my head.
I learnt how to do my scripts in computercraft by looking at other smaller examples, that simply worked, and tweaked them till I understood how something worked.
it might be that the tooltips don't go through the same rich text label thing i got the tags out of
I think that is possible, because other localizations have the <LINE> and such. I suspect I may have bitten off more than I can chew, when i started this.
I do know that tooltip for mags displays the mod name in blue, so in theory it has to possible. I just have no idea where to start. The thing about learning computer craft was the documentation was all on an official wiki. If I needed an API I could type in keywords into the search and find it. I know PZ has the javadocs, but I barely know enough java to tell a mod dev why I suspect a crash happened.
I can try, I essentially wrote a function that creates a table with instructions to be interpreted by my re-wrote tooltip.render function, and it's still slightly borked for evolvedrecipes
is there anything in particular you think could be useful to you?
how difficult is modding with pz? I already know lua and I have software engineering career so I'm not complete newbie with coding adjacent stuff
I think just an example of how you determine the stylizing of fonts. So like, how you turn -60 to green.
Or even an exmaple of it in the base game
Any situation where it isn't already being passed through the rich text
It's an incomplete picture that you have to unwrap bit by bit, there's no parameter to tell you difficult it is but it's definitely a challenge. Start with something small like just adding an item to game or something or maybe just interacting with stuff in-game that's already present.
lol is this even going to be visible in-game, for icons the size is 32x32 pixels from what ik.
visit pz wiki modding to get started
link?
search pz wiki modding
ye
๐
https://steamcommunity.com/sharedfiles/filedetails/?id=3006109377 also if you'd like to check this one out, i put together some resources in one place.
atleast i won't lose my door tag lol
much better now
quick question, id like to give player an option to change names via context menu but how do i capture the new name? ik how to set i think.
u could use this
add a rename option to context menu which opens a new ui that uses entry-text
i think that could work
i can add the context menu but how do i pass the value teh player entered to my function
actually you might be right about this one, ill see how can i manage this.
yep this is it
ty for sharing the link
Anybody know what is the earliest UI code to initialise when in-game?
so i'm trying to translate my mod into russian and i'm running into this wierd issue
UI_Trait_Cardio is what its supposed to be displaying, and then you can see what its actually doing.
does anyone have a fix for this? or at least some info so i can try to find one myself?
Did you save the file as the right encoding?
what encoding should it be?
it says somewhere on the wiki, let me see if I can find it
https://pzwiki.net/wiki/Modding#Localization Cyrillic (windows-1251)
I do not have a concrete answer for you, but I do remember reading in a guide or on the wiki that things are loaded in alphabetical order.
Is the text messed up in your editor too? Might need to retype it.
i use notepad++
the text file is from someone else.
its fine in the editor
once i change the encoding it shows the same as zomboid (obviously)
Might need to ask the original person to save it correctly, or copy paste it to a new file and try saving it. If that doesn't work, someone else will have to help you, sorry.
copy pasting it worked.
make a new file, set the encoding to Cyrillic (windows-1251) then paste the entire document into it and then save it.
@sleek magnet thanks
Glad I could help!
How can I check for a item on a player inventory including it's own containers?
eg. backpacks
FindAndReturn seems to only look for the main inventory
ContainsRecursive()
thx!
When someone has free time could you make a mod for single player where sleep isn't required but allowed, "sleeping in single player" doesn't allow you to sleep at all
Is it possible to add new walk and idle animations to the player when in a specific state? Thinking about how the character should have a different pose and animation when it's cold, for example
There are specific animations for limping when your legs are damaged, is that something to go by? Or is that some hardcoded mess?
Technicalities of creating new animations is something I can deal with later, right now I just want to know if this is even possible, and how
Hey, it's me, ya boy.
I'm currently trying to add gloves into the game. They are supposed to be made out of white wolf fur, so I took the model of the player character, deleted everything but the hands and retextured the hands.
Well, that leads to clipping issues. While the gloves aren't damaged, the masks of the hands are hidden through the xml file, but when they get holes, the masks get visible and the model starts clipping. I remembered that the project zomboid base game has gloves too, soooo, I checked other mods on how they did that - And how they took advantage of the base game model.
But they just don't reference it at all? There's no entry for malemodel or femalemodel, just blank.
How did they do that, and how can I do that too?
I believe you can use different animation, I think I even read a list of Animations that you can call through your mod like walking, idle, etc etc. Not too sure about the details but most likely there should be a file defining animation to be used somewhere. About adding a new animation, might be possible. I should clarify, I haven't dealt with animations at all so not experienced at all on this one.
OH WAIT
<m_BaseTextures> is that referencing the base model of the character?
so, it's not using a model to put it over the character, it's actively repainting the character itself?
Cheeeers
I've looked at the code in some mod that adds roleplay poses available through the Q menu, but it doesn't seem to translate to being able to change the walk animation
Might be something different than what you're looking for. Try to find how the animations are defined in vanilla files, that should be the start. Or if someone knows where to look they might respond.
Overgrown Leaper WIP
Just need to fix the attack
It low uses the long leap if its far from the target only
Hello everyone,
Is there a function akin to processSayMessage that does it as a system message instead? I am trying to run in-game tips for players but unfortunately the say message does actually transmit to other players, so I'm looking for alternatives
Ah, nevermind, it's actually just a print statement.
Print? Are you using it for debug purposes or for players? How would it transmit to local player?
I was utilizing processSayMessage for that, unfortunately it leaks into the local chat due to... it processing as a say message. I was hoping to utilize the same way that zomboid passes system messages in chat, i.e. when you change any type of setting, etc. but that turned out to be just a print statement so I'm back to square one.
What these tips are for? Couldn't you do tooltips and stuff?
They're mainly around server-specific stuff as I help maintain a dedicated server. So tips for our serve r economy, the AEBS frequency, reminder for discord channels, etc.
Ah so something like moderation stuff
Imagine if you could sneak in that one as an infomercial script somewhere in there. That'd be cool imo.
Check the custom UI section
Ooooh, thank you so much.
What is the value you need to add to recipe to adjust how much Propane torch is uses? Is it as simple as just saying BlowTorch=5, ?
how do you guys work on performance related stuff on your mods? Like logging the tiem b/w function calls maybe?
this one might be it
ah sorry, thats not what you mean
the first line inside recipe is usually the amount that needs to be consumed in order for recipe to result into something
So if you're consuming BlowTorch then yes tweaking the number such as BlowTorch=5 would consume 5 units (however 1 unit is defined)
Reason: Bad word usage
iirc character:Say() doesn't get networked, it shows over the player's head
vanilla uses it for the dialogue when you can't sleep, already read a book, etc
albion I also love you
trying to work b/w client-server events, is this the right way to pass your commands from client side?
to accomplish what you're trying to do here you'd need an event handler to call the command functions```lua
local OnClientCommand = function(module, command, player, args)
if module ~= "MyModule" return end
Commands[command](player, args)
end
Events.OnClientCommand.Add(OnClientCommand)
Is there a guide for server/client command?
If im not wrong you have to send the client command to server which then has OnClientCommand event call that executes and vice versa
But i am wrong
Probably
you are right
the only one i knew was dislaik's 
probably
i'm going to write a new one at some point but it's not a huge priority for me
I would just wish that they would extend it to OnClientCommandReceived to make it understandable
yeah, there's definitely a lot of confusion around the naming
Does the event get sent from the server to all players?
this would work on server side?
yeah
you can choose to send a servercommand to one player or all of them
there's an isoplayer argument, you omit it to send it to all
don't include it
Ah so leave it empty and it will send it to everyone
sendServerCommand(module, command, args) sends to all, sendServerCommand(player, module, command, args) sends to one player
ty, still cant make sense of how teh event is triggered. How does it work under teh hood? like when does client triggers this script
when a client calls sendClientCommand, the server will fire OnClientCommand
is it done automatically or do i have to call it from somewhere on client side?
you need to call sendClientCommand when you want the server to do something
so imagine if i want client to send the trigger when i enter a vehicle, i woudl need to add an event for onEnterVehicle , then id call sendClientCommand and itll execute it from server side whatever teh command is?
yeah basically
oh im not sure if this would solve my problems then, because im having trouble with triggering OnEnterVehicle event from client side, It's inconsistent. Yesterday it working fine and now it's not, i thought maybe i could trigger it from server side or something. But if the switch doesnt work then command wont be triggered.
it's a client-only event
Do you think something wrong in code? Events always trigger right?
they should
Could do the tried and true print("test") at the very beginigng of your function to see if the event is being fired.
yes ill throw one it, i removed em earlier when everything was working fine. Prolly introduced a new error while removing print statements
in SP, press F11, open your file and double click on lines inside your function, that adds breakpoints that will pause the game on those lines. beware, not all lines work, there needs to be something that will interrupt the process, e.g. variable assignment or function call, etc.
on client it will work only for function that are executed on client ๐ค
ye i have been trying to use debugger to its full potential, it also sometimes helps to look at what objects you get back and stuff.
i fixed it, teh event was fired but it was stalled because i didnt have something in my inventory that i needed๐
ezcalp
is there a way to generate unique id to store stuff inside tables? i tried to use getID() method of comboItem but it not unique, returns same ID for every object in the world.
ill try with a doorID in the meantime.
hmm, those IDs are supposed to be unique*
without em i cant store more than one entry, i can also start an index count maybe grab teh last index and increment it each time
Where are base inventory icons stored in PZ directory? Not in Textures, not in UI. Must be stored in a .pack or .dat or something? Only option is to take them from the wikis?
they're in the texture packs
i think modding tools has a tool to extract them, but getting them from the wiki is probably easier since they come out as sheets anyway
@bronze yoke iterating on our conversation from last night, I thought about using os.execute to make a curl request, unfortunately, os.execute is not exposed (or fortunately when I think about it). I'm not sure, given Lua and Kahlua documentation, there is a way to send a request. You talked about a possible GET request, do you have, by any chance, a piece of documentation or code I could use to help me?
all i really know is it starts with getUrlInputStream()
@LuaMethod(
name = "getUrlInputStream",
global = true
)
public static DataInputStream getUrlInputStream(String var0) {
if (var0 != null && (var0.startsWith("https://") || var0.startsWith("http://"))) {
try {
return new DataInputStream((new URL(var0)).openStream());
} catch (IOException var2) {
var2.printStackTrace();
return null;
}
} else {
return null;
}
}
you will need to do the read operations on the stream
declaration: module: java.base, package: java.io, class: DataInputStream
not sure how that translates to LUA
thanks @bronze yoke @sleek forum, that's interesting, not sure I'll be able to do anything with it but there's potential, I'll try my best hoping I won't have to build a 3rd party app
I'm afraid this function can only read from a stream and can't be used to send data
depends on the data you need to send
event with diff IDS now i can't store more than one value i think, isnt this how you add values? getModData gives you table in which you insert key,value pairs
if it fits in the request uri then that should work
discord wont format the url correctly
but you get the idea
yeah, though table.insert isn't usually used for moddata
you're right, I guess I could split some of the objects I'm trying to send, might need some work on the backend but I guess the painfull part would be to translate that to Kahlua
since you don't know what other mods are going to put in there, you usually either have string keys or an ordered subtable
and if your data is really small you could also turn it into base64
i wanted to store multiple entries so couldnt think of another way, if i create a new table called config wouldnt it be same for each entry?
depends on the server you're sending the request to i guess
Yeah, I think there's enough granularity in the API to split the data nicely in small packets. My other concern is also security, making sure I'm not exposing anything
well you would unless you're encrypting
yup, I'm trying to rely on steamID to ensure a correct authentication.
not sure I would install a mod that would be sending sensitive data over to some server in the first place though
if you're inserting id and config together it might make more sense to add them as a key/value pair doorTag:getModData()[id] = doorTagconfig, you can put these in a subtable for safety from other mods putting stuff in moddata
here is an example of mixed table
obj:getModData().config = {
id = "example",
[1] = "a",
[2] = "b",
}
you can loop with ipairs the 1 and 2 keys (ordered keys) while also having other keys in the table.
ye that one makes sense, for ID's im using Zombrand i think i might get away with it if i keep the range higher Hopefully.
Ho, I'm not sending sensitive data, it's mostly only saves data, but it's more about doing things "the right way" as it's still user data. It's not public but I personally wouldn't mind that someone could know how many days have passed since the world creation in one of my saves
oh is this what i was trying to do i think the mixed table stuff, seems much more complex
that's what zomboid uses for item ids anyway 
@chrome veldt good man ๐
Keep in mind that users are opting in to use your mod. I totally get wanting to be secure as possible, but if your mod IE: sends all connected user names to a discord bot, the people downloading the mod should already be aware that the info is being sent. Of course, that doesn't mean give up on security, but...
But also take what I say with a grain of salt
I'm strugginging to change a tooltip text red lmao
True, but you could argue that for any service you use online you are also opting in, it's still company's fault if data gets leaked. I'm pretty sure someone could sue me after being fired once the boss see that, somehow, the player's "survived time" increased during working hours haha
I'm going a little far here, I know. I guess I'll see how it goes. Thanks for your input
it was the dog's user playing.
true
I think it's awesome that you're trying to be secure from the get-go, but personally I don't hold mods to nearly the same scrutiny I would say a messaging app.
Perhaps that is more telling of my own personal saftey, than it is the greater public tho.
I'm just thinking about a mod for RimWorld called RealRuins where it uploads your save to a database when you lose, so that other players can encounter a wrecked version of your base. I haven't even once considered if any data was included with it, simply because I knowing installed a mod that contacts a server. (Albeit, like I'm mindful of it being malicous but that's another subject.)
oh that's fun, i was considering the viability of a similar project for zomboid
We're kinda obsessed with security where I work so I guess it reflects on my personal projects as well ๐
The rimworld mod seems really cool tho
Yeah, it's really cool. Sometimes you can find a base and just know how that player lost. And other times you'll find a base in pristine condition and feel a sense of unknowing dread.
Security is important, and if it is a skill you want to learn early on go for it. When I was learning to make bukkit plugins for minecraft (code is a strong word because I was using a drag-and-drop block coder) a lot of people were harping that I was too worried about optimizing my plugins. I enjoyed doing it. And it helped me learn a lot about how both minecraft and java work.
Ultimatly what I'm saying is, don't let me stop you from using this as an opportunity to learn a new skill.
if you're going to encrypt, dont write your own encryption unless thats what you do
i mean, for serious projects that is
Ho yeah, for sure, that's one way to get in trouble
however just fyi, if you're sending the GET request over HTTPS the connection itself will be encrypted, even the query string
trying to upload 7 mods today, writing out the descriptions and stuff now.
[h1]blue header text[/h1]
[list]
[*]bullet point text
[*]bullet point text
[/list]
[b][u]bold underlined text[/u][/b]
any other useful [html type stuff] i missed?
-not sure what [list] [/list] does, really. maybe a set of bullet points don't need it?
-I'd really like to hyperlink the name of a mod, so that when clicked, it takes you directly that mod in the workshop
-I'd also like to have a -------------Divider------------, that you often see separating categories of pictures, text and stuff
[url=YourUrl]link text[/url]
I am going to ask a very fundamental question, is the javadocs being used for the Lua documentation? Or is it only code that is exposed to Lua?
To the first question: it's Java documentation. Lua-side stuff is not documented there
To the second: it's not limited to code that's exposed to Lua (which may be considered a good thing or unfortunate, depending on use case)
This is not comprehensive, but it has most of them: https://steamcommunity.com/comment/Recommendation/formattinghelp
Did I ninja you or did you ninja me ๐ค can't tell on my end
Is there lua documentation, or is it mostly just reading examples from the base game? Also thank you.
i haven't heard of any lua documentation
you can find all the exposed methods in the decompiled java code though
and how it works on the java side
Okay, so I have been doing it "correctly" so far. Thank you.
how feasible is a mod that allows you to use pen&pencils to write on books/papers?
i feel like having a personal journal would vibe really well with the loneliness aspect of the game
rly? i thought we can only put marks on the map
ye i keep a note of long term goals for my character on it just in case if i load a save after quite a while
oh that's smart
yep
ye sometimes you dont play for a while and when you load back up if you dont have goals you dont know what to or where you left last time.
Is there a way to export the map to an image?
eg this:
just learned a diff b/w ipairs and pairs , i mostly used em interchangibliy but ill be cautious of ipairs from now on. Took me 20 mins to figure this one out. Anyway now it works smoothly and we're back on track, after some optimization ill work on performance and then maybe some visual stuff for mod. Hopefully itll be ready to upload soon.
ipairs should never be used
if you need to iterate through only the numeric keys in a table, a for loop is exactly the same thing but runs faster
Really?
ye tehre was something else about the it tho, someone mentioned about "halts" in code if tehre were gaps in numeric values
yeah, if there's a gap it's not an ordered table and trying to iterate through it like that doesn't make sense
ah the ui looks trash tbh ๐
ah yes you could work on that maybe, it's rather simple in nature for now.
ipairs is just a for loop with java function overhead
i was thinking like handwritten with whichever pencil/pen color etc
idk how good that would be
just did some quick testing in debug console and ipairs is ~6-7x slower
oh wow, I did not know that, thank you
Also, do you know an answer to this?
i think in normal lua the gap isn't nearly as big but it's still slower
sorry, no idea
Well, thank you anyway
somehow even pairs is faster
maybe its coz of non contiguous numeric keys?
nah you'
you'
re right about pairs being faster then
it doesnt keep track of indexes as well
with a table with three elements in ordered numerical indices, over 10,000 iterations each, i found that for loops usually took around ~0.03s, ipairs usually took around ~0.20s, and pairs usually took around ~0.12s
the times are specific to my hardware of course but we would expect a similar ratio on all hardware
that could be a nice addition then maybe you could add more stuff down the line if you wish.
safe to say pairs for the win if you dont care about order and numeric keys
yeah. if your table doesn't use numeric keys you have to use pairs, but in any situation where you would normally use ipairs, for loop is always better
When using events like Events.EveryDays.Add(functionHere) - there is no reference to player. If called from the client does this run on client or does it end up running events from the server? Is best practice using getSpecificPlayer() to access a player from these sorts of events?
Would it be possible to pass a parameter to the function in Events.EveryDays.Add(functionHere)?
it doesn't pass a player because it wouldn't make sense to, the day doesn't pass for one specific player
using getSpecificPlayer() is best practice
i was thinking hand written notes that you cant erase (need to scratch off instead) and option to use different pens/pencils causing different color/boldness etc
eventually allowing doodles as well
not sure how feasible all this is
Okay so if you are using that event and the goal is to have something happen to an individual player each day, you would need to then store some mod data and check that for info on what player to effect or something of that sort?
not scratch off but scribble over
yeah, you could also keep a reference to a player/players in a variable if that suits your code
there''s a mod for map which lets you do stuff with pens i think like colours and thickness i believe, you may wanna check that out. I don't remember the name atm.
cool. In that case if you were calling a stored player reference from an function that was attached to that event, it would call on just one client and not affect all players? Provided it is running from the client folder?
as long as it's running on client lua, it doesn't really matter which folder it's in
media/lua/client is client lua and media/lua/server is server lua? Or am I misunderstanding that?
all lua runs on the client, all lua except the client folder runs on the server
it doesn't matter which folder it's in, it matters which environment is executing it
I am a bit confused I think. How would you determine what code is running where?
i was trying to convey in response to 'it would call on just one client and not affect all players' that code can't 'spill over' to other clients, every instance of the game has a completely separate lua environment
Okay I see, that makes sense. So if I use that event I can store a player and call code to affect that client and safely only them, provided they are not on split screen or something like that, which I imagine I could check for if needed.
I am also curious about getPlayerNum() - when a player logs off, say #2 of 20 players, does PlayerNum change for everyone? Do I need to be handling that if I am running something overtime? I guess, is there risk of a players number changing as people log in and out of a game?
playernums are completely local
everyone's playernum is 0-3, depending on the order they joined splitscreen
the multiplayer identifiers are OnlineIDs, they don't shift when a player leaves
Okay cool I see, do they shift on a server restart or are they permanent until the user is deleted?
they do reset on server restart
Okay cool. Thank you so much this has been very helpful. Time to start running print statements to see if I understand this right 
Ohhh... real quick, is there an ID that does not change ever for a player? usename maybe? is that the best way to get a solid repeating id as long as the server exists?
i think the only solid one is sqlID (though that doesn't change after character death, and isn't easy to access)
open doors all day long from the comfort of your car(you do have to get out and get in tho as trigger is onEnterVehicle)
on servers that rely on steam accounts instead of server login, username is the steam display name i think? which can easily be changed
steamid can be used instead but then this causes issues for steam account sharers on server that *do* use server login
if character death is a problem, the workaround i went with was just generating a uuid when a character is created and putting it in their moddata
Okay cool this is making sense. I think I have a few potential ways to do what I am looking for.
Thank you so much @bronze yoke !

You can also use steamIDs for that
no, this causes problems for servers that use logins and won't change after character death
and of course non-steam users
Damn I always ever used Username and was happy with it for that purpose. I wonder what I'm missing.
Guys, how do I Export the armature from blender, cause of I do it as fbx it doesn't work??
Hey, looking into Distributions.lua and I am wondering why a room might have a property "forceForRooms" that points to another room
In the image, the "changeroom" has a "locker" with a property that force a "PoliceLockers" to appear in the "policestorage" room? Why is this defined here? Why is not in "policestorage" definition
its not pointing to other room, i believe the room changeRoom is teh one we see lockers in which can exist at multiple buildings. So they grouped the loot for lockers into different sections and then prioritises on the basis of if its police storage or anything else. At least that's how i see it.
forceForRooms makes sure that this table is rolled for sure no matter what
multiple room types can share a loot definition
forceforrooms forces that proc table to be picked for that container in that room type instead of the default behaviour which is randomly rolling one from the procList based on their weights
the idea of turning doors into storage units for implanting your scanner device works great with double doors but fails against Garage or metal doors. I could keep it only for double doors or ask player to put a container for scanner device beside every door they wanna tag.
from Top 5 wishlist pz in discussions on steam, every pz fan on the floor for NPC's, animals and whatnot. My man has his priorities straight
Minecraft was truly ahead of its time by binding sprint to double tap W
I have never played Minecraft but that seems like a nice way to do it, still it might be risky with pz I think what if you're character jumps from the top floor while you're working on your stairway to moon.
that happens anyway 
Hello, if I want to make certain items more rare in my multiplayer save. Is the only way to cut down on the loot rarity and can I do my own mod and then add in loot distrubtion and change the value and they will override the normal ones? Would that work?
There is a mod that specifically reduces food spawns even further that the presets allow, that might be a good place to look. Think it is calle 75% less food
Yeah, I know about that mod. But I would wanna be able to control it per item .. Would a item distrubtion list work if I made my own mod?
if you mean directly adding a new loot rarity setting, those are completely hardcoded
Like.. If I wanted petrol cans to be harder to find, can I take the distrubtion file and take that line to my own modpack and change the values?
The example here is failing at require("ISUI/ISPanel")https://pastebin.com/qcWrkxhA the file does exist locally. Something about attempted index: derive of non-table: null.
I was hoping to use a working example to test off of, because I simply can't wrap my head around manipulating localization strings.
No idea then, sorry.
that seems very odd, ISPanel is a vanilla file and it is in that location
is this from the server log?
Client debuglog.txt
I can't even get the game to boot with this example loaded as a mod
oh, because it's in shared
move it to client
the shared folder loads before client, and client contains all the ui code
now how did I manage that
lmao
I knew it needed to be in client, idk why I put it in shared, thank you
That did the trick, thank you again
I'd like to have a debug flag that's off by default in the workshop folder for uploading, but on in my mod development folder. Right now I manually set a true/false flag. Anyone know how?
I do like that idea! thanks! better than what I have, it might spam other mod devs which is fine since I guess they prob won't do development with my mod installed
btw, i recommend caching the value as java function calls are super slow and it's never going to change anyway
is there a caching library or just setting it to a module/table/namespace variable
the latter
is there any restrictions for poster image file? apart from extention being .png
one of them needs to be 256x256, i believe
the steam preview.png needs to be 256x256, poster has no such restriction
they look nice / fill up the ModManager window when in a 16:9 resolution
any reason my clothes are appearing pristine & brand new, even though they are low condition with holes?
playing in debug.
maybe its impossible to have ragged clothes in debug?
Thought of a way simpler mod. In inspiration from the Oppenheimer movie I will make a nuke
Does anyone know what we can use to generate a 'sound' that attracts zombies? like the cough or sneeze from the player, not playing an actual sound. Is there a sound emitter or radius or something that we can call/set from a player/character location?
perfect
most of the args should be self explanatory but volume is a tiebreaker, zombies go towards the loudest sound
awesome thank you, I will experiment with that but it looks like it is exactly what I need.
looks like loud sounds cause stress, that is pretty cool
or they can**
oh, and zombieIgnoreDist is a range at which zombies will not hear the sound if they are too close
that's so zombies won't all stack up on one square
okay nice! thank you for that timer saver, I was gonna test that out.
ohh man this is awesome, nice a flexible. I like it. Thank you again @bronze yoke !
do you know what the unit for the radius is? Is it meters?
it's probably squares
is there an updated page that covers that event/what parameters it takes? can't find it either in vanilla files or on the lua events wiki page
This is perfect, thank you!
If I have a mod and I change values in like the recipe, more exp, more time or etc.. Currently now I exit from a game, go into solo and load the mod again to get the changes updated. Does it work to instead launch the game in debug mode and use the F11 window or whats it called and just update it from there?
Can't I do that in the debug mode+
You can reload lua files but not .txt
Ohh okay
This value
- OnGiveXP:Recipe.OnGiveXP.TailoringLow, *
Does it determ based on the experience set on the server?
I am a bit confused regarding the xp give..
OnGiveXP:Recipe.OnGiveXP.MetalWelding25,
OnGiveXP:Recipe.OnGiveXP.Give20MechanicsXP,
Both of these work right?
If they are in recipecode.lua yea
Yeah but why does the Mechanic have the number in the start and Welding in the end?
Probably cause the guy who wrote that just forgot it
Doesnt really matter
As long as the code inside them works
But you can name them whatever you want
As long as they follow the conventions
Smth like Recipe.OnGiveXP.MyFunction
So instead of those two I can set..
OnGiveXP:Recipe.OnGiveXP.MetalWeldingLow,
OnGiveXP:Recipe.OnGiveXP.MechanicsLow,
??
How can I know what works and not in reality? ๐
Well you could check your stats
Since the one going through should give you xp
Alternatively you could add prints or says in it
Add prints or says in it?
In the function called
So that you know that it works
In the console it should add new words if you do prints
Or your character says something if you do player:Say(โฆ)
To use console I need - debug right?
Yes it only appears in the debug mod
Where can I find more info about OnGiveXP ?
This does not work :/
OnGiveXP:Recipe.OnGiveXP.MetalWelding25,
is there a place i can go to see a full list of the distibutioons
You can make one for yourself from the vanilla file /media/lua/server/Items/Distributions.lua
But there's no such list as a resource
im just trying to figure out a certain place for loot to spawn
I want it to spawn only on military zombies
Soo in trying to update an existing mod, and I was successful in updating it before, now, somehow, it's giving an error, result=2. Did anyone figure out the cause of this issue?
i restarted steam when this happened to me and it resolved it
Doesn't seem to be working on my side. Tried to restart my PC altogether, no luck. My only guess I might have accidentally messed up sth with the files in the new update but not sure what would cause this lol
this might help
I'm unable to upload my new mod "Playable Arcade Machines Grapeseed" to the steam workshop. The error I get is "failed to update workshop item, result=2" The result in my workshop is an empty mod with no content. This is my 3rd mod. I've successfully uploaded my other two mods in the past. I even...
Thanks! the issue seems to have been fixed after waiting it for a bit
probably some steam/PZ sided issue
the most common cause is just steam issues yeah
np, why is forum so ded. Would have been great resource tbh maybe its cause folks are more active on discord. But i guess it's not too bad as well. Much more active for sure.
we're just not in the era of forums
i think discord is just.. more efficient so to say
for sure, you could get answers in minute or day instead of waiting for a month or a year
i often try to search earlier chats for any related info i might wanna find out
trying to interact with in-game weather, having trouble to event trigger car events.
Would it be possible to make a mod for multiplayer that splits players into two teams and puts circles around where each team is located?
I want PZ TDM
What would be the circles for?
to locate the other team, or at least where most players on the other team are
Im imagining the teams spawn in separate towns
Hello there, if anyone has a comprehensive description of Lightfoot Vs Sneak perks, I'm interested, else I'll go in the code.
sneak is the chance to be spotted by sight, lightfoot is the radius you can be heard
hmm well that's not what the wiki says so maybe i'm wrong
wiki says lightfoot is your footstep sound radius and sneaking affects an additional radius reduction while sneak walking
i'd be kind of surprised if that's it, but it would kind of make sense with how unhelpful those skills can be
the wiki was incorrect, i am right
lightfoot affects the radius of your footstep sound while sneaking and sneak reduces your chance to be spotted by zombies while sneaking
Thanx a lot
actually, sneaking does also reduce your footstep sound while sneaking
lightfoot affects it at all times
print() in a server command would print to the server right? (trying to test via coop-console.txt and only getting command entered via server console (System.in): "ping@pong" which isn't what im printing, and guessing it's just bc i called a command, but unsure if it's executing)
it should print in that file, yeah
i'm doing something wrong maybe. lemme retry a few things.
just hosting a multiplayer locally is good enough to test thought, right? ๐
is it safe to use globalModData? or if there's anything i should know
it should be fine
aight, ty
How do i get GlobalModData?๐ through getWorld()?
Hey, new to coding/modding I'm looking for some guidance. I have added an item drop that on use gives you a small bag (think supply drop) I have the bag working and dropping correctly, I have an item distribution setup for the bag but I can't get the "crafted" bag to spawn any items. Any advice would be greatly appreciated. If I am requesting help incorrectly please guide me to the correct route. Thanks!
the distribution file in vanilla doesnt know that your container exists tho, might need to put it there as well
Can you somehow control what cars that will spawn in or a certain car mod? If I want that car only to spawn in like 5 vehicle as max?
The way the mod works so far is zombie drops a flare, you activate flare, you receive bag I have these all in my own mod file not modifying vanilla files. I then have a distribution file that specifies my bag and the random contents it can have. The last part isn't actually generating anything into the bags as the bags aren't placed on the map anywhere only created when you use the flare.
there are two types of distribution files in game, one is called Procedural another one is called Distribution, first one creates a table of items(list) that are allowed to spawn with their odds. Second one to actually used to roll these tables from procedural to spawn loot.
Checkout media/lua/server/Items/ should have both files
Okay my understanding was that the procedural distribution was for map placement of items which I don't want to implement. I must need to look deeper to see the bag contents distribution table. I'm new so I appreciate the help.
https://theindiestone.com/forums/index.php?/topic/38165-quick-guide-how-to-mod-the-loot-distribution-system-distributionslua-proceduraldistributionslua/ this one does a better job at explaining stuff
This is a visual guide for mappers and modders who need to add or modify PZ's loot entries using the new ProceduralDistributions.lua approach. Whilst the ProceduralDistributions.lua file has been in the game for quite a while (i.e. the Gigamart shelves having distinct loot types), TIS will be eve...
I'll read that, thanks for your input. Some of this stuff is hard to find because it's a bit niche.
no problem
here's a snippet from Distributions.lua which rolls lists from ProceduralDistributions.lua
in your case, i believe you'd need to insert your container in here, teh all contains items which will roll stuff universally where as other tables contains shop/room wise stuff
So my distribution table looks like the second image.
Also a word of caution, `be careful with naming files and avoid naming same as vanilla character to character that way you dont replace original files
The first is the one I don't have. I just wasn't sure since it's a created bag if contents would procedurally create on crafting
I also put sv before all mod items/recipes
both tables are in same file Distributions.lua
basically, zomboid's distribution system is to choose a random list so that 'matching' items always appear together, e.g. each shelf in a supermarket stocking a specific category of items instead of random items from the entire supermarket pool
i don't think crafting will trigger distributions, you can probably do it manually though
try adding an OnCreate to the recipe that calls ItemPickerJava.fillContainer if this doesn't help
ye you are prolly right, it might not roll distributions once its rolled
so if there was no crafting the container then it would have been possible
Anybody know if it's possible to get a list of all items in the Player's game?
Both vanilla and modded
Not in their inventory or anything, like literally all types of items. Like every clothing item, every weapon item, etc. a list.
to be clear, every *type* of item, not every spawned item instance?
you can loop through ScriptManager.instance:getAllItems() and grab the type from the script object
e.g. if you wanted them all in a table```lua
local itemTypes = {}
local items = ScriptManager.instance:getAllItems()
for i = 0, items:size()-1 do
itemTypes[i+1] = items:get(i):getFullName()
end
Thanks a lot Albion! ๐
Is this on.create referenced any where in the main files or a common mod I could pick apart?
it should be in a bunch of recipes, you can find the references in the game's recipe scripts and then their implementations in server/recipecode.lua
Thank you all so much I'll look there
for events, does it capture the args by itsself or do i have to get the value and then use em in those function calls?
what do you mean?
for ex lets say there an event OnEnterVehicle which requires function to have param IsoPlayer type of obj. So when i declare this function, do i get the player first and then send it or just write in function def expecting event to capture it and pass it along
you just write in the function reference, the event passes all of that to the function
awesome, thanks
if an event says it passes a player, that means it's going to call yourFunction(player)
ah makes sense now tbh since an event already knows how its triggered so it grabs the values it needs
this is the way to do it right? unless there's a syntax error or something.
i think i might have messed up by introducing that . in there
that looks good
all of moddata's methods are static so . should be used when calling them
ah oki oki, prolly something else then. Wrote everything in one go, it was bound to happen
Is it possible to listen to when a specific zombie is hit rather than all of them?
about OnFillContainer and OnContainerUpdate events, does fill means like full to cap? or just anything is added to container
you can do whatever to filter it out after the event fires, but you can't only listen for specific zombie's events
OnFillContainer is fired after the distributions run
is there some event to work only if anything is added to container?
so only when loot is first spawned/event respawn, not during player interaction with it
no :(
oof
you can hook the inventorytransferaction to detect when players add/remove items from containers
is it an event?
no, it's the timed action for transferring items
any idea how to use em? i only am familiar with how to trigger stuff with events so far
it's probably the most complex one to hook unfortunately, it works super weird

i have read somewhere you can create custom events as well, you think something like that might be possible? Otherwise i might have to use one of those key events i think
Is it okay if I have space in the name of a new item I am creating?
actually i think ill just use Everyhour or EveryDay instead, will be much more efficient with my problem
is it a nuclear bomb?
iirc it technically works but most people would agree it's bad practice
You know me too well
Does "item W-59NuclearBomb" work?
Should work
I would recommend you always test things before asking.
Not because people don't want to help, but because you will be getting familiar with how things works etc
sometimes I catch myself for hours debugging things, and you can always learn from it
That said, whenever help is needed, I'm sure this community will be always willing to help ๐
If a mod adds an item to a specific room fill type and my mod references that table to roll loot from will the first mods items have a chance to appear? Trying to be as compatible as possible for things like britas etc
yeah
Excellent now I just have to figure out how to reference specific procgen tables
Thank you
if this is for your loot bag thing, i think you can add a ForceForContainers entry
What is that, this is my first time coding
This is like an early placeholder for a much larger project I'm just trying to accomplish step by step basic concepts that will help me on the larger project
from what i know, its like its a property where whatever value you give that proc list will be rolled 100%
recipe ignite supply flare
{
Supply Flare,
Result:Supply Bag,
Time:100,
OnCreate: itempickerjava.rollContainerItem,
}
Ignore formatting cause I know it's not accurate but does this look accurate at all
If I'm totally off I'll just keep looking for things that work lol
I have my own distribution list that has that containers item name and the list will roll from random tables in the vanilla procgen(like medical, toolsheds, military)
Later on I'll add zombie spawn on use and the container will be placed with a delay timer if I can figure it out and helicopter sound to draw zomboids to the location
Anyone have a legend for everything you see in the Zombie Population window in Dev mode in Debug?
wym like the red dots?
well yeah I know there are standing zombies and moving zombies and the npc zombies that own stuff, but I also see flashes of green that outlines zones and other weird events that I cannot remember. I am curious if anyone has put together or has something that says what is what
or when they turn white, it seems like they aggro to maybe a sound, but I am not sure
globalModDataTable[myRandomIndex].property=someValue trying to write some values this way but table remains null i believe. I have looked in debugger as well, can we use [myRandomIndex] this sort of indexing with moddata? or is it only with . operators
doubt anything like that is out there, would recommend just play with it for a while. Spawn a horde nearby go to ghost mode see hwo they target and what happens with those dots. Hit and trial should get you there.
Yeah I probably will mess with it a bit just to understand it better.
you can also clear out zeds around you, there's a lot of options to play with.
Oh yeah there is so much in here its great, I am really curious about that flashing green line tho, maybe it is just showing things loading, but I am not sure
I think for global mod data you have to use local myTable = ModData.getOrCreate("MyKey") and then modify the table like a regular table after that.
i tried with ModData.create("key"), it works i can see the table in global mod data in debug but its empty. Thus resulting into error "indexing-non table"
I am not certain what it could be unfortunately
from what i can remember when you index non existent indexes in table it gives back nil, that might be it. Since its giving back nil as result and im calling another index on the nil value. Ill fix it later on. Ty for help anyway.
Ohh you know I think in LUA the tables are not ordered so there is no index unless you are using the key as the index... I might be wrong since zomboid uses some sort of special lua, but that may be a place to start
I'll test it in an isolated environment later on just to be sure .
my mod doesnt show up
Scroll it down to the bottom, otherwise something wrong with structure or files
Been trying to look it up but cant find many good results. Is there a way to make a user interface with lua?
it's just a table
your null error is because globalModDataTable[myRandomIndex].property you have not initialised globalModDataTable[myRandomIndex] as a table
Is it possible to still write in java for certain parts of your mod?
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md start there I think, you can do it all in lua I believe
Thank you
most of pz's ui is created in lua
hey there! quick question, the numbers within the distribution lua files (both base game and mods) are represented as percentages? or what exactly?
i'm guiding myself with other mods and base game's distribution numbers, but was just curious
it is a percentage, but there are a lot of other factors so it's never really the chance as set in the lua
for example default loot settings are well below 100% and zombie density increases the chance
you can see the 'true' chance in lootzed
How do you use lootzed?
enable it from the cheats menu (remembering that it doesn't apply until you close it) and then right click the container icon in the inventory
thanks for the info :)
If you want a taste of Assassin's Creed, you can try my clunky animation recombination in the brand new Strike From Above mod https://steamcommunity.com/sharedfiles/filedetails/?id=3009914757
ah that prolly it, after i initialise globalModDataTable[myRandomIndex]={} i should be able to store sub tables in it. I
yep that was it, fixed it finally. Everying works now.
might upload my first mod today hopefully and become an official member of pz mod community
just one more thing about globalmoddata, as long as im working with SP it should be alright but i doubt globalmoddata would be feasible incase of MP servers, thoughts? what if i have 10 entries for each player would it fine performance wise
i've heard conflicting reports on that
someone in the community was having terrible issues with not even that large of a dataset, but i maintained a mod much more wasteful of global moddata and didn't see the same issues
RAHHH
you better hurry up with em nukes
I just started at like 6 pm
I am having to learn how to model and how to do a bit of java because I learned that UIs are the type of stuff that zomboid runs java with
but dw
ig ill be fine, id have to work with something unique from player side and that can be container table for all the values.
that youll know after you subscribe, i plan to ruin everyone's saves
I will subscribe to it
nobody will see it coming
good thing my near 3 month character just died today
cant be corrupted by you ๐

Veronica Sutter was my best
she died
I wasn't sad I knew it was coming
I killed thousands but died to just 5 zombies
tip: banging at a door is never just two zombies
yep, the moment you get into your comfort zone and forget about the rule book. You ded.
ong
its kind of funny. The only reason I got into code is because my ankle is broke rn
Well that's one way to learn something new
I also learned how to draw
I actually get out of the boot hopefully in a week
ping me when the mod is posted
sure i will, you'll get the first subscriber award and a special mention. Not that many people are competing for it๐
RAAAAAAAAAAH
I need opinion for the nuke mod
should the nuke be an unmovable object located right in the center of louisville
or should it be movable
i dont think it should be movable, unless your guy is super man that he can do what he pleases i suppose.
I might make it movable for the sake of letting people use it creatively but if I might also add a need for the hazmat suit to get near it otherwise you get sick
ill give hint about the mod tho, if anyone's a Harry potter fan, my mod is something related to it.
Never got into harry potter. I watched the first movie and the last one
its a good series but I just never watched it all
if your ass is making wands istg
xd that'd be too obvious and boring
something i had in mind, now that i think about it. There's more than a couple of usecases. I think it'll be great plus something that can add value along side other mods.
well I will be waiting to see what it is
I cant be bothered to learn java but I have no choice with the UI thing
My brother who majors in computer science visited me a bit ago and got confused by the coding for zomboid XD
all the proramming languages have same stuff more or less, you know one you translate to others.
I can kind of read java but I still have to look stuff up
which is fine
Don't learn everything right away, only what you need.
It's kind of hard not to learn everything
"oh what does that do" leads to "what's that?" and so on
It's a trap and you lose motivation over time.
You learn something relevant to your work that's enough and you build on that one.
My motivation is the fact i've spent days on my mods and it would be a waste to give up now
i'm not sure where you got this from, zomboid ui is almost entirely lua
one second
oh yea that UI thing is lua
this is lua?
yeah
whats with the semicolons at the end of every line
lua doesnt care
you can do that, it's a style thing
just like javascript
welp all I have to do is change the file type
not much time wasted
A style thing
bruh
i dont think if lua even cares if you write stuff on same line(i could be wrong on this one i feel like i saw it somewhere) or maybe it was a diff language.
Do you put UI scripts in the client folder?
I put hard research time for nuclear bombs
also the bomb will be on the ground so it wont be an airblast
fallout perhaps?
It's beautiful
The UI works
Anyone knows if it is possible to get ONLY the lowest value from this kind of calculation?
local zombiePos = {x = secondObj:getX(), y = secondObj:getY()}
local dx = zombiePos.x - playerPos.x
local dy = zombiePos.y - playerPos.y
local distance = math.sqrt(dx*dx + dy*dy)
return distance```
You're looking for something related to math. Floor(takes the nearest integer on lower side)
i've tried but still getting the same issue.
playerObj:Say("They Can see me")
return end
if distance >= 10 then
playerObj:Say("They Can't see me")
end ```
If there's a zombie within the radius while is another outside, it trigger both ifs
Hey there, pretty new to modding, want to ask whether this is a correct implementation to export player kill count on the server side as I'm getting attempted index of non-table at KahluaUtil.fail line:82.. error
function KillCountServer.updateExportFile(player)
local kills = player:getZombieKills()
local username = player:getUsername()
local displayName = player:getDisplayName()
local filename = username .. "_killcount.txt"
local file = getFileWriter(filename, true, false)
if not file then
file = getFileWriter(filename, false, true)
end
local outputString = displayName .. "," .. tostring(kills)
file:write(outputString)
file:close()
end
Events.OnPlayerUpdate.Add(KillCountServer.updateExportFile)
It sounds like rather than triggering the logic for each zombie, then, what you want is to check zombies until you find one within range. Presumably you'll also want to keep state (i.e., a variable), so the message won't be said repeatedly
What does line 82 correspond to in this snippet?
Seems like its a general exception for Kahlua.Util as from the search results there's also same error with this message
That fail method is presumably just intended to print an error message. What's the full error? It likely points to where it's occurring
STACK TRACE
-----------------------------------------
function: KillCountServerExports.lua -- file: KillCountServerExports.lua line # 1 | MOD: KillCountServer.
[26-07-23 20:05:32.726] ERROR: General , 1690373132726> 1,486,989,834> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index of non-table at KahluaUtil.fail line:82..
[26-07-23 20:05:32.726] ERROR: General , 1690373132726> 1,486,989,834> DebugLogStream.printException> Stack trace:.
[26-07-23 20:05:32.727] LOG : General , 1690373132727> 1,486,989,835> -----------------------------------------
STACK TRACE
-----------------------------------------
function: KillCountServerExports.lua -- file: KillCountServerExports.lua line # 1 | MOD: KillCountServer.```
Not a lot of additional info there, but I believe the line does refer to the line in Lua. So, what's 82?
Oh, the "line 1" there may be more telling. Did you declare KillCountServer as a table?
Okay, no more errors now, the mod works, but it export the file in client side
Does getFileWriter always point to the client folder?
I thought it would use Zomboids/Lua folder in serverside if use in server context
getFileWriter i believe points to your mod media folder
Actually im wrong
I think its supposed to go to your lua cache folder if its on client
Would it be possible to make a Pathologic mod to this game, where there are areas of plague, and the plague follows you if it sees you, infects you and you die?
That would be pretty cool.
If people have not played that game, that might sound odd. There are like these invisible plague ghosts that infect you in that game, and you have to run away. And in palgue districts the plague damages your mask and protective clothing
It kinda feels similar to a zombie game, except like ghost zombies
Im still trying, but not getting any lucky though . What im trying to do is to create kind of "stealth buff" when not close to enough to zombies. So i calculate the distance between character and near zombies, but it gives all distance of all zombies at the same time. I was hoping to find a way to only return the lowest distance possible.
Or maybe a way to sort that order from lowest to highest
yeah, the files get created at %username%/Zomboid/lua
is there a way to create file in server side instead?
I dont believe so unless it creates them in the cache of the servers folder
But i would be cautious with files creating
It can cause checksum problems
hmm, what im trying to do is actually related to a discord bot to query the kill count of players in my server, so unless im able to access the exported file from the server itself, not sure how else this can be done
i think that's for chat functionality
You can send the player kill count as a message in the discord channel directly without storing them separately
You should be able to create files serverside and write to them, you just have to be careful about which method you use since placing files in the mod directory can invalidate the checksum & make it so clients can't connect
I can't check specifics at the moment, unfortunately
so I'm running pz dedicated server in a linux machine I host myself, is it possible to output to any path on the system?
and my discord bot are also on the same server so it would be able access all the files there as well
another method I can think of is just output the kill count to server side log (if possible) then use regex to extract it out
when you have two conditions like this where only one will be always true, throw the other one in elseif block. Makes sure that only one of em gets executed each time.
Hello! I've been trying to make a grappling hook mod
Basically, I want to add my own version of the sheet rope, where I retexture the sheetropes tiles and configure the placement of the sheet ropes to only take the item "Grappling hook".
Though, I've been searching through the Lua files and I can't find a mention of the sheet ropes. Does anybody know where their function, being climbed and being placed, is saved?
I'm trying use the code additem("blahblahblah") to add items but I want it to roll from the games existing proc gen list for specifc shelfing, etc. Am I able to just refence the proc. gen table in the quoted section or do I need to add another function to pull the lists and then reference that function?
add if isClient() then return end to the start of your file
all lua runs on the clientside unless you tell it not to
even files in the server folder
Reason: Bad word usage
once the distribution files are loaded i doubt it's gonna roll em again
would either of these help?
doRollItem
public static void doRollItem(ItemPickerJava.ItemPickerContainer containerDist,
ItemContainer container,
float zombieDensity,
IsoGameCharacter character,
boolean doItemContainer,
boolean isJunk,
ItemPickerJava.ItemPickerRoom roomDist)
rollContainerItem
public static void rollContainerItem(InventoryContainer bag,
IsoGameCharacter character,
ItemPickerJava.ItemPickerContainer containerDist)
Reason: Bad word usage
you wanna add an item to a container if im correct?
Otherwise, maybe I can create a function to create a table with the contents of said proc. gens and then roll items from the table rather than have it proc. gen them on creation
yes
i want the container to go into the player inventory and for it to contain x random items (medical for medical flare, food for food flare, etc)
I appreciate all your help, I am very new, I'm reading the lua handbook and trying to pull as much info from other mods as possible.
you can probably do that with itempickerjava
I'm a total scrub and haven't been able to figure out itempickerjava
im not sure if you can just add an item to container or you have to pick from the world, if its former then it become super easy.
i don't think it's commonly used
can't find anything that seems to use it appropriately for reference
itempickerjava sounds to me like the most elegant solution
but I have google everything i can think of and can't find examples or useage so far
thoughts about this? im just hitting shots in the dark personally havent done this before.
yeah i've seen that, unfortunately i'm not a programmer and can't even begin to decipher its implementation.
it should create an item i think and give you an item of type InventoryItem which can be added through addItem command which expects this item type
right now my recipe has OnCreate: Recipe.OnCreate.SupplyBagBlue which leads to a function to get the bags inventory and then spawn an item in the bag but so far its not even putting any items in the bag so I'm still stuck
the recipe itself gives you the supplybag
it might be your best shot, maybe throw up a test mod folder and jsut work on trying to create items inside inventory/container first. Once you're done with that, then merge it to your project. Will make it much better plus you can experiment a lot on your test mod with less scope of errors from other stuff.
Do you get the bags inventory?
Not totally sure how to tell. Currently its throwing zero errors but clearly not populating the bags inventory.
I don't care to share my code if thats allowed as I may be missing something super simple :/
i think you need to use getItemContainer to get a loot definition, and then pass it to doRollItem