#mod_development
1 messages ยท Page 221 of 1
do i just getCurrentPlayer instead of getPlayer and run the same function for all in game, or is there more to it
@digital osprey
This guide will teach you a way to solve almost any MP issue.
Poltergeist do you have any suggestion regarding this?
thank u!
Not sure that there is something like that. Possibly you can retrieve the cell population that appears in the debug UI or check the number of loaded zombies.
You mean, this debug UI?
how do i modifiy degration speeds on clothing n stuff in a script?
does someone have like a hand icon
Any easily-recognized problem (hopefully with an equally easy solution) that would cause my new generator PNG to be added to Tilezed with two GIDs?
And what would be a feasible way to check for the ### value used by tilesets, as referenced in the TIS thread "Customer texture packs and tile definitions"?
Obviously it's beyond a human to look at every Steam Workshop mod for PZ and make sure they're not conflicting
is there a way to make a piece of clothing a weapon
you might be able to do it with crafting
just a thought not completely sure tho
https://www.youtube.com/watch?v=N6tZujOPnDw this teaches how to make a consumable but the process is similar
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...
akaik weapons must be equipped in hands. but the attack can be hooked. https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md#hook
Halp. Should I use AI art, just show the code, or wait for a classic Spiffo bg from Chuck?
Hi Team, Just hoping to check. Is OnPlayerUpdate just as taxing to the server as EveryTenMinutes?
is there a wiki for all the PZ lua functions?
lua code is readable from your installation folder
it depends on game speed. in most cases OnPlayerUpdate frequency is higher.
Is there a difference between StaticModel and WorldStaticModel?
Thank you so much, this is exactly what I was looking to do. Where in the file structure would I put this chunk of code?
https://steamcommunity.com/sharedfiles/filedetails/?id=3171815531
No more guessing about where safehouse starts or ends for players.
That was annoying me for a while from both sides
So, does anyone know a possible answer?
I made a test tile, put the pack file in the folder
"texturepacks"
I opened the mod config and put
"pack="
And in the tile editor it appears, but inside the game for me to put it down, it doesn't
What am I doing wrong?
And typing the name "test" doesn't appear either
You need to add both pak and tiledefinitions to your mod and mod.info has to describe them.
Sorry did not understand
Do I have to create tile definitions and place them both in the folder and in the file?
and what would be the "pak"?
So I guess this is your first time creating tiles?
Yep
mod.infohas to describe both your.pakand.tilesfiles like that
pack=tradertiles
tiledef=tradertiles 1337
- Your
.packfile is where your textures are and should be located inmedia/texturepacksfolder of your mod - Your
.tilesis the file that describes the purpose of those textures in-game and should be located in amediafolder of your mod.
@mystic vessel ^ most compat explanation
Well, it exists. @bronze yoke
https://steamcommunity.com/sharedfiles/filedetails/?id=3171829037
maybe i made something wrong with the "Pack" file? i think?
Feel free to repurpose our code if you want to do your own main volume / options page, albion.
I followed the tutorial of
daddy dirkie
It's probably old
wherabouts in the game files do I find that?
Zomboid\media\lua
have a look at the pz modding wiki for all discovery questions. https://pzwiki.net/wiki/Modding
very very white
my eyes hurt looking at the wiki lol
Im looking through and cant seem to find any functions for shooting, any idea where those are?
https://pzwiki.net/wiki/Lua_Events
There is mouse down and weapon swing
Not sure how to achieve firearm shot event but I guess you can combine mouse down with it or sum
I did what you told me, but unfortunately it didn't work
Well something you do isn't right, because this is how my Immersive Shops work currently.
Check manuals about how TileZed works
where can i find it?
I figured it out, thanks in advance for your help.
She was super fundamental for me to progress :)The problem is that I needed to create a new save to load the textures.
(unless you can recharge the lua)
This page helped me to get through everything I needed
very cool! i love seeing tools like this
@mystic vessel and that too
Thats cheatsheet for properties, PSD for tiles and blender template for creating sprites from 3D models
And another question, can I only reload the textures by closing and opening the game?
yes unfortunately
This is sad ;/
Well actually makes sense, blobs always get flock'ed in most engines
The important
But the problem was solved just by creating a new save and installing the mod
new save is not required, you need to enable mod and reload the game to make game load fresh copy of assets from blobs
The only sad part is that my Zomboid doesn't start quickly
Remove unneccessary mods for debugging
There is no need to run game with 100+ mods like you do for gameplay while you code the mod, you need to only do it after to see any possible conflicts
In fact, taking advantage
What are the 2x and 1x textures for?
Basically what it says. Different quality of textures.
Thanks! I thought about decorating require itself, but decided against it because I didn't want to accidentally grab samename mod files instead of local vanilla modules in the event of overlap. Still might offer that in an update as an optional import mode. But yeah, hopefully it leads to useful things.
Game can run potato mode and switch to 1x textures instead of 2x
DOME is a sick as hell name btw
i wouldn't mess with require, i've played around with stuff like that a bit but modifying global state is a bad idea in a heavily modded game like this
normally i'd be worried about adding any overhead at all to global functions but require isn't really performance sensitive
you can sort of locally inject overwritten 'globals' using the fenv stuff but it's kind of overcomplicated and i hear runs badly
Word, I hadn't experimented at all, just mused. But thanks for the words of warning.
i wrote an overwrite for pairs() that would allow it to iterate over arraylists but found it not worthwhile to add any overhead to the global function, and if people have to manually import it with an injector function they might as well just call apairs or something instead
Completely fair. I could also simplify use with a global function but wasn't sure what people would prefer, so I decided to keep stuff local.
wrequire har har
please keep everything in a module whenever possible ๐
Yeah all my latest mods are doing that now. No globals in TMJ
Well glad my decisions were at least acceptable lol
Probably leave it as is indefinitely
it seems good how it is to me
When you pick up a sprite item like furniture it results in this log entry "pickup test" does anyone know where this is coming from? Be looking through the actions etc but do not see any furniture pickup actions... I found the place commands in lua server world objects
it prevents overriding from outside though
what do you mean?
if everything is local to a module, you cannot override it from "another mod" without overriding the whole module.
you can override parts of modules just like anything else
local MyModule = require("PathToTheModule")
local old_foo = MyModule.foo
MyModule.foo = function()
print("foo overwritten!") -- will be printed whenever the function is called, whether it's by this mod, another mod, or the original mod
old_foo()
end
what about java-implemented modules, is that possible?
your exemple has something like ? ```lua
--PathToTheModule.lua
local function foo()
end
java methods can't be changed but the reference lua keeps to them can be - in effect, you can change a java method but only when it's being called from the lua side, java side calls won't be affected
oh right, sorry that's what I meant
so like calling Picker from Lua and overriding it to another Picker
if it's a true local you can't overwrite it but that's just because it's local, not because it's a module
I somehow managed to make a more accurate picker (in this case, for mouse over tooltips) in Lua than the basegame apparently, even though it took me over a week to figure out the math and stuff lol
--PathToTheModule.lua
local MyModule = {}
-- part of the module, can be accessed by other files by requiring this one
MyModule.foo = function() end
-- not part of the module, can't be accessed by other files whatsoever
local function foo() end
return MyModule
thanx
Is there any way to guarantee certain clothes on a zombie outfit? I just got started learning how to add custom outfits for zombies and it is half-is working. The shirt is popping up as expected but it puts random pants on the zombie instead of the custom one. I already checked my code multiple times and everything seems to be correct :/
For the record: Shoes are also fully ignored and replaced by generic shoes for some reason
Is this to add new moodles (because I understand so) or to modify the form of the current ones (UI)? My idea is to modify the interface in the style of Plain Moodles/Moodles Quarters and Flat UI Revamp. This is the first time I'm trying to do this, answers to those questions would help me a lot. Thank you
this is to create new moodles. as it was part of your initial question.
It works for me, at least in part. Thank you very much for the reply
There's a line to have no pants or no shirts
Omg...
<?xml version="1.0" encoding="utf-8"?>
<outfitManager>
<m_FemaleOutfits>
<m_Name>Bloater</m_Name>
<m_Guid>06c758ce-eb0e-4905-9ede-5c84e5c45332</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
<m_items>
<itemGUID>6b9a55dd-a875-46d9-8205-b3454358b9d5</itemGUID>
</m_items>
</m_FemaleOutfits>
<m_MaleOutfits>
<m_Name>Bloater</m_Name>
<m_Guid>06c758ce-eb0e-4905-9ede-5c84e5c45332</m_Guid>
<m_Top>false</m_Top>
<m_Pants>false</m_Pants>
<m_AllowPantsHue>false</m_AllowPantsHue>
<m_AllowTopTint>false</m_AllowTopTint>
<m_AllowTShirtDecal>false</m_AllowTShirtDecal>
<m_items>
<itemGUID>6b9a55dd-a875-46d9-8205-b3454358b9d5</itemGUID>
</m_items>
</m_MaleOutfits>
</outfitManager>
That is probably it
Example of clothing I have
Ok that is a lot of info I had no idea about, thanks
I'll see if I can get it to work this way
Tho in my case it just adds a single clothing which is a complete custom model of a zombie
idk if it will apply to what you want, go try it
I'm trying to make a standalone region, but I wonder if there is a way to remove the default map items from the loot tables somehow?
(Solved btw. - turned out I was very close to the actual solution but did just some small mistake all along)
how do I get a BloodBodyPartType so I can setBlood of a clothing Item? like is there a way to just type it out instead of having to use :getBloodBodyTypes() or whatever that function is called?
All the stuff I find is about adding additional items to the loot tables - but in my case I'd rather want to remove entries or replace them.
I worked with it and ended up causing the pants to disappear entirely. Then I just copied over an outfit from Authentic Z to double check and realized that something is definitely messed up because even in my own mod it refuses to work
Wait I might have figured it out
Nvm 
Reason: Bad word usage
You could use getCoveredParts() to get an arrayList that works for BloodBodyPartTypes.
If you use getCoveredParts() on a pair of pants, you'll get Groin, UpperLeg_L, UpperLeg_R, LowerLeg_L, LowerLeg_R, then you can iterate through that arrayList (or specify the index) for the addBlood command
local coveredParts = thisClothingItem:getCoveredParts()
IsoGameCharacter:addBlood(coveredParts:get(i), false, false, false)
does anyone know where to start learning modding
I solved it!
Just gonna write it down here in case someone else ends up having the same problem and is a bloody amateur like me:
When creating outfits for zombies, make sure that every piece of clothing, etc. is referenced in your own mods' fileGuidTable.xml, regardless of whether or not the items are from your own mod, vanilla, or from another mod. All have to be referenced in there in order to end up on the outfit
check the wiki, it has a pretty good section for modding, and the different kinds of modding as well
plus it helps IMMENSELY when you look at other mods, that do stuff similar to the stuff you want to do. I cant understate how much this will help you getting started
Dude, I gave you two superb starting points for learning how to mod PZ, I am not sure how else I could have answered your question. I even went out of my way to get you a link. That is literally the best advice I could give you. I dont know how this could possibly result in such a rant about the community supposedly being bad
what kind of label? you should be able to just change its text whenever that action completes, though finding the label might be difficult
How can I make Icons change their color depending on the color of the item? Like T-Shirts and other clothing does? I cant find any hint on this in the gamefiles
Dude, I already told you where you can find out how to mod the game. There is nothing more anyone here could do for you, unless you ask modding specific questions
errr.... does anyone know why this screen popped up on pz?
it appeared when I disassembled my item
is it a "major error" screen?
It's a script debugger, it shows up sometimes when there's an error with a code, most often with mods. You can close that by clicking on the play button above or F11.
oh thanks... i didnt realise it could be closed ๐
Sometimes you'll have to click the 'Break On Error' box if the error is persistent.
wondered what that was...
yea
You're all under arrest
lets bully uppy now
you first frickin nerd
Oooooooo
okay i'm glad i'm not the only one who does this--i felt really bad when i first started and was worried i would be "plagiarizing" someone else's mod or something but sometimes i'm just like dang, what's their file structure or how did they write this code out..? good to know it's not just me
im not sure if other types of items support it but i think clothing items automatically change the icon colour based on the clothing colour. ive seen a few items like the poncho also set the colour of the icon manually in the item script
I use it for clothing items. When my code has errors and the items are corrupted, they funnily enough have colored icons (even though in random colors), but for some reason it does not work when everything is fixed
3 things wrong here
- claiming this as your idea
- does not support shared folder
- does not support classes with same name
hey boys
what will be a best approach in trying to check if a certain UI is open
so i can prevent for it opening repeatedly?
I tried setting a name to an UI by using setUIName("string")
and it didn't help.
has anyone done this before please give me advice
are you setting an instance for that UI? For example:
local o = ISPanel:new(x, y, width, height)
setmetatable(o, self)
self.__index = self
CustomPanel.instance = o
return o
end
If so, you can check if CustomPanel.instance exists and\or isVisible.
actually no i am not
if you save it to an instance variable then you can get it from a static function
and then you can perform the check to see if it's open\exists from there
i see, but isn't what i have also saving all things in a table?
is there a way to check if the table exist ?
I'm not sure I understand what you mean
like at line 85
i create an empty table
and save new() into it so it's all packed into a table
as an "instance" mimick
by returning the "o" table
Ok, I think I understand what you mean. You're not really "saving" it to the o table, since it's local. Your only reference to that is gonna be the returned value in your case
you'd need something like the instance I told you about to have a reference
oh i see
i understand
thanks ill try that
Looking for a group of testers to help testing some of my mods. ๐ผ
Hey peeps, what ya think of my guitar on wall mod im working on? only a couple of days in, so it looks rough. long way to go still
That's pretty good hey
It might not be perfect but that's already pretty good
which mod do u need test with
I love testing and debugging even though it can be annoying sometimes.
Is there a way to set 2 types in item`s script, like drainable and weapon?
No
But you can make a lua function that swaps the item between 2
I know chuck has a mod that converts most items to weapon type for this purpose.
I made a mod that converted buckets to different types for different uses.
It would be a nice feature for the future, like tags were a nice addition.
hmm, thanks at tips
Does anyone have any tips for formatting the steam workshop page?
Quick question: So I figured out how to get zombie outfits working properly, but I'm wondering around the probability that I can set for clothes. Does 1.0 equal 100% or 1%?
https://steamcommunity.com/sharedfiles/filedetails/?id=3172171349&searchtext=
Screaming crying throwing up we're public y'all AAAAAA
If anyone has feedback for my description I'd appreciate it
If I am not totally mistaken, 1 should equal 1 % chance - at least in the LUAs this seems to be true
Jesus, this Icon Art is beyond beautiful, have you done this yourself? Otherwise I feel like you are going a bit on the overkill side of things with your text - you add three hairstyles with textures (that I like, great work here!) and for that rather small amount of content you have written a book on steam, including chapters containing political education ๐ maybe a bit over the top for a PZ mod, imo. But its yours, so do whatever you feel like with it ๐
Looks cool! Do you already have an idea about how to fix the clipping issues?
BAHAHA i'm known for being extra so thank you. i made the image with canva using their free assets--may update it to something more hand-made in the future, but i wanted it out of my hands.
I do! Tbh most of the current bugs are quick fixes, I'm just too tired to bother and I get publishing paralysis so my brain was like "DO IT NOW BEFORE YOU DON'T DO IT"
Since I just did a mod around hair.... and all my hair is clipping through hats... How do you fix clipping? I deemed it impossible
Depending on the hat, you just need to keep testing it (you can have the game open while you update the model/export it straight from blender into your mod folder) and warping/moving the hair around until you get it to fit the hat. You may even need to "cut" part of the model off or flatten it reeeeaaaally close to the body
How do you do this with your afros? I mean, if you make them match, lets say, a cowboy hat, there is not much afro left
for those, some styles will have to be bald. like, a hood, it's just gonna be bald most likely, or just a small model of the bangs showing.
did you peek at spongie's hair guide? they do a much better job of explaining it than i do
have not heard of this one yet. you mean the mod on steam?
Nope, a guide! Helped me most of the way through my experience.
Thank you, I will have a look ๐ Maybe I can do some fixing without breaking everything, lol
Im sure you can! Youve got this ๐๐ฝ
could anyone tell me how to upload my clothing mod? i cant seem to figure it out.
is it in the Workshop folder? From there, you click on "mods", then "create or update"...and go from there!
Oh jesus... "New Hairstyles for each Hatmodel" translates into thousands of extra itemfiles for me, lol xD I guess this will take some time
yeah, it had certain recuirements that i noticed other mods didnt meet, so i was confused, i assumed it was just for map mods.
you could also use the fluffy hair mod! it describes in the guide what that means
Did you upload it from ingame?
wym? call mods go in the workshop folder and stuff
here, let me get a pic of what i mean
Thing is, I use Hairstyles as items (wigs, so they can be put on mannequins). That means each model and texture combination needs a separate itemfile. quadrupling the number of models would get me up to close to 3k itemfiles right now, and I am only at 28 hairstyles xD
this power armor mod doeesnt have this structure, and my mods structure is the same layout as the power armors.
ohhhhhhh you made THAT mod! i see, i see...
i guarantee it does, you just don't see the upper folders
Still very much a work in progress, but already fully functional ๐
go into the workshop folder and copy the structure shown in the mod template
weird?
you need a specific folderstructure for workshop
but ill give it a shot
hey you've already got me beat--mine isnt even without bugs yet
Look at users/zomboid/workshop/ModTemplate. This is how your mod has to be structured. Add folders in users/zomboid/workshop following the logic: Yourmodname/contents/mods/Yourmodfolder/media/....
ye you've got this! you should just need to drop your mod a couple folders deeper--[Mod Name] > [Contents] and a 256x256 preview image > [mods] > [Mod Name] (MAKE SURE ITS THE SAME!), a 500 x 500 image named poster, and a txt file called mod.ini > [media] > ...
anything in brackets needs to be a folder
256 x256 should be right
or not?
Alright, thanks ๐
No problem mate, just got me confused ๐ still new to this as well
i got it working, i really appreiciate you guys helping, modding this game is very different than what im used to
Same! I'm also new to this--glad we can all help each other <3
<3
Thats why we are here ^^
Now the real test is to see if it actually works
bahaha legit half the battle is getting the mod up in the first place
honestly kinda suprised there arnt more mod templates?
tbh there's such a variety of mods out there--i highly recommend doing what you did and just looking for a mod that does something similar to what you want, then following their structure, or asking for help
you can always download any mod from workshop that does something similar as you want to achieve to have some kind of template
BAHAHA JINX
lol xD
well thats a good sign
Like, I was thinking "what if I want to do custom textures in the future?" took a look at Yaki's, figured out how they do it...now, if I wanted to, I could do that.
But I would've had 0 clue without seeing how they did it.
Thats exactly how I learned how to add tiles
yeah no, i tried making one from scratch from the tutorial the devs reccomend and HOLY, it goes from 0 to 100 real quick
It really really does. Give yourself time and kindness while you learn! The learning curve is def steep...
But you can do it!
honestly, it really helps having some experiance modding other games tho
lets me weight paint models and the like better
I still dont really feel like touching blender. Way to many buttons I have no clue about
true, but its needed for armor sadly
oh man...yeah, i went into it with 0 knowledge and 0 wllingness to watch videos (which i ended up having to do anyway LOL)
i just powered through blender learning most of it myself
same LOL i just didnt want to do the like
"learn how to make a fish!" tutorials LOL
like lemme just DIVE IN...
I stick with Gimp. 2D is already enough dimensions for me ๐
ah i use paint.net, my prefered image editor
dont get it confused with paint tho
btw, is their a way to cheat in materials so i can craft my stuff?
-debug mode, you get a menu with all items. (add -debug in steam start options)
sick, thanks
you can also use admin tools/the item menu
Afaik, having different icons for one and the same item type is not possible via modding (and not supported by vanilla code).
It def is--If you pick up a red t-shirt, the t-shirt is red...I forget how you do it though.
So I would have to write LUA? Now thats a whole new dimension...
https://steamcommunity.com/sharedfiles/filedetails/?id=3025955520|Workshop
Have you seen this guide?
yes, this one helped me getting started
This specific thing you want is not even possible by lua coding...
I wonder if ElictraV knows--it looks like their mod does what you want
Do you mean how the pink shoes have a pink icon?
That is good to know, thank you! The easiest way would probably anyway be just creating Icons for each item
yes, they also made separate Icons, they just link them in a special way
only way to realize this is to define new item types in your script and give them their icons there, for example and item red tshirt with red icon, an item blue tshirt with blue icon and so on. One for each color
finally, a starwars mod
I will think about this, thank you
seems to be working
do they have those shoes in all colors (ie the full vanilla color set) and an icon for each one?
"Beam me up Scotty!" - Gandalf
"Leviosaaaa" Scott Pilgram
off the top of my head i'm not sure. i wanna say yes..? check ellie's clothing mod on the workshop
nope, specific colors with specific icons. all kind of pinkish
ellie's shoes that are currently available in the mod are avaiable in any color i think i know
(idk why i say i think when like.....i know they are)
I will have a look ๐
but just out of curiosity, how would i let my characters body/clothing appear under the suit?
kk. even know this mod. they did it probably as I said, just a seperate item types for each color. (in this case, no lua coding required ofc...)
id imagine its with the "masks" but i have no clue what color the should be
maybe check out how spongie's open jackets does it..?
forgot that mod exitsed, lemmie download it rq
lmao i love it, it's one of those "you don't realize you have it until you don't" kinda mods
spongie is around this server too, you could ask them what they did
i think this is just for applying textures to models
have you tried to just delete all those masks?
i have not, couldnt hurt
just delete it from the xml file.
yeah, nothing, but its whatever i guess
doesn't work for you?
that's strange. in general, the game will render everything which is under your clothing by default if you don't use masks. only the parts which are covered by your actual 3d model should be hidden. so at least the nude character texture should be shown then
try reloading just in case..?
good idea. and maybe restart game
i'll restart again then
btw what body location are you using for your suit?
USUALLY you can just update textures and models straight into the game but i have noticed sometimes she gets...goofy.
so give 'er a restart LOL
maybe there are problems when you do this with xmls. but not sure....
tbh i'm not sure. sometimes it works for me, sometimes it doesn't. i always just do a full restart just to be sure. sometimes i have an issue, restart, and it goes away, so...
ยฏ_(ใ)_/ยฏ
FullSuit
FullSuit Removes you clothes beyond, IIRC
would wonder if it does that...
what could i change it to and have it still be one peice for the body?
i mean, worse comes to worse, i can give teh model an under suit
Try something different. I picked Nose, not many problems with that
belly button ring/whatever slot that takes would be a good one
since you can't see the belly button ring anyway with the full suit on
thats even better than Nose, did not know this
time to boot up the game and give her a go
or a make a new body location... but still wondering whether fullsuit automatically hides the vanilla character skin. that's usually not what bodylocations do.
yeah, cause i can let it get holes
Looking at the clothing thing on the wiki--could you add the suffix TINT to the ID? i wonder if that would do the thing matching up the icon with the color...
i lowkey wana make those zombie stormtroopers nw
wait
do i have to update the mod page everytime i change somethign to test?
I did this, to no avail. I could add randomtints to my wigs, that also works on Icons then. But then of course the wig color is random - and a blonde wig should be blonde, not pink xD
nope! if it's in the workshop folder, that's the verson your computer loads
update it when you're ready for everyone else to have that version
I was somewhat afraid you ask this xD dont work in the workshop folder, work in the mod folder
D:
opposite--work in the workshop folder, update when ready
mod folder is the copy that is CURRENTLY uploaded to the workshop
thats what I did with my first mod as well, like 18 times in three hours xD
It updates from the workshopfolder for me? ๐ฎ I will give this a try, I am working in user/zomboid/mods, what works just as fine, and only copy over to workshop when I am done/updating. Gives me two copies of my mod, so a lifeline if my python code messes something up badly xD
if you work in the workshop folder, nothing updates until you click "update" in the game menu
BACK UP YOUR FILES OFC BUT
you can work in the workshop folder if you're feeling risky
So I must have misunderstood you ๐
i work in the workshop folder cuz i wanna just be able to update as soon as my stuff's done/fixed rather than having to look for everything
but i'm sure it'll bite me in the ass
but when you do this, dont you have to update the mod in the games workshop menu if you want to test it? oO
nope
interesting!
though, if you're subbed to your own mod, it's possible that version might overwrite the local one...hmm...
@frigid mantle My only thought on the issue is that you do trigger log-in using a primarily Lua UI, so in theory perhaps you could make the game re-trigger log-in process while already in a server -- but it may require logging all the way back out and back into the server due to Javaside processes between pressing Join and the actual "Click to Start" screen that cannot be modded from Lua.
Or it may require Java modding, which is beyond my Zomboid interests, personally, due to how much harder it tends to be for some users to install those mods correctly.
when you edit your own mods in the zomboid/workshop or zomboid/mods folder, you should always unsubscribe from it in steam
hmm
i just wondered because i cant use a username and psw to enter as the host and so i wondered if a mod could do that or if i should ask the devs to maybe add it in the future
But, yeah, in theory, I could see it being feasible, if you hack hard enough at the code.
Steam wouldn't stop you to my knowledge, but I could be wrong about that. (And if the only thing stopping a thing is PZ itself, well, in theory, that can be modded.)
BTW, since you asked for feedback to your mods steam-stuff before: For me personally the "v 0.1" in the thumbnail is hell of confusing. My brain reads it as "Vol. 1" and therefore automatically categorizes it as just another music mod and therefor uninteresting (to me!). Honestly it took me until writing this now to realize that it does not even say Vol. 1. So I guess this could be discouraging people from looking at it
eh, that's fine. i'd hope the name doesn't Sound like a music mod? and i think it's important for me to (somehow) show that it's. not finished/to the point where i feel comfortable calling it a "full" release. i don't know how else i would say that.
any ideas?
check your recycle bin
what body location are you using now?
Well, it does not say that it is a music mod, but it does not say that it isnt either. To me as someone just looking over it "Palsj's Poofs" could be some indie band with three black ladies singing and someone uploaded their music and albumcover to the game. Maybe replace the "v 0.1" with something like "African Hairstyles" (cause thats whats in the mod) and just say in the mod description that it is a work in progress (as you already do)
the belly peircing
some bodylocations can do crazy things IIRC. Maybe try "Nose". This worked for a lot of stuff for me, and only replaces noserings, so no biggie
this is rendered before the pants and the sweater and it doesn't have the correct setExclusive definitions. it therefore won't cover those clothing types. you should choose a body location whoch is rendered after them to hide them
where can one find the order?
hmmm...i'm honestly not sure that i agree/that this would be a problem, but i'll keep it in mind for future updates. thank you for the feedback! ๐
No problem ๐
in vanilla shared/NPCs/BodyLocations.lua. The render order correponds to the ordering of body locations you find in this code
That is awesome, thank you! I did not even know I needed this, until you mentioned it
looks like i just need to do some reposition now, thanks for all the help
what is your bodylocation now?
Nose
you can try using this but this will result in a lot of glitches. whenever players wear pants with a 3d model for example like baggy jeans, they will get those render problems as in your screenshot from above
eh, ya win some you loose a few hundred
ofc it's your mod and you can design it to your liking. was just to inform you that those problems will occur. using appropriate body locations can prevent this. the whole vanilla body location system is specifically designed to avoid those problems.
I'd still try the FullSuit location...
did you try this after reloading your mod without the masks?
cannot imagine that the full suit doesn't work! can you send me your mod as a zip so I can have a look?
I am just bored atm ๐
sure thing, but keep in mind, its a heavly edited T-60 power armor mod, so its gonna be a bitch to find references
I'd try ๐
so as a game suggestion would be better than modding it
works completely fine for me when using the FullSuit
yeah my thinf being weird on my end ten
but you have to delete all those masks entries in your xml file!!!
i did, but i readded them later
in the version you send to me, they were still there. it has to look like this
I wouldn't necessarily hold my breath for either modders or devs to add that particular feature, to be honest. But you are welcome to try to make those changes possible. It'll be a lot of reading through game files at the point where the game tries to log you into a server and figuring out what you would need to trigger from in-game to simulate everything necessary that follows.
that's because you didn't delete the masks in the xml! they will hide the full player model
So you would need to decompile game files most likely and read the Java as well as the Lua, starting with the function triggered when you hit Join Game.
:p
well, i should be heading off, its like 6 AM :/
if you wait 2 mins I can send you my edited file of your mod. then you'll see that it should work
nah, ill just edit it out on my end
kk
For some reason I hoped this would fix models glitching through each other
it's only the render order. but it comes with additional stuff like setExclusive or setHideModel which makes other clothing automatically disappear when worn together. But it doesn't hide the character skin
but it can only hide like a whole model, if I see it right? So no (easy) way to make, lets say, Hats override the part of wigs (items with hair meshes and textures) that they actually touch?
it can in some cases prevent glitching since the problematic clothing item is then simply not rendered
yes. only the whole model.
dang it... you dont happen to know where in vanilla I can find the models for the altered hairstyles that happen through hats?
no easy way. this can only be done by trying to design the actual 3d model in a proper way
\
you mean the vanilla hairstyle which characters get equipped when they wear hats?
yes, like the normal "FHairLong2" version of the models when using hats
the basic one (I use it) is in models_X/Skinned/Hair, but I guess if there is no other way than making new models, there already must be models for this somewhere
isn't there a model which called "Hat" or something?
Oh. Now that makes sense. So the models for different hair lenghts are the same, no matter the hairstyle
when using a hat
yeah... not 100% but I think vanilla only has 1 or 2 models for hats
Well, gaining that information is progress and setback at the same time ๐ I guess I will be fine with a bit of clipping for the moment, lol xD
I think if you would like to avoid clipping with hats, you simply have to replace your modded hair with one of the vanilla hat models then.
your mod already on steam?
Funny thing is, by accident I already added the "hat" hairstyles as separate wigs on steam. Now I can just sell it as if I did this on purpose to give wigs that are useable with hats xD
so I just checked, vanilla names are "Hat" and "HatLong". can be found in vanilla media/hairStyles/hairStyles.xml
I thought so... Well, I guess Python will find a way to make the work for me
Python?
yes, my whole mod is written by python code. would not be possible by hand
understand. all the xml and scrip.txt files
also made a mod where I created some of them automatically but I even used lua to generate them XD
btw just had a look at your mod and saw that your hair styles are all clothing items. then there is no way to make them all so that they don't clip automatically (i.e. just combining your hair style and a hat and there is "magically" never a clipping issue). you probably have to remodel your hair styles or make a separate "hat version" for each of your hairstyles. In the latter case you have to replace the hair styles whenever player puts a hat on. this must be done by lua coding
I was afraid that this would be the way. This would at least double the already obscene amount of items I have ๐ And yes, the hair needs to be items, as It needs to be put on mannequins
yeah got that. won't work for normal hairstyles. also necessary in order to make them craftable
yes, exactly! It is a difficult balance between providing a solid amount of content and flooding everything in files
also the amount of 3d modelling required for this would be some work
do you just use vanilla hair styles for your mod or did you create your own ones?
No, everything is vanilla. I try to avoid blender as much as possible
hmm... ok. so the 3d modelling could be bypassed if you simply try to use the vanilla "Hat" and "HatLong" hairstyles. then there would only be the lua coding thing. this wouldn't be much code I guess but still some work if you aren't used to lua modding in PZ
This would require some drastical rewriting in every single file, but the textures, lol ๐ Maybe I will tackle this in the future, but at the moment I guess I am happy (seeing the amount of work the alternative means). There is hair on my mannequins, that is all I ever wanted ๐
And I even have the hat versions as wigs in the mod, so they are separate items that can freely be used with hats
That actually was an accident- but a lucky one xD
Yeah, that's totally ok! ๐ But still... I don't think you have to change anything on your mod. Just add some lua code. Not changing stuff you've already done
I would basically need LUA code that checks if a hat is placed on a wig, check for the wigtype to chose the proper hat-hair-type and make sure it uses the wigs texture. would this be possible with LUA?
yes
what would you consider the best starting point / guide / tutorial to start learning LUA?
if you already know python, learning some lua basics shouldn't be a huge thing. I learned it directly through PZ modding. Checking the PZ code, checking code of some mods which did similar thing I'd like to do and asking here on discord. and using some web resources for basic lua commands (here for example: https://www.lua.org/pil/contents.html or just google smth like "lua for loop")
for me, it was more difficult to find out how the PZ code works and how you can mod it via lua
i dont know python, unfortunately. I just know how to explain stuff to idiots and can therefor make ChatGPT do my work
haha ok! XD
without any programming knowledge, it might be a bit more difficult then to learn the basics
in this case, I also don't have an idea for a good tutorial then. but maybe there are some out there
I say by reading code, I understand 60-80% of whats going on. I just cant write it. But seeing that LUA is an own language, and nothing that PZ just made up (what I presumed), I now can find out how to go on ๐
best is idea is probably to start with a lua program which prints "hello world", then a lua program which prints all elements from a table, a program which adds to numbers and prints the result and similar easy stuff
I did all this in java once, that is not even too difficult ๐ Should get it running in LUA too
if you know basic java, then lua would also not be too difficult to learn. just thought that you have no experience with programming. my bad
well, it is extremely limited at best. Cant write myself, but can successfully alter existing code to do what I want ๐
But this link here is awesome, this will help me a ton writing myself
I just asked ChatGPT if it can also write in LUA... and it said yes! Lets goooo
you then need to get a rough overview over the pz lua code, learn how to properly mod it and how to use all the predefined commands and stuff
I think there are also some simple pz modding tutorials on the pz wiki
I will first try make my robot do this. I just need to find the right commands, and iirc they were somewhere on the wiki ๐
the commands which you can use in lua can be found here: https://zomboid-javadoc.com/41.78/index.html
they are programmed with java but can also be used in lua. only downside is that the source from my link does not really tell you what the commands do. this has to be inferred from the context when having a look at pz lua code
Javadoc Project Zomboid Modding API package index
Thats great! I knew I have seen this list somewhere, thanks for the link!
@cosmic ermine It's a cluster of my mods, but the main one would be EHE. The server I have is 24/7, mostly vanilla settings. I turned events up, just trying to see if this latest fix for the infinite sound is fixed.
@fiery pecan @bronze yoke Do you know if y'all gave permission to have your file in this mod? Just got a rare conflict because someone running the pack was also running the (sort of awkwardly named tbh) "Small Town First Responders - LEGACY2 - REWRITE OUT NOW!!!", which includes the same exact file name in the same place, but slightly edited:
https://steamcommunity.com/sharedfiles/filedetails/?id=2809058492
Filename is 87GMCarmoredcar.txt... Seems a bit specific to be a chance alignment. And code is almost identical up to a certain line. P sure it's no vanilla file in my game.
try torsoextravest maybe
Does editing the workshop description affect your workshop.txt aswell?
No. Did this mistake a couple of times
No, do a copy of your steam page before updating a mod
Also, if you expect your workshop.txt not to change much or at all, you can dupe your text into a good editor (e.g. VS Code), find and replace all the newlines with newlines followed by description=, and then throw that in your workshop.txt. Then your page will keep the right text when you upload.
If you use the SteamAPI you can bypass the in-game uploader
Would only change the contents package, and not the workshop related stuff
For what that's worth
Fancy
This is also how gif posters are setup- using a program/steamAPI to edit just that file - as the in-game uploader doesn't allow gifs
just gonna toss this out in the aether since i just had the idea: Pogs
nice!
is it possible to set up custom survivor npcs that idle on the spot for rp faction guards in a mod
morning, does anyone know how i can get my mods armor to spawn on zombies?
this might be what your looking for
https://steamcommunity.com/sharedfiles/filedetails/?id=3088354589
ooh nice ty man
np
Braven made a NPC framework? I thought he was using PZNS ๐ฎ
looks nice but wish it was for multiplayer like spawning npc hostile military guards or police that raid you for looting lol
MP NPCs as a mod would be pretty close to impossible
and probably require java mods to get off the ground
Not to mention parallel developing something like that along with the official version would be a good waste of time
i honestly don't know what this file is for, night has vanished for the time being so i can't ask him, but my best guess would be that this is an intentional overwrite of that mod's file
that is, it probably originates from that mod and not us
@bronze yoke Interesting, because this picture suggests that it is not allowing an overwrite, and simply registering it as a mismatch:
I wonder if perhaps the files loaded in the opposite order on server vs client?
So client overwrote the opposite direction?
Not sure, problem could be something else.
But that's why I hyu
does the client definitely have the correct mod installed? maybe it's checking before making the client download it
Unsure, he has other issues and burned out before we could finish. @bronze yoke
I'll let you know more when I know more.
He rebuilt new server settings from scratch and launched his server okay (I didn't catch whether he used both those mods the second time), but then it crashed due to some kind of divide by zero error associated with clothing, which leads me to believe maybe he removed a very important clothing-related mod that the save cannot live without.
We never made it to reproducing what he originally asked for help solving.
I think he was given the idea to just remove all mods and resub to everything by Beard and did that before I could get my scalpel out. Was at work.
That can happen even when you really have the right mods installed, I suggest uninstalling the mods that are mentioned in this error and reinstalling them
Just decided to do my own thing from the ground up. It's nothing special, far from it in fact.
It's more of a pet project for eventually getting to the real crazy ideas, but I've been out of time to work on it more.
Word if he lets me try more stuff, I'll mention results here.
๐
Was just curious, thought I remembered wrong ๐
Or just go from 0 to 10 you mean ?
bruh
Anyone hearing impaired? You can become so...
(I put subjectively reasonable limits on this, but it does get pretty loud.)
why lmao
Accessibility of course
For the hearing impaired and people who are metal
And doesn't seeing it just make you happy?
I mean isn't happiness worth something?
is banned for getting off-topic
@bronze yoke I might just be delirious from modding all day, but, if not, I believe I've found a small error in MFTEOTW...
While using it for many months, I have very rarely encountered the following error:
Originally I chalked it up to a bad track or something; but today I was bored enough to check line 50 of that file, and I found this:
local function onFillContainer(_roomName, _containerType, container)
local dummies = container:getAllType("Tsarcraft.BlankCassette") -- dummy item type
if dummies:size() == 0 then return end
for i = 0, dummies:size()-1 do
container:Remove(dummies:get(i))
end
for i = 0, ZombRand(1 * SandboxVars.MFTEOTWC.maxCassettes) do
local itemChoice = ZombRand(#itemList)
local item = container:AddItem(itemList[itemChoice]) <-- Invocation Target Exception
container:addItemOnServer(item)
end
end
Events.OnFillContainer.Add(onFillContainer)
So I think to myself, "Can I be sure itemList[itemChoice] exists?" and I quickly notice ZombRand(#itemList) which would give you a number from 0 to #itemList - 1... And if I'm not mistaken, itemList does not have a 0, because it is created entirely using loops based on table.insert. It is therefore possible for this to randomly (about, what, 1/500 times?) throw an exception because it rolls 0.
thanks, it'll probably be fixed when the next update comes out
Thoughts on my mod (wip) to hang guitars on the walls? (other instruments might come later)
Super rad, I love that. Is it a modification of current guitars or is it like a โfurnitureโ that we put up and then store the guitar in?
This is nice, good for builders and decorators.
how would i go about creating new animations for new guns
Awesome work so far! Dont forget the shadows ๐
Is there a way to give tiles tooltips? As in just hovering over a generator with the mouse, it will tell how much fuel it has? Or does anyone know of a mod that adds something like this?
check farming tooltips
!!! Thank you! It was right before my eyes
noob question but do players autodownloaded required mods for a multiplayer server or do they need to dl them individually from workshop ?
wondering if i should compile them all into one megamod (its just a small server for friends)
when connecting to a server a player sees a list of all missing mods and gets the option to download
easy thats what i was hoping, thanks
Guys, anyone has a clue why a car mod would not work in MP?
And also, what if a car doesn't spawn randomly on the map at all?
better ask in #mod_support or on the mod's steam page if your question is about a specific mod
Thanks! its like furniture... you attach the guitar to the "hanger" from inventory then place it on a wall. only way i could do it without loads of code, which i dont know how to write ๐
thanks dude! yea it needs shadows... is there a light direction that pz uses? i.e. light source comes from west side, etc?
following the logic on the textures, light should be coming from topleft (east?), so shadows are cast to bottom right
so would i mostly see shadows cast from items on the northwall onto that wall? items on the west wall would cast a shadow into the center of the room?
isnt topleft the west side?
orientation is this game confuses the hell out of me xD
basically yes, they will throw their shadow into the room
๐ yea i got no idea too.
I might just focus on the north wall, as that's where a shadow would hit the wall... im thinkink
Cant figure this out. I'm trying to make a function called localTigerIITurretKillZomb() that uses a global variable from the other existing function to make a killzone in front of the turret (to act like an MG) the problem I have is that when the vehicle spins in the opposite direction the rotation of the MG zone gets inverted. Ill post video
Idk how to change the math to fix it
P.S I had an idea to use this function for a flamethrower tank as well lol
How to remove the sandbox label in sandbox-options
Adding new tiles to TileZed, does anyone know what this tile property does? Is it the surface the tile uses or the surface that items can be placed on the tile?
Looks like the translation variables are set up wrong. I'm not even sure using non-English characters for the variable name can work at all. I imagine there are many non-English characters that would definitely not work as variable names properly in the Lua but I could be wrong.
Share your sandbox-options.txt and Sandbox_LANGUAGE.txt and we may be able to spot the issue
I see two issues... First, this;
are you uploading this to the steam workshop?
If my app is misreading the translation names because you're not using English characters for the names, it's possible Zomboid also parses then wrong.
written in Cyrillic
Yes that's the problem
no
Variable names may need to be in English letters
well maybe but not with that model at least. I got permission from the coder but not the model maker
and they need to be translated into Cyrillic?
Translations in your Sandbox_LANGUAGE file can be Cyrillic with the correct encoding.
wasn't the model maker shark?
But I don't know if that's allowed for the names of the options
yeah he didnt want me to use it
Also, you do not use a closing comma on the last field in sandbox-options
ah, it looks cool though
I think papa chad might make a model, he said he was interested but Idk
And I am not sure about trying to write more than one field on a line; I always put each field on its own line@brittle vapor
in shared?
Im just gonna keep working on the code though
Yes, but to be clear I mean the translations themselves, NOT the variable names.
I have never tried Cyrillic for variable names anywhere, and I would expect problems if I did
the issue is here on mine if vehicle and string.find(vehicle:getScriptName(), "TigerII") then local angle = vehicle:getAngleY() -- Calculate the direction vector based on the turret's rotation and current bearing local deltt = {} deltt[1] = math.sin(math.rad(angle + currentBearing)) if math.abs(vehicle:getAngleZ()) > 90 then deltt[2] = -math.cos(math.rad(angle + currentBearing)) else deltt[2] = math.cos(math.rad(angle + currentBearing)) end
but Im stupid and cant figure it out
I am somewhat stuck. Tiled cant find my png in the 2X folder, so I cant add it via the blue plus button. I used the basetemplate for creating new tiles and paint in it, as I did before (I already made it work before), but now it is not working - no matter what I try. It is 1024 x 2048, it has an alphachannel, it definitely is PNG, but nothing is working. What did I miss? Is there a certain way to name my layers? Or like a button I missed during saving?
Also one of your options seems to have a "." where its name should be
These aren't variables, are they?
Yes they should be
Ok thanks
If you're not using quotes they're assumed to be variables pointing at translations in Sandbox_RU or whatever language that is
You can check True Music Jukebox for examples; we have sandbox options with Russian translations
๐
And, again, I'm pretty sure you cannot use a trailing comma there
I think it'll bug the line and cause translation not to load
@brittle vapor
yeah I dont think its supposed to have comma either
I'll take it into account
so in pz does the y angle become like a negative value after crossing the center axis or something
in terms of like vehicles
What is like the least amount of time it would take to make a mode ?
like two minutes. unless you want a good thumbnail, then depending on your skills 10 minutes or more
so close yet so far lol
Wym that looks good bruv
watch till the end though, like when the actual vehicle break the 180 degree mark it like flip flops
Ah
yeah Idk why
Wish I could help but I ain't no coding genius
me neither I'm just jamming random stuff in till it works lol
No no you probably have basic knowledge I have no knowledge about coding I mean I'm currently taking a classes for it but I'm failing lol
I just know like really basic stuff
Exactly
I think I just need to do like this but have an else to do the other way
angle = angle -180
end```
From one peasent to what currently feels like a lord when you are done with that do you want to make the smallest mod ever for me
plz
whats the mod?
Very basic just something that makes it so the only people that see the circled part are the nurse/ Doctor occupations
Basically, so it's dangerous to change bandages alone.
man idk nothing about player UI stuff I just been messing with vehicle stuff
Ahhhhh ok well thx anyways
If I ever figure this out I can look into it, is there a player UI lua for it I assume?
Honestly bruv idk anything about notin
If there is a similar mod that edits player UI you can reference it and see what files need to be edited
ahh yes perfect
I'll look more but I know the inventory tetris changes looks of inventory ui
yeah man sorry I'm just not sure how to go about doing it I'd have to look at like a reference or something
If I had my game decompiled maybe
Ight
UI ..Tell me please how to set the default selection in a comboBox to the first element? It really confuses me that I have to click every time to select
How do you calculate the angle
it looks like you're using the vehicle's model direction
yeah and then the current bearing is a globabal variable thats calculated in another function and thats a value between 1 and 360 so I'm subtracting that from the vehicle angle
which gives me the right angle in most directions except when the vehicle turns 180 then it breaks it
so these are the two functions
local playerObj = getPlayer()
local vehicle = playerObj:getVehicle()
if vehicle and string.find(vehicle:getScriptName(), "TigerII") then
local angle = vehicle:getAngleY()
-- Calculate the direction vector based on the turret's rotation and current bearing
local deltt = {}
deltt[1] = math.sin(math.rad(angle + currentBearing))
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle + currentBearing))
else
deltt[2] = math.cos(math.rad(angle + currentBearing))
end
-- Get the initial coordinates for spawning smoke
local xxx = vehicle:getX()
local yyy = vehicle:getY()
-- Variable for breaking out of the loop
local isbreak = 3```
for i = 3, 20 do
xxx = math.ceil(xxx + i * deltt[1])
yyy = math.ceil(yyy + i * deltt[2])
-- Loop through a grid of squares around the calculated coordinates
for xx = -1, 1 do
if isbreak <= 0 then
break
end
for yy = -1, 1 do
if isbreak <= 0 then
break
end
-- Get the grid square at the calculated coordinates
local zsquare = getCell():getGridSquare(xxx + xx, yyy + yy, 0)
if zsquare then
-- Check if there's a zombie in the grid square and kill it
local zombie = zsquare:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1
end
-- Spawn smoke at the grid square
IsoFireManager.StartSmoke(getCell(), zsquare, true, 200, 1000)
end
end
end
end
end
end```
and then
local modData = player:getModData()
if vehicle ~= nil and vehicle:getSeat(player) == 0 then
if isMouseButtonDown(1) then
modData.TigerIIAim = true
modData.TigerIIAimVehicleId = vehicle:getId()
goalBearing = pMod(math.floor(playerDirection(player:getDirectionAngle()) -
vehicleDirection(vehicle:getAngleX(), vehicle:getAngleY(),
vehicle:getAngleZ()) + 0.1), 360)
goalBearing = math.floor(goalBearing / 1) * 1
else
goalBearing = 0
end
if RotatoTick <= 0 then
RotatoTick = getAverageFPS() / 50
else
RotatoTick = RotatoTick - 1
return
end
if goalBearing > currentBearing then
TurretRotating = true
locked = false
if goalBearing - currentBearing <= 180 then
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing + 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing + 1, 360)
else
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing - 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing - 1, 360)
```
-- Check if the looping sound is not already playing
if not vehicle:getEmitter():isPlaying("TurretRotate") then
-- Start the looping sound
vehicle:getEmitter():playSound("TurretStart", false)
vehicle:getEmitter():playSound("TurretRotate", true) -- 'true' for looping
end
ISTigerAimTime = ISTigerAimTime + 1
if ISTigerAimTime >= 1 then
ISTigerAimTime = 1
end
elseif goalBearing < currentBearing then
locked = false
TurretRotating = true
if currentBearing - goalBearing <= 180 then
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing - 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
```
else
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing + 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing + 1, 360)
end
-- Check if the looping sound is not already playing
if not vehicle:getEmitter():isPlaying("TurretRotate") then
-- Start the looping sound
vehicle:getEmitter():playSound("TurretStart", false) -- 'true' for looping
vehicle:getEmitter():playSound("TurretRotate", true)
end
ISTigerAimTime = ISTigerAimTime + 1
if ISTigerAimTime >= 1 then
ISTigerAimTime = 1
end
else
TurretRotating = false
locked = true
if vehicle:getEmitter():isPlaying("TurretRotate") then
-- Stop the looping sound
vehicle:getEmitter():stopSoundByName("TurretRotate")
--vehicle:getEmitter():playSound("TurretStop", false)
end
end
end
end```
I wrote the top code to use the bottom code
My brain has done gone
mine too lol
I think your issue is,
goalBearing = pMod(math.floor(playerDirection(player:getDirectionAngle()) -
this part
because your playerDirection changes according to the vechile doing 180
and then you subrstarct the vehicle dir from it too
Give me your brain juices
Ik goal bearing is also a global variable but I though it was referring to the aimed point
but yeah I do see it does this in his ```if goalBearing > currentBearing then
TurretRotating = true
locked = false
if goalBearing - currentBearing <= 180 then
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing + 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing + 1, 360)
else
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing - 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing - 1, 360)
end```
so what would I have to put here to fix it?
TurretRotating = true
locked = false
if goalBearing - currentBearing <= 180 then
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing + 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing + 1, 360)
else
sendClientCommand("TigerIISend", "Rotate", {
newBearing = tostring(pMod(currentBearing - 1, 360)),
oldBearing = tostring(pMod(currentBearing, 360)),
vehicleId = vehicle:getId()
});
currentBearing = pMod(currentBearing - 1, 360)
end```
Why are you checking btw if the GoalBearing is higher than the Current Bearing?
and not if they aren't the same for example
but for erm fixing, I think you might want to, check how you spawn the smoke
and where
Because, when you aim it, it doesn't aim where your mouse is
its not in the current bearing etc
this was the orginal function, but I think because if its higher hes telling it to add if not than to subtract from current bearing
yeah but probably to get the closest point beacause if the pointer is all the way on the other side it will tell the turret to spin the direction that is closer
it proably is from it going from
currentBearing = pMod(currentBearing + 1, 360)
to
currentBearing = pMod(currentBearing - 1, 360)
in his function thats making it flop in mine
so I need to edit this to account for the change
local angle = vehicle:getAngleY()
-- Calculate the direction vector based on the turret's rotation and current bearing
local deltt = {}
deltt[1] = math.sin(math.rad(angle + currentBearing))
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.cos(math.rad(angle + currentBearing))
else
deltt[2] = math.cos(math.rad(angle + currentBearing))
end```
I think I dunno lol
more likely is my math part is wrong
or that when the current bearing goes from a positive to a negative value instead of adding it I need to subtract it instead
I have been trying to figure out a way to get the number of zombie kills from the player, is there a function I need to call or should I make one that runs separately?
isnt there a mod that does this already? you could look what they did
this one will probably have answers for you
you can try this: player:getZombieKills()
thats what I found is used in the mod listed above, was just asking too see if there was something else reccomended to use. but as of now thats what I am using.
getZombieKills() is also the "official" command for that which is used by the vanilla code. Not sure if there is a better alternative...
thank you!
perfect, that's what i'd prefer from a user perspective. keep up the good work!
Hey guys, do anyone know where can I find the layout for the zpop_xx_xx.bin file?
I wanna be able to see how many Zeds are still around in a given playthrough and think this may be the way to do it.
thanks, I'll try ๐
I am an idiot, but I am a determined idiot lol
this is what I ended up doing if curious
local playerObj = getPlayer()
local vehicle = playerObj:getVehicle()
if not vehicle or not string.find(vehicle:getScriptName(), "TigerII") then
return -- Exiting if player is not in a Tiger II or not in a vehicle
end
local angledet = -currentBearing
local deltt = {}
local angleY = vehicle:getAngleY()
deltt[2] = -math.sin(math.rad(90 - angleY))
else
deltt[2] = math.sin(math.rad(90 - angleY))
end
-- Calculate deltt[1] based on the condition
if deltt[2] < 0 then
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.sin(math.rad(90 - angleY - angledet))
else
deltt[2] = math.sin(math.rad(90 - angleY - angledet))
end
deltt[1] = math.cos(math.rad(90 - angleY - angledet))
else
if math.abs(vehicle:getAngleZ()) > 90 then
deltt[2] = -math.sin(math.rad(90 - angleY + angledet))
else
deltt[2] = math.sin(math.rad(90 - angleY + angledet))
end
deltt[1] = math.cos(math.rad(90 - angleY + angledet))
end
-- Get the initial coordinates for spawning smoke
local xxx = vehicle:getX()
local yyy = vehicle:getY()
-- Variable for breaking out of the loop
local isbreak = 3
for i = 3, 20 do
xxx = math.ceil(xxx + i * deltt[1])
yyy = math.ceil(yyy + i * deltt[2])
-- Loop through a grid of squares around the calculated coordinates
for xx = -1, 1 do
if isbreak <= 0 then
break
end
for yy = -1, 1 do
if isbreak <= 0 then
break
end
-- Get the grid square at the calculated coordinates
local zsquare = getCell():getGridSquare(xxx + xx, yyy + yy, 0)
if zsquare then
-- Check if there's a zombie in the grid square and kill it
local zombie = zsquare:getZombie()
if zombie then
zombie:Kill(playerObj)
isbreak = isbreak - 1
end
-- Spawn smoke at the grid square
IsoFireManager.StartSmoke(getCell(), zsquare, true, 200, 1000)
end
end
end
end
end```
I just jammed stuff in till it worked lol
I am currently removing a floor tile and replacing it with another floor tile. The removing works immediately. but the adding half works: the Iso object + sprite is on the tile (seen through Chunk Debugger), but invisible (black tile when there is no other IsoObject on the tile) If I move far enough away and come back or quit and continue, the tile loading system shows the new tile's sprite as I initially expected. ```lua
currentSquare:RemoveTileObject(toRemoveIsoObject)
local newObj = IsoObject.new(currentSquare, "myvalidspritename", 'myobjectname')
currentSquare:disableErosion()
currentSquare:transmitAddObjectToSquare(newObj, 0)
newObj:transmitUpdatedSprite()
Reason: Bad word usage
Reason: Bad word usage
Hy @mellow frigate, you are the author of the Auto Loot mod right?
I am the guy who was asking about the possibility of reaching farther the other day.
Maybe you can help me here, I am trying to find a way to count how many zombies still exist on the map in a given playthrough, and think that the answer may lie on the zpop_xx_xx.bin files.
Do you happen to know where can I find a description of their layout and usage?
@bronze yoke @bright fog Mission completed fairly easily thanks to DOME.
Can a recipe give more than 1 item?
i.e. I want to seperate 1 item into 2
Say...... How do I make an object edible?
Been having issues with making nails edible, it's an inside joke and was wanting to make it possible for us.
Have you set it as a Food item?
As the type? I should yes, I will double check
Yea, i think that does it... if not... im all outta ideas ๐
anything I am missing? or that could cause an issue?
@robust locust and @vital karma maybe you guys would know where can I find the layout for the zpop_xx_xx.bin file?
I wanna be able to see how many Zeds are still around in a given playthrough and think this may be the way to do it.
idk. have you checked the game files? I have no clue
Do you mean, decode the java source?
anyone know where to find the lua code for the generator?
In the bin file you mean?
yes
No, it is not there, just binary stuff and some codes about dresses and types of zombies
Sorry, I dont. Im super new to modding, so not much idea where anything is ๐
no, but let me know if you do as i was looking for that too
Thanks guys, I am a newbie myself, just trying to find my way
will do. imma give it another look rq
from my understanding there is no "zombies left" as I know zombies in buildings are not spawned until you look in the building.
quantum zombies 
then that is your answer for the files layout. nothing much too it
sorry was running somewhere on my play through
I've killed all zombies in the streets in my current playthrough, but I know for a fact that there are plenty of zombies still in the woods.
I would like to create some mod that coould count them.
then I would recommend looking into how zombie spawns work and starting from there. might be able to find your answer there.
Thanks to help from folks in this server and others, Propane Generators Version 2.0 is live with custom items, sprites, and icons! https://steamcommunity.com/sharedfiles/filedetails/?id=3167672659
found these two files, but they dont appear to contain the actual lua workings of the generator.
"C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\client\TimedActions\ISActivateGenerator.lua"
"C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\server\Map\MapObjects\MOGenerator.lua"
it's a sneaky little bugger
this looks great... i'll deffo add that to my playthrough
if i use local recipe = getScriptManager():getRecipe(item) will that get me a recipe object or an array of all the recipe objects that match?
That's actually genius even its a bit unrealistic
Subbed and favorited
Hi mates
Mb somebody could help me explaining how to make modpack?
Thanks
At least
If i make modpack
Will it stop mods from updating on server and client?
Is there a gitflow pipeline for zomboid mods?
Now that's interesting
Hi, I do not know. I do not look at binaries directly. But all Zombies are not alive at all time. I guess random will come in your way and it is not possible to get more than an estimation like those given by Zombie Heat maps.
should return a recipe object. you can check that here https://zomboid-javadoc.com/41.78/
Javadoc Project Zomboid Modding API package index
Hey guys! When I want to add tiles, I have to add the "tiledef=nameofmytiledef randomnumber" line into mod info - my question is, where do I find the random number? Do I just pick one? Unfortunately all guides and videos about this I found dont mention this / are outdated
If i make modpack
Will it stop mods from updating on server and client?
Yes, if you make your mod pack as a separate mod, they will never update when the creators of the original mods update them in the steam workshop (this applies to server as well as to client).
Is there a way to get the grid square a player is facing at?
How can I make a mod
How do I get everything to work right and so that I could test it
set up the folderstructure with your contents in user/zomboid/mods, then you can test it ingame
It'll auto load it and then I can just go into a world and shite
when you put everything in the right folder, you can activate it ingame as any other mod and test it
set -debug in PZs steam starter options
then you have debug mode, with all cheats
and an item search menu, and basically everything you could ever need
Ok that's cewl
So adding a text file to the game through that structure will automatically load and be used or? Like how do I get it to recognize it as code for the game
it is highly depending on what you want to do, but yes, when you add a textfile with the right contents to the right place in your mods folder structure, you can make something happen in your mod
so do i create a new folder in the mods folder or no?
Yes, your mods folder goes there. there should also be an examplemod already present, you can copy the mod.info file from there and modify it to your liking (this names your mod and more)
like this
yes, one folder per mod. so you "mymods" folder should contain the mod.info file, a poster.png (not mandatory) and the media folder, where all your stuff goes into
media folder?
yes, a folder, called "media". best to look at other mods how they have done it. your mod basically copies vanillas folderstructure, beginning with "media" (the main folder of the game with almost everything in it)
so i need to create a new folder in "MyFirstMod" called "media"?
yes
what do i need to put in that folder?
depends on what you want to do. Add an item? Put a scripts folder in your media folder with a textfile called "items_whateverbutspecifictoyourmod" as name and your item desription in it
as example
textures go somewhere else, as well as code, texturepacks, clothing items, etc. Look at the vanilla folder structure or at mods that do something similar you want to do, to learn how they made it
Is enough for most mods, yes. Some mods, like tilepacks, would need additional entries
whats a tilepack?
stuff like furniture, floor textures, wallstyles.... all the 2D stuff
alright ๐
how can i find the info from other mods so that i can look at it
is there a way to disable a key press if certain conditions are met. Like if I want to prevent the E key from exiting vehicle if the player is aiming with the tank
because I get a overflow if the player exits while aiming
steam/steamapps/workshop/content/108600/MODID-you get from workshop
maybe isExitBlocked?
Hello ! I'd like to work on a mod about Wooden Crate. It's ok for the .fbx but I can't find where's the script or files in PZ directory to work on ! Help ? ๐
i dont think i understand how to read code to understand and replicate it myself
you dont have to understand code ๐ for a lot of stuff just understanding the folder structure and what goes where is enough
i meant to add an item or the scripts or anything like that
it really is pretty simple - as said, as long as the files go to the right folders and you used the right format (via copy paste - edit) there is already a lot you can do
maybe but i cant find a mod simillar to what i want to do because their all numbers
the numbers (i guess you mean workshop ID) are on each mods workshop page. So you want to look at the files of mod XYZ? Go to mod XYZs workshop page, look at the bottom of the description, and look for the folder named after the steam ID in the 108600 folder I mentioned earlier
oh
Next update we read in Mod Options if they exist and write them to our own file... Mod Options will no longer be a dependency of TMJ. We're handling our own options using our DOME now.
I reimplemented everything it did for us but better using DOME (better in that we now have more control and our own options page with less dependency on other mods)
You should not modpack without permission and you should change all mod ids in your modpack to avoid causing bugs for all your users or getting your mod taken down drom Steam for code stealing violations
If you modpack badly and without permission, modders can and in my opinion should have that modpack pulled from steam. And before you try hiding a badly made modpack that reuses original mod ids, know that we will find out about it through mod support even if it's hidden or private because it will cause bugs for people who will show up there for help.
Changing all the ids and references in mod.info and the mods' files will reduce chances of you causing bugs for people, but you can still get pulled down for reposting code that isn't yours without permission.
Does anyone knows how to check whether a square contains obstacles for player movement? I.e. solid, insuperable obstacles like cars or tables but also obstacles which only slow the player down like hedges or trees.
maybe here it better to add my question so i can continue trying
if i want a recipe to have 2 different results how i write it? for example result is a 200$ coin and a 50$ coin
Result:200$,50, or Result:200$/50$? or something else?
i dont want to create a 250$ bill also as a new item (which i guess i can but i dont want )
There are several functions.
https://zomboid-javadoc.com/41.78/zombie/iso/IsoGridSquare.html#isSomethingTo(zombie.iso.IsoGridSquare)
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoGridSquare
@small topaz
I think you'll have to use isSomethingTo as trigger to figure out what
thanks! I'll check those functions out.
anyone use setLocked() or getDoor() ?
cant any1 help me?
Recipes can only produce items of one type. For example, to get 20 nails, you can add
Result:Nails=20,
to your recipe script.txt. Recipes cannot return items of different types. If you want to achieve this, you have to make a Recipe.OnCreate function in your mod's lua/server folder and use this function to add the additional items to the player's inventory. To see an example how this works, you can check the vanilla recipe "Open Box of Jars". It has a function Recipe.OnCreate.OpenBoxOfJars attached to it. This function can be found in vanilla lua/server/recipecode.lua and it adds additional items to the player inventory.
@small topazty so much
so it will be easier for an amateur like me to make it return money=250 i guess
ty
yes, if you want to avoid lua coding, this will be easier
ty
oh boy, how does getAllRecipesFor work? what i am trying to do is go through the list of all recipes and affect certain ones based on if it matches a recipe enumerated in the sandbox vars. the way I used to do it was with local recipe = getScriptManager():getRecipe(item) but i realized that it would only grab the first recipe with a given name from a given module, when what i want is each matching recipe (in the event more than one has the same name and module name)
I don't know what the getAllRecipesFor exactly does. However, the result will be an array list which you can access and modify via lua code
looking like that gets all the recipes with a particular result? not what i wanted. would the best way to find all instances of a given recipe to just iterate over all the recipes? also is there a way from a recipe object to get what module it is from when not using local recipe = getScriptManager():getRecipe(item) (that took the module name and the recipe name)
๐
don't know anything about those things. sorry here
okay, thanks for the help anyway
the blocking movement is handled by TchernoLib through ```lua
MovePlayer.isBlockedTo(fromSquare,toSquare)
Hiya... I'm trying to write a function that always gives me back an item...
but it's pulling an error in game... could someone please point out how I'm being an idiot?
Whats the error?
Made a new anomaly today, kinda fun ๐คฃ
when the save loads, the "break on error" screen pops up and shows that code. I cant tell what the error is saying exactly
looks really kool!
ideally, I'd like my DisconnectGuitar function to check what guitar ive clicked on (if I have more than one type for example) and return that item...
but I dont know how to do that
Get the stack trace from the console.txt
Just ctrl + f stack and send the error, it will tell you the line it throws and the error ๐
im not sure where that file is... will have a look
your local zomboid folder, same place you'd go to upload your mods
Hello. I have a question. I would like to design a mod that not only was a profession but changed the way the Character looked. Like a 1-Armed man, or 1-legged woman. The idea being you get a large number of bonus traits along with draw backs. What tool can I down load that would let me design characters and their animations?
probably blender
Blender is the goto for MODIng? I see a map modding tool in steam for PZ. Nothing for character development.
for 3d models and animation... it think so, but im new.
for 2d stuff - either photshop or gimp... again, i think ๐
My guess is that Recipe is returning null, I haven't really messed much with recipe script calls but I'm pretty sure you need
require "recipecode"
require('NPCs/MainCreationMethods')
and to be on the safe side
Recipe = Recipe or {}
Recipe.OnCreate = Recipe.OnCreate or {}
at the top of your script @robust locust
Try Recipe.OnCreate instead of Recipe.onCreate
thanks i'll try that
thanks, i'll try that too
In your function you have the latter
^ Good spot
i'll that change first, as it's a quick one, then 1ndie's
so many i things need to fix 
this still appeared on start up
i think i also have a texture problem somewhere
the recipe worked, but the function didn't
I wish they made an easier way to get more than 1 thing back from a recipe...
gonna try this now
requiring vanilla files doesn't do anything at all
if you try to Recipe = Recipe or {} here, it won't work because the vanilla file doesn't do that, it'll just overwrite the table you created - you can guarantee you load after the vanilla file by just putting it in the server folder, which they have done
click Errors to see what the error actually is
in the screenshot OnCreate is still not capitalised, which would throw an error
vscode doesn't know about zomboid stuff so it doesn't know where Recipe is coming from
if you install umbrella it should go away
but it won't affect how your code actually runs
i tried installing it but the lua open library doesnt work
you don't need to do all that stuff anymore, i put it on the addon manager
i ran the game and it crashed on load
instructions here
it keeps showing this when i click it
weird as hell, never seen anything like that
that's not good ๐ซ
i can't see why your function wouldn't work, it looks like a perfectly valid oncreate function - at the very least it has absolutely no reason to crash the game
i took the lua file out and the game ran, but with it in... it crashes. Something in there is killing it ๐ฆ
do I need to import Base?
nah
at least not inherently, if your recipe uses base items you might need to unless you reference them by full type
For a new item, all the attributes is a list and that's how we make new weapons or whatever?
Did you copy-paste anything into that file? Sometimes you'll end up copying invisible characters that way that can really bork a file
E.g. event handler templates
I've copy-pasted those before and gotten bad results
no, i typed it out whilst watching dried-meat tutorial on YT
Did you post the file that prevents game from starting somewhere here?
Letting people read the whole file might be necessary
Also did you check console.txt after crash?
Sometimes an error makes it there right before crash
i posted the only code in there...
But gotta check before you reload game
no I didnt check console file... had to restart as it boinked my entire pc
Whaaa
yea, the icons in the taskbar wouldnt go, and shit wasnt closing all of a sudden
I removed the code file and reloaded the game, and all worked again
Sure doesn't sound like anything I've ever heard of PZ doing
as far as i can tell, it's only a simple function that i wrote 
Did you try reinserting code file after restarting?
To confirm it causes that outcome?
And not a coincidence?
I had it in there and it crashed... removed it and it was fine... added it back in and it crashed... restarted pc and removed the file and all was good again
does the line in recipe script that calls that function have to be there, or will that cause a problem?
Without it no function gets called afaik
Is there a way to debug player mod data the way globalmoddata works? I am tired of console logging ๐ฅต๐ฅต
Debug how
See the values for each key of each mod
im looking forward to the debugger they showed off on the latest update
Mmm... Not sure how easily. I have a function for quickly grabbing all keys but not values
You could definitely write a loop
Can I add a button to the debug "dev" tab? Or is that a private api
Never tried but if I wanted to I would use visible words to find translation variables, and use those variables to try to find a Lua file for the debug window UI
Idk what file it is or whether it's even Lua
yes I implemented it with TchernoLib https://steamcommunity.com/sharedfiles/filedetails/?id=2986578314.
See 3rd point of UI in description
\ProjectZomboid\media\lua\client\DebugUIs\LuaThreadWindow.lua
and
\ProjectZomboid\media\lua\client\DebugUIs\LuaDebugger.lua
May be that file
Idk
you just need any generic table dumping function, nothing special about mod data
(I think he's so tired of typing into console he wants to make a button if I'm not misunderstanding?)
You could probably decorate one of these to add a button but I think it's easier to just use the debug console than make a whole UI for what you want... @final raptor
Where did you save this file
the debugger screenshot shows server/HGWHRecipeCodes.lua
Oh
Hmm
@final raptor
BS = {}
BS.maxSafeDepth = 7
BS.reveal = function(someTable, verbose, depth, prefix, found)
if not (someTable and type(someTable) == "table") then return "" end
found = found or {}
if found[someTable] then return "" else found[someTable] = true end
prefix = prefix or ""
depth = depth or BS.maxSafeDepth
if depth > BS.maxSafeDepth then depth = BS.maxSafeDepth elseif depth < 0 then return "" end
local result = ""
for key, value in pairs(someTable) do
result = result .. "\n" .. prefix .. tostring(key)
if verbose then
local subresult = BS.reveal(value, verbose, depth - 1, prefix .. "--", found)
if subresult then result = result .. subresult end
end
end
if prefix == "" then
Clipboard.setClipboard(result)
print(result)
end
return result
end
@final raptor I use this to dump keys to my clipboard to read them in an editor. You could easily edit result line to include tostring(value) and see what's up.
Then just call BS.reveal(getPlayer():getModData()) from debug console and paste results to somewhere worthy of reading them.
I saved in lua/server
Yeah tmk that's where you need to be... I dunno that's odd. I would crash it one more time and send us the console.txt
Might have to let your computer crash, too, but console.txt should be there when you restart
ok, i'll give her a quick hug and tell her it's gonna be ok before i do ๐
yes, with autorefresh as on option (CPUheavy). automatically available with TchernoLib https://steamcommunity.com/sharedfiles/filedetails/?id=2986578314
Savagery
it was required because vanilla refresh moves back the scrolling to the top and it was anoying
Bahahaha
can it collapse/fold tables?
On a serious note, Tchernobill, can you stop releasing so many cool mods that I feel absolutely compelled to provide gamepad support?
Haha I just spotted Roll; killin me over here man.
lol I have to have that.
It worked!!! ๐
My game didn't crash and it gave me back what I wanted!!
lol!
I didn't think anything sounded wrong...
I didnt do anything differently.... put the file back and it loaded... then I added the line in the reciped, loaded and it worked!
I swear computers are already sentient and they're messing with my head ๐ ๐ซ
I mean it would make sense if their first instinct upon becoming sentient is to troll people
thanks all the same, much appreciated!
No, but great idea !
lol receives thanks for saying "try running it"
if they're learning from the internet, they know to troll and take feet pics...
Thank you chernolib!!
I know this is probably obv but I'm very new to lua, and I don't understand why this isn't working.
I looked for an example in the files and found ISFastTeleportMove that looks the same, but when i press the g key it does not log anything to the console
input.lua -
OnKeyPress = {}
OnKeyPress.log = function()
print("G IS PRESSED")
end
OnKeyPress.OnKeyStartPressed = function(key)
local player = getPlayer()
if player ~= nil then
if key == 71 then
OnKeyPress.log()
end
end
end
Events.OnKeyStartPressed.Add(OnKeyPress.OnKeyStartPressed)
I do have it in the ModName/media/lua/shared folder if that is important as well
I would be careful about highly generic root level names for files (e.g., input.lua) and common names for global modules (OnKeyPress), because it'll increase risk of conflict with other mods. Assuming nothing in vanilla or another mod has prevented your file from being read properly, I would verify it exists in the game at all by firing print(OnKeyPress and OnKeyPress.OnKeyStartPressed) in the debug console.
If it exists I would try logging every key instead of just logging G to make sure the key event even fires
When looking in it, it does show a "classstack 55" for the ISFastTeleportMove, but not one for the newly created one. On the right it shows all the lua files and input thankfully is the only one named input, and does show up there
If that helps
It's also possible you need key signals in client. I'm not on PC right now so I cannot confirm, but if the process depends on files that are loaded in client, you could be attempting to use it before it's ready.
Oh i thought shared was just client and server
shared means that it loads on client and server, yes, but it does not eliminate the importance of load order.
Since both client and server use shared, it logically loads first.
If you try doing things in shared as soon as a file loads that depend on things found in client, they won't work, because client hasn't loaded yet.
client loads after shared
But if i put it in client will it still be able to print to the console?
Yes, the console to which you print is the client console.
The debug console in game shows clientside messages
Not serverside ones.
So i tried it and got
closure 0x2071871637
I see
Then the function does exist.
I would try removing 71 condition
Or perhaps putting key command in client; unsure
Just a guess
The code doesn't look wrong but I could be overlooking something
Half busy sorta
Watching stuff with friend online
Ah thats fair, I appreciate any and all help, I couldn't find anything about simple stuff like this online
It exists but you really gotta dig and ask the perfect questions like you're in I, Robot
That's a good reminder link to visit
For this detail
Ah, it was the 71
Keyboard.getKeyName(key) iirc
Or just use if key == Keyboard.KEY_G maybe
It's been awhile since I mapped keys
Javadoc Project Zomboid Modding API declaration: package: org.lwjglx.input, class: Keyboard
Keyboard is exposed you can def use it globally
Are Global variables able to passed through to other Lua files? Like let's say I wanted to make a file that only updates and declares variables. Is that able to be used by other files?
Yes but it's better practice to use a local module and return it.
In DirectoryName/NomOptions.lua:
local NomOptions = {}
NomOptions.one = true
NomOptions.foo = "bar"
return NomOptions
And that's the same with functions right?
Yes
In DirectoryName/ThingThatNeedsOptions.lua:
local NomOptions = require("DirectoryName/NomOptions")
-- Can now call NomOptions.whatever.
-- Adding to it will be registered in every file that references NomOptions.
Changed Package to Directory above to be clearer
โ๏ธ
thank you!

