#mod_development
1 messages ยท Page 254 of 1
like seasons have stuff that the climate manager bases its stuff off aeaea https://www.projectzomboid.com/modding/zombie/erosion/season/ErosionSeason.html
declaration: package: zombie.erosion.season, class: ErosionSeason
wth why is the link cut off
it was because I put braces around it lol
Hey. I wanted to ask if someone could help me modify a mod.
There's a mod called "Zombie Harvester Redux" And I want to increase the area of effect of the Thresher infront of it. No idea of where to begin, looked around in the files, but I'm not sure where it declares the area
I haven't looked at it but if I had to guess I'd say they probably used a nested loop for something like that
So I would look for a for loop inside of another one
That appeared to track two similar indexes
And dealt with squares
could someone help me out? im using the exact same methodology here to get these item icons working but half the time they just dont work and i dont know why
is there anything i need to know to get these to show up in-game?
nevermind im dumb
anyone know how or what the Decalgroup is?
i wanted to make a t-shirt mod which "should" use custom decals
Hi i'm currently working on Zombie Skin mode and managed to replace all the zombies with my zombie model, now i need to removed the zombie skin(cloth) and add 1 banana in small chance from zombie corps loot table. is anyone can advice me with that? just like occult and Dead Space zombie mod works but i can't figure out how it works.
Anyone know a good guide on making a custom UI?
Finally got this up
https://steamcommunity.com/sharedfiles/filedetails/?id=3304823344
hey there, if anyone could help me out with figuring out why the mod I'm working on wont show up in my mod list please hmu!
Just post what can help us find the issue here
as of rn i think i figured it out
my mod.info saved as a .txt
instead of .info
will report back if im wrong which is very probable
Where do I start to learn how to mod zomboid? I have a program installed that allows me to write LUA, but I don't even know how to properly use that. I'm pretty well out of my comfort zone, but I'd love to learn the process. Any pointers?
lf mod that increases the heating radius of fireplaces 
i wanna mod in mosquitos that can carry the infection and have to be repelled with bugspray or hairspay (something of the sort)
AYYYYYYYY i fixed it
that sounds awesome
I'm not even sure how to start with modding though. Is there a way to connect SciTE to zomboid, like a pluggin or something? is it as simple as sifting through code to add/remove what I need?
i found a zomboid tutorial, gonna look that over
so i followed the tutorial on the forums on how to make a custom map item, but im getting this error and the map shows up blank in-game. has anyone had this?
does anyone know how to prevent to custom zombie skin to be lootable? it's keep remain in the corpses inventory as an item everytime when i kill my custom zombie
ending numbers with f is not valid in normal lua but project zomboid accepts it anyway, delete the f to get rid of the warnings but it shouldn't be the cause of your problems
ill figure it out some other time
but how do i add an item to the loot pool to spawn on the ground?
like if i wanna spawn an item on the ground in a living room or bedroom or something
I am curious about ^^ too, for learning
imagine putting a huge sus looking obfuscated string in your mod, in order to generate a fake crashdump and put it in console.txt which contains an incredibly rude and snarky message to whatever poor user has to deal with someone else's bug
like JEGUS get a life
I was looking into the mod's source code because documentation simply doesn't exist, and this is THE VERY FIRST thing i find inside.
I mean look at this. Does this strikes you like something anyone whatsoever should put in their mod? Especially just to be mean to strangers? But in a backhanded way so that people who look at your code cannot tell? Which in itself is extremely poor look?
At first I even thought this was some kind of eval backdoor, but no it just displays super rude text disguised as PZ crash dump.
trying to make a model mod for the game I followed this tutorial https://theindiestone.com/forums/index.php?/topic/37647-the-one-stop-shop-for-3d-modeling-from-blender-to-zomboid/ but the console in-game says it's not a x model
I exported it as an fbx like it told me to
try using dislaik clothing guide
it's more clear
Oh god that's obfuscation ?
it's not very sophisticated, no. But it bothers me that it exists at all, that it exists to hide the fact that the mod displays a very rude message, that it displays such a rude message at all, that it's disguised as a real crash dump, and that it displays a rude message instead of helpful tips
the message itself uses an euphemism to call the user an idiot, then patronizes, then emasculates, and then mocks the user
this is not ok. There is no scenario in which this is ok.
and perhaps worst of all, is that the user gets this message instead of a real crash dump (which is useful for debugging the issue) in case something is misconfigured
At face value it's pretty insignificant. It's just a snarky fake crash message replacing the real crash message. But the way I see it, it's just layer upon layer of being a complete douche.
wrong
i'm not a modpacker
like i said i was looking into mod's source code for the want of documentation, and it's what i find inside, right at the top of the file, front and center
So what about the error ?
nothing, i never got it
(X) doubt
it doesn't do anything whatsoever about modpacking and all it accomplishes is gives people grief
I think you got emasculated little buddy
well i didn't get this error so idk if it applies. The fact that all of this exists in this form does piss me off on a lot of levels though.
I mean, it's one thing if you want to print("lmao ur dum")
when you put that into a cipher so people couldn't see that you're doing this, it's where it crosses the line for me
local function _check()
local m, lCF = nil, getCoroutineCallframeStack(getCurrentCoroutine(),0)
local fD = lCF ~= nil and lCF and getFilenameOfCallframe(lCF)
m = fD and getModInfo(fD:match("(.-)media/"))
local wID, mID = m and m:getWorkshopID(), m and m:getId() if wID then local wIDH, e = "", "fifmkhjkfi" for i=1, #wID do wIDH=wIDH..string.char(wID:sub(i,i)+100) end if e~=wIDH then toggleModActive(m, false) ECC_VC = {wID, mID} end end
end
Events.OnGameBoot.Add(_check)
Checks if the mod has the right ID. Else ECC_VC is set as existing. Then checks variable exists and creates a function and does your string thing
A quick read allows anyone to understand what's going on
it's like you have full intention to be an ass, but you don't want people to see that you have such a full intention
And you're here acting like you're doubting it's for modpacking
He's counter acting against modpackers and you're just mad about it
Protecting his code
i don't do modpacks i could hardly care about that particular aspect
Exactly, so why judge his anti modpack security ?
Why act like that ? Why do you care ? You shouldn't ?
who said it's the "anti modpack security" i'm judging?
tbf its not really security, it's mostly a slight inconvenience
This
It's a security, it makes anyone who doesn't know shit about lua not able to modpack
It is a security
well I guess that is for the better lol
Of course a better security could exist that's for sure, but that's really good enough
you'll notice that i didn't said anything about the modpacking and i did said a lot about making a snarky condescending message and doing it in a shady way
The start of the conversation is this
yes. None of it pertains to modpacking.
It's not shady, it took me 2 fucking minutes of looking in the code and understanding it's for modpacking
the string thing is shady
please quit trying to make it look like i said anything about modpacking because i didn't
You can't hack someone with this shit if that's what you think
While I think it would be bad if someone were to include this generally in a mod, it's included specifically for the case where a user decides to modpack so it's not like everyone will receive that error
Although this doesn't mean I don't agree with the fact that obfuscating/encrypting/trying to hide anything in a Lua script for a mod in a game is a bad practice
His mod is explicitely said to not be allowed to be modpacked, if someone does it, he gets his console fucked or idfk what and he deserved it
He's not doing that to random users and shit like that
i can respect breaking people's modpacks as a personal choice, but breaking it in this way specifically is a douchebag kind of choice
instead of all that it should be just print("modpacking not supported")
You're just nitpicking on stuff for your convenience
i don't even use that mod jegus
But they don't read the console, so they will never see that
Modpackers do not care about a print in the console
in which case why do all that crap then?
You can think that but so long as the current implementation of Kahlua gets no updates in years, there's probably going to be a method to break the sandbox one way or another. I was trying to find a way so I could execute Java code, but even if that were possible it would allow for much worse anyway.
Bcs it breaks the mod
It doesn't just print
It breaks the mod
You can't
you're missing the point
You just can't
How would there be no way?
I mean like overflow stuff gets found seemingly weekly
more generally i think you're so intensively putting words in my mouth that it's difficult to hold a conversation
And it's not like the game's code has the greatest reputation overall (sorry TIS)
*as of latest public release
You came here, looking for war, on a random modder, coming in randomly posting code, you don't even mention who it is
because why would i do that
You would deserve a fucking ban if I was a mod being such a rat
i'm not here to point fingers at anyone specifically
just to show this disgusting way this disgusting message is created
its not that serious ;-;
"disgusting way"
Protecting his work by disabling his mod and printing some shit in the console
Is a disgusting way for you
It is, that guy is not at his first
would you PLEASE quit insisting that this is what it's all about?
ok modpacker put something in his mod so it doesnt load his mod when modpacking is found, its sus (only because something can be bad but not everything is bad) but in this case its not too bad, done
I dont even think theres more to debate about
You've proven yourself to be a rat, people saw you as you are, I've brought it up to the attention of the public. No point in arguing with you in any way, you know what you do, you know your hatred, you don't even know what the code does while reading it for more than 2 minutes would have inted you towards the antimodpacking, which you never mentioned once
because modpacking here was never the point
jesus christ modpackers live rent free in your head
Then there's nothing to bring up, he's not doing any shady shit
It's just a long string, that's it
it wasn't your initial point but it was brought up in context so i think it's ok to mention
They don't, I don't check the modpacker tracker every 2 days, nor does anyone do it
I do it somtime
The code is for antimodpacking, that's it, end
I do sometimes, every 3 months or so maybe
but only because I have a license on my code
yeah it's fine I thought it had nothing to do with it but i was wrong. Either way I don't judge them for intentionally breaking modpack compatibility since this creates a lot of issues for original modders.
k
With that out of the way, can we appreciate at face value the fact that a) some very rude message is displayed to people instead of making a statement of fact that modpacking is not allowed b) the message is hidden in the file such that people who look at the source code cannot see the message and its rudeness to strangers
and perhaps c) that i never mentioned who made this
well in fact it doesn't matter who made this. I don't care if it's the president of america.
Alright, you both can stop now. We've reached the conclusion of the conversation.
The code is scary, and looks bad, but does good, like batman.
Hey I already said that I was wrong about previously saying "nothing to do with modpacking". I don't do modpacking so I have grand zero experience with it so should've known better than to say it in the first place. But it's not about modpacking, it's about the message and how it's put there.
If it was just do return end --modpacking detected, aborting i wouldn't even bat an eye.
And it would be easy to delete
but like, wouldn't the mods just crash anyway?
Issue is, the clearer and more obvious it is, the less meaning it has.
Such "security" measures only prove successful until it's broken. (Not that it's difficult, but helps prevent it for most)
i mean it checks a variable to detect this. If it just uses this variable and the values are incompatible, it'll crash and not work, so even if you delete this check it wouldn't make it work
No, I believe it might be more complicated than that but I'm not fully aware of how his security works
well now it's the same issue as me saying "nothing to do with it", which for me turned out completely wrong
I'm only skimming this dubious code, but it appears the security measure is separate from the error printing - perhaps to throw off would be mod editors.
I don't think it replaces an error, but I could be wrong. I don't really see how it's snarky or rude though.
it's not a replacement (i was wrong about that too) it generates a completely artificial error message when modpacking is detected
and well "error: low neuron count" isn't exactly subtle about calling people stupid
Ah you were able to translate it?
after verifying that it just prints a message, i copied that part and ran it in isolation. It printed something very close to a regular PZ stack trace (i was so confused for a few moments) but it's edited
i could see how someone thought it was funny
Even includes helpful information along the error lines
ok thats not even extremely rude or slanderous as you made it seem (how I though it was being said)
it's literally a fellow modder just saying dont repack my mod, use udderly up to date with my original mod please
I love this.
if you look at it thinking that whoever is reading this message fully deserved everything that was coming. To me this looked super unwarranted and the bar for basic politeness was not quite so low.
I guess it was my misinterpretation but you said this " displays a very rude message, that it displays such a rude message at all" which made me switch my mindset to this is like really bad words
It didn't drop F bombs, I dunno if that's what you were expecting. But like. Imagine you started a game, and a bunch of stuff doesn't work and you have no idea why. You check the error log and you see this, speaking to you.
I was expecting that alongside "your mother" and other things lol
honestly if I got this error and didnt know what it mean i'd just ask someone here
i think i figured it out
this code checks if mod 2529746725 is loaded and disables it
does it only activates if this file is required from elsewhere?
well it doesn't matter, i have no intention of circumventing this block. I don't do modpacks.
it's just, this function alone already breaks modpacks
from what i can tell anyway
so the other part, which displays the message, is just to be rude to people
The guy is a thief when the mod EXPLICITELY says to not modpack with a big ass sign that takes a quarter of the modpage
so technically there's no real reason it should be even included in that file
Yes it should, make them confused
Also it's a fake error, so that can lead them to the wrong direction to delete the security
yeah IDK fam, alienating people who use your mods doesn't look to me like mentally sound thing to do
And if they read the error they can quickly see it's a fake error
But since they won't properly read it, they'll be fucked
i wouldn't be upset if i didn't read it ๐คท
But it's an error that could say what broke the mod
And it's falsely leading the modpackers in other directions
It's just securities
Stop arguing about this part I swear, you yourself are the problem rn bcs you don't even read it and come shitting on it again and again
well it doesn't exactly do that now, does it? It doesn't make it look like something went wrong. It says "u dun goofed lmao".
Stop you're making a clown yourself
I know this sort of message might come across as judging a topic without contributing but like... This really does not matter enough to warrant an hour long conversation
yea
it's not, really. But Sir Doggy Jvla dragged it kicking and screaming into direction of modpacking.
Well fortunately we're all empowered to just stop & let this channel be for modding help like it's meant to be
And I don't think anyone here even disagrees on the subject so there's that.
?
Wow
You're truly the master of clowns
You don't want to go and show who started throwing shit for a small part of a code that fucks modpackers do you ?
Frankly you're not in position to call anyone clowns when you've been making one huge strawman argument after another for an hour straight.
Stop you're shit, we're starting to know you now, trying to fuck around, arguing about modders etc
Alright, you both can stop now. We've reached the conclusion of the conversation. x2
Well, I tried
You're not at your first
Yeah it's ought to stop. The original point was derailed so thoroughly that nobody even brings it up anymore.
Anyway
lol
Anyone know if a model can be displayed with out a gray background box?

Specifically on UI
default avatar object has avatarBackgroundTexture so you might be able to replace that with a blank pixel. Otherwise, the background is hardcoded.
Then again you can replace the entire thing, or its prerender function which actually renders the grey background.
i've modified mine to show bronze background to indicate incorrect configuration
darker grey wasn't doing it for me, and making it more yellow made it bronze
ISUI3DModel.new(self, x, y, width, height)
that stuff actually renders the model, it has no background or anything
That is the goal, I don't want a background
well i mean the default panel also does a little border. But yeah that's probably the way to go in order to just render a character model.
I'm actually not sure if this class can render anything else.
I've never tried but it appears to be coded specifically to display human characters.
attachment editor uses ISUI3DScene so that's probably the general purpose 3d viewer class
Ok sooooo...
I made* a mod
But idk how to upload it
How do I do so?
(*I just took a level up sound mod and modified it)
in your user/zomboid/mods folder there's an example mod folder
Wich one is it
for me it's C:\Users\coldsteel\Zomboid\mods\examplemod
in there there's preview and modinfo files, but importantly your modded files go into media folder inside it
if you just replacing the levelup sound, you can probably get away with something as simple as duplicating the folder path from the base game in your mod folder, and putting your modified sound in there with the same name as the original sound
when your mod is loaded, its contents will override the original game contents by the same folder/name.
(terms and conditions apply)
anyway in order to be able to upload it to steam, you should place that into C:\Users\XYZ\Zomboid\Workshop\YourMod
What I did was open the mod files
Replacing the sound and modifying a small line of code so it plays the sound
there's a mod template folder which you can duplicate and edit
in that case you can place the mod folder contents into the zomboid/workshop/yourmod/contents/mods/yourmod*/ folder
*again
there should be media folder and modinfo file and poster image
and in the first folder with modname there's workshop.txt (you don't need to edit that outside of the game) and preview.png which should be exactly 256x256
by the way if you put your mod there, you can activate it without uploading to steam in order to make sure that everything works properly.
(might seem obvious but for example one of my modder buddies didn't knew, so due to workflow separation he ended up sending to his dev team members for upload a completely broken version and he only found out after subscribing to it)
While closing extraneous editor tabs I looked at the security code again, and I was wondering. Is the point to break it for people who make modpacks incorrectly but allow it to those who know what they're doing, or to break it for all modpacks? Since it checks for steam ID which AFAIK has no bearing on mod confligts, but doesn't check for modID which is what PZ uses to determine what to load. And the function literally just says add(_check) which is, like, right there. It could be fixed with any amount of coding skill. But it could be something like _G[a][b][c](d) and that'd make it way harder to change anything without breaking everything else.
somewhat related, loadstring works in PZ but that's probably taking it too far
@sweet mirage that is the my used vehicles IDs
I'm making a military base, Rosewood to St Paulo's. to west in Rosewood road. the road on my map will have a stop made by the army and if I were you I would be careful about going too fast with your car
a 5 tiles garage door LOL
hey!
would anyone know why my wheel models arent appearing in game? (error message that appears in logs attached)
Ok so
I got the level sound to work
Now I just gotta upload it
But the game tells me preview images cant be bigger than 1mb
lower the photo resolution
Ok
-# And how do I do so?
yes, just look up file condenser or something
I reduced the preview file size but the workshop keeps telling me its bigger than 1mb
Its not
Its 954kb
why is your photo file so large?
Maybe its the image size
image size must be 256x256
Alright,thanks
Im still getting the issue
What the fuck
make the file size smaller
make sure the right file is there and the name is right
Its name right and its the right frile(PNG)
i dunno then sorry
there are 2 different picture files
make sure you edited the right one
you can just use the same file for both pictures
one is a workshop preview, and another is modinfo poster
What do you think of this roof?
Hi, is there a way to override vanilla items without having to specify the entire object and its properties in the items file? I am looking to add a new attachments slot. Instead of redefining the entire block:
item Hat_Army
{
DisplayCategory = Accessory,
Type = Clothing,
... many properties ...
AttachmentsProvided = ANewAttachment,
}
I would like to do something like this
item Hat_Army
{
AttachmentsProvided = ANewAttachment // only add the attachment slot, dont touch the other properties
}
you can do it with lua but not with just scripts
Great. Can you provide an example? (Or atleast link to some docs)
local item = ScriptManager.instance:getItem("Base.Hat_Army")
if item then
item:DoParam("AttachmentsProvided = ANewAttachment")
end
```i'm not sure if that'll nuke the existing attachments though, some properties will just let you add stuff like this and some will get overwritten
but this is how you'd generally modify just one property of an item
Cool. I have not seen the ScriptManager before but i will give it a try. Cheers ๐
I threw together this simple mod based off the code posted here earlier. It's more of an upfront tool to display a warning, just to encourage modpackers to make modpacks properly, so that whoever's mod got included don't have to deal with modpacked version becoming outdated and conflicting with the actual mod (not as much).
https://steamcommunity.com/sharedfiles/filedetails/?id=3305360926
it does offer some anti-modpacking protection, as per namesake. But really not much, also per namesake.
what is the command to delete an item? cant seem to find it here
the only one I see is isDisappearOnUse()
what do you mean "delete"? From the game? Or from inventory?
from the inventory
you can simply remove it from the inventory object
getInventory():remove(index)
pretty sure there's a way to pass the object itself so you don't have to find its index
if you do that, the item seizes to exist right?
I want to make an item consumable but not by using it the normal way
it's removed from inventory and not inserted anywhere else, so it exists in Java memory limbo until it gets garbage collected
so effectively it's gone
if I do
isDisappearOnUse() and Use() will it do the same?
that I don't know
ill try to do your version
yeah you have a handle on the item itself, you can straight up pass it into the remove function
getInventory():remove(inventoryitem)
do I pass the index number or the item itself?
the item
okay
there's also RemoveOneOfโ by item name if that fits the application
media\lua\shared\Translate\EN\ContextMenu_EN.txt
ContextMenu_PopAnUppyDecky = "Pop an uppy decky",
}```
``` item JYTCitrusBurst
{
DisplayName = JYT Citrus Burst,
Type = Food,
EatType = can,
ThirstChange = 5,
Weight = 0.1,
Icon = JYTCitrusBurst,
UnhappyChange = -10,
FatigueChange = -30,
DaysFresh = 9999,
UseDelta = 0.05,
UseWhileEquipped = FALSE,
UseSound = OpenCan,
ReplaceOnUse = JYTEmpty,
CustomContextMenu = PopAnUppyDecky,
Tooltip = Tooltip_JYT,
}```
can't for the life of me figure this out
CustomContextMenu not working
do you encode ContextMenu_EN.txt in utf-8 without bom ?
i am noob no clue what that means
try replacing CustomContextMenu = PopAnUppyDecky, with ```
CustomContextMenu = Drink,
will try, give me one sec
Drink is already in the games translation files so I don't need to add it to my mod's right? @mellow frigate
exactly that's why I propose you that
gotchu thanks gonna do that rn
we all are before being stuck with encoding problems https://en.wikipedia.org/wiki/Character_encoding
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values that make up a character encoding are known as "code points" and collectively comprise a "code space", a "code ...
in the end you want utf-8 without BOM for your txt files for eng translations as well as internals descriptions (but you want other encoding for other language translations like Brazilian and Cyrillic)
what editor are you using to write / edit ContextMenu_EN.txt ?
encoding is a one of the main menus
how would I encode it in notepad++?
ill look around for it
it's already UTF-8 without bom
@mellow frigate
works with drink
so it's GOTTA be my ContextMenu_EN file
idk what could be wrong with it though
https://steamcommunity.com/sharedfiles/filedetails/?id=3305459666
Done in 1-2 days, first day was mostly art lol.
i like this!
hey!
would anyone be able to help me figure out why my wheel models arent appearing? (ik i asked earlier but im still having issues)
https://pzwiki.net/wiki/Scripts_guide/Item_Script_Parameters/EatType
This is all I can find for EatType, kinda useless does anyone know of a list of all the different EatTypes
BleachBottle, Bowl, Bourbon, 2handbowl, drink, popcan, Pot, 2hand, 2handforced, can, plate, Bucket, Kettle, Mug, wateringcan, cigarettes
trying to find an EatType with a really short eat time, I found popcan in the AnimSets .xml files and itโs speedscale is set to .64
but popcan is a foodtype
would i just set FoodType = popcan instead of EatType?
eattype is just the script name for foodtype
oh shit ok cool thank you
that worked thanks a lot @bronze yoke
Watch Untitled and millions of other Project Zomboid videos on Medal, the largest Game Clip Platform.
it's coming along ๐ค
with help from the original Zyn mod creator, needed help with the function to decrease the weight every time u pop one
Hello, im new to modding, how can i delete an consumable after a player uses it?
Currently having an issue where people are cheesing the mechanics of a healing item by cancelling the animation half way through, so the item stays in their inventory, but the effects of the item are still applied
How would I stop players from doing that?
@uneven ore
DisappearOnUse = TRUE,
Thanks, no more instant full heals, =)
๐ซก
it seems like the same issue is occurring unfortunately, is it influenced by the fact its classified as a food item?
@uneven ore the issue where players can stop the eating animation and still recieve the effects? or it doesn't disappear after you let your character eat the whole thing
Guys one tick in zomboid, is how many seconds?
it's not a set amount
on the client ticks will fire as fast as the game can, if the player has set a framerate limit it'll be that unless they're lagging, on the server it'll target 10 per second unless it lags
so, how i do to make my crafting a certain amount of time
Example: if i want to make a crafting lasts one hour in-game. How much should i put it?
oh, crafting uses its own time, 48 units is one real second
thank you so much
is that like 1 unit = 1 in-game minute? or second?
Hey guys. Can anyone lend me a hand with a quick mod?
I made a mod some time ago that would allow the player to craft spears out of sturdy sticks, but instead of replacing the vanilla recipe, it appears to have added another option in the drop down menu and now there are 2 "Create Spear" options to choose from. How can I just replace the vanilla recipe instead?
make your recipe named exactly the same as the original, but add sturdy stick into "use one of" ingredients table
SOMW just adds a different spear
that would be a very fast game speed ๐
i don't think it correlates to anything specific in game time but it might scale with day length regardless
having 2 different options is probably for the best, given that it can use different ingredients. So one of the optios will show regular ingredients list, and the other will show your ingredients list.
I was using SOBS instead since I don't want to clutter the loot tables with so many different items, I'd rather keep finding the vanilla hunting knife more often instead
add Override:true, to your recipe script to replace an existing recipe
I just checked my code from when i first created the mod and I got the Override:true, line in it but i'm still getting a secondary option in the context menu, im not sure what I'm missing
Vanilla recipe, made from tree branch or plank
Then the modded one which allows sturdy stick as an ingredient. Still 2 context menu options
I must point out that my mod is quite old, made it almost a year ago. I don't know if the devs changed something, and im such a newbie coding i wouldn't know what it is that could have changed
does the recipe have the same internal name as the one you're trying to replace?
I think so...
Remind me how you paste code in discord please???
enclose it in triple graves
enclose it like
```
paste here
```
thx
module ChippedStone
{
imports
{
Base
}
recipe Make Stone Knife
{
TreeBranch/WoodenStick,
SharpedStone,
RippedSheets/Twine/RippedSheetsDirty,
Result:FlintKnife,
Time:80.0,
Category:Survivalist,
Override:true,
}
recipe Make Stone Axe
{
TreeBranch/WoodenStick,
SharpedStone,
RippedSheets/Twine/RippedSheetsDirty,
Result:AxeStone,
Time:80.0,
Category:Survivalist,
Override:true,
}
recipe Make Stone Hammer
{
TreeBranch/WoodenStick,
Stone,
RippedSheets/Twine/RippedSheetsDirty,
Result:HammerStone,
Time:80.0,
Category:Survivalist,
Override:true,
}
recipe Create Spear
{
Plank/TreeBranch/WoodenStick,
keep [Recipe.GetItemTypes.SharpKnife]/SharpedStone/MeatCleaver,
Result:SpearCrafted,
Time:100.0,
OnCreate:Recipe.OnCreate.CreateSpear,
Category:Survivalist,
OnGiveXP:Recipe.OnGiveXP.WoodWork5,
Override:true,
}
}
ah, it's because your recipe is in module ChippedStone
it needs to match the original recipe's module and name to override
i feel silly now, lol
Thanks
Sorry to annoy you all with my noob questions...
Where should I look for to find out which module the original recipe might be in?
According to the Wiki, it says that the spear is located in
ProjectZomboid\media\scripts\items_weapons.txt
Is "items_weapons" the module? I'm confused
Gonna go in blind and try with Module Base and see what happens
Sorry, just rambling. Starting to remember what I was supposed to do and where to look. It seems I was indeed correct regarding the Base Module
everything in the base game is in the Base module
It's basically just an item name prefix, which was given its own infrastricture to insert it automatically (pretty needlessly IMO).
Thanks for pointing in the right direction guys, the mod works as it should now.
Have a good weekend
First one yeah
I have a request for you. I made a big workshop collection for the zomboid project and I put a lot of effort into it and I will be happy if you look at it and rate it and best if you give this also to help that this exists about the world. Thank you in advance for your willingness and I appreciate every review. you can also try it, the entire procedure for setting up the game is in the collection.. ๐
https://steamcommunity.com/sharedfiles/filedetails/?id=3302020133
For some reason I cant get my cleaning books to load in with distributions lua
Followed the basics from the wiki, its in lua\server\item folder but I cant get it to pop up on lootzed in bookstore tables.
`require 'Items/Distributions'
require 'Items/ProceduralDistributions'
table.insert(ProceduralDistributions.list["BookstoreBooks"].items, "Coot.BookCleaning1");
table.insert(ProceduralDistributions.list["BookstoreBooks"].items, 4);
`
the item and mod names are correct also*
have you made sure your item works (spawning it in debug)? if it does, then add a print statement to this file somewhere and check the log for it to make sure it's actually running
yeah been using lootzed to test
what you've posted looks exactly correct to me so i have to suspect the issue is something like that
changed to
local bookstoreBooks = ProceduralDistributions.list["BookstoreBooks"].items
table.insert(bookstoreBooks, "Coot.BookCleaning1")
table.insert(bookstoreBooks, 4)
and that works
huh! glad you got it worked out
just got it, but man.. I really dont want to rebuild the entire table ๐ฆ time for find/replace
Quick Question. Is there a mechanism to render a items "WorldStaticModel" in the UI somehow? Kind of like how the character can be rendered?
neat idea, could probably check out what lifestyle does with the haircut/appearance menu
Hmmm
I was looking for a similar thing, there's UI3DScene
Haven't looked into it
It's a UI object, so you're dealing with UI which partners up with a java object
I get that.. but yeah, its not like the other UI objects...
its a bit more raw
going to take me a bit to sus out wtf is going on
๐คข
looking at it though, I should be able to figure it out
Want to make the "Hiring" of a new "NPC Salesmen Shop" to show a preview of what the NPC looks like. There will be like 20 different models to choose from, and I want to give a little preview.
Neat
How far along are you on this project? Maybe you'd like to collab on shops and traders?
I am basically done. It's very very simple.
No purchasing, nothing fancy.
The only thing left is to implement a bunch more models for different kind of salespersons, like a farmer, survivalist, doctor, etc
then the upgrade path, to allow you to sell more stuff
@hardy drift any follow up?
I have another one, and I'm probably missing something basic. I want a warning at 23:00 every day on my server as from 00:00 - 01:00 all zeds turn to sprinters. This is what I tried and failed with lol:
local function checkTimeAndPrintMessage()
local gameTime = getGameTime()
local currentHour = gameTime:getHour()
if currentHour == targetHour then
sendServerMessage("What a horrible night to have a curse...find shelter")
end
end
Events.EveryDays.Add(checkTimeAndPrintMessage)
hey!
would anyone be able to help me figure out why my wheel models arent appearing? (ik i asked earlier but im still having issues)
both parts of the script that reference the wheels
are they in the same module?
a couple things i notice: why do you have them doubled up? and there's no comma on your scale line in any of them which might cause them to fail to parse
doubled up?
also not sure what module is reffering to
you have two vehicles_wheels and two vehicles_wheels_dualy
yeah because there needs to be two of each, thats how wheels work
(that was meaner then i ment im sorry)
i mean for the model scripts, both wheels are probably going to use the same model script?
oh true....
i think the issue is probably having no comma on the scale = 0.004 lines though
i added a comma, changed nothing
for module i mean at the start of your script you should have module ModuleName {, if they're in different ones it can be more complicated to reference them
oh its all in the same one
is there anything else in the file with the model scripts? a common issue here is that a script further up is broken and that causes the rest of the file to be skipped
the only other part is the scripts for the truck, and it all works fine
same error message
how would i make it so you can use paint to change your skin color?
cause i wanna make it so you can have pink skin
Makeup ?
so, i did something and the wheels are gone now, same error appears
Hello, I'm new to the entire Project Zomboid scene in its intierty. But I've been reading up and it seems like its possible to make mods in both Lua or Java. Is there a benifit to using one or the other?
java mods require manual installation by users, they aren't common at all and you won't find very much help for making them
but lua mods are somewhat restricted in what they can do
table.insert(ProceduralDistributions["list"]["GasStorageCombo"].items, 18)
18 is the spawn rate ofc, but what is 18 out of? 100?
sort of
there's a lot of factors that go into spawnrate, technically it is out of 100 but the default settings aren't 100%, they're 40%
does anyone know how i can add an item to the loot pool of items that spawn on the ground of a room?
so technically it's out of 250, but it's modified heavily by the zombie population in the area of the container - it's not really predictable what the spawnrate will be so it's better to base it on other items than try and work it out mathematically
okay fair enough, thanks for the info
so basically if I have my spawnrate set to 50, it's 50%, but 50% of the spawnrate % in sandbox settings?
kinda?
yeah, so 50% * 0.4 = 20%, but with zombie population it's really hard to say what the actual effective spawn rate would end up being
Hello, does anyone know how to execute the option of an item in the inventory through a function, like eating, smoking and other things?
ok ok makes enough sense for me, thanks
wdym?
like the ContextMenu?
yep
a type of cigarette.Smoke()
if I assign a function to F10, for example, it pulls that smoke function from the contextmenu automatically, you know?
ohhhhhh im dumb i just realized what ur original question meant
you wanna basically make a macro to utilize an item in your inventory without going into your inventory to use it
exactly
lemme try something real quck ill tell u if it works
can't figure it out lol shit sorry @finite patio
no worries
Forgot to thank you earlier. I was just wondering also for server side code do clients rlly need to have it installed or can it simply be ran on the server only?
the game doesn't actually have a mechanism to load mods on the server only but if you make a mod that runs lua files from the cache directory then the server can run anything they want without the clients needing to have it
that being said you'll likely be disappointed on what you can actually do with entirely server sided code, quite a lot of stuff needs to be done on the client, even stuff you would expect to be the server's domain
Alright thanks for the help
Please tell me, is it possible to make other players hear the player's say? Or is there any way to display a message like with Say, only so that other players can see this message?
Use SayShout
won't this method attract zombies?
No (unless using chat attracts zombies mod)
You could also send a /say chat command on MP
then please tell me why the SayWhisper method is needed?
That's direct to specific players iirc
iirc?
Oh, now I got it, thank you!
free mods for me??
what the heck is the difference between WorldStaticModel and PlacedSprite
ik obv ones a sprite ones a model but how do I know which one I should do
do the model if you can help it
canBePlaced would make you see the WorldStaticModel right?
im assuming WorldStaticModel is the model when you drop/place something on the ground
and then PlacedSprite is just the img version of WSM?
yes
sick thank you
I plan on using the same model for my StaticModel but I gotta make this shit way smaller
any tips on scale for my model
set it to .0001
i mean when exporting the model from blender I set the scale to .0001, however if I can just set the model scale in my code I wil def do that
Yes you can add a scale line to the model def
you know what it's called?
scale = FLOAT,
thanks bro
Won't work without closing comma in that model def
That's why I asked
Thought you were using it
Usually. Some people seem to use separate files for models
But regardless it goes in a model def in a script
yeah lol gonna add it to my models.txt
There are often model defs in item script files
Idk about yours
But it doesn't go in the item script
It goes in the item's model's script
{
mesh = WorldItems/jyttin,
texture = WorldItems/original,
scale = FLOAT,
}```
Float you change to a number of course
scale makes it bigger or smaller
ok ok cool that helps a lot
i joke i joke
thank u all for your help
well you asked ๐
i meant like how much is big and how much is small haha but ur all good im just kiddin
anyway if you need it to be like 5 times smaller you put it as scale = 0.2
woes of making 3d models for flatscreen games
in VR this problem doesn't exist - absolutely everyone uses the same measuring system of 1 unit of distance = 1 real life meter
yeah it took me way too long to make a god damn cylinder with my image on the top of it smfh
first time using blender
or any 3d software
@frail violet was very helpful
stuff's way harder than people on youtube make it look
nah fr i hate it when the tutorial guys are clicking thru shit at the speed of light too
well anyway what i meant to say is that it would be easier to scale the models if the game 3d units had a hard reference with real life units
which it kinda does by default but you know what i'm saying
yeah i get u fs
nice much smaller now and u can place them
just gotta figure out how to rotate it to be flat
you can rotate the model in blender
ah yk what
probably set z and y as the wrong things
I made Z up and -Y forward
not sure the proper orientation
that would be hte same as rotating it so yeah sure
that's how it's commonly done yeah. X is right, Y is up. The only direction left when you add Z is forwar.d
yeah makes sense idk why I thought it was flipped the other way
mainly because all of this is completely arbitrary since the cross products & everything else works the same, and at some points in time different people chose different default orientations, even though as far as math goes it's all set in stone
in math X is always right, and Y is always up. You build Z by taking a cross product of X and Y, and that direction is forward.
(fun fact: cross product only exists in 3 and 7 dimensions)
in godot Z is back (or X is left depending on how you want to look at it)
You can also use Attachment editor and add "world" attachment that alters how model is placed on ground.
I don't know what attachment editor is tbh
it's in debug menu, you press one of the F buttons i don't remember which
you gotta start the game in debug mode, pass -debug as exe start parameter.
Does anyone know if it's possible to change a recipe's name (as in the name displayed in-game) via lua script? I saw there is setOriginalname() but that doesn't do it, and I'm not even sure what that might be used for.
Does it needs to be via Lua specifically? You can simply change the translation entry for it.
Hello all, The PZ-Modding-Community discord's first ModJam has concluded, here are the results: https://www.reddit.com/r/projectzomboid/comments/1eovokn/modjam_game_in_a_game_in_a_week_results/
@hardy drift If you keep blender up while using PZ you can export/overwrite the mod file and it will adjust live in game. I use this to align car parts and size objects. Now... sometimes the item will get "stuck" at a size and you need to reload the game but this method is safe and saves time.
yeah
Works for animations, AnimSets
Textures I'm not sure, models yes, even for clothings
Doesnt debug have a reload texture option? or was that just for cars?
No idea
how is that Zomboid 3D Project going on, someone worked on in the past?
Not sure it went anywhere, I remember they got stationary things to render nicely.
hmmm
interesting thanks for letting me know
btw debug mode breaks my game for some reason. i open it and i donโt get the regular menu i get a bunch of random shit and it doesnโt let me get to the menu
That's probably the breakpoint screen you're staring at lol
Hit the play button at the top
And check the box up there if the errors are continuous.
i would suggest fixing the errors that cause it rather than ignoring it
thought i found the built in lua debugger to be remarkably unhelpful as well as straight up broken in places
the one place where it would be most useful to know the information, it shows wrong information (the locals panel at the point of crash)
and bizarrely the debug panel's error log doesn't show what was the actual error, only the stack trace
maybe that's just visibility settings but that's bizarre defaults to have either way
wdym it doesn't show the error?
how do I have a player say something? I used player:Say("string") and gave me an error
what error? that should work
I made a typo on the string lmao, sorry
glad you got it working!
btw anyone know how do I use math.floor() but with one decimal number? instead of zero decimals
multiply by ten before and divide by ten after
thats cleaver hahaha
apparently I fucked something up in my mod and now contextmenu's for certain other modded items don't show up
but they still show up for my mod
I should see a couple other options here from Vehicle Repair Overhaul to salvage these brakes
but since I added my mod, I can't
w8 maybe i fixed
yeah in my models.txt i had module Base not module NameOfMyMod
You should have an error pop up
Slight note: It's best to use some kind of SCM (ex.: git) or just backups to assist with keeping track of what files you changed and whatnot.
(I know this ain't help for the current issue at hand, but it can do a lot for relatively "little" effort once you're used to it)
well ik for sure it's something with the context menu
by means of deductive reasoning
Watch Untitled and millions of other Project Zomboid videos on Medal, the largest Game Clip Platform.
what the fuckkkkkkkk?
the errors are perpetual
just keeps going up
i dont know how i fucked up so bad
NOTHING in my mod should be doing this ๐ญ
console.txt will usually let you know
Is there any way I can make a mod for a silent generator? The wiki code is just for the placed item, not the power code. I'm tired of doing hored events for my players and having to turn off powered areas so that the zeds dont gather under the sound sources.
u could probably make function that takes the sound files of vanilla generators and replace it with either nothing or a blank sound file maybe?
alr this makes no sense at all
somehow my mod prevents you from using recipes from other mods
my mod doesn't even add recipes
doesn't do anything with recipes
doesn't touch other mod's recipes
but then my mod works perfectly fine
Hi, I'm newer to the game but was interested in modding. Is there any form of documentation(official or unofficial) that I could read to get started?
I FIXED IT
MY ITEMS SCRIPT WAS CALLED ITEMS.TXT
AND OVERRODE A BUNCH OF SHIT
CHANGED THE FILE NAME AND WE ARE GOOOOOOOOD
anyone know where I'd find the foraging loot tables
steam\steamapps\common\ProjectZomboid\media\lua\shared\Foraging Wouldn't that be it ? Half way down i see each item is assigned to certain zones?
I looked in there but maybe I'm trying the wrong thing, I'll look again
ahhhhhh yeah the zoneChances thanks @tranquil kindle
Is there a way to change the chance of a player falling when colliding with a zombie while running or sprinting?
anyone know if theres a mod that can properly display a mannequin head item / clothing item in general.
Example, if u try equip a Spiffo head on it , it doesnt show.
@onyx aspen Ik of a craftable manequin mod and i remember in the description it said you could use it as an armor stand but I'm not sure if they changed anything to make head items show
i know but its useless if the mannequin doesnt show the head item
yeah idk i haven't used this one
just remember it's all i found when i was looking for armor stand mods a while back
Heya, guys. I'm trying to edit a vehicle mod. Specifically the trunk's capacity. Where can I find rthat?
Looking at the files in "mods\89def110\media\scripts\vehicles"
I guess here
That didn't work, changing capacity from 100 to 500 there
Or do I need to create a new game for the changes to appear?
just a small question is it possible to have multiple result items from one recipe ?
i want to be able to take "carrots" (the perishable one) out of "canned carrots" ( the not perishable one) and i was going to make a recipe that basically let me craft carrots using the canned carrot but i want the empty tin can to be a resulting item aswell
IIRC no, you have to use an auxiliary Lua function which adds additional results
i see
( i didnt understand batshit )
thanks still
i havce never done modding and it probably shows
so if i understand this correctly, you want to have a recipe like "open can of carrots" but which directly spills the carrots and the tin can into your inventory, rather than producing an opened can of carrots?
yes
in that case you'll need to add such recipe that takes a can of carrots (maybe an already opened can?) and produces carrots, and use OnCreate function to add an empty tin can.
player:getInventory():AddItem("Base.TinCanEmpty")
end```
that goes into a /media/lua/server/MYMOD_recipecode.lua
and in your extract carrots recipe you add OnCreate:Recipe.OnCreate.MYMOD_OpenTinCan
Hi. Is it safe to use getPlayer() when writing client-side lua ( files in /media/client/) or do i need to use getSpecificPlayer()? It is my assumption that given it is client-side, the game always has the correct reference to the local player so using getPlayer() should be fine? So only in /media/server do i need to use getSpecificPlayer?
files in /server/ run in all cases
i.e. on server, on client and in singleplayer
not sure about /client/
Right. I have added a function to the OnKeyPressed event in a /client file, and i am trying to extract the player that pressed the key, since the event does not provide the player parameter. Right now i am using getPlayer(). Perhaps there is a better way?
i'm not sure about getPlayer specifically but OnKeyPressed is relating to the game window, not even any player in particular
so you can make an assumption that only 1 player is associated with the window
but it's not necessarily true
sounds like i need to boot up a multiplayer session with somebody and test it out ๐
or you can look in the game's decompiled code
by the way
OnKeyPressed actually activates when the key is released
Is there any way to get value of script item? I know that with DoParam you can replace item values, but is there any way to get original value?
define "original value"
I think they mean the values defined in the item script
Like wants to get the value like uhh
for example getScriptItem:getMaxAmmo ?
WorldStaticModel = myModel wants to get myModel
pretty sure that's not possible
it only stores 1 value and if it's overwritten then it's overwritten
Like this, but I need to get capacity
I saw there were some funcs for that stuff but if they want some other custom value it's difficult
-_-
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory, class: ItemContainer
I think they want InventoryItem:getMaxCapacity() or InventoryItem:getItemCapacity()
not sure what the difference is, one is integer one is float
ill check rn
anyway a lot of the stuff is available as a read-only field
doparam gives you ability to write to write to some of them
i think by default kahlua exposes everything public of the class, except with fields they're read only unless you manually define a setter
so if you have an item parameter in mind, you can just do something like local foodtype = item.FoodType
there is no method to getCapacity()
It's script item
yes because thats for ItemContainer class
hwat even is script item class, my intellisense tells me its just an Item
I know, that's why I'm asking for a method for scripted items
yep
Item is an abstract description of an item, InventoryItem is an actual in-game item created off of Item
I use instanceItem for the script item ;-;
and since candle tells you getAllItems returns ArrayList but not what in the list lol
it is Item
you mean something like this?
int
Capacity
print(item.Capacity)
if yep, this not working
how, I can't do this
I don't even think it exposed
well some of it works
wait it is public ur right wth
when i was messing with clothing items, i could read some of these fields but to set them i had to use doparam
You sure your item is Item and not some other class?
maybe then there is a way to use Item to get InventoryItem and through it to get getCapacity()?
how do you get your item
local items = ScriptManager.instance:getAllItems()
for i = 0, items:size()-1 do
local item = items:get(i)
if item:getTypeString() == "Container" then
print(item)
print(item.Capacity)
-- item:DoParam("Capacity".." = ".."120")
end
end
yeah you can instance that item, it creates an actual real item
Can you please explain in more detail?
local item_inst = instanceItem(item)
local capacity = item_inst:getMaxCapacity()
well of course it doesn't work, the type is Container, not Item
then how is it a Container
code writes -1
well there's only 2 ways it could work: everything in that array is an Item so the code never runs, or the element in question is type Container which doesn't have this field
that means its not set, so try the other one getItemCapacity() instead of getMaxCapacity()
well Item.type is stuff like:
I'm guessing this means it's a combo item. I think vast majority of items are combo items.
Nah, the same
backpacks?
turns out it creates new InventoryContainer class
huh, the more you know
well in any case i haven't had much luck modifying Items like this, they always came out broken one way or another. And in particular I couldn't fill up the clothing masks because they must be integers and when you add items, they're added as doubles.
when you call instanceItem it creates the correct information like InventoryContainer for Container item type or Food for food item
oh true
local item_inst = instanceItem(item)
print(item_inst)
local capacity = item_inst:getInventory():getCapacity()
print(capacity)
yes that is correct nice
fucking methods shortage
right? encapsulation is cancer
the more you know
well it makes sense at least (I guess in retrospect)
yeah well the way I see it, the whole feature serves no purpose other than trying to pretend like you know better than other coders
@drifting ore @grizzled fulcrum thanks guys!
but encapsulation isn't used to hide knowledge but to group relevant information into smaller thing
like if you made a whole game in Main class it would be a mess, even though all methods are there
no that's classes. Encapsulation literally just cuts visibility and adds nothing.
on reading more, I guess its true but idk on the specifics
and by the way you don't really need classes. C programs never had anything like it and people write in C just fine, separate files and all. The one and only issue I have with C is that you you need to type out the entire function name which includes its own namespace. If the compiler could just automatically figure out the shorthands, it would be close to perfect.
like I come from C++ where theres never like getThis getThat
you just do MyClass.value = 4
true, I think Java is built around classes and encapsulations oits hard to escape
that's a thing in C++ as much as in any other language that has classes. You're just not using the getters and setters.
granted in C++ there's literally no overhead for using these and they can be generated automatically for you.
constexpr inline my beloved
i'm super rusty with C++ and i don't keep up with the new standards though. Is it a thing yet that when you access fields that have getters and setters, these functions execute transparently?
i.e. class.foo = bar compiles to class.setFoo(bar)
I think not but I am similar position
I do less and less C++ than I'd like to because uni never has C++ stuff. Most of my uni work is Java and SQL which I really am annoyed
I''d rather read asm than SQL it feels like someone programmed it while having a migraine
oh boy, the sql
it's something that should be so extremely simple, becomes so extremely complicated because it doesn't want to acknowledge that it's not a programming language
in real world application I just use wrapper like in python or I just stack overflow
good thing i guess that nosql becomes popular
ye
the exposer does not expose fields
evidently PZ does something of its own which is a half-implementation of what kahlua already has
quite common
pz loves rewriting parts of kahlua for little reason and intentionally or unintentionally removing features in the process
schizophrenia moment
Is any way to set Moodle.Type level?
is there an archive of all versions of the pz modding tools? Specifically alpha 0.1.5d
I wanted to make a map for it.
not really, moodles always recalculate their level every tick so changing that directly doesn't do anything
but is there a way to do this?
if I set an onTick event, won't it interrupt the vanilla calculations?
like with walking speed in trees
i think the vanilla calculation happens before rendering so the change won't be visible
but still, I get the error did not have __call metatable set when I try to call this line, am I doing something wrong or is this not possible at all?
Moodle(MoodleType.FoodEaten, character):SetLevel(1)
Moodle() is not a function
it's a constructor, you would call it as Moodle.new(MoodleType.FoodEaten, character) but that would just create a new moodle, not find the existing one
and how do I call an existing one?
let's back up. Are you trying to render a fake moodle, or affect the character status that's represented by a moodle?
because the latter can be done through a variety of status setter functions
I want to influence the existing moodle of the character's saturation
elaborate
it is much easier to influence the underlying stat the moodle represents than to modify the moodle itself
what do you mean about?
you can increase or decrease characater's hunger and that will change what the moodle displays
nah
moodles have literally zero support for modding
It's not working this way
they're completely hardcoded and intentionally locked off from lua aside from reading their levels
moodles are technically UI elements so you can hack into them thorugh Lua to make them display things other than what Java commands
then they will not give bonuses, which are also written in java
so which is it
do you want to affect the character or not
cuz you say it like you want neither and both at the same time
Why don't the developers add more methods for such moments?
mostly because it'd require them to rewrite a lot of it
if you need better modding support tcherno's moodle framework and my statsapi kind of cover most of it
the saturation moodle is based on BodyDamage:getHealthFromFoodTimer(), if you modify that value you can mess with it
byte1 = 0;
if (this.Parent.getBodyDamage().getHealth() != 0.0F) {
if (this.Parent.getBodyDamage().getHealthFromFoodTimer() > 0.0F) {
byte1 = 1;
}
if (this.Parent.getBodyDamage().getHealthFromFoodTimer() > (float)this.Parent.getBodyDamage().getStandardHealthFromFoodTime()) {
byte1 = 2;
}
if (this.Parent.getBodyDamage().getHealthFromFoodTimer() > (float)this.Parent.getBodyDamage().getStandardHealthFromFoodTime() * 2.0F) {
byte1 = 3;
}
if (this.Parent.getBodyDamage().getHealthFromFoodTimer() > (float)this.Parent.getBodyDamage().getStandardHealthFromFoodTime() * 3.0F) {
byte1 = 4;
}
}
if (byte1 != this.getLevel()) {
this.SetLevel(byte1);
boolean1 = true;
}
thanks!
just like minecraft
where are the game's UI files stored? Like trait icons?
and I'm talking not about 4 traits in the ui/traits folder
in the ui texture packs
thanks
Can you please tell me a program for viewing pack files, I canโt find it anywhere
i think tileed does it, you can get it from project zomboid modding tools on steam
modding tools? please tell me more about it
if you search that in your steam library you should see it
it's added to your account as long as you own project zomboid
first time I learned about the existence of this thing, thanks
iirc it's pretty much just mapping stuff
require "Foraging/forageSystem"
require "TimedActions/ISBaseTimedAction"
local function increaseStoneChance()
if not forageSystem.isInitialised then
return
end
local stoneDef = forageSystem.forageDefinitions["Stones"]
if stoneDef then
stoneDef.lootTables = {
{ item = "Base.Stone", chance = 5000 }, -- Increase the chance significantly
}
stoneDef.zoneChance = {
DeepForest = 200,
Forest = 200,
Vegitation = 200,
FarmLand = 200,
Farm = 200,
TrailerPark = 200,
TownZone = 200,
Nav = 200,
}
end
end
local originalInit = forageSystem.init
forageSystem.init = function()
originalInit()
increaseStoneChance()
end
Events.OnGameStart.Add(increaseStoneChance)
anyone know why this might not be working
numbers are turned up to an ungodly amount cause I was trying to see if it was actually doing anything
Small tip: you can put in lua codeblock by typing lua right after the first `
is it possible it is having trouble initing?
because you hook it for apparently no reason (from me just reading the code)
Why don'y you just call forageSystem.init() and then your increaseStoneChance() func
What are you trying to do ?
luarequire "Foraging/forageSystem" require "TimedActions/ISBaseTimedAction"
huh didnt work
trying to just make stones appear a lot more commonly when foraging
uhhhhh cause im an absolute noob
```lua
your code here
```
also you call your increaseStoneChance twice, once when game starts and once when forageSystem.init is called (your callback)
personally I'd remove the callback and figure out when you want to call it, probably onGameBoot
Check your if statements too, I have a hunch that either forageSystem.isInitialised is false or stoneDef is nil
thank you @grizzled fulcrum I'll see of those things work
Hello! I wanted to ask if anyone has worked with animated objects. I am referring to 3D objects as for example a dog
I could not think of any object that has been animated, but was hoping someone else would remember a mod or something that is making use of animations for objects.
you could look thru one of the dancing emote mods
@grizzled fulcrum i just said f it and made a mod that lets you use 5 chipped stones and some glue to make a stone lmfao
If it works, the it works ๐
Hey, do you guys know how the OnFillWorldObjectContextMenu worldObjects params is constructed? Upon right clicking the square, there is a list of worldObjects (tiles names like "blends_natural_01_16") but I can't figure out how to get them from outside the event. I can get the gridSquare but the getObjects() method result is empty and I tried a few others like getWorldObjects() which were empty as well.
getObjects shouldn't be empty, what did you try?
I'm trying to do something when the player press a key near a tile I just created.
Here is the code:
local function OnKeyPressed(key)
local isoPlayer = IsoPlayer:getInstance()
if (key == 18) then -- 18 = 'e'
MyMod.OnPlayerUpdate(isoPlayer)
end
end
Events.OnKeyPressed.Add(OnKeyPressed)
function MyMod.OnPlayerUpdate(isoPlayer)
if not isoPlayer then return end
local square = isoPlayer:getSquare()
if not square then return end
local charOrientationAngle = isoPlayer:getAnimAngleRadians();
local forwardDist = 0.5
local forwardX = isoPlayer:getX() + math.cos(charOrientationAngle) * forwardDist
local forwardY = isoPlayer:getY() + math.sin(charOrientationAngle) * forwardDist
local targetSquare = getCell():getGridSquare(forwardX, forwardY, isoPlayer:getZ() + 1)
local worldObjects = targetSquare and targetSquare:getSpecialObjects()
-- print world objects
for index = 0, worldObjects:size() - 1 do
print(index, worldObjects:get(index))
end
end
Here I tried with getSpecialObjects which is also empty
I made sure the targetSquare has the same coordinates as the one that display what I want when right clicking, so I know it is the correct gridSquare
Am I making a stupid mistake here?
just uploaded in case anybody else has a use for this
https://steamcommunity.com/sharedfiles/filedetails/?id=3307580100
huh, are you trying to select tile objects above the character?
No, the tile the player is facing (in front of him)
I'm asking because you're using player:getZ() + 1 which selects one tile above
and usually there's absolutely nothing so the rest of the code doesn't run
or at least that's how i see it without actually running a debugger
I forgot about that +1, damn, I canโt test it rn but it seems like thatโs why.. I was trying to check if the tile above was free earlier and forgot to change it and my brain somehow ignored it. Sorry about that, thanks
I have a idea I've been thinking about for quite some time
I want tips on how to make any tainted water in Zomboid cause the Knox infection
I have little experience but I doubt this would be extremely complicated
You would have to get the lua function for drinking tainted water and override it with your own
I made a mod that infects people after reading a book (crafting recipe), so I could get you the code I have used for it, the drinking tainted water function you would have to find on your own though
I don't know whether it really is a lua function though, maybe someone else knows more about that
is there a way to add rv interior to vehicles that dont support it
"Base.88w900scarletdist"
this is the vehicle
hi guys i'ts my first time making a mod but i created a custom clothing and i want to ask how can i make it naturally spawn in the world
Is OnGameStart event calling to player when this player not host and joining server?
Is there any way other than ghost mode to make the player transparent to zombies?
You can make zombies useless but they can only be fast shamblers
This will make them not have a target
how can I do it?
it's called only when a singleplayer game starts
server doesn't calls it when loading the game and client doesn't calls it when joining a server
zombie:setUseless(true)
I think you are wrong, event runs on the server, because I saw the prints
well i distinctly remember having to hook up my mod setup code through a different event if the file ran on the server because the OnGameStart didn't fire
in fact here it is
i've experienced a similar issue on the client side (i probably just messed it up, OnGameStart works either way)
I use like this code and it works correct on both the client and the server
Events.OnGameStart.Add(function()
firstLevelValue = SandboxVars.LongerSaturation.firstLevelValue
secondLevelValue = SandboxVars.LongerSaturation.secondLevelValue
thirdLevelValue = SandboxVars.LongerSaturation.thirdLevelValue
Multiplier = SandboxVars.LongerSaturation.Multiplier
print("1")
if Multiplier == 1 then return end
print("2")
end)
do you mean by that it runs the same way if you put it in lua/client/ or lua/server/ folders, or that if coop-console.txt prints the same entries as console.txt when you host a game and join that server?
because what I had to do there didn't come out of nowhere. I didn't think this would even be an issue, it's why I remember this quirk existing.
Of course not! I originally wanted to know if it would run on the client the client side of the code that connects to the server.
As I understand it, your code is publicly available and you run the code on both sides at once?
well you can tell if it runs on the client by using isClient() and for server there's isServer(), and for singleplayer there's a combination of not (isServer() or isClient())
I need to know about running the code only on the client side, but since the event is called OnGameStart, I asked if it would work for players who logged into the server after the host.
files in /server/ run on both clients and servers, but the execution environment is actually not identical between clients, servers, and singleplayer. Some functions behave differently.
doesn't this make the shared folder? Runs the code both on the server and client
the /shared/ folder runs everywhere, even in the menu
it's a bit of a mess so you just have to learn what's what
i think it's like this: files in /client/ run in menu and client game, files in /server/ run in server and client game, and files in /shared/ run everywhere, and all of them run in singleplayer game. And you can require files form /shared/ in both /server/ and /client/, but files in /shared/ cannot require from /server/ or /client/.
Im using ShopX and im trying to find out how to code in modded map like for Riverside its :
Shop.Items["Base.RiversideMap"] = {
tab = Tab.Trips, price = 1,
}
but i cant find out where to find the code
That would help
I'll try and look through more mods to see if I can find the Tainted water function
local body = player:getBodyDamage();
body:setInfected(true);
body:setInfectionLevel(-1);
body:setInfectionTime(-1);
end```
this is the code I used
though you really would just need the setInfected(true)
I've seen others do this sort of code
I always wondered what the
Body:setInfectionLevel
was for
it is the nauseous moodlet iirc
0 is not feeling sick at all, 1 is zombie
OH
I forgot there are multiple stages ingame
Quesy, nauseous, sick
For the list of clients that run server or client side
https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md#ongamestart
Check the event name in the list and it's written where it runs
Yes
OnGameStart launches for the client whenever he loads a world
So joining a server loads a world and thus it runs
Usually you can safely assume that client only Events will run for your client when the conditions for that event are met, that's it
so I would assume but that's not what I found. I could cook up a test code real quick though.
I know it does bcs I actively used OnGameStart and it does
Well then I must have did something wrong.
If it didn't I would have gotten a fuck ton of error spam from players that use my mod, but they don't
What did you do ?
I used it to run "setup" function which mainly just reads a bunch of sandbox options, passes them through functions and caches results
But that can't work server side
In fact, a lot of the events you use here are client side only I believe, but you're trying to add them server side with your isClient() check
the outer guard check stops it from running on client, but it does run on server and singleplayer game
You're caching server side with this code ?
specifically I do this
i don't recall what EXACTLY was wrong when I was using OnGameStart, but it prompted me to use OnServerStart which worked properly.
i think it straight up did not run
same deal with the client code
the client version of this function is much of the same, but some of it is cut because these variables are never used there
not sure about the theory of operation but all of that was necessary to put this way specifically in order to get all of that to run on the server and in singleplayer, but not on the client in an online game
i can explain what every single one of those functions does on the server and how I know it does works
I run a test and here's the results.
singleplayer:
ClientServerTest server OnGameStart isServer=false isClient=false```
client:
```ClientServerTest client OnConnected isServer=false isClient=true
ClientServerTest client OnGameStart isServer=false isClient=true
ClientServerTest server OnGameStart isServer=false isClient=true```
server:
```ClientServerTest server OnServerStarted isServer=true isClient=false```
I can't for the life of me remember what was wrong with OnGameStart client-side which made me use OnConnected, because it wasn't my first option.
Could've been a negative confirmation bias? I remember I had an issue where one of the sides had gameSpeed twice as fast as the other, because I thought it was executing before sandbox options are loaded. But it could've been the other way around all along?
Like this?
I used Water goes bad to find the function
you need an end to close the function. And this module by itself doesn't do anything, it needs to be required from another module which then applies it
were you meant to use it in an item script as OnCreate:WaterGoesBad.onDrinkTaintedWater ?
I'm trying to make all tainted water give the infection
Not just a particular item
hmmmmmmmmm
I'm just doing this completely blind I have no idea what I'm doing
i think you might get the desired result by hacking into eating timed action class
Thanks, this is exactly what I needed!
thanks
onDrinkTaintedWater is the function i call after tainted water is drank, you can see the actual vanilla water drinking actions override that trigger it below that
specifically they are ISTakeWaterAction.perform and ISDrinkFromBottle.drink
you can look at watergoesbad to see how it hooks those actions if water is tainted
typing
GORDON ARE YOU TRYING TO GET ME IN TROUBLE?
Apparently the purpose worked. lol
i am so insanely stumped on how to add items to floor loot pools
i cant find anything related in Distributions or ProceduralDistributions
and i cant find any file names that seem related either
@unreal pewter throw a bunch of game files into blackboxai and tell it to look for what u need
thats how i find a lotta stuff
ah, thank you
these might not be a thing. Usually stuff like that is spawned via so-called "events", as in map events. Those are randomized but pre-determined things that can be added to the map sometimes. Things like car crashes and family suicides. They also spawn stuff like party mess on the floor.
not to be confused with the totally random loot spawning in certain types of containers which are manually placed on the map
(certain containers are assigned certain types of loot however)
unless you mean like foraging spawns
no i mean like
how you can find paper or books on the floor sometimes in certain rooms
See RBOffice.java and RBSchool.javaโ"stories" and "randomized buildings" handles that, Java-side
i dont see it anywhere?
Hey, I need some help with something. does anybody know how to check if the game is at x2, x3, x4 speed?
I just need a bool that returns true or false depending if the game is sped up or not
Do I need to override it?
I just want to effect what happens when you drink the tainted water
Also please remember to explain this to me like I'm 5
I have 0 experience with anything related to coding and know what nothing does
here's what water goes bad does to detect drinking tainted water, with all the other stuff cut out:```lua
local onDrinkTaintedWater = function(player, amount)
-- do something when the player drinks tainted water
end
local old_ISTakeWaterAction_perform = ISTakeWaterAction.perform
ISTakeWaterAction.perform = function(self)
old_ISTakeWaterAction_perform(self)
if not self.item and self.waterObject:isTaintedWater() then
onDrinkTaintedWater(self.character, self.waterUnit)
end
end
local old_ISDrinkFromBottle_drink = ISDrinkFromBottle.drink
ISDrinkFromBottle.drink = function(self, _, percentage)
old_ISDrinkFromBottle_drink(self, _, percentage)
if self.item:isTaintedWater() then
if percentage > 0.95 then
percentage = 1.0
end
local uses = math.floor(self.uses * percentage + 0.001)
onDrinkTaintedWater(self.character, uses)
end
end
```you can copy paste this and edit the onDrinkTaintedWater function if you like
Thank you
Would I just need to change the tainted water function like I did
Or is there anything else I have to do?
File structure for code related mods confuses me
I believe everything is supposed to go in Lua
this should go in a .lua file in yourMod/media/lua/client/ , name doesn't matter
Alright thank you for the clarification
I believe I'm supposed to just edit the code to this (with semicolons to end the string)
Correct?
I've seen that you can't rotate tiles, but you can rotate chairs, microwaves and many other objects that are defined as tiles. I don't understand the difference.
You can place items freely within a square, but a chair snaps onto the grid and can rotate. So, is a chair an item that snaps onto the grid and can be rotated or is it a tile that can be rotated?
it's a tile, it just has a texture for each direction
you should copy what i just posted and work from that instead, i think you're getting a bit confused by some of WaterGoesBad's inner workings
what the code i just posted does is create a function called onDrinkTaintedWater that will be triggered when drinking tainted water - water goes bad does the same thing further down the file, but it's more difficult to understand there
So I must have missed something, I've created a tile with 4 textures for each directions, I've defined each face for each texture in TileZed, but I still can't change the direction. I can pick it up, but I can't rotate it -_-
I mostly just mean the
Local body =character :getBodyDamage();
Body:setInfected(true);
Part
I'm mostly just asking if I got anything wrong before testing
My game takes awhile to load so I need to make sure I cover all my bases
ah, you made a typo on the second line, Body should be body since that's what you called it on the first line
but apart from that i think it's correct
Alright thank you for your help again
This is something I've been wanting to do for a long time but couldn't get enough information to get anywhere
i'm happy i could help!
Ok first test failed not only was I not able to get the infection for the water