#mod_development
1 messages ยท Page 211 of 1
Does anyone know which method of (IsoGrid i guess?) highlights tiles inside of it like it happens with safehouses in -debug mode by default?
How do you alter item distributions?
Whether that's to completely remove pre-existing a specific location, changing the chances of an item appearing at a pre-existing location, or creating entirely new locations.
hooking into Events.OnPreDistributionMerge https://pzwiki.net/wiki/Lua_Events/OnPreDistributionMerge
you need to modify the procedural logic and intercept the tables keys in order to achieve what you want, i think that would be the correct approach
I'm really new to Lua... as in extremely new, and so I apologize if I'm really slow to understand ๐
So essentially modify the procedural distributions before the game loads them, as to have it load the distributions I want instead of the regular ones?
you need to create a function that will be passed as an addition to the event, in that function you need to declare the tables as they're declared with their by default value or empty as empty tables, then you call the iterTable function for each of your desired tables to instruct the rolls reduction
local function reduceTableRolls(key, zone)
if zone.rolls and zone.rolls > 1 then
zone.rolls = 1;
end
end
local function iterateTable(table)
for key, zone in pairs(table) do
if type(zone) == "table" then
if zone and zone.items then
reduceTableRolls(key, zone)
if zone.junk and zone.junk.items[1] then
reduceTableRolls(key, zone.junk)
end
else
-- Iterate until `zone.items` or `zone.procedural` are found.
if zone and not zone.procedural then
iterateTable(zone)
end
end
end
end
end
Events.OnPreDistributionMerge.Add(yourPreDistributionMerge)```
Am I an idiot for not really understanding this
It's not your fault for not explaining it properly I'm just an idiot
local function reduceTableRolls(key, zone) What's "key" and "zone" here?
oh in Lua i think they're tables tho ๐
ah okay
So "key" and "zone" are just two different keys for that specific table?
Or for that function
Wait I'm confused
What do those do for that function? There doesn't seem to be a table defined in the scope of reduceTableRolls
see iterTable
What does the iterateTable function do
oh
Is it just to reduce the rolls for a specific item?
if I make the rolls 0, does it do the equivalent of making it so that item doesn't spawn in that location?
Sorry, I'm completely clueless about how to do this - I can't even entirely understand what the code is doing/how to read it ๐
Coding seems like something that's very hard to... practice. Like, where would I even start to learn more Lua?
Okay, so for the first part, it's defining the function reduceTableRolls which has two parameters, "key" and "zone".
That's about all I can understand for the top part, I don't really know what the "zone.rolls and zone.rolls > 1" stuff does.
For the second part, I understand just about the same amount and that's it.
Does type simply refer to a list of variables?
Ohhhh wait
type will return what kind of data type the variables stored in it are
I think
Hello comrades, I apologize for a possibly stupid question... but does anyone know the function that puts clothes on a character? or a mod that has something similar
For example: after pressing a key on the keyboard (or after any event), an item of clothing from the inventory is put on the character
Is there a way to edit a recipe added in one mod with another mod? Do you have to use Lua for it, or can you just redefine it?
How can I get the current mod id in lua? Like, if my mod is has the id casualoid is there something like getModId I can call in lua?
Check this conversation here ๐ #mod_development message
Eugh. Can't just use Override:true like people claim?
you can redefine it, but i wouldn't recommend doing that unless your mod is personal use
It is.
If the original mod were open-source I'd just PR the fix, but instead I have to patch it myself.
For me and a few friends to use. I'm just doing the bare basics and handing it off to someone else to do what they want with it, upload it, whatever.
overriding the recipe entirely puts a maintenance burden on you as you have to keep your overwrite up to date with changes to the original, and it eliminates the possibility of compatibility with other mods doing the same thing
but for personal use, it doesn't really matter
Override only works on vanilla recipes AFAIK.
The original mod has been unmaintained for I think at least a year now.
I have seen no reason to believe that.
The issue with Override:true is that it only applies to the first recipe named that - so it's not reliable in some cases. Just something to keep in mind.
This is the closest I've seen.
https://projectzomboid.com/blog/modding-policy/
Abandoned mods can be reuploaded. Check: 8. Abandoned and Broken Mods
It has been, but it's still not actively maintained. There's like eight, none of which are open-source.
I started with fruit
Hello, does it happen to anyone that when they download the Britas Weapon mod they get a little red box in the game that says "error"? If anyone has a solution it would be very helpful.
I've been told and observed before that some vehicle data on vehicles in save games isn't updated when the vehicle script file is updated. I'm trying to figure out what parameters are/aren't updated and how it's saved into the save data. Anyone have an idea, or know where I'd look for this info? I've been looking at the BaseVehicle and VehicleScript classes but haven't figured much out.
Is there an event for when all the mods have loaded? ๐ค
anyone here know opengl shader stuff yeh?
It looks like vehicle data is saved in vehicles.db and less is saved than I thought, unless there's somewhere else data is saved too that I'm missing. It seems pretty much only part data, mod data, and inventory of a vehicle is in the database, so I think vehicle parameters should almost all be moddable and testable mid-save apart from the parts/part templates themselves? Hmm
Does zomboid have modding support for using MySQL?
I'm trying to make a plugin that connects to an external database to store stats like playtime etc.
I wonder what you mean with "unmaintained". e.g. No Update may just indicate the mod does its job.
It has numerous issues, which is why there are forks/reuploads with fixes.
But those aren't very good either.
That looks very subjective. My own experience is: undetailed problems are mostly users-side problems. And most of the remaining mod problems can be corrected in patch mods instead of reuploading the initial mod.
Okay. I didn't ask you.
Anyone who can help me with this error would be of great help..
41.78.15 ? was this version out in 2022 ?
Ladies and gentlemen, my farming mod sometimes incorrectly selects the current plant sprite. The functionality works correctly, but visually it looks incorrect. Do you think the server will be overloaded if you check the surrounding global farming objects every 10 game minutes and change the sprites to the correct ones if they do not match?
anyone know which mask layer is for the head? i realise that bc of my outfit having all masks it removes any headwear
Iโm thinking of adding firefighter boots and Iโm curious as to if itโs possible to make it so a piece of clothing prevents a body part from catching fire?
Does anyone know if it is?
making a huge map
Hello, I have an issue with my recipe and the context menu, let me explain. I have a recipe that requires an item + a screwdriver, and I want that when right-clicking on the item, the option to apply the recipe is shown REGARDLESS of whether the screwdriver is in the inventory or not. So, if it's there, the recipe is displayed with white text (the default behavior), and if the screwdriver is not in the inventory, the option is shown in red, and it's not possible to perform the recipe.
It seems that OnTest (in Recipes.txt) is not working for me. I can create a tooltip manually and set "notAvailable = true," but in that case, I don't know how to display the panel that shows the items needed to craft the recipe (the one that says: "you need a screwdriver", and renders its texture).
What can I do?
I finally got my lua code to work
I feel really happy
and I feel as though I'm actually learning
Hi I'm new here.
TLDR: is there a way to tell if a corpse is a zombie corpse or a dead non zombie?
I'm working on a mod for my public PVP server. I'm wondering what I have to do to identify if a corpse is a zombie corpse?
I want to be able to EG: Cut ears off dead players but not dead zombies (like in diablo 2 ^.^)
Heyo peeps, gonna be here every now and then trying to work on a project. I'm no stranger to programming, but hadn't modded PZ before. What's the proper way of adding a new 3D Item?
Like, I have an item in my script file, do I need to do the
model = mName
{
mesh = FBX-File,
Texture = FBX-File-Texture,
scale = 1.0,
}
in the same file as my item? And reference it wiiith... WeaponSprite, right?
Also is mesh suppose to be the FBX 3D model, is texture suppose to be, well, the texture for it? what if the 3D model had colored polygons or such and doesn't have that? That gonna mess it up?
Some British Vehicles from a mod I'm making
Possibly, just fiddled around the code of Susceptible and I saw something that checked different states of zombies, not sure if there was a check if the zombie was on the floor or some shit like that
You could test to detect zombies around and see if those that are fake zombies are detected that way
OK thanks for the idea
Looking good!
do you have brita's weapon pack enabled
also make sure that you're only running 1 version of arsenal 26
also this should go in #mod_support
hello
i use this code for zombies to drop money: table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.Money");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 50);
but is there also a code for min and max amount they drop?
guys is it possible to respawn a dead player? (same character)
maybe when player didnt press the respawn button yet
Does this look ugly? (the green car ofc)
yes
Not sure if anyone saw my message yesterday, but Iโm looking for help with making flameproof clothing. Is it possible to make it so a piece of clothing protects a specific body region from catching fire?
Maybe a code that checks to see if the body part is on fire, and if it sees that youโre wearing the piece of clothing, it prevents the body part from being on fire - would that work?
I'm not sure body parts can be on fire. I guess the character can be or not on fire and body parts get burns consequently to fire on tile or on character. But I am not sure of anything.
maybe dig the code and tell us what you found ๐
Ahh, I thought which part is burned is because the game checks to see if a body part is "on fire" when the player is burning
Iโll definitely still go have a look to see what I can do!
hello. i am thinking of creating a remote control mod where i would control the character by another application.
for this to work i need some form of communication between the game and the app.
i think i can somewhat achieve this by file io where i would use getFileWriter for current status and getFileReader to wait for commands.
writing to a file is the easy part but not sure how i would incrementally read a file via lua commands. before sinking in many hours fiddling more with the lua api, do you think any of this make any sense? would you recommend any other way?
i actually wished for a headless client that can connect to a local server. that way i could run multiple players at once but i guess there is no such thing.
After adding back the compatibility between Susceptible and Spore Zones, I'm now looking at Bloater models. And I did it :)
Time to check if everything works correctly, and if I can simplify the files of the mod
ah, the fun part lol
It's mostly some copy pasta
But I want to see if I have to repost the whole infected mod to actually add the model
I mean I don't think it would be an issue anyway since the developper stated he won't continue the mod, so reposting it overall should be fairly ok
Is it possible to replace a function from another mod ?
I've never tried personally, but I saw this recently (someone correct me if it's outdated/inaccurate plz) https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/api/README.md
it has a section on overwriting
I mean if I can do it fairly simply, I'll do it, but it definitely isn't really needed. I just modify a simple file but need the others from the mod
Also I literally just modified a single line of code so it was very easy lol
Just had to understand how PZ handles custom models, clothing on zombies etc but it was ok
Question, can I store the mod data in a IsoThumpable that can be moved around and carried like a box? And ensure that this mod data is saved when the item is picked up?
Hi, quick question-- do lua events like EveryHours and EveryTenMinutes operate on real-world server time or in the in-game clock?
In-game clocks
got it, thank you!
Which also means, that if you change the day duration, it changes how often they get triggered
I guessed it correctly then
yeah, i'm just trying to log the in-game time on our server so we can pipe it to our discord. While I was googling around I found this bug report post from a year or two ago -- https://theindiestone.com/forums/index.php?/topic/50777-4168-singleplayer-event-everyhours/ does this mean that if I trigger an event on EveryHours that calls GameTime.getHour, the return from that function will still be an hour behind?
It seems like the event happens before all things you would consider "standard" are updated. One example is print: getWorldAgeHours / getNightsSurvived / getTimeOfDay LOG : General , 1648017263472> 71.10296630859375 /ns 2 /td 6.102962970733643 LOG : General , 1648017286722> 48.0000228881835...
good question, I don't know ๐
figured, but I thought i'd ask. Thanks for the help, I'll just try it out
Out of curiosity, why do you need the in-game time on a discord server? ๐ค
it's a large multiplayer server with long days, and often groups want to coordinate things like "let's go out looting together when it's morning" without logging in to see the time.
Ahh that makes sense cool stuff!
guys how do i respawn the player, like after u die add a button that respawns u on the same position and with the same character and remove the dead body or remove the zombie, items arent required to get kept, only clothes tbh and character name
i want to make like be a zombie mod
that is better than "infected player"
Are item distributions used client side? I noticed that mods that modify the distribution tables will often put the code for it in /lua/server/items but not gate it with an isServer() check?
to my knowledge no, people just don't realise they could (and a not isClient() check would be more appropriate otherwise your distributions wouldn't be applied in singleplayer)
guys
guy
yep
IIRC nurse made a video about it and linked it
thanks bro
The bedcovers mod does something like this and it seems to work well.
if not isoObject:getModData().movableData then isoObject:getModData().movableData = {} end
isoObject:getModData().movableData.bedcoverData = bedcoverData
isoObject:transmitModData()
the movableData is copied over in moveable actions, however it might need some fixing under some conditions.
ah interesting thank you
I would like a way to stress test my "Proximity Inventory" mod, does anyone know a good way of doing it?
I need to put a stupid amout of items inside containers, like thousands of them
Could someone guide me on modifying this mod?
https://steamcommunity.com/sharedfiles/filedetails/?id=2784607980
I want to remove the flags I don't need, it's for a small co-op server (the mod author has given permission for this kind of action)
For example I'd like to remove the African and All of the Regional USA Flags (but the one from Kentucky), and some pop culture flags as well.
But I'd like to keep the option of crafting the remaining flags
You'd have to remove the item spawning that you want to remove and probably edit the tile pack in tilezed to change textures you want to
Zombies, just spawn them on a water tile and kill them in a pile. Recommend modding a weapon that can hit hundreds so you're not standing there killing for minutes at a time though.
What are you stress testing? I've killed up to 1000 in one go to test some zombie loot dropping stuff. Aside from the game itself lagging prox inv seemed perform fine.
Hi... how can I render a icon on the screen, like the PVP icon, to show to player when he's inside a specific custom zone. Any one have a exemple of that ?
Guys, do I need anything besides that to make the zombies able to spawn with clothes? For me it's not working, the zombie is appearing naked
I'm stress testing the new proximity inventory code as I re wrote it from scratch
๐
standing over 1000 zombies and loading thousands of items didn't break the old prox inv, fwiw
awfully laggy though
lol
Great thank you for sharing, I will try it ASAP.
It should fix the lagginess this new code
though there was an issue, and i'm not sure it's because of prox inv - items that are added to zombies on death dont seem to populate on prox inv window
sometimes you have to refresh the container and then stuff just appears
It can happen with thousands of items
got reports of players not finding stuff (cures, special items) unless they manually scrolled through zombie inventories or specifically moved items around
Hi, I am trying to create a evolvedrecipe but I'm not sure how I add it to the base items EvolvedRecepi property. The only way I found so far is overriding every item that can be added to the recipe.
is there a way to add a recipe to the EvolvedRecipe property without overriding the entire item?
Found the problem, the pathing in the guid is apparently case sensitive 
fuggit ima try and balance the skyler DrugMod. its not my mod but the drugs are too common and way too risk free/op so ima change it so u can od or have other effects XD
alright im also adding fentanyl and dmt. withdrawl effects etc. but im allitle stumped on how i can script for the dmt trip. im not sure if pz coding has a way to let me distort the screen or color change
if anyones got any tips to throw at me for that id love it!
(ive only done lua for roblox devving lol)
also anyone know the event name for like falling over?
or stumbling etc
i cant find it on the event list
(i might just be blind lol)
hnnn i see fallenOnKnees isbFalling isBumped isBumpFall isBumpStaggered
idkkk, im new to pz modding lmao
oh i also see setKnockekdDown
Gentlemen, bit of a question on how Zomboid works.
When making a vehicle whose engine is located in the rear, is it possible to do this?
From what I've seen, the engine and rear "hood" take damage once you hit something head on.
ive seen some vehicles in mods witth engines in the sides etc
i swear im deep in a dungeon looking for the right animation variables rn
It's not just about the items existing in the world
I wanted to make the mod size smaller, and have a lot less things for the Crafting Menu to load
you can overwrite the recipes and make them hidden
Yeah I think you need something more
This is what is used in TLOU Infected to add the clicker headpiece to the infected
And the clothing name
Exactly how you got it
will Empty Bottle,
work for a recipe requiring them? considering all the botttle types default to Empty Bottle i jus wanna be sure
I don't understand the question ?
A filled bottle isn't the same item
So if your question is that you can use a filled bottle in a crafting that requires an empty bottle: no
ohh wait i see now. thats display name XP
is there a way to do item distrobutions? cuz i aint gonna edit 621 lines LOL
yes there's
HOWW

intercept all the tables when procedural distributions and others occurs
implement your logic there, done

if you scroll up the chat, then you'll find information about it
do your research on certain topics, don't expect to be spoonfeeded here
ngl when you're new to modding or coding in any sort and have no way for what words to search to find something, it's normal to come and ask for help
Especially when you don't have the vocabulary, searching it can be tedious
One thing I would suggest however, is just find mods that do what you want to do and try to copy it
ngl when you new to modding you need to learn the basics
Scrap some other mods to see how they do basic stuff
Of course, but finding the ressources to learn it isn't that easy
google's everyone friend ^__^/'')
Like 2 years ago I was new to Python and had no idea what class are and how to do those, and even today even if I know how to do it, I'm not too sure what the word is to describe what it means
Google is your friend if you know what to search for
It sounds easy when you already have the basics, but it's hell when you don't know shit and it's not the kind of stuff you pratice everyday, and in fact it's a subject you just try to get a grasp of
Coding doesn't work like anything else in life, most people don't ever touch a subject that looks like it
And there's nothing wrong with that, and neither is it wrong to ask for a small tip, even just where to look
there's official documentation, thousands of mods of variety of categories, you don't have a solid point, if you are new to programming or modding, then aim to your level of knowledge, yes you can ask for help if you stuck or couldn't find information, he didn't even scrolled up the chat, spoonfed won't happen
hooking into Events.OnPreDistributionMerge https://pzwiki.net/wiki/Lua_Events/OnPreDistributionMerge
you need to modify the procedural logic and intercept the tables keys in order to achieve what you want, i think that would be the correct approach
Mitch (GDmitch) โ 30/12/2023 18:17
I'm really new to Lua... as in extremely new, and so I apologize if I'm really slow to understand ๐
Mitch (GDmitch) โ 30/12/2023 18:21
So essentially modify the procedural distributions before the game loads them, as to have it load the distributions I want instead of the regular ones?
Francis โ 30/12/2023 18:32
you need to create a function that will be passed as an addition to the event, in that function you need to declare the tables as they're declared with their by default value or empty as empty tables, then you call the iterTable function for each of your desired tables to instruct the rolls reduction```
clearest example ever of a newcomer trying to touch procedural distributions, there's nothing wrong with it, but do you think this is where you should start as a rookie? do you think someone will take the time to explain to you the language and then how to do it? ye, gl wit that
Sure ain't a solution to scroll up this chat when there are thousands of messages
The documentation follows the same rules as what I described, when you don't have the vocabulary it's barely possible to read it
you've no point, say less
lmao whatever boy
If that's your argument
Do as you wish, go follow your way of life it's fine, but don't be a dick about someone asking for help, there's no need for such rudeness towards someone new to this subject
rude's to come here and ask to be fed to finish your project, because you didn't sit down for 5 minutes to read anything
If you think that's how it was 
best thing to do is look in the base lua files, you can learn quite a bit. look in distributions lua and you will see functions that will already do what you need. start from there.
Hi, If I teleport a bag full of items with Lua, will the items inside be teleported with the bag?
hey anyone here wanna help me with an error XP again ive only done lua for roblox deving, so i have NO idea how to use debug. but here
wait
wronmg file LOL
WAIT
WRONG FILE IT MAKES SENSE NOW
LOL
worlds biggest dummy
thats me
put the distrobution file in the wrong folder
Hi, does anyone knows if there is a way to store data on the client side? I am writing a public mod that check if the resetID on the server is changed. I can get the current resetID from server without problem, but i would need to save and read a copy of the resetID on the client side so I can compare and determine if the resetID was changed. Does anyone knows how to store and get data on client side? or if anyone knows a mod that might have similar feature that i can learn from?
local player = getPlayer();
if player:getModData().MyCheck then
-- player has MyCheck data, do something with it
else
-- no data, create it
player:getModData().MyCheck = {}
-- add data to table
player:getModData().MyCheck[1] = true
end
I'm not sure but I think something like that is client side. You can save data on player
moddata or global modata is certainly what you're after but im not sure which one will be better fit for your use case.
eh we all do that sometimes
Hey so I'm overall new the modding of Project Zomboid and I'm wondering how PZ handles a certain line of code.
In the lua/shared/.lua , how does the game react with the specific lines of code exactly ?
player = getPlayer();
pillowmod = player:getModData();
How does it react in multiplayer more specificly is my question ? In multiplayer, this gives up this: attempted index: getModData of non-table: null
What exactly is player:getModData meant to output ? (this is not my code, trying to fix an error that happens with this part of the code in multiplayer)
I made a reupload tracker: https://docs.google.com/spreadsheets/d/1_As6KjXBv2hMmRRZUFOnCmIRrZis14a6KwBo9WZnZpU/edit?usp=sharing
You'll need to make a copy of the sheet and add your own mod IDs.
My high score is 39 ๐ข
What's that supposed to be for ?
You put in a mod ID and it scrapes the workshop for uploads with the same ID
I found 1 mod with 39 reuploads, another with 28, and another with 20
it just so happened they used my modID+another word, for a patch or language
I bet if I used the special character for line breaks it could avoid those
hmm well some mods probably follow the same rule in title
Anyone happen to know if the tiles property app is buggy, or am I just missing something? Been trying to load a sprites file to create a new tile, but the "Add tileset" button is only listing the files in the default tileset, (despite my custom spritesheet being present in the "2x" directory alongside all the other sprites).
Hmmm, progress. ~/.TileZed had cached records for the tilesets available on the filesystem and it didn't seem to refresh. Deleting that directory and re-launching Tiled allowed the custom sprites to be visible :/
Hey so I'm kind of stuck here:
In lua/shared/.lua, I have the function getPlayer() that sends a nil and this at any time of the character's life. If the player is spawned in and his character here and present, it doesn't matter and the function always sends nil. Searching about it it could be because the player isn't here yet (like spawning in and stuff like that) but the character is present and the player is present too, doing actions etc.
Would anyone point me towards the reason of this issue please ?
I definitely prefer this icon
So if I was trying to figure out project zomboids api for a few things
I found this
https://projectzomboid.com/modding/allclasses-index.html
But I wasn't sure if this is the best places to figure out how to code lua and how to address specific logic in the scripts
class index
Thanks for replying! No worries, I can instead wrote it so that all information is stored on the server side! Btw, this is my first public mod that i built for the server that I just published! https://steamcommunity.com/sharedfiles/filedetails/?id=3129971832&searchtext=
Congrates on the mod @slender stream
Thx
Yeah I am trying to learn lua and figure out some modding stuff also
Nice~ best of luck with your modding. The community need more modder for sure.
I am a moddler and 3d 2d artist I am not a coder for sure but hopefully I can figure out some stuff
Thanks by the way
this is what you will be referring for using api, for example if you wanna access player related information or available methods then you will checkout IsoPlayer. Or if you wanna access door related things that will be IsoDoor etc.
Ok @crystal terrace cool thanks any chance you got a cheat sheet with these classes written down somewhere you could share maybe
i don't exactly remember, been a while but i did add some resources in a guide i wrote a while back. https://steamcommunity.com/sharedfiles/filedetails/?id=3006109377 checkout the last section for resources that i linked, apart from that this channel will be your source for getting your foot in the door. Don't be afraid to drop questions, search chat for related keywords.
I only ask because I am way out of my normal wheel house man OK thanks to @crystal terrace and @slender stream for helping anwser the question of basically where to start and figuring stuff out. The new information I will follow up and review the Modding 101 in a few minutes Thanks again for the help guys I really appreciate it alot thanks so much glad their are a few helpful people here
Hmmm, that seems to be similiar to what I'm fighting with; trying to make a placeable storage item which supports N/E/S/W orientation. That guide appears like it may be beneficial.
I managed to get the tileset working and placeable with the brush tool, but it's not rendering that tile when you place the item, clearly I'm missing something, I just need to figure out what that is.
So I ran across a page talking about using java but the way I understand it Java is what the base code for the game was written in and Lua is a very basic scripting language that gives us a flexible and simple language to build scripts for Project Zombie to have base logic.
nvm I figured it out
but in every changes in the lua file and I'm ingame, do I have to quit and join a save again?
Yes
oh damn, how do i test functions ingame though?
like the function Say
when i type in the command line smthing ingame
I'll just enter the code?
Anyone knows how to change sound effects in game like level up sound or death screams?
player:getInventory():AddItem("Base.Pistol");
How would I change this code to give me two pistols?
Put it in twice in your code
What about for ammo?
If you don't want to put it in a box?
I think you can set up how many bullets in the gun
Donโt remember the command for that though
Look into the java docs for pz for that
Is the player visually freezing for other players when attacked by zombies in multiplayer (but actually moving on the player screen) a vanilla problem ?
hello guys, Have you guys ever encountered the same problem as me?
I have made some very beautiful mansions, but as soon as I enter certain areas of the mansion, my game becomes very lag and FPS becomes very low
Whenever I walk down the corridor from the second floor to the third floor, the FPS of my game instantly drops from 75 to 3
The basement garage, first floor, and attic have no such problem at all
It's so strange, why do I encounter so many strange problems every time?
Last time, there were thousands of zombies spawned in my mansion, and after, i'm fishing in the river, the fish resources did not recover. This time I'm in my mansion, and after walking in the hallway on the second floor, the game says Application not responding
Game freezes directly
This is the house where I have problems
How can I get gridSquare with coordinates?
AddItems(item, number)
am I supposed to change the whole 300 MB .bank file just to edit a single sound effect as PZwiki tutorial says? If so how do I make it compatible with other sound effect mods since they will all change the same .bank file?
How to go through all ground-level squares in a map, or alternatively a predetermined list of coordinates, with lua?
Apparently this line can be used to access a square sq:
local sq = getWorld():getCell():getGridSquare(x, y, z);
So should the idea be something like this
for x = 0,299
for y = 0,299
for z = 0
getWorld():getCell():getGridSquare(x, y, z)
end
end
end
But then, how to access all the cells that I'd be interested in ๐ค
You could maybe check the code for Cordyceps Spore Zone by Braven, I haven't looked too much in detail into it but it's possible he uses something to access the tiles of the building that's infested
You could maybe find something similar
guys i think its "possible" to make project zomboid in 3d, tho it would require raycasts and making a whole 3d engine
and it would be really hard
but if someone makes it then gl
Hmm, thanks! Definitely closely related, not sure if I can get anything useful to myself, as buildings seem to be treated as something special.
local args = {
origin = { x = buildingSq:getX(), y = buildingSq:getY(), z = buildingSq:getZ() },
groundZero = { x = zoneSq:getX(), y = zoneSq:getY(), z = zoneSq:getZ() }
}
sendClientCommand(playerObj, 'SporeZone', 'TransmitSporeZone', args)
if SandboxVars.SporeZones.GroundZero then
local args2 = { x = zoneSq:getX(), y = zoneSq:getY(), z = zoneSq:getZ() }
sendClientCommand(playerObj, 'SporeZone', 'CreateSporeZoneTile', args2)
end
if SandboxVars.SporeZones.SpawnCorpses == true then
local bodyAmount = math.floor((buildingDef:getH() * buildingDef:getW()) / 50)
if bodyAmount < 1 then bodyAmount = 1 end
for i = 0, bodyAmount - 1 do
local randomSq = BuildingHelper.getFreeTileFromBuilding(building:getDef())
if randomSq then
spawnBody(randomSq)
end
end
end
playerObj:getModData().cordycepsInfectionTimer = 0
BB_Spore_UI.drawSporeCanvas = true
end```
I'm trying to make a cargo mod. I want the player to be able to teleport a box of items, but it doesn't work unless the target gridSquare is nearby. Is there a way to load a gridSquare and place the item in the desired location without the character going to that area?
Yes he checks if you are in a building, but every buildings are different
I haven't looked into how he makes the difference between every building
Could be related to how they are mapped in the game (a single inside zone for a building for example)
Yup, the snippet I pasted looks like it treats a generic building into a sporezone, then somewhere else they access all buildings somehow
Something weird I've seen is that, you can have a building with multiple floors considered the same building but I've also seen some zones where the first floor wasn't a spore zone but the floor above was (it was a building in the port of Louisville
This makes some spore zones more interesting in fact, as you could have a low area infested but top area not infested and shit like that but eh
Ahhh, they add a checker to be done every minute, then access the player character and see whether it is in a building
local playerObj = getPlayer(); if not playerObj then return end
local building = playerObj:getBuilding()```
Yeah every minute they check if you are in a building
But how does the everyminute -checker know what player character to access :--D
The code for spore zones is very clean and easy to read, at least at my level of Lua (it was the first code I studied)
playerObj = getPlayer()
yeah, what if there are 10 players on server?
getPlayer() gives the player it runs the code on
It runs the code for each players I think
Anyhow, that's not in my toolbox then, as I try to figure a script that runs entirely on the server-side, and on a trigger associated with season changes
Something I learned yesterday night when trying to fix a problem with getPlayer() is that if it runs in shared (and probably server), you have to make sure the event can use the player as a parameter
Like OnTick doesn't have the parameter isoPlayer for example and didn't recognize getPlayer() as a player, it outputs nil
https://pzwiki.net/wiki/Lua_Events/OnTick
but OnCreatePlayer for example does have isoPlayer so it can run getPlayer()
https://pzwiki.net/wiki/Lua_Events/OnCreatePlayer
Because it runs the event for each players independently I think
Basically what I described here
hm.
And my solution was to not have getPlayer() in events that don't have isoPlayer
I wonder if I could use Events.EveryDays.Add(MyFunction). Any hints as to where I could read what info I can access within this event?
All I'd need is to access the World, and thus its ClimateManager
Of course there are two pages for lua events even in the wiki
Hmm idk what the difference is
Yes Ik actually
You have old events lists "Deprecated Events"
Yeah, this page is completely empty, I come from there with my question about what stuff this event accessess.
And what I sent is "Current events"
It can access things that you can access anywhere I guess
But here for example it can't access getPlayer()
Nor can it apply functions on a player
I guess your question is mostly what can you access in general
informations from the game
Mm, indeed
And to this I have no answer but to tinker around other mods and see how they access things
Or look for some documentation
Yesterday I used ChatGPT to get some better understanding on how Project Zomboid handles stuff, and it worked pretty well, just the problem with getPlayer() he didn't knew about it seems like
He gave valid reasons, just missing some of the possible reasons my getPlayer() sent nil
For example OnWorldSound -event doesn't have anything that needs getWorld()
`local function OnWorldSound(x, y, z, radius, volume, source)
-- Your code here
end
Events.OnWorldSound.Add(OnWorldSound)`
declaration: package: zombie.iso, class: IsoWorld
So I guess getWorld() in this case is a method that is global to the events
Aight, Imma wish that
local function blabla()
local Season = getWorld():getClimateManager().getInstance():getSeason()
-- do stuff depending on season
end
Events.EveryDays.Add(blabla)
would actually do what I want it to do
What does getWorld() output ?
apparently a string
I mean, yeah
But does it output the name of the world ? The season ? The time and date ?
I have zero clue
I don't even have an idea as to how to do the usual debug via printing as I've no idea where the printed message is readable
The in-game console?
in Zomboid/console.txt
ty!
I guess ingame console works too
I didn't use the debug menu for modding yet
Tho I'm new to this shit
Aaaaand which Zomboid folder would this one be, naturally it ain't the one in steamapps :--D
Mainly because debug mode is terrible when you have a lot of mod and just makes it so buggy, to the point where you can't even launch the game properly sometimes
aha, found it
user/Zomboid
yass
user in my case is my name
It's where you place your manually installed mods too
Or just the one you are testing
Same folder as workshop to send a mod on the workshop too
And loads of other shit
You can also find coop-console.txt when you host a server to test your mods on server
If errors don't appear on the bottom right in server, they could still appear in coop-console.txt
But if a red error appears bottom right even on servers, that's a client side error
Argh. Does anyone know how to disable the red overlay shown for safehouses in debug mode?
looks like the console.txt has the same info as the ingame console does!
Yeah
Sometimes the print don't print in the console
I'm not too sure how to debug if you can't print in the console in some functions
guys how do i check if player hp is less than a number, i want to test a thingy for a suggestion
getHealth()
Is what I found
do i run it in a loop or there is a function when health gets changed
Probably do
player = getPlayer()
hp = player.getHealth()
if hp < number then
-- do action
end
Probably that:
https://pzwiki.net/wiki/Lua_Events/OnPlayerUpdate
ty
Events.OnPlayerUpdate.Add(function);
and in the function do the example code I did
Adapt it in your own way and needs
Don't hesitate to check other's mod code that could use what you want to do
what program do u recommend for editing code?
the microsoft one i forgot the name or notepad++
Reupload Tracker v2:
Make a copy and change the mod ID at the top only. https://docs.google.com/spreadsheets/d/1JDO_jELKNQqpNVU_IbzgJ-gprxEU9Pn3kFsCLu_L1YE
TEST
Looking for Mod ID:,SkillRecoveryJournal
Workshop ID,Title,Page,Fixed Value Copied For Posterity,1:1 Reupload or Not Approved,Approved or Acceptable
Skill Recovery Journal - Profession Lockedby differential
SharedFileBindMouseHover( "sharedfile_3055098573", false,
{"id":"3055098573","titl...
V2 makes one load per sheet
imports {
Base
}
Events.OnPlayerUpdate.Add(function(player));
hp = player.getHealth()
if hp < 2 then
player:SetGodMode(true)
end
will this work or i need some modifying, i have no experience in PZ modding but have experience in gmod/roblox lua
lil in gmod and more in roblox
What comes out from getWorld() seems to be a string called "zombie.iso.isoWorld@[some identifier string]"
yeah it's basically the world
ahh, this gives me a human-understandable handle to the season
even within a "everydays" -trigger
local Climate = getClimateManager();
local Season = Climate:getSeasonName();
For some reason the "Early Summer" is followed by "Autumn"
guys pls help
Events.OnPlayerUpdate.Add(function());
print("ok ok it works yeah?")
player = getPlayer()
hp = player.getHealth()
if hp < 50 then
player:setGodMode(true)
end
end
i dont get why its not working
ai fixed some stuff
Events.OnPlayerUpdate.Add(function()
print("ok ok it works yeah?")
local player = getPlayer()
local hp = player:getHealth()
if hp < 50 then
player:setGodMode(true)
end
end)
tho it gives errors now
local function TestFunction()
print("ok ok it works yeah?");
player = getPlayer();
hp = player:getHealth();
if hp < 50 then
player:setGodMode(true);
end
end
Events.OnPlayerUpdate.Add(TestFunction);
idk if this fixes anything, just massaged the syntax to something more common, and in doing so removed at least one bracket issue from the original lines
it sends errors every second
Is OnGameStart event triggered every after player's character creation?
no, it's triggered each time the game enters the game world
you can catch character creation with OnNewGame
Thanks! this is exactly what I'm looking for
guys do lua scripts should be named some exact way or u can name then however u want
I use notepad++
I think a good thing to do is not to have spaces and replace them by _
mine is lua.lua.lua
But overall I don't think you need to have exact name
yeah, just to test
Personally, I use IntelliJ. Great when navigating through huge line of codes (more specifically when you're trying to check through vanilla coding)
Don't call it like that, I don't think it will cause issues but god damn it that's a weird name that could glitch something out
is server_godmode.lua good?
also i decided to use VS microsoft
visual studio
Yes
*-fo
I think with VS you can search terms in the whole project
Sounds like it yes
Just don't name it after existing lua files or you'll mess up a lot of functions. Make it as unique as possible
when code runs this error appears
ok
i dont know how this is related
local function TestFunction()
player = getPlayer();
hp = player:getHealth();
if hp < 50 then
print("ok ok it works yeah?");
player:setGodMode(true);
end
end
Events.OnPlayerUpdate.Add(TestFunction);
ok my script works now but it doesn't auto work
and always works when hp is even over 50
print(hp) and see what your hp actually is
it says 1
1 is less than 50, checks out
i believe its just a 0 to 1.0 scale?
as in, 0% to 100% health
Hrmkph, I need to access a given square, but I'm completely in the dark as to how the fudge I define an IsoSquare -object with only its world coordinates
Like for some reason a vast majority of """tutorials""" just state cell = world:getCell(), but this seems to me like it is a clientside call and not a serverside, rhnhrmknghmknasg
is it suppose to be getPlayer():getBodyDamage():getHealth()?
Yes so hp is a scale of 0.0 to 1.0
No idea
no, its just a fact i know
yeah that works
ty
but i have one more problem
its that code doesn't auto execute
How is it a clienside call ?
local InjuryRedTextTint = (100 - self:getPatient():getBodyDamage():getHealth()) / 100```
from ISHealthPanel
how so ?
when i join the game nothing happens, my variables are changin, it works only when i manually execute it
there are more than 1 cell in the world, how can one specific cell then equal world:getCell()
What folder is it in ?
media/lua
idk
Put in media/lua/shared
thank u
Go download a random mod and check how they organise their folder
In media/lua you either put it in /client /server or /shared
Does what you expect
client only affects the clientside and server only serverside
And shared idk how it handles shit but it affects both sort of ?
local function TestFunction(player) and remove player=getPlayer()
How would it recognize player as the player ?
true
Legitimate question, I lack some knowledge in modding
anyways, how do i like cancel the animation where u are being eaten, like how to detect it happens
uuuuh
godmode doesn't cancel it
the onplayerupdate event will pass the player variable down
local function OnPlayerUpdate(player)
-- Your code here
end
Events.OnPlayerUpdate.Add(OnPlayerUpdate)```
how to make a wait() function
otherwise if there are lots of people in close proximity it might trigger for them too
i need it to wait for 0.1 seconds
there's no wait in kahlua, best you can do is an ontick handler that checks if enough time has passed
also how do i heal the player fully but not using the godmode, like remove sicknesses and infection
like fully heal but not godmode
Oh so that's what the parameters are for
https://pzwiki.net/wiki/Lua_Events/OnCreatePlayer
be me
copypaste a tutorial given by official pz sources
the syntax in the tutorial is wrong
nice
lmao
otoh the tutorial is from 2012, maybe they changed GetBlabla()'s into getBlabla()'s
ah yeah, one or two things may have changed since then lol
I dunno if it's always been that way, but lowercase first is def the convention now
Does anyone know if a splitscreen player is considered a client in solo? I can't test atm
in what sense?
how the fucking fuck is it this difficult to access a fucking sprite in a fucking tile hr,mrhnmgrnmhnm
forgive me if I'm off base, but client is for mp, right? or no?
generally but it's all the same code so they can be treated as clients in many places
do you happen to know how to check if a session is mp specifically?
Welcome to my pain these last few days.
this pain SUCKS
pz lua makes me want to perform inexplicable violence to objects near me
isServer() or isClient()
I don't mind the LUA aspect, but TileZed makes me feel that way.
one of these should be true in multiplayer, neither should be true in singleplayer
okay, I had an IsClient check but just wanted to be sure that wasn't the problem... For some reason my option isn't appearing in controller context menus, but I'm not familiar with the joypad enough to know why
Guess that's what I'm doing tonight. Whoot
guys how do i prevent player death
all i know is that this function runs a second before the death or less than a second
local function OnPlayerDeath(player)
player:setGodMod(true)
end
Events.OnPlayerDeath.Add(OnPlayerDeath)
what i have tried
oh wait i sent the wrong one
there
Events are triggered 'on' something, ie: after the action has been initiated so that listeners can implement logic upon that event firing.
what about character
like how the fuck is it near-impossible to access one freaking tile, and the objects that are in it
this shit shouldnt take 4+hours to do some goddamn obscure raindances with a blackbox that refuses to tell me how it works 
what are you having trouble with?
accessing a tile and the objects that are in it cant you read
tile being synonyme to a square
I've seen that functionality before I believe, but I forgot exactly where I saw it.
i know the exact world coordinate in X Y Z that a given sprite is in, and i've struggled for aeons to tell the goddamn game that this indeed is the sprite that i want to interact with using lua
getSquare(x, y, z)
then what is this nonsense of getWorld():getCell():getGridSquare(x,y,z)
if its just a getSquare() then i'll praise you to the highest honors
that's what getSquare ultimately calls upon iirc but getSquare is provided to keep the lua api cleaner than that
:DDDDDDDDDDDDDDDDDD i'm gonna bang my head into a goddamn bucket
how do i prevent player death?
keep in mind that a square that is not currently loaded cannot be accessed in any way
like reset his health to full when u are about to die
thankyouthankyouthankyou
i'll report on whether this works
pls
how do i make so when player is about to die his health goes back to full
so he doesn't die
and it works only once
A SQUARE IS ACCESSED, praised be merry christmas!! !
(to the highest honors)
Updated to fix issues with some titles breaking
Also added page support
Cheat menu has a cheat to prevent death
do i just take the code then?
Or just learn from it :)
Tho it doesn't work in some cases
Like since I do TLOU modding, the clickers oneshot you, and the cheat doesn't prevent that
I haven't even tested it properly yet, if it actually saves you
Mfw I haven't saved and my power goes out 
Noice. I only caught the end of it, what are you doing that was so specific to that square?
An appletree
The part that I got to working is that now the script fires each day, and changes the sprite of the appletree if a season has changed
Ahhhh, okay. Very cool.
Next part is to also spawn some apples into it โจ
How would I add a new tab under the sandbox options
lol That yours @bronze yoke?
it is!
Nice! I saw the profile pic and was wondering before you reacted lol Very helpful guide!
glad to help ^^
Ok.
Why is this ok:
local AppleTreeX = 1;
local AppleTreeY = 1;
But this breaks everything:
local AppleTreeX = {1,2};
local AppleTreeY = {1,2};
AFAIK every single lua tutorial on arrays and lists tells me the latter is also OK, but for some reason it breaks all functionality from my script that worked just well with the above formation for only one coordinate pair
It refuses to even print the list if i put it into a print()
It refuses to access things like AppleTreeX[1]
i swear to got the person who invented programming was a sadist, and everyone who thought this is a good idea, i'll also do it, is a masochist
Is the issue in that syntax, or should I suspect I added some extra semicolon into a nonsensical spot while doing it
that part is fine
semicolons don't do anything in lua so unless you put one somewhere completely ridiculous they shouldn't cause problems
So then I must've done something else to mess the code than the array
hmmm...
Well, atleast reverting back to the single-tree -case I managed to spawn apples in it :3
I probly should ask the maker of the farmable apple trees -mod if I can use their sprite for my mod in case I ever release this on steam, these are nice sprites
Your goal is to have two possible amount that could spawn right ?
That's trivial:
for j = 1, (ZombRand(20)+1) do
AppleTree:getContainer():AddItem("Apple");
end
The last step to figure out is to access all the appletrees i plant in the map via map editor, which should also be trivial if i just hardcode them as a list
Hello all! I'm working on a small mod and have a few questions. I have very little experience with writing mods for PZ and I'm not very familiar with lua. Anyway, the mod I'm working on adds a single item, for now, which is a bag. I've basically copied the decalation of the Satchel and changed a few things around to make the new item something different. I've made a crafting recipe and an icon for it so it's distinquishable in one's inventory. How would I change the way the bag appears in the game world? Would I have to make a new model for it?
If you want custom model, then you do need one. Then you would have to rig it into player armature, assign the Weights so it moves with the player model, You do need to export 4 separate models (1 with weight suited for backpack on back, 2 models where each would be in right and left hand with their weights assignet aswell and finally one final model exported without any bones/armature, as it would be just World model that would appear on ground) if you would like to have it work like in vanila.
Any way to make that easy? I intended on the bag functioning the same as the satchel just with different stats and a different coat of paint
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid. Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Ble...
I assume youre not familiar with Blender?
Well... its kinda needed to create a model and then rig it. There is no easier way, even if you were to find model on the internet, you still need to tell game where its supposed to be on body and how to move with it and thats the task of Armature in blender
Considering PZ is low poly, it's not extremely hard to make a model
Depends what you plan on modeling
I tried learning blender a while ago, it was fairly easy but it was to make just 3D models
You can find a bunch of tutorial for Blender nowadays
Got it. It's not a big deal, I can learn it. Just like to take a lazy route sometimes
If one exists, anyway
The competition for most re-uploaded I think has been decided...
๐ฅ
With a whopping 918 re-uploads...
๐ฅ
||ModTemplate|| 
Honorable mention is ||Arsenal Gunfighter with 360+|| ๐
once you have a mod prototype and want to test it in game, do any of you know which file folder I would put it in?
You first start in your cachefolder, which is %userprofile%/zomboid (Assuming you're on windows).
The if you're using the ModTemplate for the workshop you put it in workshop, otherwise you put it in the mods folder. Either one needs a different format.
Oh gotcha thanks, the mods folder seems to have worked for me
I goof'd the formula a bit - it's actually double
can you have a tile mod that allows the crafting of a tile without the use of pack files and tilezed?
When saving this into my file, does it need to be an INFO file?
Yeah, but I think it's just a .txt file with the extension .info
Yeah I'm not too surprised but I believe it's not actual reposts of the mod, it's configs for it
It's because the configs of the mod were side mods at first I believe
so I save it as a text file and just put .info at the end?
"sandbox-options.txt" specifically
Just, download another mod and look how they do it
I have the sandbox-options.txt
Like this is something you could have figured out in 2 seconds by taking a random mod with sandbox options (if you're into mods and don't know one, idk what to tell you lol) and check how they do it
but when Im putting the script in there what does it need to be
Sorry if its a dumb question im new to all of this
Ok you see what I typed here ?
Go do that
Things will be so much clear right after
Hey and you know what ? Take my mod, there are sandbox files in it
It is very small, easy to understand
You don't even need to look at what it does
Your best friend in programmation is to just look what others do, because everyone does that and you rarely get a genius out of nowhere that did everything himself
can someone explain what exactly transmitModData() does?
Yeah browsing through some of arsenal, this is correct. The mod template I'm also referring to is the vanilla template that comes with the game. (Just to clarify)
are these configuration mods? try true music.
I can't even check truemusic cause most of them are the addons
I forgot gunfighter told everyone to make submods for configs lol
I vote it is disqualified and skill journal is reinstated as the 2nd runner up with 39 
The number of people who have shown me logs because something doesn't work and had the ||ModTemplate|| enabled is high.
But wow, 918 public mods.
grrr, ScriptItems support AcceptItemFunction, but TileZed doesn't seem to have similar functionality for Tiles.
Told you
That's config files
Configs files for every server that were created back then when that was the only solution to get configs for Arsenal b41 I guess
because tiles don't support it by default
I think I'll definitely stop using Arsenal B41, the mod just has too many issues
Happen to know where I can look to implement this functionality? I'm sifting through the extracted game code now, but it's a slow process.
I use it in the solar panels mod
I remember explaining it before here, need to find the message.
If you just let me know which solar mod, I can reverse engineer what you did from your code.
ah, nvm, believe I found ya
Ah, someone with source code actually published, nice to see that!
I'll be publishing mine on github as well, but won't upload until it's at least half-way working.
You need to set the function in 2 places, when the object is first placed and when it is loaded again.
That placed handled in your client lua in o.process()?
I have a global object, not sure if this works for your case.
eh, it'll give me a starting point at least. Thanks!
You could use the OnObjectAdded event or maybe something else.
True, if placedItem == myContainer, ...
If only we could just attach a function based off the ContainerType
I was digging through some mod files and I saw a setPoisonLevel function. Is there anywhere that tells me what this stat is and what it does? I'm assuming it makes your character sick, but I have no idea what the value itself is supposed to represent. Is it a percentage? or is there a certain threshold where it starts killing your character?
ummm, ok
Yup, having success with Events.OnObjectAdded! Got a breakpoint when I placed the tile ๐
These calls print what they should print:
print(AppleTree);
print(AppleTree:getSprite());
print(AppleTree:getSprite():getName());
However, after changing a sprite with
if AppleTree:getSprite():getName() == "spritename" then
AppleTree:setSprite("anotherspritename");
end
The abovementioned three calls no longer print what they should. AppleTree still exists, but getSprite() is no longer the same for 3 AppleTrees that have the same visual sprite, and getName() returns nil.
What am I missing when updating the sprite with setsprite?
This is how the logs see those print calls at the point where the sprite is changed, repeated for 3 separate AppleTrees:
LOG : General , 1704335823514> zombie.iso.objects.IsoTree@74ab0c84
LOG : General , 1704335823515> zombie.iso.sprite.IsoSprite@3ed49315
LOG : General , 1704335823516> mosapuut_01_1
LOG : General , 1704335823517> zombie.iso.objects.IsoTree@4487f330
LOG : General , 1704335823517> zombie.iso.sprite.IsoSprite@3ed49315
LOG : General , 1704335823518> mosapuut_01_1
LOG : General , 1704335823519> zombie.iso.objects.IsoTree@64b50534
LOG : General , 1704335823519> zombie.iso.sprite.IsoSprite@3ed49315
LOG : General , 1704335823520> mosapuut_01_1
LOG : General , 1704335843803> zombie.iso.objects.IsoTree@74ab0c84
LOG : General , 1704335843803> zombie.iso.sprite.IsoSprite@deca6bf
LOG : General , 1704335843804> nil
LOG : General , 1704335843805> zombie.iso.objects.IsoTree@4487f330
LOG : General , 1704335843805> zombie.iso.sprite.IsoSprite@10914a30
LOG : General , 1704335843806> nil
LOG : General , 1704335843806> zombie.iso.objects.IsoTree@64b50534
LOG : General , 1704335843807> zombie.iso.sprite.IsoSprite@415cf920
LOG : General , 1704335843807> nil
Does the other sprite you set it to not have a name?
It is in the same spritesheet right next to the sprite I'm changing from
The spritesheet is well-defined.
also you can always do what I'm doing; force an Exception to be triggered in that block of code and look at the call stack in-game.
Also: how and why does getSprite() return a different identifier for all three AppleTrees if the sprite i'm changing them to is the exact same
Visually they look the same, visually all of this works brilliantly.
According to your log, IsoSprite is a different location in memory.
Yes, I can read, I'm asking for how to interpret what I've just read.
This feels complete nonsense as to why the sprite I'm referring to would suddenly be in three different memory locations
Oh, I just noticed that, that is fun, isn't it? The first pass it's all the same variable, but then it's suddenly something different each pass
If called from the client: sends the relevant mod data to the server, which receives it, updates its copy, and propagates changes to other clients
If called from the server: sends mod data to clients
It's only necessary for certain things, since some handle syncing themselves. Couldn't tell you which because I don't remember ๐ (maybe IsoObjects & IsoGridSquares?)
does anyone know how to make your own skill VHS tapes? ive been stuck on it and im also confused on why the messages are encoded strings and have to be decoded
got it, thanks!
Someone should make a mod that adds more suicide options other than bleach
pretty sure you can shoot yourself in some
Available if I am not mistaken, something called Gunfighter vengeance or so
Bet
alright so im trying to solve a bug in one of my mods where renaming an item on a MP server won't appear for other players or get saved when server restarts, unless the item is renamed in main inventory, or if renamed in another container then moved between containers. I assume something triggers the "name saving" when the item is moved, so I checked the relevant vanilla files but no luck. I think the function addItemOnServer does it, but I can't tell for sure, and its not useful in my case anyways
I also tried to pass the item using sendClientCommand, which then passes the item to all clients using sendServerCommand, and renames it on all clients, but apparently the item becomes nil somwhere in the process
Anyone has an idea of how to solve this?
P.S.: an item is renamed in the mod using item:setName()
also vehicle's moddata isn't saved on MP either, not sure why
try to set sprite but not with name, first use getSprite("sprite name") and then set it.
if here is some guy that makes mods. please make a mod that we can craft traps in and for example put them under windows
SetSpriteFromName("sprite name") actually resolves this, the call to print(getSprite():getName()) starts to return what it should!
Thanks a billion, I also think this could fix my issue with container overlays I ran into, since now the sprites seem to be more properly defined in-game than before โค๏ธ
In containeroverlays, the room is defined as "other" by default. However, my container overlay doesn't seem to work. Would there be a specific room definition that is valid outdoors?
Hm. The containeroverlay works. What doesn't work is a containeroverlay for the object whose sprite I change with lua.
I thought containeroverlays were associated with sprites, and the lua-changed sprite is the exact same as the one to which the overlay is associated to, when I print it using getSprite():getName()
njaha, so its most likely associated with the luaobject, and the constructor of the object merely checks the sprite and then slaps the appropriate containeroverlays to the object
that's why a pre-placed appletree behaves like this when it has items
and a lua-sprite-changed -appletree behaves like this when it has items, even if the visual sprite is exact same and verified through print calls
let's see if "setOverlaySprite()" would fix it
Yep!
HAHAA!
FINALLY
Oof, wish I was around, I could have pointed you to overlay sprites ๐
You can also tie actions to overlays
Similar to removal of vines
I'm case you wanted to tie a picking function and not have to fetch the overlay as well as house modData
Oh you're already sorted on that front ๐
It looks like it behaves as it should, so I'm gonna keep it as is and wait for the moment a playtester eventually breaks everything ๐ซก
"It's just a container whose sprite changes depending on a season, and spawns some items in it depending on a season, how hard can it be?"
a very pz-esque funny feature, not a bug, is that i can store my socks in an appletree and it looks like a bunch of ripe apples during autumn
Yup, same thought, "I'll make a simple garage container for a specific type of item and displays how many of those items you store visually, should be simple, right?" heh.... sure
Are apples suppose to populate the container instead of the usual right click harvest approach?
yeah, they go in the container
this exists completely outside the farming system
Might need to prevent people from dumping random stuff in it then so they can't fill the tree with random stuff
And prevent apples from spawning
"look I grew all these ripped sheets!"
turns out the add items -part of the script can, and will go beyond container limits
so the tree can't be blocked from spawning apples whenever the time comes
Ah yea I was thinking of container spawns
People with organized be malding if they can't grow an extra 30% more apples if that's the case lol
nono, the logic is, in its simplicity,
check day number
if in range Range
do things, including set appropriate sprite or spawn a bunch of apples
You could make it so it doesn't grow in winter too...
Love me some winter farming
the wintertime appropriate sprite is there, and the only time it spawns apples is in autumn
ain't no that pz infinite crop every 3 weeks -nonsense from these beauties
Nice, any plans for other fruit trees?
Nope, but I will release the script whenever the map is released. :P
Should be simple enough for others to adapt, but the drawback is that it is hardcoded for trees that are pre-placed via tile editor, and no more trees can be planted.
In other words, it fits my scenario well enough, and I don't have an interest to push it to be more general
I see, still pretty cool implementation.
thx!
I'd imagine the generalization to also have plantable trees would be to make the script check all tiles in the map for whether it is an appletree, and I suspect it gets quite heavy to check the entire map every day.
The other necessary bit would be to program a script to generate new IsoObjects that are apple tree saplings, and then to account for the growth of saplings would be a different routine than the one that merely checks what season an adult apple tree should be in
Considering the timescale in an usual PZ playthrough, I guess the most meaningful way to include fruit trees is to just have a set of pre-existing ones and be happy with it
Still interesting to see it done, perhaps one day the idea can be used on placeable containers where the sprite updates based on planted duration and season
I'm not experienced enough to know how to make these objects have an independent memory of their own past, but if that is doable, then that'd be doable, yes!
tbh I'm already super surprised that the game allows for a sprite that acts as a tree that can be chopped for logs, as well as a container.
TK, you can attach this logic onto the actual Tile object, so it could support a plantable tree concept.
It's a little weird as the game doesn't natively support it, but it works.
I believe you can attach mod data to the object, then use transmitCompleteItemToServer() and transmitModData() so the information persists
Is there a way to remove a trait from the character creation panel ?
Considering someone has already made a mortar mod
How feasible would it be to make a 155mm / 203mm artillery mod?
Enter in coordinates, cause a huge explosion in the assigned coordinates
I forget exactly but I had to mess with the more traits mod a while back and it has some disabled in it if you want a reference.
I believe they're the ones with a "2" iirc. I think they were planning on changing them but didn't get around to it.
Hey I found how but thx ;)
Noice
Just Spyjack hid the .lua in random folders so I was having trouble actually finding how he added the Susceptible trait in his mod lol
It was in lua\shared\NPC
local function initSusceptibleTrait()
TraitFactory.addTrait("Susceptible", getText("UI_trait_Susceptible"), -11, getText("UI_trait_SusceptibleDesc"), false, false);
end
Events.OnGameBoot.Add(initSusceptibleTrait);
That's how to add a trait
Actually to remove a trait it seems like you can't just remove this line of code lol
Try changing one of the false to true? I vaguely recall that being the thing with more traits, but I'd think without the event it wouldn't do anything... Strange
I know why
I did a thing where you check a sandbox option to stop players from getting the trait
But since it loads the trait ongameboot
The sandbox option was by default true
So the trait was always here anyway
The way more trait removes traits, is by having a secondary mod loaded in, and this is checked on game load
So you are sure the trait will be removed if you have loaded the side mod that removes the trait
I'm doing that
please do not promote cheat menu mods. until now they try to give same abilities as debug mod but fail at it and add many (MANY) bugs and mod incompatibilities by forcing vanilla intermediate variables when they should not. promote debug mod instead https://pzwiki.net/wiki/Debug_mode
I prefer cheat menu for simple tasks because activating the debug menu on heavy modpacks make the game impossible to boot
But you are right, I should learn to use them, but at my level of modding it seems to be ok
I do simply scrapping of code right now
Most importantly and obviously: do as you please. Secondly, I would be very surprise that mods and debug mod mess with boot time significantly more than cheat mods. I am also perplex with the notion of 'heavy modpacks' (especially the plural to modpack) so maybe this why I do not understand the rest. Anyway have fun out there.
Oh boy, has debug mod caused me some issues. Between the glitches that can happen and make it absolutely impossible to read and just the overall need to press the play button (no idea if it has a specific name) to close 3 times the debug menu to actually have the game and/or save to boot up
Basically to load debug menu in a heavy modpack, I need to unload all my mods, and join my save with all the mods which will reload all the mods
If I load my heavy modpack with debug mode, the main menu will not appear, only the background image
Probably some mods fucking it up but hey tis okay, I can still use it as long as I do that manipulation lol
Never heard of anything like that. I have no idea what you are writing about. I use DEbug mode all the time.
If mods muck up debug mode, I'd 100% ditch those mods.
Gl finding them ;)
Well that would be pretty easy; the debugger tells you what mod threw the Exception.
I would take it as a hint you'll have many other problems from such mods though. (same idea as cdp I think)
If you are talking about errors, those are in the console but I haven't ever checked
Tbf I'm just fine with not using the debug menu rn
Reminds me of jobs I've had in the past. I'd turn on debug mode on an application I'm working on only to get assaulted with a bunch of issues. When asking about those, other devs would just say "yeah, that's why we don't enable debug mode" or even better "there's a debug mode?!?".
lmao
Covering up the glaring underlying issues in code with a blanket and just not looking at them does not magically make your bugs disappear.
There are similarities in the behavior, but in that case Jvla is a user, not the dev.
(not saying you personally, just in general)
ahah no worries lol
Technically I don't debug my mods with my heavy modpacks, so I could technically use it for mod creation rn
I don't really know the features of debug mode, and I'm not too sure those would actually help me for my current modding intentions
Like anything in coding, just pure lack of knowledge of what's possible and available
I cannot say for sure in your case but in my cases that debug mode was a huge time saver.
Aye, debuggers can be overwhelming at first, but once you get a grasp of how they function, they're MASSIVE time savers.
example: I'm working on a mod and am trying to figure out containers and how to retrieve its item contents.
Also prints rendering onto the console can cause some stuttering
There's getContainer and getItemContainer.... WTF is the difference? What do they return?
I mean, those print I only use for debugging
Tho they don't always render in the console and I'm not too sure why
getContainer probably the name of the container and getItemContainer the items in the container?
The debugger shows me local variables, so I can see that continer and containerContents point to the same space in memory, so those two functions do the same thing.
One is for if the item has a container
Interesting
Still, it pales in competition to Jetbrain's debugger and I would love if I could find a way to integrate the running application into it, but that would require configuring JRE to connect back to the IDE, which I'm too lazy to do at the moment
for a mod to edit an item's variable can I just do this
item WeddingJacket
{
ScratchDefense = 70,
}
will this override that item's ScratchDefense or must I also write rest of its properties?
Another question, where can I find this Jacket property? I need to change a clothing's body protection areas and I believe this is it?
item Jacket_WhiteTINT
{
BodyLocation = Jacket,
}
You want to use script manager and use DoParam to change the item
I dont understand
is it not possible to just change it by hand with method above?
No because you'll just overwrite the entire item and you're missing everything else
So you'll just brick the item and cause other issues
You need the rest of the properties. But you can use DoParam to do it. Search for DoParam in this discord for some examples.
vs
it works ๐ (and yes, I'm aware there's an overlay management feature in tiles already, but it only supports 0, 1, and 2+ quantities, whereas I wanted 0..12)
I know this was an example, but fwiw + for the sake of anyone reading, checking the decompiled code would turn this from a ~4 minute task to a 1 minute task (or less)
With the benefit of more context, since they could have different behavior depending on whatever factors
Well yeah, you should also have access to the decompiled code, that's useful when actually writing the code, whereas the debugger will give context of the running code.
Also make sure your IDE is setup to use that code as a source library, so you can benefit from autocomplete, typecast hinting, etc.
Shameless plug for https://github.com/asledgehammer/Umbrella (which will hopefully have improved Lua stubs soon if I get around to finishing the stub generator rewrite)
Is that different than pz-zdoc? (https://github.com/danilo-favoratti/pz-zdoc)
Serves essentially the same purpose, but idt that's maintained + Umbrella includes typings for Lua events as well as the Java & Lua
If you want to use Umbrella with IntelliJ IDEA, you need to use a build from before 2023
Oh..... got it. Different IDE.
I don't know how well that zdoc repo is maintained, but seeing that I had to patch it to get it to work on a41, probably not overly well. It's got native Linux support though, so it worked well for my needs.
Yeah, I remember having to tinker with that one when I used it, too. I imagine the same will be true of future builds unfortunately, unless it's updated
Can someone help me figure out why my new sandbox tab isnโt working even though I have the file order right and everything in it right
I think we should first confirm that you actually have the file order & everything in it right, but before that: is the mod enabled in the main menu's mod menu (as opposed to the save)? Also, you're referring to options added in sandbox-options.txt, yeah?
Any of you awesome devs willing to hop on a 1:1 voice chat and tutor me a little bit? To be clear I'm looking for someone to give me the basic run down of mod file structures, best practices, and limitations? I'm not a dev noob, and I've been a Mobile App Dev for 5+ years now so I have a solid understanding of foundational programming skills. I want to build a very simple mod to start, a leaderboard, and I think that would be a great foundation to get started with modding. I have so many ideas I want to build, but resources online seem spotty. Blackbeard on YT shows some stuff and theres one other, but their videos aren't very explanatory in a way that works for me.
I would, but this is my first time fumbling through this too.
yeah i had someone look at my file order and they said it was right but im not 100% sure
check that video https://www.youtube.com/watch?v=N6tZujOPnDw
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 appreciate that, however that tutorial doesn't go into UI stuff at all. It's creating a simple item and giving it a distribution. That's too low level. I need something a bit beefier xD
ok, but your asked: "To be clear I'm looking for someone to give me the basic run down of mod file structures, best practices, and limitations [..]"
Lol thats fair. What I really need is more of how do different files interact with one another, where's the entry point, how can I use a dependency, etc..
then start from the modding main page of the wiki here https://pzwiki.net/wiki/Modding
entry points are mostly events (see page above for events)
others are functions override, see FWolf's guide (see page above)
Ty that's quality stuff my friend ๐
Oh my there's TS for PZ modding ๐ฒ
Any idea what's the correct way to pass an InventoryItem object from client to server, then back to all clients, using Server/Client commands?
I thought about item:getID() but it requires a container to retrieve the object using its id, which I can't pass
You mean like modify an item's modData while it's on the floor?
not really. My mod allows players to rename items using item:setName(), but the item's name changes only clientside. It doesn't change for other clients unless moved from one container to another, or renamed in main inventory, so i am trying to pass the item to all other clients and try to set its name
I mean, in certain cases, modifying its modData will be useful too
apparently passing the item object directly in sendClientCommand makes it nil
I only ask cause modData has the same caveats
What I do in gameNight is move the item into the player's inventory discretely and back out
I suppose you could try sending a command to the server to then send to all clients
Like if the item is not in the player's inventory -> send to server -> send to clients
But I'm not sure if those changes will take as I never tried that
That's what I am trying to do, but you can't pass an item object directly via sendClientCommand since it becomes nil in the process
I thought about that solution, but would that cause any problems? At the end of the day I need to use the timed action that transfers items from one container to another, since it has some kind of logic which I can't find that solves my problem
have you tried getCell():addToProcessItems(inventoryItem); once you've changed the name client side?
not really. Matter of fact, never seen that method before. I'll try using it now, but what exactly does it do?
Doesn't seem to solve the problem
Does anyone know why my TileZed tiles are offset? These are the main pz tiles not even my custom ones and they all do this! Any help greatly appreciated I've been struggling with this for hours
I bypassed the timed action - just used the guts of it
Had to place a delay for my stuff though to prevent the vanilla issue of items not self correcting the item ID being in the same container multiple times or multiple containers
Sorry new here :P, How can I get a player faction id and store it in a file? I've looked around online and at other faction mods but I'm lost and my head hurts so any help is greatly appreciated
I wonder how I haven't seen this video when searching for tutorials. Weird
Is the issue that a player renamed an item in a container and the name doesn't update for others who view that container unless the item is manually cycled ?
I fixed it! For anyone else who may have this issue I set the 'Tiles Folder' to Tiles and not within the x2 folder and it fixed it somehow
I'm trying to make a function that ticks while the player is in a moving vehicle. Is there a good way to do that that doesn't involve riding the onPlayerUpdate/onTick events constantly?
Would adding the function to onPlayerUpdate using onEnterVehicle and removing it using onExitVehicle work?
If it helps: End goal is to collect information (movement/condition/passengers) on the vehicle and use that information to modify the player.
Why not use onplayermove?
Doesn't seem to work in a vehicle when I tested it.
Adding and removing player update would work on vehicle entry and exit
It's how ki5 maintains minimum part condition on cars iirc
Also the reason why apc is indestructible lol
maybe OnUseVehicle(player, baseVehicle, pressedNotTapped) https://pzwiki.net/wiki/Lua_Events/OnUseVehicle
interesting, thanks! I'll take a look at those.
OnUseVehicle is only for the driver, unfortunately :/
see VehicleManager.clientPacket(ByteBuffer var1) this method seems to handle the packet bytes for each client in different switch statements to achieve certain things
Yes exactly, it needs to be moved to another container first for the name to show for others players and to save in case the server restarts
oooh thanks!
Is there a way to detect if thereโs a puddle present on a tile?
Say after it rains, way to get a function which will check every tile in the area the player is in every 10 in-game minutes and see if there are puddles present
I didnโt see anything for the detection of puddles in the climate manager
I'm not sure if there's a better way to do it, but I was in ISWorldObjectContextMenu.lua and saw
local function isPuddleOrRiver(object)
if not object or not object:getSprite() then return false end
if not object:hasWater() then return false end
return object:getSprite():getProperties():Is(IsoFlagType.solidfloor)
end
At least that's how it figures puddles for the context menu
Crucial question.
Any idea if there is a way to perform /addvehicle directly from server Lua?
Hello everybody guys, can somebody help me? I have a problem with one of my custom traits mod. I mean, I ran a dedicated server a few days ago and I put on it a few mods containing custom traits I made. The problem is, everything works fine but when I try to add a new trait as admin to a player or to myself, the player is not able to see it in the "info" panel. If I try to add the trait to myself, I can see the icon in the panel. Moreover, when I add the trait to a player, if he has other custom traits, they disappear :(. Could anybody help me understanding why?
dunno. It is called by vanilla after some item modifications.
vehicle got no moddata. we get around it by putting it in unremovable vehicle parts
also, please minimize using moddata as data store, is bad for MP. Use global moddata instead and send only the required data to the relevant players. Not all servers are on 10gbps port.
I see, thanks!
I see. Well, doesn't seem to do anything with my problem, unless I need to trigger another method after "adding to process items"
Will try to mess more with it
Hello guys, I just made 2 weapons mod CM901 and ACR, does anyone has an idea how to make my mods compatible with brita's weapon pack mod? specifically in distribution part?
I think it's because the items in your inventory window are a table that is populated when the inventory container is refreshed, so when a player changes the name it doesn't update the table
Believe you may need to do table.remove, setname, then table.insert. Check out ISInventoryPane there's a function that loops the items on the container and does table insert
Otherwise yea drop it on the floor and stuff it back in the container with an instant timed action to get it to stick
Hello! I needed to get a list of global farming objects as an array of objects. The goal is to check that each sprite matches the current growth phase of the game's cultures every game hour. How can I efficiently retrieve and process this list of objects in my script?
Well most likely resort to this considering the other ways are just too troublesome. Thanks for the help everyone
you could make it so that the renaming can only take place within the player's main inventory too
well when you put it that way.. that's actually a decent idea
I made it so that its transferred to player's inventory and then back to the container with maxTime set to 1. It seems to actually work very well
it won't work if the player is max encumbered or wil become max encumbered, but otherwise it should work
it works even if the player is encumbered
oh
probably no big deal, but if you want to avoid that fringe case (it's inevitable) just make it so you can only do it from main player inventory
yup doesn't seem to work at capacity > 50, will make it so that renaming items happen only from inventory
seems like least troublesome option honestly
you could do the item transfer to player inventory first, then check if its in the inventory before renaming
if you wanted to preserve what you already wrote
basically the same thing, if you're >50 encumbrance you're not going to be moving items anyhow lol
Not sure what's the point of that? I mean, wouldn't the check return true anyways since i moved it already to the inventory?
i would go with the dropping on floor instead of moving to inventory logic, but it seems buggy
sometimes works, other times not
unless you mean to check if the item "successfully" moved to the inventory in the first place
^
its a good solution but inconsistent
just needs to be consistent is pretty much the goal i think, otherwise people might get confused?
exactly
I'll keep it sweet and short. I want to make channels on TV and radio chatter.
Where would I ultimately start?
Getting if an object has water in general is really helpful, even more so than just puddles, thank you!!!
Itโs for a mod which will add mosquitos
Also, I hear "Context Menu" get brought up a lot, but what does it mean exactly)
Oh, good!
The context menu is the popup menu when you right-click.
Mosquitoes sound like a nightmare, but very fitting for Kentucky lol I look forward to it
Hey I'm new to modding and I was wondering is there a location I can get the project zomboid clothing assets in .fbx format? I'm having trouble working with the .X format
I'm generally looking for context on modding the radio and tv channels
Does anyone have resources
Itโll take forever to come out since itโs only a tiny part of an utterly massive mod that remakes all the health mechanics in the game
Lol feel ya. At this point I'm just hoping to beat b42 by a couple months at least lol
I guess it depends on what you're trying to do... I'd probably sub to some adjacent mods and see how they work, personally.
this mod which is abandoned has a lot of issues.
i want to build something clean and enjoyable.
all of the radio sounds don't even play
42 is about to be out and I want people to go back in with something great
No chance that I will but
ยฏ_(ใ)_/ยฏ
Is there a cleaner way to do this?
Or is this jumble the only way to generate text out of devices?
I'm def not an expert lol but afaik all the media lines are those encoded strings
I think it's because those strings contain timing and player effects and stuff, but I'm not experienced with the recorded media
fyi, azakaela has some relevant tools.
https://steamcommunity.com/sharedfiles/filedetails/?id=2998120058
this seems to have been used by the problem child who I'm trying to fix
I can compare the results of what some Russains gave me as an example.
Then go from there.

This is exactly the gateway I needed. Thanks @fast galleon

the tool is made by the same dude who won't fix his shit
Whatever here I go
Both use unique id values for things like VoiceEntry, ChannelEntry, ScriptEntry, BroadcastEntry, and LineEntry.
One uses channels but the other uses adverts
No telling what script entry does

yeah i got this, all of this can be easily automated
won't even need this tool
Never worked with global moddata before. Any reference I can learn about using it from? Also, how does it differ from normal moddata?
getModData is attached to an object
global mod data is not attached to anything
local ModData = ModData.getOrCreate("whatever")
getorcreate ? uh
if "whatever" does not exist it creates it
getOrCreate is an existing function ?
yes
How would I go about adding a player model to play as in zomboid
Thank you!
afaik getModData on an item persists, so i dont think there is an issue just writing moddata to the item
Hey hi, has anyone made a decryption script for the player data field of the players database? Need it for some server management / statistics system.