#mod_development
1 messages ยท Page 171 of 1
Can't find any doge models, closest you're gonna get is finding a dog to your liking in Anthro Survivors or Xochi's customs
I haven't specifically looked at any plushes, but if you're really wanting it, you could probably commission Xochi for relatively cheap to have a doge model made for you
i know there are people here that like modelling plushies so I'm sure they'd be happy to help too
Sure...
which folder is this file in?
if it's not in server, you're referencing it before it's created
Youโd need to require that file probably
requiring vanilla files doesn't do anything
you need to put it in server, or delay your code until after the server folder loads
looks correct to me
closetshelfgeneric should those small 2 tiles rooms
I set crate tools to 100 lets see if it spawns
I moved the reference to the old function and now it's not throwing an error...??

PZ is magic
should be .lua
how do I make it lua?
just rename it from .txt to .lua
okay thanks
the specific name isn't important but it should ideally be unique to your mod (if another mod has a file with the same name only one will load)
pro
your are a pro
modding is kinda of fun
I'm getting the hang of it
I got a error 1 when loading up the game
what do I do about that
ohh i didn't notice, in your file you always write ProcerduralDistributions, should be ProceduralDistributions
what
it's just a typo
oh thanks
I don't usually do this, but this was a fun little mod to make so
Hive Mind
All zombies are connected. If one of them sees you, they all do. Can you overcome this challenge?
Mod idea by Cardholder.
https://steamcommunity.com/sharedfiles/filedetails/?id=2990755215
it seems to not spawn in still no items
tlou
(tv show ver)
Yea hahah
I'm thinking its more of the ai is connected in a way if one reacts they all do
i know that
im talking abou the code side
oh lol
If a zombie spots you, the server creates a noise for the whole cell once
Every 3 minutes
smart
thats what i figured
I didn't want it like that tbf
Wanted to specifically target the player
But couldn't work it out, no matter what functions I used, zombies just don't go for it even with the player as a target. Only the one that spotted you.
couldnt you make noises be pinged off the player every like few seconds?
does this need to have spaces or?
So then I look at the last stand scenario that's pretty similar and I see it's like.... add a sound all the time lol
also is the art ai generated?
last part
it looks verry ai
Yup yup
I could, but I wanted it to be survivable lmao
This adds some interesting mechanics
correct me if im wrong dont you need base.RedHandledMachete?
let me try it
my friend showed me his dist code
You could for once let a zombie see you, they will all come towards you, then bolt and once it breaks line of sight you just lured like 1000 zombies to a specific location
Could be used to get them away from a location, lure them to a killing zone, or even to mess with other players
oh okay
i dont know if it works
I'll try it
how long did it take you to become a good mod creator
What's that supposed to mean
yea and maybe to get all these cool modding stuff
braven when did you make your first mod?
istg seeing one of your mods when i started
playing
I have been professionally programing since 2018. I'd say I am somewhat experienced. So I got PZ in I think... late 2021? Something like that. I can check later.
oh wow okay
So I instantly love this game cause I love zombies
But then I realize..... where's the BICYCLES?!
yeah i prolly did
i started in late 2021
IT WAS THE BICYCLES MOD
So I look up and no bike mod. The hell? We have Britas and a lot of epic complex mods
and not a single bike
do you still watch tutorials?
true
Never watched a LUA tutorial, or PZ modding tutorials
I learned by myself
I like it that way. Lots of banging your head against the wall, but you pick things up fast.
nice
the tutorials are outdated too
Yeah most of it barely touches real modding too
There was a supreme lack of proper guidance when I started. Still hard today ngl.
ik man
i never watched a modeling tut either
Every modder knows a good deal about something, so if you ask around you can thankfully get some help
too boring
Albion and Konijima helped me a lot with getting the hang of server stuff
Is there a guide somewhere on how to make professions and how to give them attributes (foraging search bonuses, traits, etc.)?
Most modders are very nice ppl
i couldnt find one
So basically as soon as I released the bike mod, inexperienced as I was, I got a lot of attention, and then I kept going
still not spawning in
is the main source of clicks the poster?
I remember I had absolutely no idea about how modding worked, so I just paste my mod folder in the workshop template mod, and after I release a Russian guy writes "You're not supposed to ship the template" and i'm like "...Oh."
ship the template?
I uploaded the template folder by accident with it cause I didn't know how the folder structure worked
release it to the workshop

oh lol
Hello there, is there something to hook on to know on a client, when the OnlinePlayers list was modified ?
hm. @bronze yoke you mentioned a while ago that you test your mods in MP with two seperate PZ clients. I have two up and I can't join my localhost since my steam username is already being used on it
yeah, you need to be in -nosteam mode
this is the way
See what I'm talking about? I'd take 3 and a half ages to figure this out
Thank the lord for other modders 
https://www.lua.org/pil/contents.html I think this is better than banging your head.
what could I be doing wrong here
The only thing I know how to do is add are traits , xp boosts and recipes but can't find info on how to do these other bonuses like the foraging stuff or park ranger's being faster in woods
To each their own
Programming is art
or
is this the way you normally connect?
it could be because your not actually doing the correct item name
thats the item name
that's what I was asking lol thanks again
think so, yeah, haven't really had to test with that kind of method in a long time
in facts the OnMiniScoreboardUpdate event is very close to informing on other players connection / disconnection ๐
the time has come... to release my very first mod
one sec
you changed all the shit like the pic?
pic?
do you want my steam for crds?
yes
like the from pic
use the one from template
Good afternoon everyone, I have a quick question
I created a new cleaner for my mod. How do I add the function so he can clean the blood?
I created it with the intention of being a more durable "bleach"
I did
I literally put my image on top of that one same size
Why does the modding have to be so broke man
I can't with this it's not even working I read a forum post and it still does not work
he means copy the image
the entire mod folder i meant
okay dms
yup
I have created a firearm mod, everything works fine except my character reloads it upside down. Does anyone know how to fix that?
tell them not to reload it upside down
i have no clue
Thanks bud
np
hi, when I use sendClientCommand on first few OnUpdatePlayer calls of a client, the client command is not sent. any idea what I should look for to do things correctly ? Do I need to wait for a valid square or something ?
That's good to not be alone bothered with that. Thanx for the tip
i've published the sandbox options guide i mentioned last night: https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/SandboxOptions.md
i think it could be a little bit clearer but it's good enough to release
Got another mod release from bro, feedback is welcome!
With Point Blank, if you are close enough to a zombie and shooting a gun, the zombie will die instantly. Quality Of Life Mod For Project Zomboid
Steam Workshop Link โบ https://steamcommunity.com/sharedfiles/filedetails/?id=2990322197
My Twitch โบ https://www.twitch.tv/scott_hf
My Twitter โบ https://twitter.com/HelloFriendGame
Music By WhiteBatAu...
what does it do?
ooh
sick
mod looks cool
the video is amazing
he'll be happy to hear that!
How does the park ranger's faster movement in woods work like? Where is lua stuff related to it located? I'm wondering how to add it onto a custom occupation
Anybody know a tutorial for adding custom clothing?
Hey, I'm having an interesting typing issue
I have a headache and I don't know why
I'm trying to use an object that's returned as a IsoMovingObject but I need to convert it to a player object. I've been trying to get the modData for a player from said type and it's been returning nil
It's odd though because in the f11 console it shows as the type of IsoPlayer
Has anyone had to deal with this before?
Sounds like you are either incorrectly referencing what you are looking at or don't know what to call exactly.
it doesn't really matter what type it's returned as, i don't think that has any relevance to lua
since we don't have casting or anything
that's what I thought, but I have no idea what else this error could be
this is everything I have compiled on it
There's an API call you can use to get the type of java class
in the case of the event i just listed it as IsoMovingObject because it's always that or a subclass of that, i don't think the event actually casts anything
(and again don't think that would have any implications on lua anyway)
I use instanceof(collider, "IsoPlayer") in my code
You need to figure out how to interpret it
are you absolutely sure the player has this ATPlayerData?
yeah, one sec
That's all the times I use that to grab mod data, and this function gets triggered OnObjectCollide
ohh, is this happening in multiplayer only?
right chat this time lol how come the pen is disabled? i cant place flooring 
well i have two theories about this actually
yeah, as far as I can tell
- your moddata is created OnNewGame, so if the character was created before the mod was added it won't work
- if the event fires for a remote player, it doesn't seem like player moddata is synchronised
ah!
i was under the impression that I didn't have to sync data like that if it were moddata or in shared
๐
Nvm Iโm a dummy just had to go to tile
also:
moddata works case by case, the shared thing seems like a fundamental misunderstanding of networking though ๐
networking was... not my strong suit in school
every process has an entirely seperate lua environment, shared is just (supposed to) mean those files are loaded on clients and servers
of course in pz the server folder is also loaded on clients so the meaning of those folders is sort of weak
i hear you
So no matter where I put things I still have to worry about networking and syncage
:S
local function ATOnCharacterCollide(collider, collidee)
if instanceof(collider, "IsoPlayer") and IsoPlayer:isLocalPlayer()
```give this a try
oh i've edited the wrong function ๐ but you see the idea
that might be necessary elsewhere
it will be. I mean, i use that logic in ATOnCharacterCollide
lol
๐ค
I'm getting an inkling that if I have this run only on clients using IsoPlayer:isLocalPlayer() I can sidestep this whole syncing issue? maybe?
oh that also should've been collider:isLocalPlayer() LOL
no worries I understood lol
i wrote IsoPlayer to get autocompletion because i couldn't quite remember the name and it isn't typed but i forgot to change it back
that is my hope, yes
also sticking this here for posterity
Is there any other occupation bonus related stuff hard coded into the java code? Just wondering
there's a lot, but off the top of my head the driving traits come to mind
unfortunately as a rule for trait stuff i'd say if it affects a part of the game handled by java, it's hardcoded
Are java mods possible?
Well just curious because surely ain't gonna code a thing in java
yeah, but they aren't distributable through the workshop and generally there isn't much of a community or support for them

trying to make some IsoPlayer run
but the default pathfinding call seems to override the numerous running flags check
Someone should make a Changed themed mod
I got a function I wanna run when folks first load into their save/server. (its a function that checks if a list of items are being worn). Do you guys have any advice on what event to use?
ongamestart or oncreateplayer
hmmm okie. Yeah I was afraid of that. I tried those and got some errors
I was hoping it was a bad event use, not an issue in my code problem
thanks
There is also this way
local function init()
Events.OnTick.Remove(init)
-- do something on the first tick
end
Events.OnTick.Add(init)
But that would not trigger again if the player dies and create a new character and load back in.
So this is running the event on tick, then removing itself?
is there a situation where this might behave differently to ongamestart?
Network is not ready i believe
i don't think the network is ready on the first tick either
Actually this (might) work
its a gasmask check, i already have Events.OnClothingUpdated.Add(HS_SD_GasMaskCheck) and its working
so it already works if you change clothes
its just logging in and checking im trying to solve
oncreateplayer would be best for that
Yeah the problem I encounter is this, This is the function I call with oncreateplayer
function HS_SD_GasMaskCheck(player)
HS_GM_wornItems = player:getWornItems()
it fails on HS_GM_wornItems = player:getWornItems()
but it works fine with things like, OnClothingUpdated or OnPlayerUpdate
the first parameter passed to OnCreatePlayer is the player index
not a player object
you'd want to do something like```lua
local function onCreatePlayer(_index, player)
HS_SD_GasMaskCheck(player)
end
Events.OnCreatePlayer.Add(onCreatePlayer)
I see. I just started seriously diving into pz modding a few days ago, so I appreciate the patience
thank you, ill give this a shot
It did work. Thanks a bunch
Does setVariable not work with ints, floats, etc?
it works with strings, bools and floats
kahlua should be happy to interpret it as a float
playerObj:SetVariable("Name", 1) gives an error
likely because it's setVariable

No way
Why does it work with a string
I can't believe I committed this mistake lmao
yeah, there's a string capitalised one - maybe a backwards compatibility thing?
This is so wrong lol
I am not getting back the hour I spent trying to figure out why it didn't work 
Thanks Albion 
I was finna ask that lol
no module
no comma on mesh line
It should be illegal not to format your script before posting it to ask for help.

I sound like an asshole about this but I swear that this will help you so much.
i'd say you should format your scripts but not for my sake
Do it for your sake
to get a percentage, should I use ZombRand(0,100) or something else ?
100%
what am I doing wrong
btw I don't know how to formate my scripts
I just need to know what I am doing wrong
Would you pass in a college paper that looks like that?
Tabbing like that?
You want something that "works". If you have that much concern when maintaining your car's engine it wouldn't run. It's not your fault though because the game's files are just as bad.
Clean code and clean text will help you more than you will know.
You bring me a jumbled mess and ask me what you're doing wrong. :/
holy moly wtf is that whitespace
Anybody know an easier way to fetch the squares around a Player without fetching every single one manually with coordinates?
As in get say a 5 tile radius
I thought you were making fun of me for some reason ๐ #mod_development message
right??? lmao
i'm assuming you're using loops already so no nothing better than that
I'm between buzzed and drunk irl so I'm simply answering questions
real
to be fair, their implementation will also be to loop from x-5 to x+5 etc etc
it's not really something we need them to add
You should stop asking TIS for it and write it in yourself.
just a util function
There's stuff we can't write
Not as well as they can
I mean it's all about learning
You can. No one is stopping you.
You're talking to the one who grandfathered in 3D model modding support.
All you have to do is try
Then by all means explain to me how I would code the function to check if a Player just made a new character, cause as far as I know it's just guess work
And guess work is lame AF
oncreatecharacter check their hours survived
Don't be afraid to mod the game.
You can create a character, leave then come back in less than an hour
I fundamentally disagree with modding everything ourselves, based on guess work and work arounds, when it's infinitely easier and more helpful if the devs code it on their side.
i agree that the onnewgame event should be fired more consistently
I wish that more people modded the game in java.
local function getSquaresInRadius(square, radius)
local squares = {}
sqX = square:getX()
sqY = square:getY()
sqZ = square:getZ()
for x = sqX-radius, sqX+radius do
for y = sqY-radius, sqY+radius do
table.insert(getSquare(x, y, sqZ))
end
end
return squares
end
```i just don't see why we need to get TIS to do this specifically for us i guess
I'll rip this game apart to get the results I want.
I'm really new to this, but I'm used to hopping into games and just learning how to mod as I go, and I'm really debating just going straight java
I have for ten years
keep in mind you'll have very little support if you go the java route
I mean I have the javadoc and class references
Eh this is fine, but as I said there's multiple stuff that sucks to do on your side
what more to need ๐
Mod for you, not what the devs want. This is what modding is, not what modding is here.
keep in mind that they are creating a game not an engine
Have fun modding. Take it as far as you want to go
The best part of modding is discovering and sharing new ways for other people to create mods
It's your world to make
I'm not disagreeing with that?
Braven, I don't think anyone has an issue with the way you are modding, like at all
if you don't feel comfortable going that deep into the source code it's 100% fine, no one is going to knock you for that (at least I won't)
I want to see modders transcend the limits and make their own visions come to life, if through modding games like PZ
Woah you guys just made this convo extremely odd. I'm outie.
lmao
It's all good
Just know that you always have a opportunity to have fun here
@red tiger you mentioned modding PZ for 10 years yeah? What were some of the biggest breakthroughs you've seen through modding? I used to be big into Black Ops 3 modding, and just seeing all the changes since I strated modding to now is just amazing, and I'm always interested in hearing how things came to be how they are now
Don't limit yourself to what people want from you.
I can't speak for the black ops community. I will say that the daring projects definitely shaped PZ. I did. I'm glad for that.
Making entire communities out of simple ideas of how to make the game better.
That's why I love to help people mod here. It's fun to see what they do with better tools. =)
I think that the best moments in the modding I did was seeing people who could never speak the same language form factions on my server because I wrote a translator chat engine that translated based on the selected language of the player.
i never heard about that one, that's crazy
I don't think that I could do something like that again
Seeing full friendships from because of translators built into the game
It's the best thing to see
See! That's what I'm talking about! What an awesome idea!
That's why I say to not limit yourself. :)
You never know just how much you can charge people for the simple ideas you have.
lmao no kidding
That's what over 20 years of modding taught me. :]
can i specify multiple items in player:getInventory():AddItems(); ?
or just one item per additems?
one per call
okay thanks
so maybe turn my delimited list from sandbox vars into an array then loop through the array and add the items one at a time?
Any zomboid animation modding video tutoral?
or skip the step of making an array, just do for item in string.gmatch(list, "[^;]+") do player:getInventory():AddItems(item); end?
okay thanks again
Hey Everyone, im new to modding, but i have a bit of experience programming. Im looking to making a simple(VERY SIMPLE) NPC mod that can be run on multiplayer or single player game modes. There seems to be very limited information about creating mods to be inclusive of multiplayer. Is there any information or caveats i should know about before diving head first into this multiplayer mod
the number one caveat is that npcs can't be rendered in multiplayer, which is why none of the existing ones support it
Okay but why ?
they use fake player objects, and multiplayer is just stricter about them
As in the game logic prevents it ?
it seems that way
Is there any specific information about how or where this is done? and if it specific to a particular function call ?
it's not something i'm specifically knowledgeable about
Okay hmm ill have to see and find where its being blocked.
and am i correct in saying the server lua is run in both single player and multiple player ?
yeah
if you're referring to the client/shared/server structure in the lua folder, don't be fooled
server is also ran by both, the only special behaviour is that client doesn't run on the server
so nearly the entire game's lua is run on both sides
is there any mechanism to tell what the code is being run on ?
yeah, there's isClient() and isServer()
eg perform one set of functions if on single player and another on multipler
both are false in singleplayer
ahh perfect
for that reason, with server-only code you generally want to check if it's *not* a client, not if it is a server, since usually you want your server-only code to run in singleplayer
i am having trouble figuring out how to use the value of a sandbox var, how do i get my local variable to grab the value of a sandbox var?
for an option defined as MyMod.MyOption you would reference it as SandboxVars.MyMod.MyOption
i feel silly now that i see the solution written out
i guess i am pretty new at this
hey, it's a big undocumented system
i appreciate the help
is there a distinction between 'Hosting' and 'Dedicated Servers' or are they just both Multiplayer
i think there is some function to check for it, but they behave basically exactly the same so i've never needed to look into it
the game usually refers to in-game hosting as co-op (but it also sometimes refers to splitscreen as co-op
)
hmm okay, yeah i saw a couple functions mention co op
is there a way to reload all lua files, or to reload lua files on change ?
you can reload individual files from the debug menu (i don't recommend doing this, it usually causes issues), or reload all lua from a button on the main menu
if the mods in your save game don't match the mods on your main menu, it'll reload lua every time you load the save automatically: i consider that the easiest way
@north drift ```lua
isCoopHost() -- return true when called from the host client. The coop server runs in background, it's like a dedicated server.
To reload a server file in a hosted server, send this command from the chat as admin `/reloadlua server/myfile.lua`
awesome thanks
reloading a server file from the F11 debug menu will not reload on the actual server.
server lua files also runs on clients.
oh, and don't expect server prints to show up on your client
if you really don't want the server lua files to run on client add this on top of the file
if not isServer() then return end
in which case will also not run in single player
yeah figuring that out now lol
now that i'm working on this again, I need to name this file something other than recipecode.lua right? it will mess up vanilla items if i name it recipecode.lua?
yes, the filename must be unique to your mod
okay good
if your mod needs many files i recommend just creating a folder so you don't need to give everything weird filenames
ya
I do my structure like this
media/lua/client/MyMod/client.lua
media/lua/server/MyMod/server.lua
media/lua/server/MyMod/recipecode.lua
media/lua/shared/MyMod/utils.lua
media/lua/shared/Translate/EN/Sandbox_EN.txt
require looks like this:
local utils = require("MyMod/utils")
is there any standardised way to do commands ?
not really
you can do as you like
I do this most of the time:
local function onServerCommand(module, command, args)
if module ~= "PlayerConnectionMessage" then return end
if command == "playerConnected" then
PlayerConnectionMessage.doConnect(args.username)
end
if command == "playerDied" then
PlayerConnectionMessage.doDeath(args.username, args.killer)
end
if command == "playerDisconnected" then
PlayerConnectionMessage.doDisconnect(args.username)
end
end
Events.OnServerCommand.Add(onServerCommand)
a lot of people like to make a table of functions keyed by the command name
i don't like that though because you have to unpack the args table in the command function, makes ugly code imo (and difficult to reuse)
well i think i borked my mod lol, my test server is hung on initializing. it feels like so straightforward of a mod too
i have a recipe recipe Choose Kit 1 { destroy Sandbag, Result:EmptySandbag, OnCreate:Recipe.OnCreate.StarterKit1Open, Sound:PutItemInBag, Time:180.0, }
and a bit of lua code function Recipe.OnCreate.StarterKit1Open(items, result, player) local list = SandboxVars.StarterKits.Kit1 for item in string.gmatch(list, "[^;]+") do player:getInventory():AddItems(item); end end anyone see the problem offhand?
ignore the fact that i'm using sand for some reason, i haven't made the item for the mod yet that will replace sandbags in this instance
I suggest you create your own global for your recipes, replace MyMod by your mod name
MyModRecipes = {}
MyModRecipes.OnCreate = {}
function MyModRecipes.OnCreate.StarterKit1Open(items, result, player)
end
errors in these files wouldn't be able to bork your server (probably)
is that the full recipe file? if it is you're missing the module
i looked at the full file, used the wrong bracket to close it lol. ] was supposed to be a }
it's always a typo 
esp this late at night
As I read that I uncovered a typo causing me issues. It literally always is a typo
bonus points if it's a comma
i don't understand what this does
Well instead of adding into the vanilla table Recipe.OnCreate. you add your functions into your own mod global table.
This way you reduce the risk of overwriting a recipe function with other mods.
ah that makes more sense to me now
i'm still just trying to get it to work right at all lol, right now i can do the recipe but the knock-on effect of Recipe.OnCreate. isn't working
whats the knock-on effect?
local list = SandboxVars.StarterKits.Kit1
for item in string.gmatch(list, "[^;]+") do
player:getInventory():AddItems(item);
end
end``` it's to read the sandbox vars for a list of items and add them to the player's inventory
Try printing some values
does that print to chat or console.txt?
console.txt
if you run the game with -debug youll see it in the console UI
@crystal oar also whats the Kit1 string value atm?
Kit1 = "Base.Sandbag;Base.Belt2",
just to see if it works
adding some prints to the code now
also AddItems require a second param with the quantity
oh well that would probably help a lot
oh that was evidently the whole problem, i needed a qty
I added the function isCmdReady() to know when sendClientCommand is valid. This is in https://steamcommunity.com/workshop/filedetails/?id=2986578314
how do you detect it?
I sendClientCommand until I got an answer
You can now play as a zombie https://steamcommunity.com/sharedfiles/filedetails/?id=2991010328
sendClientCommand is valid from the first tick
local function init()
Events.OnTick.Remove(init)
--- sendClientCommand is 100% available
end
Events.OnTick.Add(init)
you can send it for sure ๐ but the server may not receive it.
What do you mean may not receive it?
The network is ready during the first tick technically
The callback added to Events.OnClientCommand is not triggered.
It occures systematicaly when I send on the first OnPlayerUpdate occurrence.
i have not been able to send commands on the first tick either
and on the second?
dunno ๐
@mellow frigate I have question about luautils module from ur lib
why in luautils.removeFromTable r u creating new table?
it's creating new object so after it input and output tables will be different so it's not removeFromTable but createNewTableWithoutValue
in addition this function is free to break sequential table
Hello, anyone here with some experience in creating new tiles? I have an issue I am not able to rotate a new sprite in game. I have defined all the four faces (east, south, west, an north), also CustomName and GroupName. But still, once I get the item in game and try to place it, it won't allow me to rotate. I can only see the east facing direction.
Also, double check with existing/vanilla tiles definition, and everything looks correct ๐ค ๐ Am I missing some Lua magic somewhere?
Would you mind sharing the pack, tiles and mod info files?
#mod_development message
also, is this how you add the item and spawn it from debug item list?
Sure, can I DM you?
getPlayer():getInventory():AddItem('Moveables.Moveable'):ReadFromWorldSprite('furniture_seating_indoor_03_17')
--or
getPlayer():getInventory():AddItem(InventoryItemFactory.CreateItem("Moveables.solarmod_tileset_01_0"))
you could try spawning it like this ๐ค
hello everyone! Who knows where I can find a person who is willing to make a mod in pz for some money?
Guys, who know conditions for UI Offscreen Rendering, I need to check for this option
What exactly you want to do? ๐
@tame mulch for example
local X = 0
if UIOffscreen Rendering = 1 then
X = 5
else
X = 10
getCore():getOptionUIFBO() ?
yep, thanks
Good morning
getMod(id).getInfo()?
I don't know the explicit API calls.
One way would be to read the file, the other involves using ChooseGameInfo.
You don't have direct access to mod files in Lua.
Hello
We do commissions
Pls join our discord for more info
https://discord.com/channels/136501320340209664/1115602184936108062
Oh nvm saw you already joined thnx
Probably good to keep that to DMs.
of course we do
local reader = getModFileReader("uta_mod","mod.info",false)
print(reader:readLine())
Which goes to the lua cache folder in Zomboid.
Not direct files in a mod.
print(getModFileReader("uta_mod","media/lua/client/UtaUtaNoMi_SkillControls.lua",false))
I just used it in prectice so it works.
public static BufferedReader getModFileReader(String var0, String var1, boolean var2) throws IOException {
if (!var1.isEmpty() && !StringUtils.containsDoubleDot(var1) && !new File(var1).isAbsolute()) {
// getCacheDir() == "../Zomboid/Lua"
String var3 = ZomboidFileSystem.instance.getCacheDir() + File.separator + "mods" + File.separator + var1;
The individual asked about reading mod.info files.
You cannot get this from the folder that you can access but can't go outside of.
I don't know what you're reading but it shouldn't be what you're making it look to suggest.
Oh I see a clause in there for mod folder. Interesting..
All other readers forces the cache folder absolutely..
He didn't specify if he want to read all the mod info files. This would only require to know the mod ids to make it work.
Yeah ok so maybe.
I didn't say he said he wants to read all the mod files..
Okay bud.
I am not sure why are so mad, that I managed to read the file.
When you put words in other people's mouths, they typically get annoyed. Mad? Nah.
But I understand that there's a lot of kids here so why would I be mad? lol.
You did use a plural there. So please calm down and stop being demeaning.
Telling me how I feel and telling me to calm down is actually not being lovely.. I'm not going to ask you to stop. I'm simply blocking you. Good luck with your projects here. ๐
What the hell got up his ass?
he even said good morning lol
๐๐โค๏ธ๐โ
Maybe this will cheer him up?
๐
I'm not sure whether i post this here? I just made my 2nd mod so I just wanted to share it.
https://youtu.be/bnbjy8FDgCo
With Point Blank, if you are close enough to a zombie and shooting a gun, the zombie will die instantly. Quality Of Life Mod For Project Zomboid
Steam Workshop Link โบ https://steamcommunity.com/sharedfiles/filedetails/?id=2990322197
My Twitch โบ https://www.twitch.tv/scott_hf
My Twitter โบ https://twitter.com/HelloFriendGame
Music By WhiteBatAu...
somone else posted it before and i will say the mod looks good again
Hi, I did this because it was the only reliable way I found to remove an item from a table :D. What do you mean by sequential table break ? I'm interested by a full lesson if you feel like it. I'm interested by a straight improvement of the function if you feel like it.
So, I am trying to write a hook that will allow two weapons to not have muzzle flashes; which I did, and which technically worked. However, if a zombie gets close enough to trigger a shove animation, all weapons never fire again, which is definitely not something I wish to happen. Any idea of how to fix this? (Also, thank you Glytch3r for pointing me in the right direction.)
ISReloadWeaponAction.attackHookOSBB = function(character, chargeDelta, weapon)
ISTimedActionQueue.clear(character)
if character:isAttackStarted() then return; end
if instanceof(character, "IsoPlayer") and not character:isAuthorizeMeleeAction() then
return;
end
if weapon:isRanged() and not character:isDoShove() then
if ISReloadWeaponAction.canShoot(weapon) then
character:playSound(weapon:getSwingSound());
local radius = weapon:getSoundRadius();
if isClient() then -- limit sound radius in MP
radius = radius / 1.8;
end
if string.find(weapon:getWeaponSprite(), "Base.WEAPON1") then
character:addWorldSoundUnlessInvisible(radius, weapon:getSoundVolume(), false);
character:DoAttack(0);
elseif string.find(weapon:getWeaponSprite(), "Base.WEAPON2") then
character:addWorldSoundUnlessInvisible(radius, weapon:getSoundVolume(), false);
character:DoAttack(0);
else
return original(character, chargeDelta, weapon)
end
end
end
end
Events.OnGameBoot.Add(function()
Hook.Attack.Remove(ISReloadWeaponAction.attackHook);
Hook.Attack.Add(ISReloadWeaponAction.attackHookOSBB)
original_attackHook = ISReloadWeaponAction.attackHook
ISReloadWeaponAction.attackHook = ISReloadWeaponAction.attackHookOSBB
end)```
can someone tell me what's wrong if no ones tell me anything Im taking a break
The bracket on the same line as item?
Line 2?
I don't think it's supposed to be in the same line as other stuff, perhaps.
items parametr
WorldStaticModel = RedDuctTape,
but
Model RedDuctTapeBase
Yeah, was going to say it's not the same, also most likely case sensitive as well.
where do I put that?
try
{
item RedDuctTape
{
DisplayCategory = Material,
Weight = 0.3,
Type = Normal,
UseDelta = 0.25,
UseWhileEquipped = FALSE,
DisplayName = Red Duct Tape,
Icon = RedDuctTape,
Tooltip = Tooltip_FixItems,
ConsolidateOption = ContextMenu_Merge,
SurvivalGear = TRUE,
WorldStaticModel = RedDuctTapeBase, ---- HERE
}
model RedDuctTapeBase
{
mesh = WorldItems/Redducttape,
texture = WorldItems/RedDuctTapeBase,
scale = 0.01,
attachment world
{
offset = 0.0000 0.1500 0.1500,
rotate = 0.0000 0.0000 0.0000,
}
}
}```
your items use WorldStaticModel = RedDuctTape
but your model name RedDuctTapeBase
what goes here I mean
nothing, it's just link for error, all stuff after -- not readable for code
so delete it?
may or not, it's don't do some stuff with code, just for comments
what
god...
this stuff just for comments, game not see it
scale = 1 may be
u reload game or file in -debug mode with F11?
oh I never knew that thanks for telling me but I restart the game fully
like I exit out and run in again
yep, it's not update in realtime if u change files
but can be if u start game in -debug mode
for lua, not know for txt...
u should set parametr for start game -debug
I already did
and push F11 ingame
thanks and what do I do when I do that
name of your file and reload button should help you
but scripts with items - it's not lua, it's txt...
not sure, but think it's not help u xD
but for future stuff... may be
the item still does not spawn though
drop your mod in pm
dm?
personal message
okay
what is item again
Hey, quick question, which method should I use to damage an entity without instantly killing it?
An IsoGameCharacter*
the base class for character objects
It looks like the parent class for players and zombies but I might be mistaken
I'm only just digging into the javadocs, though I generally find javadocs unhelpful because people don't comment the functions you want
character:getBodyDamage():ReduceGeneralHealth(amount)
thank u
YOO
Are there any logic gate mods that are relatively popular? Something where players could define simple boolean/timed logic for gates/traps/lights/sounds?
Also are there any good references for making a vehicle drive itself?
Javadocs make me sad because they usually have no comments on the methods you actually need
i haven't looked into it but i would be surprised if self-driving cars are possible
I was aiming for an on-rails thing
i've done a lot of stuff with vehicles and it doesn't seem like it would let you do that
Ideally a rollercoaster
oh hey! I remember you in my comment section asking for a link to the PZ discord. Glad to see you here!
Are people aware of a limitation to the use of UI draw functions ? I'm having a hard time understanding why it sometimes draw and sometimes don't. This includes (but is not limited to) calls to ISUIElement:drawLine2, LuaManager.renderIsoCircle and in the end: all that uses getRenderer():render(...); e.g. getRenderer():render(nil, x-thickX, y-thickY, x+thickX, y+thickY, x2+thickX, y2+thickY, x2-thickX, y2-thickY, r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a, nil); Note: for the Iso relative functions, it also occures even when the player on the same Z level and in the same cell & chunk.
someone tell me what I'm doing wrong I rather not send anyone my whole folder
missing comma on scale = 0.6 line
okay
fixed it
anything the wouldnt make it show up in game as in its not in the spawn menu
there doesn't need to be a comma after imports { Base but i don't know if that causes issues or not
oh, it is .lua, scripts should be .txt
that isn't lua
these are a made up format zomboid uses for item, model etc definitions
okay thanks lemme try it now
@bronze yoke @tame mulch please help #mod_development message
sorry i don't have any knowledge about that
My world is upside-down 
It's called ZedScript for right now..
ZedScript?
Also UI stuff isn't well documented.. It's why I am writing 3rd-party docs to it.
The .txt files with the stuff posted above, yes.
Isn't there a zedscript plugin or something that does this work for you?
with all the syntax?
Yes. I wrote it. It's still a WIP.
can u drop all your folder mod in pm?
just for check
I guess I always get anxious I'm about someone stealing
Look up 'ZedScript' on vscode extensions.
I think people are pretty vigilant about that here. Besides, people are likely to reference your code anyway when you put it up on the workshop
I had to work on something else because I had spent 4 months of my free time learning how to make extensions, writing syntax highlighting, a full on linter and parser, etc.
yeah, your code is going to be visible to anyone who downloads your mod so no point being too secretive about it
alright
where is externsions
I've had been helped so much here, i don't really care if somebody references my code. Anything I can do to help out other modders
Do you use vscode?
okay I found it
I'm new to coding and stuff so I do I use it
okay I did it
Oh. Speaking of which, has anyone edited tooltips of items? Like, either hooking into the function that creates the tooltip or editing tooltips on game launch?
Not sure where to begin with that
Again, the extension isn't feature-complete however it should help you visually and help you with item properties for those definitions for now..
okay thank you Jab
It doesn't seem to be that much in demand so finishing that project will be later on.
local player = getPlayer();
local inventory = player:getInventory();
if player:HasTrait("DemoStrongGrip") then
if player:getPrimaryHandItem() ~= nil then
if player:getPrimaryHandItem():getType() == "Sledgehammer"
or player:getPrimaryHandItem():getType() == "Sledgehammer2"
then
local sledgehammer = player:getPrimaryHandItem();
sledgehammer:setEnduranceMod(1.0);
sledgehammer:setBaseSpeed(1.2);
sledgehammer:setCantAttackWithLowestEndurance(false);
sledgehammer:setTooltip(getText("Tooltip_demostronggripbuff"));
end
end
end
if player:HasItem("Sledgehammer") == true or player:HasItem("Sledgehammer2") == true then
local skip = false;
if player:getPrimaryHandItem() ~= null then
if player:getPrimaryHandItem():getTooltip() == getText("Tooltip_demostronggripbuff")
or player:getPrimaryHandItem():getType() == "Sledgehammer"
or player:getPrimaryHandItem():getType() == "Sledgehammer2"
then
skip = true;
end
end
if skip == false then
-- local inv = player:getInventory();
for i = 0, inventory:getItems():size() - 1 do
local item = inventory:getItems():get(i);
if item:getTooltip() == getText("Tooltip_demostronggripbuff") then
local sledgehammer = item;
sledgehammer:setEnduranceMod(4);
sledgehammer:setBaseSpeed(0.9);
sledgehammer:setCantAttackWithLowestEndurance(true);
sledgehammer:setTooltip(null);
break ;
end
end
end
end
end```
hmm... need to learn spoler do...
wait If I made a weapon and a crafting item does it need to be in the same .txt
it's can be in another txt or another mod folder or etc
alright I'll send it
for example:
Zomboid - Workshop - Your Mod Name
mod name folders can be another
all your modding stuff start here
wip
k
okay?
okay let me fix that
what about it
check from it
I'm using the mod folder not workshop
{
item macheteredhandle
{``` - imports base should be
oh, actually
recipe should be with module
you have a comment here, but -- doesn't mark comments in zedscript
delete it?
ya
but it's nothing happen if it be... nope?
can someone tell me what to do
Hello everyone. Please tell me how I can get a list of cars in a certain square in the world. I have the coordinates of the world, like:
startPos = { x = 8688, y = 7066, }
endPos = { x = 8710, y = 7052, }
what do I do
the easiest way is to loop through the vehicle list and check each vehicle's location with BaseVehicle:isIntersectingSquare(x, y, z)
vehicles 'belong' to one square but they're big so they cover many other squares that don't know about them, so you have to work backwards from the vehicles
How to get vehicle list? getCell():getVehicles() Is that enough?
Thanks!
dude the mod worked with the directory I already had I have been saying the red duct tape is the only thing that does not work
btw it still doesnt work
JUST THE RED DUCT TAPE OKAY
THE MACHETE IS STILL GOOD OKAY
he set his scale to be 0.6
instead of 0.1
never mind. it's only model, his problem with items, they cant find RedDuctTape
but i have it shrug
I bet it's loading another version of the mod instead of the one he's trying to load.
xP
?
Like a copy of the mod in another folder.
same ID.
A lot of people fall for this issue.
maybe
what do you mean
how do I fix what your saying
well if it's working in the other location
if you've worked from both the mods and workshop folders you should make sure only the one you're working on is still there
its the same mod
hes adding an item to his mod
yeah but if you've worked on the same mod in two different folders this issue happens
that's usually the cause of these 'new thing i added that works for other people and seems perfect doesn't work for me' problems
i feel this is partly my fault
probably
for not saying what it meantr
i only work in the /workshop folder
no
guys, need event stuff for trigger after apply game options
you should only have 1 folder
for the mod
drop screenshots of your folder
folder stuff plz
dude
head of full folder position
...
there's two structures for mods:
Zomboid/mods/myMod/mod.info
Zomboid/Workshop/myMod/Contents/mods/myMod/mod.info
you should only have one
btw work in the workshop folder
as it will save time transfering folders to update the mod
it's fine to work in the mods folder until your mod is ready to release
oh then that's why
this is our first update
crafting recipe
we are trying to get this to work
your nasty
are you subscribed to your mod on the workshop
yea
i dont do imports
if your module is base it doesn't need to import base
ive decieded to make this a comunity effort
but iirc this doesn't break it, it just complains in the log
what does iirc mean
if i recall correctly
oh
@bronze yoke @thin hornet @ancient grail and other modders, I just added a new request here: #1118138532314218557 message
Let me know what you think of it and if I have anything wrong! I'll be adding 1-2 more suggestions shortly about adding more variables to the IsoGameCharacter class and allowing modders to change the speed scale for some animations (or change animSets for a game character)
Sorry for the @ but I think this is a widely requested and bumped-into issue
i wouldn't expect much
If people could thumb it up or something that might also help?
i'd post something in the lua requests forum thread, not that i think that really has much of a chance either
Updated Player Connection Message
https://steamcommunity.com/sharedfiles/filedetails/?id=2823707388
whats a import and a base?
doesnt really mattter
i got sm to ask you btw
what
ilkl dm
what
I need to know
i'm probably explaining htis wrong but Base is the module that contains the base game's stuff, and importing it lets you refer to it without putting Base. before each thing you reference in it
oh
guys, need event stuff for trigger after apply game options
and for key push/holding/pushed (right mouse button or ctrl key)
hmm...
Is there a list of what each anticheat does in MP?
it's possible some cheaters would have documented it by now, but part of the idea is security through obfuscation, which is why they aren't named
so there probably isn't anything widely available for that

I... I guess I might get some people banned then lmao
I wanna use TP on multiplayer
honestly, just try it and turn off whichever anti cheat it tells you kicked you
I think it's type 12 or 13
The fact that the official anticheat is cryptic is hilarious
There was no need to but they did it anyway
I think problem with how you call this functions
hello aiteron
That's also what I though, so I played with it for several weeks. As it also occurs when called from LuaManager.renderIsoCircle, I now doubt there is a way to ensure it works (it works most of the time, not always, with the same call). Also When calling the equivalent for (above) map (and minimap) it works ALL the time.
Hard to say what problem without checking code. Maybe sometimes you check not pass and draw not started. Try debug by print near this functions and when it not start draw - check work print or not
I will
okay still its not showing in the spawn menu can't find it at all
anything I need to fix
?
so would I base on one thing and import on another
help
I get no one wants to help because its not working for me no matter what but come on
try find like base.redducttape
where would I go
if you aren't getting help it doesn't mean nobody wants to help, it means nobody knows what's wrong
or redducttape. idk but i have it in spawn menu
no I mean I cant its not in the spawn menu the cheats
the items does not spawn yet
what do you mean base.redducttape
Does player mod data not persist in MP?
What item? Also are you just trying to spawn in an item or are you writing a mod?
it persists
so I am writing a mod that adds
a machete
so I did that
I'm trying to add a custom item duct tape
red duct tape
{
imports
{
Base
}
item SKit1
{
DisplayCategory = Junk,
Weight = 3.0,
Type = Normal,
DisplayName = Starter Kit,
Icon = Briefcase,
StaticModel = Briefcase,
WorldStaticModel = Briefcase,
}
}``` so like this is how to add a really simple item that right now does nothing without more code
icfon?
okay so since you are making your item part of base you don't need to import base like i did (i think)
okay so what do I do?
Ok I found the issue wtf
So I teleported the player up, and when I load in and check they are in the Z position they were before I teleported them

what is it not doing right now? is it just not working at all?
Only in code, in-game they are on the floor I sent them to
I'll the run the game again
reeee
one sec
so the machete I added works but the tape is not
so you do like a additem playername Base.redducttape 1 and nothing happens?
k did you get an error when you loaded the save up?
no
also i see worldstaticmodel is RedDuctTapeBase and then you have a model for redducttapebase, is that the problem?
models_X is Redducttape
that was greek to me, anyone catch that?
bump
i am unsure, i only reuse vanilla assets. i'm a rookie, but i'm trying my best to grasp what would cauuse it to not show up
and something like the case of RedDuctTapeBase versus redducttapebase seems a likely culprit
like what is RedDuctTapeBase? i don't see that defined
no that is redducttapebase
WorldStaticModel should be the name of a model script
the model script's mesh should be the actual filename
yeah
the fbx?
do you see what i mean that redducttapebase does not equal RedDuctTapeBase?
ah thanks as always albion
how about now
as far as i can tell with my rookie eyes that looks right
can you show the whole thing again?
i dont think model matters for the item to spawn ingame
unless it works and the model isnt apearing
man
i think it's not getting that far, otherwise it would show up in the item list
I'm trying to make it appear in game like the item in the cheat menu
it should be a type drainable not normal, i'll keep looking
but I'm trying to make a recipe and I don't want the players to keep using the redducttape
to make the item
come again?
man
maybe seeing the recipe would help me understand?
no no
man
I don't want the player to keep using the red duct tape
so I made it a normal item
I want it to be a one time use
so then why and how does it have a usedelta?
UseDelta = 0.25
how much of a drainable is used
so delete it