#mod_development
1 messages · Page 176 of 1
I am quite curious how deep modding can go, to decide how "immersive" my mod could be.
I am thinking, when a character is mortally wounded/bitten and too infected, your hands/overall skin start to glow and you hear faint sound. You then get ability to press a button and, in a very explosive way, reset your progress (no idea how progress worls here), and become a completely new character but in same place and with same gear equipped. You might also get temporary debuffs right after. Just like in Doctor Who! I am already thinking about how this could likely be implementable based on my knowledge of MC modding (probably rather different though)
rq, anyone know a simple way to mess with happiness? Its not explicitly listed in Stats, so I assume it is named something else...?
isn't it unhappiness?
i'm not sure if the glowing part is really possible but resetting the character is possible if a little impractical
There is nothing related to happiness under the Stats class explicitly as far as I have found
Okay, cheers!
Unless it is morale
But anger and sanity are also in there, so idk if there are diff unused I shouldnt touch
you kind of just have to reset every possible thing you can, you might just be able to create a new player object and swap over the few things you do want to carry over but the game might get mad at that
check bodydamage
iirc morale is unused
I did. There is an "unhappyness" level. but I dont know if that is equivalent to the Stats versions for editing...
it's probably just bodydamage only
hmm but it does have boredom redundant with stats
i'd say 'it wouldn't have a setter if it doesn't work' but bodydamage is particularly notable for having many setters that don't work or don't do anything
Love that 😅
love having setters for properties that literally don't do anything and never have, love having setters for things that get overwritten by the main loop
can you re-order the context menu after it completes?
i'm adding a context menu to inventory items and i'm trying to make it not appear at the bottom of the list
you can addOptionAfter
how does that work? the only context menu functions i know of are addOption and addSubMenu
you should look through ISContextMenu
lots of useful stuff in there
not at my pc rn and i'm intellisense dependent so i can't just give you a straight answer 
lol, i found ISMenuContext but that only has 30 lines in it
found it, its under ISUI
thanks though, this looks like exactly what i needed 
It's in bodyDamage last I checked
getPlayer():getBodyDamage():getUnhappynessLevel()```
https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyDamage.html#getUnhappynessLevel()
declaration: package: zombie.characters.BodyDamage, class: BodyDamage
The setter for it does appear to be coded in
unfortunately doesn't always mean it works, particularly when it comes to bodydamage
but the fastest way to test that is to just do it
Uh, anyone been decompiling zomboid lately? Mine's throwing errors
'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
What decompilation thing should I use then?
decompile it normally or use beautiful-java if you want something a bit easier to read
I think capsid decompile is safest right now because it includes an older decompiler, while the updated one throws errors.
beautiful java is a tool co made that decompiles zomboid with intellij's decompiler and renames variables to suck a bit less
it's not as ridiculously annoying to set up as capsid
Ah, so I have too new Gradle, probably
if you want the lua libraries capsid generates, candle (bundled in umbrella) is way better and doesn't need you to generate them yourself
I think I only need the Java code for what I need
I have the Lua libraries for development already
Can you give me a link? I can't seem to find it
Thank you
I'll decompile some Zomboid with this and see if I can finally end my madness-induced search
Also to redo tailoring
I just realized...
Zomboid Server and Zomboid Game are... two different source codes?
Like, it makes sense, but considering you can host a multiplayer game yourself, I thought that the game already includes server code in itself...
And yet, BeautifulJava outputs the code to different folders if it's the server or the client that's decompiled
Do you know which folder should I use to read the code? Decompile or Sources?
I think it is pz/41.78/decompiled/?
Is there any way to make corpse sickness start at 1 corpse? Not seeing any options for it in the packaging
I'm struggling to understand how UI hooks into... calling some Java functions
removeAllOption = context:addOption(getText("ContextMenu_RemoveAllPatches"), self.chr, ISInventoryPaneContextMenu.removeAllPatches, self.clothing, self.parts, needle);
Does this add a context menu option that calls a function when added?
Yes it calls ISInventoryPaneContextMenu:removeAllPatches
And passes self.chr, self.clothing, self.parts and needle
Wait, so all functions for various interactions with items are in there?
I can pass in any lua function into addOption, right?
Hello there, I got reports of a problem I do not understand with one of my mods. ```
require "ISUI/AdminPanel/ISItemsListTable"
if ISItemsListTable.isModdedIconPatched then return end
local lcl = {}
lcl.item_base = __classmetatables[Item.class].__index --__classmetatables[Item.class] is null
lcl.item_getIcon = lcl.item_base.getIcon
lcl.item_getIconsForTexture = lcl.item_base.getIconsForTexture
lcl.item_getNormalTexture = lcl.item_base.getNormalTexture
lcl.item_getCategory = lcl.item_base.getTypeString```
how can __classmetatables[Item.class] be null ?
Also this does not occure to me but it occures to other players
minor clarification, the function is called when the option is pressed (selected) not when it is added.
Right, yes ,that's what I meant... Still... what I want is gonna get a little awonky
I hate to assume anything but maybe somebody makes a new global variable Item?
Oh my..
Changing the function is not that hard, you can patch the function before it is added or find the added option and replace it.
I see. What I really want to do is change the function and also modify the underlying logic, touching the tailoring menu... Issue is, half of it is buried in Java
that's true, I have heard some of patches logic is hardcoded.
Sure is... I actually cannot do what I want with it because it's all hard-coded
A shame, really..
What a nice tool. It'd be nice for a vscode extension.
Would a extension providing the same tools bother you in any way?
I wound up needing to change the code further haha but I have it as an exe now
Works perfectly for generating tapes
I'm a very active vscode extension developer right now with PZ tools.
Oh. I'd do my own code but I might reference the tool to learn the format.
All my work is in Typescript.
Oh for sure
Ywah its a good idea though. The more access people have to tools the easier it will be to mod
Working on this right now
nice work!
Thanks. Template files are loaded, making it possible for people to write their own to use with the extension.
hey there! think you could help me with the mod i'm trying to make? i have a couple questions about generators and how the electricity works. I'm willing to pay for a lesson
I won't stop you from hiring a tutor, but this channel operates pretty effectively on volunteer effort. I will say, though, there are enough experts in this channel that would be worth paying for tutoring. For now what are you stuck on? I'm not sure if I can help, but I'm willing to take a look.
Before I dive into this is there a easy way or maybe some kind of parser to convert the scripts folder with all the recipies, items etc. into JSON format?
eg. this:
to this:
i doubt theres an easy way to do it, but im sure theres a way
I'm interested to know why you want to do this.
I wrote code to do just that. I have all of this in a JSON format.
@worthy sparrow
Is this what you need?
The only issue with this rendering of ZedScript is the issue of recipes with the same names being shadowed and not present in the JSON file.
This is the project. https://github.com/asledgehammer/ZedScriptParser
It needs one or two fixes but is otherwise a hard-code take on ZedScript parsing.
Just got to convert the dictionary for recipes into an array.
or dictionary of clusters.
I started writing my own in C# but this one is great too I think, Thank you very much and I do need this for a website I'm planning to make: a crafting tree with everything, tooltips, panning, scoping to different items, categories etc. I need something to take my free time since im on sick leave for a month lol
Please consider using my work since I put the 3-4 months of active work on it and made it FOSS for people to use.
Im working also in react with typescript so I guess I could try to implement some fixes to your ZedScriptParser, Ill take a look today
Thank you for considering it.
Aaand using it to reverse the process would be neat too. Like to create a tool that can automate the process of making custom recipies/items.
That uses an aggressive lexer. The vscode extension is a WIP on a passive lexer and linter.
This was exactly that goal.
Don't waste your month working on what's already done. You could at least reference my work to help accelerate your C# flavor.
=)
I know that no one really cared about making tools for ZedScript so I stepped in.
Yeah, totally agree. That's why I asked first before trying to implement my own 🙂
I'm very glad that you did.
But I was close lol
Right now I'm focusing on a simple vscode extension for something else.
So I use sparse data schemas so if something isn't defined I don't leave something for it in the JSON.
My PZ-Rosetta project does this.
I seen your previous work on the gif, really amazing I love those tools that help to implement repetitive snippets. Very nice job
That alright, as long as the schema is constant
the pz .txt is just a mess to use (sorry dev's)
Thank you. Right now I'm pushing Umbrella, a EmmyLua typings collaboration project for exposing all API for modders inside of vscode & IDEA environments.
At this point I guess you could say that I'm building an entire suite for modding PZ. =)
Definitely following this
Thanks. Use whatever you need on that organization github account.
It's for everyone here to use.
Open-source is the way.
I can't seem to find a problem here it won't seem to show up in the spawn menu I ask this alot sorry I see alot of advice I do it and still does not work
^ The tool here would help 🙂
Note: I am mid-way through a multi-stage linting solution.
If you read the ZedScript-VSCode repo you'll see that WIP.
I'm writing out the full process of language support in order to ensure that formatting only occurs when syntactical errors are not present.
linting also provides a way to express issues as problems in the IDE.
what?
You'll also see my work in transcribing the properties for each scope definition in ZedScript into JSON-like datasets.
I stopped right when merging that data with the data for linting.
The extension also uses the parser I sent you first, which I'm going to be removing entirely.
A more user friendly tool that helps to create items/recipes
the extension needs to be passive in its approach to handling and interpreting the script.
Hope that insight helps you understand what I'm doing and where I'm at in the project.
how do I use it?
I will dive into it
Still a WIP
oh
soon™
what attributes does a recipe have when i find it through local recipe = getScriptManager():getRecipe(recipeName)?
like anything i can set?
name or anything?
If you use Umbrella in your coding workspace you can see what is available for you to use.
=)
i don't have unbrella, does it work with notepad++?
It will work in any environment that supports Emmylua typings. I only know of vscode and IntelliJ IDEA working so far.
It exposes and types all the API in the modding environment.
i thought there was a link to umbrella on the modding page of the wiki, do you have a link handy?
thank you
No problem. We currently don't have any pre-packaged zip releases. The setup is simple if you have git installed.
Umbrella is a collaborative effort so the design of the project is to use git submodules.
You clone and then populate them using a 2nd command and then you're set.
okay so i got vscode, the lua language server extension, and cloned the repository to my computer, and used git bash to git submodule update --init --remote now how do i get it into vscode?
You add Umbrella as a folder in your workspace. If you see the bottom-left showing scans of a thousand or so files then it's working.
If you don't see it, re-open the project.
Hi, I need to get the sqlid (server, not local) of a vehicle. I can do this through client-server commands, but I think this is not very good with a lot of online and multiple identical requests to the server to get an ID.
Can I write the sqlid of a (server) vehicle into the machine's moddata and access it on the client side without making a request to the server?
How to do it?
i re opened the project, and i didn't see it scan a whole mess of files, and it seems to not be working
i can browse the umbrella stuff tho in the project, not sure what i am doing wrong
so i need to put my folder in the umbrella folder in the workspace?
You need to put the umbrella folder in your workspace.
where do i find that file?
You create it.
You'll see it in my root project folder.
I should make a template repository tbh
Sorry for the little technicals.
guys, how to add item in distribution.
me need industrial zones (Black zones on map)
Provided it works for you, this'll expose everything you'll need for API.
now maybe i close and reopen?
Yeah.
Point it to where your source folder is.
That file tells the extension where to look for lua files to digest for IntelliSense.
it says cached files 14/14, that doesn't seem right
Yeah.. @bronze yoke I'm convinced that it's necessary to build a template workspace for Umbrella.
This frustrates me. Why is is simple setup for us but many others are having this problem?
Try this:
{
"source": [
{
"dir": "./StarterKits/Contents/mods/StarterKits/media/lua",
"exclude": [
"csv/**.lua"
]
}
]
}
Move Umbrella to inside your lua folder.
Then reload your project.
Notice how my setup has everything under the folder that config file points to.
You could make the folder broader so that Umbrella isn't included in your mod when you upload it.
like you could do "dir": "./"
All you're doing is telling it where to scan for lua files.
i tried making a test.lua file in the umbrella folder and that also didn't work, i must be doing something else wrong, i'll have to dig back into it when i get back form my interview
Yeah. Sorry. I don't know why this is an issue for people.
My stuff works even without that json file.
So I can't tell you because no one has provided definitive proof as to why it fails to load in.
I'll take a look at it this weekend.
The plugin has settings to include libraries to be scanned additionally. More reason to make a workspace for people.
Props to using the static link generator on github.
Sorry for asking again but can someone tell me what's wrong the problem is its not showing up ingamew
item block isn't bracketed
like this?
item MyItem
{
}
@worthy sparrow A visual GUI editor for scripts will help this dude out.
is there a page somewhere with all of the loot distribution categories?
is this what your looking for?
if not there is more distributions in /steamapps/common/ProjectZomboid/Media/lua/server/items
sort of, i'm trying to add loot spawns for items in my mod and i want to make sure i do it right
/steamapps/common/ProjectZomboid/Media/lua/server/items
try going here
already am, thanks
np
found it, i was looking for ProceduralDistributions.lua
how are the values weighted?
is it just a standard weight system? or is it some chance based thing
not sure
it's not weight
it's chance
every item is rolled for
not just a certain amount from the list or something
this does mean that adding more items to a list means that on average more items will spawn in that container
that's why true music cassettes are absolutely everywhere when you have a large pack, for instance
as an example,
if you have 5 different items in a distributions table and they all have decending values of 50,40,30..
what does that actually do as far as spawn rates?
is it 50% to spawn the first one, and so on?
also what does the "rolls" value indicate then? if its not a weighted system then having a limited number of rolls doesnt really make sense
i think it goes through the list multiple times? not really sure, never messed with a container that even has a rolls value
roughly, the default spawn values reduce the chances
you can see the actual spawnrate in lootzed
Working on it 😉
Ill put it on my website
Wish I knew what to add as templates before publishing the plugin.
BTW the plugin externalizes templates now. It's in a documents folder I create.
The main templates repository is cloned and pulled from GitHub.
holy crap I got it working and it was like seeing heaven
now I just need to correct the model and the angle
i can't get the items to spawn.
the file goes in media/lua/server/Items right?
it goes in server, it doesn't really matter where else you put it
table.insert(ProceduralDistributions.list["ArmyHangarOutfit"].items, "DynamicBackpacks.UpgradeCapacityMilitary");
table.insert(ProceduralDistributions.list["ArmyHangarOutfit"].items, 2);
table.insert(ProceduralDistributions.list["ArmyHangarOutfit"].items, "DynamicBackpacks.UpgradeWeightReductionMilitary");
table.insert(ProceduralDistributions.list["ArmyHangarOutfit"].items, 2);```
is anything wrong with this then?
that looks right, have you checked lootzed?
no, what is it?
found it, i had a double parenthesis further down the script.
i wasnt seeing the compile error
=)
tbh it sounds weird and rude but if I use that it feels like I'm disrespecting all the modders who type have of the stuff
very cool tho
Definitely weird because the point of this is to contribute your own templates, as albion did here.
It's literally to help people out.
oh okay
what is pushback mod and knockdown mod
I'm looking to change the time of the zombies down
i did not, sounds like it is a substitute for umbrella?
Its built-in to Umbrella
so i just need to figure out how to get umbrella working
is it a problem with my emmy.config.json? { "source": [ { "dir": "./src", "exclude": [ "csv/**.lua" ] } ] }
anyone know
I don't think you need that. I think that's for specifically the EmmyLua extension.
I originally worked with that.
Visual Studio Code
PZEventStubs's annotations have been tested with the Lua language server plugin. To load PZEventStubs as a library, open the extension's settings, look for Lua › Workspace: Library, click Add Item and type/paste the full path to the folder you cloned to.
i'm lost, how did you get here
today is my first day using vscode, i'm a notepad++ guy
ah perfect
what's a good spawn rate
I'm picking like 20s and 30s
like is this a good spawn rate
oh now it's loading like 1400 files
Holy crap. I suddenly don't have a headache anymore.
That bothered me for a while.
Jab can I have your thoughts about the spawn rates?
I don't know much about anything when conventionally modding PZ. Sorry.
I'm a very niche modder here.
okay no problem
When it completes, try typing what you originally did with the RecipeManager.
Gah, luas being a weirdo
ya this looks very helpful now
Thank God. Seriously.
Schrodinger's code coverage.
Code coverage fails 50% of the time to even work
Unless I add a break point
I hate leaving people with broken tools I make.
Which causes it to work 100% of the time
Ye
race condition?
In lua?
Hmmm
A race condition is when you expect something to sequence and it randomly fires in different sequences you don't expect or don't want.
But that's usually an asynchronous problem.. which PZ doesn't know what async is, apart from the invokeRenderThreadContext stuff.
at MethodArguments.assertValid line:123.
ERROR: General , 1688156147345> 0> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: setOriginalname: Expected a method call but got a function call. Correct syntax: void obj:setOriginalname(String arg1)``` when i try to `recipe.setOriginalname(recipeName, starterKitName)` or `recipe.setOriginalname(self, starterKitName)`
maybe i should recipe.setOriginalname(recipe, starterKitName) ?
Don't pass self
This is an artifact from EmmyLua
Those are Java calls.
recipe:setOriginalName(recipeName, starterKitName);
getting there i think, that time it didn't do what i wanted but didn't throw an error
Yeah. Take your time and go through the methods and try different things. You can see the catalog now in your editor.
It'll be a huge help.
ya this is rad
Glad that you got it working.
Glad to hear that as well.
I feel like you're writing Jest in PZ.
I'm pretty much done at this point.
Last thing is right clicking a failed test to open the error.
is it possible that setOriginalname just doesn't do what it says on the tin?
Looks like setOriginalName only takes 1 string arg
recipe:setOriginalName(newName)
Oh, I guess thats techinally the same as what you had:
recipe.setOriginalname(recipe, starterKitName)
recipe:setOriginalname("Testing") didn't seem to change anything for me
but no error, that's good i think
maybe i need to reload the table of recipes after i set the recipe name?
is there perhaps a mod that sets the recipe name based on sandbox variables that anyone knows of that i could look at?
also is there a way onResult to set the durability of the item that was just made, or do i neeed to add the item to the player's inventry in lua to be able to set its durability?
On a weapon type? Or just the Condition property?
on a plank, so technically a weapon
try with conditionMax=10.0
oh wait I think thats related to vehicles?
im not sure
so a plank has condition max of 10 normally, if i used that to set the condition to 7 lets say, should i be able to repair it to full? assuming there was a way to repair said plank
Ohh you mean to like give it random number (condition) between 0 and X
well specifically one value, tho now that you say that, i should have it done in lua so i can set it equal to the player's carpentry
Ah I see, yeah lua is the way here
Hey you guys know the metal gates zombies can see you through? What are those under in the building editor?
so i should do something like function Recipe.OnCreate.PlankFromScrapHardCraft(items, result, player) local CraftedPlank = player:getInventory():AddItems(Base.Plank, 1) CraftedPlank:setCondition(7) end
to make a plank with condition 7/10 right?
Yes
Yeah something like that
the png is named fixtures_doors_fences... if that helps.
so something like CraftedPlank:setCondition(player:perkLevel(Carpentry)) to set it to the player's carpentry level?
Thanks. I Hope I'm able to actually open them when I'm done. It's my first time modding so I have no idea what I'm doing
good luck! i had no experience a little while ago and these folks have helped out a ton!
Anyone know what the lines for the parking spaces is under, or is that considered grime?
CraftedPlank:setCondition(math.floor(1,player:getSkillLevel(Carpentry))) i think i'm getting there
Im working on something that will help you modders create items
you damn dirty modders! lol
lol
https://azakaela.itch.io/pz-recorded-media-maker-tool
I've released my zomboid modding tool
Is there a hotkey to flip tiles in the building editor or no?
You just gave me an awesome idea
no idea
any idea what i am doing wrong here? CraftedPlank:setCondition(math:floor(1, player:getSkillLevel(Carpentry))) i can set the durability manually to 7 but when i try this it sets it to 10 every time
Holy hell, I could kiss you. I gave up trying to make VHSs and CDs just because testing the RGB, copy pasting the GUID, matching everything up was such a cumbersome process.
is math:floor actually correct? shouldn't it be math.floor?
math.floor
okay going to try CraftedPlank:setCondition(math.floor(1, player:getPerkLevel(Perks.Woodwork)))
Yeah I thought it was BS too so I learned Python just to automate it
It works perf tho I am pleased with my first ever python tool
now recode WordZed and you'll be a deity amongst mortals...
Kinda technical question, the color can be any RGB value 0-255? Or is it predefined like you have in the file magenta=Some text
Oh my God I actually couldn't figure out why I couldn't use string templates for a minute.. In Lua..
Wow..
what are you trying to do? math.floor doesn't take multiple arguments
i think you're confusing it for something else
you're thinking of math.max
math. max takes the largest argument?
yeah
lol what does math.floor do?
it rounds it down
good to know!
predefined for now; I Wrote the available list of colors in the instructions
Oh okay, thanks
the colors get turned into rgb floats
and should i use player:getSkillLevel(Skill.Carpentry) or player:getPerkLevel(Perks.Woodwork)?
perklevel
k thank you
... Why did I get Timed Out?
@red tiger The ItemScript class in ZedScriptParser and all of its inheritances are up to date?
If not it should be very accurate.
whatever I guess they don't like blocked formatting in the channel that uses CODE specfically lmao
I didn't make an uber class.
Tried to keep things separate.
If that causes issues, combine it all into one class.
Wasn't a problem for me at the time.
You can always add if missing.
It's alright, I just need all the possible properties
Seriously can't wait to see this in action. 😍 😍
typo 🤔
Gotchu
Curse these bloated jointed fingers.
now back to this, recipe:setOriginalname(starterKitName) unclear why this doesn't throw an error or seemingly do anything
👋 Hey everyone! I hope you're all having a wonderful day. I'm trying to leverage ScriptManager to fetch all containers available to the user with the following code. However line 3 claims items_by_type is empty. I'm making some assumptions about what getItemsByType can actually fetch, but I thought I was at least making an educated guess... Does anyone know why my variable is empty?
local items_by_type = getScriptManager():getItemsByType("Container")
print("fetching all empty container types")
print(items_by_type:size())
okay so it seems like Originalname isn't used for anything as far as I can tell. i can set it, but it doesn't show up in game
👀
very much WIP but the backend stuff works, just need to code in all the properties with description etc. and make templates for items
and beautify it lol
Yes but not in the way you'd expect.
SP with vanilla Lua only? No.
MP? Yes.
You can use a file system for requesting from another process that listens for changes to those files and then does the get/requests and then saves the data to a file that the server can pick up.
client sends command to server, the server saves it to a file, the 2nd process on the server processes it, the server picks up the result, passes it onto the client.
It sucks but that's the way you'd do this without modifying the core of the game.
Well if it works
Assign a number to a file and track it. Maybe a 2nd file with _result appended to it.
Put the link in the first file, the 2nd process renders the results to the 2nd file.
Read, clean, move on.
Also, this looks nice:
The first version of PZ-Wallet is out.
https://marketplace.visualstudio.com/items?itemName=asledgehammer.pz-wallet
Don't expect it to have a lot of templates. That's the next step.
don't worry, this is TIS's mistake not yours
that is actually in the script format
grr, TIS is why i can't change the name of this recipe after sandbox vars have loaded lol
i can't complain too much tho, i'm playing the game right now lol
I haven't played it in many months.
I think that it's funny how I almost never played this game yet I modded it for almost 10 years.
This is how I play the game.
@red tiger everyone plays in their own way. 🙂 I'm glad you enjoy doing what you do because your contributions make everyone else's experience better.
Does anyone know why :getItemsByType("Container") is returning no results? I'm pretty sure "Container" is a valid type. I've been banging my head on this for hours. 😦
for playerObj?
@verbal yew I'm calling the following code and it returns 0 results
local items_by_type = getScriptManager():getItemsByType("Container")
print("fetching all empty container types")
print(items_by_type:size())
yeah. /shrug
but it should be from space
like get inv
also getitembytype
no?
player:getinventory:getitembytype
getItemsByType looks for type (internal name) not type (type)
@verbal yew I'm trying to get all the items eligible to the running game, rather than all the items the player has. For instance if I run getScriptManager():getAllItems() it'll return over 2000 items that can be used in game.
ou
is there a way to look up all type types instead of name types? Or should I just loop through :getAllItems() like I did before? I was trying to write more efficient code but I just dug myself into a hole.
this is the second time I've been burned by type not being type. 😢
i don't think so, the loop is fine
most scriptmanager stuff shouldn't be happening during gameplay, so the performance isn't critical
Very fair point. Thanks!
how make helmet mod smh
imports
{
Base
}
item Hat_g2gh
{
DisplayCategory = Accessory,
Type = Clothing,
DisplayName = GAS2GO helment,
ClothingItem = Hat_g2gh,
BodyLocation = Hat,
Icon = g2g_Helmet,
CanHaveHoles = false,
BloodLocation = Head,
BiteDefense = 100,
ScratchDefense = 100,
ChanceToFall = 10,
Insulation = 0.25,
WaterResistance = 0.2,
}
this should work
?
im only adding 1 itme but my code that i posted is right?
module MyMod
{
imports { Base }
item myItem
{
*stats here*
}
}```
ty man
begging for help here with one thing
is there a way to make corpse sickness start at one corpse and not 5?
not without reimplementing corpse sickness entirely
ah
currently attempting to buff the rate at which players get corpse sickness by using 'working masks' reverse engineering, what number do I need to change to do so?
-- we cannot get the number of corpses, because that value is not exposed in lua, so we calculate it backwards ourselves local sicknessFromCorpses if poisonLevel > 0.0 then --use different formula if poisoned --original formula for 41.65 sicknessFromCorpses = deltaSicknessLevel - ((bodyDamage:getInfectionGrowthRate() * (2 + Math.round(bodyDamage:getPoisonLevel() / 10.0))) * gameTimeMultiplier) else sicknessFromCorpses = deltaSicknessLevel end local sicknessFromCorpseRate = BodyDamage.getSicknessFromCorpsesRate(6) -- Damage is calculated for any corpse above 5 local estimatedCorpses = sicknessFromCorpses / sicknessFromCorpseRate / gameTimeMultiplier local sicknessFromCorpsesAdjusted = Math.min(Math.ceil(estimatedCorpses), 20) * sicknessFromCorpseRate * **5 (this is where I've been attempting to buff the rate, to no avail)** * gameTimeMultiplier -- capped at 20 corpses if sicknessFromCorpses > 0 then newSickness = newSickness - (sicknessFromCorpsesAdjusted * MaskEfficiency) end end if newSickness < 0 then newSickness = 0 end bodyDamage:setFoodSicknessLevel(newSickness); prevSicknessLevel = newSickness else prevSicknessLevel = currentSickness end end
where is the nutrition system in the game files?
i want to make it easier to keep a stable weight and harder to go under and overweight
i think there's a nutrition.java
it could be spread throughout the character classes too though
do you know how fast a character loses weight if they eat nothing normally? is it 1 weight per day?
how do you do a += in lua? just var = var + value or is there a more elegant way?
+= doesnt work?
vscode is complaining about it
okay that works i just feel weird not using +=
yeah Lua doesn't support ++, --, +=, -=, etc
Does anyone know off of the top of their head where zombies are defined in the lua?
Or is their logic all java-side?
All java side but you can access their IsoZombie class with lua
Ah I see- thank you
I want to fix one clothing mod I play with. For some reason jackets from that mod don't cover forearms thus I have question regarding what determiness which part of the body is protected by clothing and which is not. Is it BodyLocation? If yes, why Jacket location covers only torso and shoulders?
how to overwrite recipe file with mod?
BodyLocation = Jacket,
BloodLocation = Jacket,
?
BodyLocation - it's inventory slot.
BloodLocation - it's defense location.
Ah, I see, now this makes sense
For that one paticular jacket I was using BloodLocation is Shirt
how to overwrite recipe file with mod?
Guys, there is an invasion of mods using the following broken snippet function Adjust(Name, Property, Value) Item = ScriptManager.instance:getItem(Name) Item:DoParam(Property.." = "..Value) end stop using it, it breaks vanilla symbol Item, use this instead function Adjust(Name, Property, Value) local Item = ScriptManager.instance:getItem(Name) Item:DoParam(Property.." = "..Value) end see details in steam discussion below, some of your mods may be included. https://steamcommunity.com/workshop/discussions/18446744073709551615/3812908758675356532/?appid=108600
@fast galleon you were right, a snippet overwritting Item has spread in the workshop.
until it is fixed you can get the class another way, it would be something zombie.???.Item.class
you could also get the metatable from an Item instance.
Hi, I need to get the sqlid (server, not local) of a vehicle. I can do this through client-server commands, but I think this is not very good with a lot of online and multiple identical requests to the server to get an ID.
Can I write the sqlid of a (server) into the moddata vehicle and access it on the client side without making a request to the server?
zombie.scripting.objects.Item.class
dunno about vehicle mod data, but you can create a dedicated table in ModData (global mod data), and subscribe it client side. it will be the same network use as writing your own messages but less verbose, less chances to get buggy and somewhat optimized.
Just made the vscode extension 'PZ-Wallet' more powerful, allowing for templates to include other templates.
Are all items always capitalized?
item My Item {...} or it can work with item My item {...} ?
Also I noticed some files have "_" as delimiter My_Item and some without like MyItem
There's no set standard for item naming conventions.
Since im like not actually making mods I don't know which properties are used for which item category, I guess i could use the defaults from PZ files but if theres someone that might have a decent list or help create one i will be grateful
Heya -- guidance on making a UI system similar to notes for a "FoundJournals" series of items?
I was looking at it, I can make few templates out of it but for eg.: template "Weapon" has too many attributes if you want to make a one handed mele weapon, because it doesn't need half of those like InsertAmmoSound, MaxAmmo etc. Anyway thanks 🙂 Im going to follow the advice for now lol
https://steamcommunity.com/sharedfiles/filedetails/?id=2977982429
Tired of having to install all the texture packs ?
Introducing the MandoDB Texture Pack! It gathers all the textures and textures map in only one mods, it is useful for the modders, mapper, but also the administrator of server thanks to the mod "Better Tiles Picker", you will be able to make event without having to add all the necessary maps !
Have you used Beautiful Java to decompile both the zomboid client and the zomboid server? if yes, have you ever seen any difference in code?
no, i wasn't really interested in the dedicated server
Anyone could help me how i could put "item Freeman's_Crowbar" inside this function so it doesnt break (replace Crowbar with Freeman's_Crowbar, cuz it seems that underscore and ' seem to break it)?
`function Recipe.OnCreate.Crowbarspearfc(items, result, player, Crowbar, firstHand, secondHand)
result:setCondition(Crowbar:getCondition());
if firsthand or secondHand then
player:setSecondaryHandItem(result)
player:setPrimaryHandItem(result);
end
end`
Well, I decompiled it, and after throwing both on a private github... It gave me a couple of differences in code
between the same version of client and server codes, from the "decompiled" folder
why change it? crowbar just refers to whatever item the recipe gives it, it doesn't actually matter what it's called
is it just the stuff to do with launching the server or is it actually significantly different?
there were like 4 differences...
I don't remember exactly
It could've been... Decompiler jank?
I have no knowledge in it so ive been testing blindly, i want my recipe to use this function but to have diffrent result. The result of craft its supposed to be item from other mod (freeman crowbar) but keep condition of Crowbarspearfc and remain in hands after action if it was in hands. I tried puting item name Freeman's_Crowbar but it doesnt work then so i did test with vanila crowbar as it seems to me that underscores break it or " ` " symbol does and its part of items name.
yeah, that would be my first guess
Actually, no
There are some differences
Just as an example
I, uh... I don't know which one is which anymore
I think the right one is the client code
I might've messed this up
I might decompile both again...
Okay it actually worked, thank you. Im also sorry if its stupid question, but could you explain to me what are things between "( )" for if it appears that changing "Crowbar" for item name i wanted doesnt matter? function Recipe.OnCreate.Crowbarspearfc(items, result, player, Crowbar, firstHand, secondHand) For future reference (Once i have acces to non limited data i intend to learn it myself but right now im stuck with very low limit so any video tutorials are out of question for me)
There are few rules you have to stick with when naming variables which include:
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
https://en.wikipedia.org/wiki/Naming_convention_(programming)
In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types, functions, and other entities in source code and documentation.
Reasons for using a naming convention (as opposed to allowing programmers to choose any character sequence) include the follow...
Will add it to my lecture. Thanks
Hi sorry if this isn't the right place for this but are there any modders out there taking commissions atm?
Automated Test Framework is on Github now.
https://github.com/Notloc/zomboid-automated-test-framework
@novel barn
YESSSSSSS
Thank you!!!
i feel like a lot of neat tools for pz modders have come out recently
@wet sandal not sure where the past four hours have gone, but I'm SO excited to use this test framework and complete my project with TDD. I really hope this becomes a community standard.
how about local function Adjust(Name, Property, Value) Item = ScriptManager.instance:getItem(Name) Item:DoParam(Property.." = "..Value) end
when func a local
why anyone uses PascalCase for this at all 
I'm a bit hater of camelCase but Pascal.. bruh
it's very unusual
I also dislike camelCase but it seems to be prevalent in the PZ modding community. I tend to use snake for variables and camel for functions.
can't stand snake, love camel
honestly I just prefer standardization over everything else.
Wow dude, thanks!
I'm glad you're enjoying it. I'm Canadian and it's Canada Day right now, so this was just something I managed to squeezed in today before the evening debauchery, but it's really nice to hear.
seriously sat down for 4 hours and didn't move until I had a few failing tests set up 💙
I have a clothing item with a custom body location but the ui text for the customize character menu shows like this
i'm assuming it's a translation file that needs to be configured
does anyone know where the clothing items are defined like this?\
for example
That's perfect, thank you so much
after reading some more code and fixing up the whole process I can conclude that, yes, this does appear to be decompilation jank.
What does GUID mean?
The id the game assigns to each item to distinguish from each other
You can generate one online
alright, thanks
I'm your worse nightmare: I switch format depending on the wind direction. 😂
what could be causing my model to come out crooked like this?
I'm making a mod which will, among other things, add some new spawn locations to the original map. This works in singleplayer, with there being 8 different locations to choose from (original 4 and 4 of my own) but when I launch a server with the mod, only the original 4 locations are visible. The rest of the mod works fine so the mod is enabled. Anyone know why this might happen / how to fix it? I was unable to find much by googling this time

nvm fixed it
Are you adding the locations in Map=?
dont think so, I've just added them to media/maps/ in the mod. I assume I need to add them somewhere in the server settings then? But what would I write there
I was now able to make it work by manually add them to the serverName_spawnregions.lua server file, but is there a way to do this from completely within the mod?
Im only familliar with adding them to the Map= list in server config file
But maybe its possible do that withing the mod, i have no knowledge in that sadly
Thanks for trying to help, apparently it seems like they get automatically added whenever i add the mod to a server, it didnt show up the first time because the spawnpoints didnt exist when i first added the mod to the server. I didnt notice since I've just used the same server for testing until now, so it seems to be all good now
How hard would it be to learn to make mods for zomboid? I don't know anything about coding
Depends on the mod you want to make, its not rocket science but you need to learn few stuff, there are many tutorials which can help you start. You have to learn about lua and its syntax, limitations, usefull classes.
Hi guys, wondering if someone might be able to help me. I'm working on a custom map, and I'm running into issues with foraging - notably, everything works exactly as it should on singleplayer and local hosting, but doesn't work on the actual dedicated server. We've tried everything, removing all mods (except the map mod), deleting all server files and allowing them to regenerate - and I'm pulling a blank at this point. Does anyone have any ideas?
Roberto Ierusalimschy - Programming in Lua
to the part where coding begins in conjunction with the C
after Zomboid API on PZ wiki / moding
Are headphone types hardcoded in java? <.<
Before I publish the website id like to make a list of usefull extensions, tools, utilities and whatnot to help with making mods to PZ, contributions are welcome, just send me a dm or reply to this message with a link (Added Project Umbrella, Jab's VSCode Extension and Notloc's Automated Test Framework)
Hello! Is there any modder capable of making vehicles, specifically, that are open to commissions?
guys, help me to inject into the function
function ISHealthBodyPartListBox:doDrawItem(y, item, alt)
Hello! I'm looking for someone who can help me create a custom power generator in LUA. Im offering payment for the job
Your dms are closed
hey guys, i've just released an API for the game's passive stat calculations (specifically hunger, thirst, fatigue, boredom, stress and endurance) - the feature list is pretty bare at the moment but as i had to reimplement the entire thing in lua to get this done (including the entire sleeping mechanic, so if you want to mod that, look here) there's not much limitation on what can be made modable
https://github.com/demiurgeQuantified/StatsAPI
https://steamcommunity.com/sharedfiles/filedetails/?id=2997722072
since this requires a hook to work, it's best that it can be shaped into a one-size-fits-all universal solution, so i'm very open to feature requests
Hello
Question
In a mod that adds a craftable melee weapon to the game, is there a way to let the user change what level of a required skill [to craft it] they need to be at?
Using the Sandbox Options
i haven't seen it done but it looks possible to me
it would require lua and not just recipe scripts though
Someone must have an idea
in script recipe 'Tooltip:' with string required skill,
and OnTest:MyLuaFunc
function MyLuaFunc
cheking stuff
end
in stuff we can add sandbox var
done
Hello i have a question how do i do if infection level is ... then ... thing for my client script?
i couldn't find any information about that in google
you can get the infection level of a character with IsoGameCharacter:getBodyDamage():getInfectionLevel()
something like that
if you want the tooltip to work it'd be simpler to just edit the recipe
i haven't tested it but it looks pretty simple
i don't want to write out a bunch of pseudocode for it right now but if oninitglobalmoddata you grab the recipe from the script manager, you can clearRequiredSkills() and add the new values with addRequiredSkill()
you could also loop through the existing required skills to copy them before clearing it but that seems like overengineering
it's just text in recipe (bottom of required item) with something like (if u cant create it, you need more Blunt skill level)
sounds janky
That's why I'm a work-arounder xD
This is a bit of a headache for me so I apologize for even asking, but I would appreciate any and all help! I'm currently trying to get the capacity of a bag that has been fetched from getScriptManager(). The item returned is derived from (as best I can tell) zombie.scripting.objects.Item. However this object only has a field named Capacity and no methods to getCapacity().
Assuming the following:
item = getScriptManager():getItem("Bag_DuffelBag")
print(item:getFullName())
print(item.Capacity)
gives me the following output:
"Base.Bag_DuffelBag"
nil
I can get the capacity of all containers from the itemContainer object. So I wrote a function to add all bags to the player's inventory, iterate through each one, and insert the item and capacity into a table. However I feel like I must be missing something simple and I've dramatically overengineered my solution. Am I doing something wrong with item.Capacity? Or am I missing something simple?
getCapacityWeight()?
or getMaxWeight()
Those are both exposed in the itemContainer object. The objects I'm getting don't inherit from there.
You have to get InventoryItem then getItemCapacity()
yeah, unfortunately not all properties are exposed on the script
you can create an instance with InventoryItemFactory
that's what I've done so far. It's just really messy. 😦
wait 🤔 that does give me another idea... I've been using InventoryItemFactory, adding the item to my inventory, and then pulling the capacity back out. I don't even need to add the item though 🤦♂️
you could technically grab it from the script with the field stuff but that stuff sucks and it'll probably break when the game updates
(so in approximately three years)
exactly why I'm writing unit tests for every single parameter for every single bag 😦
Item has a field of InstanceItem(string param) of type InventoryItem and InventoryItem has a method getItemCapacity(), so I guess something like
item = getScriptManager():getItem("Bag_DuffelBag")
local itemInstance = item:InstanceItem(item:getFullName())
local itemCapacity = itemInstance:getItemCapacity()
(...)
I'm not 100% sure but thats in the docs lol
Yeah I've been trying to figure out how to get an item out of instanceItem. Thanks so much for taking a look! I'll report back when I figure this out!
InstanceItem(String param) param???
np 🙂
that is the most confusing name that variable could possibly have
i'll go check the source
i want to know what that's supposed to mean
if you want to instance items i'd stick to inventoryitemfactory
yeah... InstanceItem isn't written very intuitively... also my instanced item returned a capacity of -1. :/
it seems to set the colour of the item, i'm unclear of the actual syntax though
maybe the param is wrong
it's even weirder than that
the ultimate usage of it is just to append it to the end of the icon it looks for
e.g. InstanceItem("test") would look for Item_(the icon name defined in the script)_test
i don't think it does anything else
what the...
I ran the following in the command console ingame
item = getScriptManager():getItem("Bag_DuffelBag")
inst_item = item:InstanceItem("Base.Bag_DuffelBag")
inst_cap = inst_item:getItemCapacity()
print(inst_cap)
and got
-1
can you try getMaxCapacity()?
also -1 😒
who knows what these do
fuck me. :getCapacity() works. Successfully returned 18.
but I could do the same with inventoryitemfactory in less lines
i wonder if one is more performant than the other
I do too. But this'll never be run by anyone other than myself. Everything I'm doing is wrapped tightly in my test suite / debug mode.
I have just tested this rofl
in the end the factory just calls instanceitem and does a few extra things that don't seem important for you
so technically I'm using instanceitem either way 😂
if you're actually going to create an item you should use the factory but if it's for a temporary use there's no need
also looking at that let me find out that inventory item ids are not necessarily unique and just rely on the idea that you probably wouldn't get the same random number twice
me dumb. Is clock. looks like it's not even random. It's just clock time down to what I assume is milliseconds
Don't ask why I have that in json format
oh wait so actually since ItemCapacity is deprecated then the method getItemCapacity also is? and getCapacity replaced it? That would explain the -1 result
so just docs aren't up to date
always the last thing to get updated in almost any project 🙃
According to my handy cheat sheet there are 28 deprecated fields
that's just the time of the print 😅
🙃 proving one post at a time I have NO idea what's going on 😎 👍
Yes, that's easy to do
But does it work on servers?
Like, can the server admin change the recipe for all players?
oh sorry, i meant editing the recipe object automatically in lua
server-side file changes are no good
I supposed so
Unless you reuploaded a new version of the mod
But... eh
You already released an API, would you consider making one for customizable crafting recipes?
not a bad idea honestly
'making things that shouldn't be able to use sandbox options use sandbox options' is what i spend about half of my time doing
I would also like to be able of seeing what mod adds a recipe, and to disable it if I want
Could interact a bit with Craft Helper even
I've actually been thinking about something like that for a few weeks now. I plan on eventually (probably months out) start developing a massive primitive survival mod. My problem with large mods like that is they don't make it easy to pick and choose what you do want. There are plenty of mods that do a few things I want, but also add some really unbalanced things I don't want.
Precisely
Primitive Survival
I quite like the mod despite the lack of 3D models, but I don't like how it lets you craft Baseball Bats
{
Log,
keep FlintKnife/ButterKnife/HuntingKnife/KitchenKnife,
SkillRequired : Woodwork=4,
Result : BaseballBat,
Time : 1000,
CanBeDoneFromFloor : True,
Category : Survivalist,
}```
so the gist of what you want to do is either remove that recipe, or add a carpentry level requirement?
With a low Woodwork requirement
I just saw it says Woodwork instead of Carpentry
woodwork is carpentry
Yeah
did you find your bug? 🙂
not all of the perks' internal names match their english names
Anyway, level 4 seems pretty cheap for what's essentially unlimited Baseball Bats
yeah logs are not exactly a limited resource
You can't even put together a decent chair until like level 7
carpentry skill is always going to be an awful balancing tool when it's so easy to level
@bronze sand if you're interested in injecting new values into an existing item, you may be able to leverage this https://github.com/Poltergeistzx/Project-Zomboid/blob/main/Workshop/BucketsMultipurpose/Contents/mods/BucketMultipurpose/media/lua/shared/MIC_ScriptEdits.lua
Karlson uses this to add new tags to existing items without having to overwrite them. You could potentially use this to adjust the carpentry requirement. Your first step could be confirming you can change it this way. Then your next step could be converting it to a sandbox variable.
heck, you could probably use this to add a long blunt skill requirement
you'd need to rewrite it to work for recipes
Ohh good point. In my excitement to be helpful I failed to realize this is for items and not recipes.
i think this would work, but i'm done writing apis for a little bit
i should probably get around to actually writing the mod i needed to write StatsAPI to support 😅
@bronze yoke I don't know how you get ANYTHING done with how often you're answering questions here.
most of the questions here are very easy to answer
I aspire to reach this level of understanding and clarity. Catch me here in 3 years knowing what's up.
LOL i've only been at it for about half that
You also very clearly have a much deeper understanding of programming theory, which I am currently lacking. I'll get there. I just have a ways to go.
NOOOO MY PLUNGER
Has anyone had any luck with getFileWriter lately? I think that's the standard for writing to external files but these two lines don't seem to fire and don't result in any errors
local fileOutput = getFileWriter("BagExtractor.csv",true,false)
fileOutput:writeln("itemType,capacity,DirtReplaceType,GravelReplaceType,SandReplaceType,CompostReplaceType")
I'm literally just trying to create a csv and print a string to it. I am closing the file later with fileOutput:close()
are you checking the right directory?
I (probably foolishly) thought it would appear in the same directory as the file that called it. I might be having another silly moment.
it appears in Zomboid/Lua/
Yup. There it is. :/
there's a getModFileWriter that's based around your mod's directory but that one is a really bad idea for anything except development tools
thankfully I'm only writing development tools at the moment. I'm writing a mod that converts all bags into bags that can accept solids (dirt, sand, etc). I'm assuming this will break in the future so I'm future proofing it by building in the tools to extract all the info I need from the game instead of having to hand write all the adjustments. That way if anything ever changes I can just rerun my tools and it should spit out the adjustments I need to make.
I'm 100% overengineering this, but I keep publishing mods that are just code rips from other projects. I want some part of this to be mine. 🙃
for that it should be fine
the problem with the mod file writer is once you've written a file with it the checksum will be wrong forever
and there's no way to delete files so you can't even undo it
the modfilereader is still awesome though, and you can do anything you would've used the writer for in the lua folder instead
That's almost certainly what I'll do. Thank you so much!
probably a dumb question but this is my first foray into trying to make a mod (bit of experience in java though)
im trying to create a recipe, but every time i open up the crafting menu in -debug it brings up what i assume is the debug menu because something went wrong? this is the "tatersMod recipes.txt" contents, file structure follows tatersMod -> media -> scripts -> "tatersMod recipes.txt"
module tatersMod {
imports {
Base
}
recipe Make Machete
{
SheetMetal = 1,
result:Machete,
}
}
i was stripping down what i had until i got to this and it still seems to be a problem?
recipe name might need to be one word
surprisingly no
i see this very often caused by the result item being unable to be found, but i think Base.Machete is correct...?
ill try that real quick
you shouldn't need to include the Base. part since you imported base but idk that's the most common cause
hmm its still bringing up the menu
could it be caused by my items.txt?
i have two items my mod is trying to add as well, but i was able to bring those into my inventory
this is the code for that:
module tatersMod {
imports {
Base
}
item beltGrinder {
Weight= 2,
Type=Drainable,
DisplayName=Belt Grinder,
Icon = beltGrinder,
DisplayCategory:Tools,
}
item sandPaper {
Weight = .1,
Type=Normal,
DisplayName = Sand Paper,
Icon = sandPaper,
DisplayCategory:Tools,
}
}
what error is the console spitting out at you?
im not sure where to access it in this, but this is the screen that gets brought up
when i press on the crafting menu
if you don't mind. I suspect it's the same error but it might be different. that log sorts oldest to newest
the getFullType is the classic 'can't find result' error
wait does it need to be result= or result:
result: is correct i think
in your items script you do DisplayCategory:Tools, a few times, it should be done as DisplayCategory = Tools, like the other arguments, the weird colon syntax is mostly a recipe thing
also, errors are easier to read from the debug log C:\Users\[USER]\Zomboid\Logs\[DATE]DebugLog.txt but that can be a pain to find, open, and mentally parse. Also the file has a max write size of 10mb so if your game has been running for a while you might have multiple.
That looks right, but doesn't have any errors in it. Try what Albion suggested #mod_development message and let us know if that worked.
btw, the file isn't actually called items.txt, right?
no no, its 'tatersMod items.txt'
ok good
though a probably connected error is the Icon doesn't load when i spawn in the item (just a blue circle with a question mark), and when i exitted out the game and came back in, the items from the mod dissapeared from my inventory?
it definitely hates your items then
intellij my beloved
ill try seeing
if removing my items
makes the recipe work
nope, it do be the recipe
@hasty horizon I'm pulling your code into a mod to test it myself. See if I can get it working.
this is all the code rn, and the path of where the files are
could it be my syntax?
@bronze yoke any idea if script files can have spaces in their names? I'm guessing they can since @hasty horizon has at least been able to load the items once upon a time.
the file is definitely loading so it should be fine
it's not something i've seen before though
i can put my items and recipes files in the chat here if that wound help?
idk why its being difficult either looking at the fwolfes github page, and some workshop mods i had downloaded
it does look correct to me
hmm, is it important if i use a space or a tab
no
ok i was thinking "maybe notepad translates 4 spaces and tabs differently" for a second
THAT would be fun 😮
all the whitespace gets nuked before parsing, it's just for looks
got it. capitalize the R in Result
seriously? that's the one thing that's case sensitive??
aaaa thank you lmao
now to readd what i had before trying to debug
i appreciate the help!
Sure! Let me know if that doesn't work. I'm not sure if my final code is identical to yours aside from the R
i just tried it with the R, it do work
I was trying Module Base {}, commas, adding different parameters
awesome :spongebob_phew: I'mma take my dog for a short walk to celebrate.
give em a treat they deserve it
I finally helped someone in here instead of begging for help 🙂
big mood
i can't wait for my time to shine in that regard
hmm, im trying to add a recipe to the Metalworking tab, but it just duplicates the tab, highlights both when i click on it, and only shows the propane torch under it instead of my recipe
was using Category:Metalworking,
try Category:Welding,?
ye that worked
Is there a resource that lists all the distribution tables? i found the link to the .lua in this channel that explains how to add things to it, but unless im blind i don't see a list of all the base tables
in ProceduralDistributions.lua you can see all of the game's distributions
danke
when i put a file in the lua folder, do i have to worry about the name for reasons other than organization purposes? or does the game run them in descending order or something?
it does run them in descending order, but vanilla files always run first, and you can force specific files to run before yours, so this is rarely a consideration
the main thing to think about with the name is that if two mods have a file with the same path and name, only one will run, so make sure it's something unique
ye i was just going to name it with my [modname]Distributions, but i was curious if i needed to be particular about casing/naming and that sort of thing
the server/shared/client placement does matter
but other than that it's just organisational really
im guessing that server has prescendence over shared, then shared has prescendence over client?
it's mostly a load order thing but when i say 'vanilla always runs first' it's per folder
the order is shared -> client (if it's a client) -> server (even if it's a client 💀)
but for example it loads vanilla shared, then modded shared, then vanilla client, modded client, etc
so if you try to add distributions in shared for example, vanilla server didn't run yet so the distribution tables don't exist
well good to know, i was planning on it being in server either way because i wanted to have some friends play the mod on a server eventually
so in this example, the shared distribution would return a nullpointer is what your saying?
if im understanding correctly
yeah, because the server lua creates the distribution tables and that hasn't run yet, so it's just nil when your shared code runs
so that would be a situation to run a shared file after server than before then i think? neat
Anyone know of a mod that adds an extra trackable need/stat like hunger/stress I can use as a reference? I made a mod that tinkers with stress mechanics, and I had trouble getting it to work neatly
Hi, look at this #908459714248048730 message
I have no access
Oh, by Albion...
I was about to ask why nobody is running it, then saw the release date...
Yeah, yesterday
Hey guys I was wondering about one thing. What determines the loot spawns in containers on a map?
Specifically, I'm running Clear Cove and decided to attach other map mods for the heck of it, but even though I copied all files except the map file, the items don't seem to respawn in there?
Theres Distributions.lua file
Is this up to date? I just checked two map mods and I don't see that file in either of them
I’ve been trying to stop any weather and lock the game into a groundhog day type feel - the easiest thing I could think of is to simply setDay to a day a week or so out of game start. I was thinking of adding an extra condition to check if it’s going to rain and then move the day accordingly.
Is there an easier way that anyone knows of?
On the Team Orbit discord, they had a section for code snippets server owners could just copy/paste the lua in debug.
They had a snippet to change one tile's appearance to another (ie: boom box to jukebox tile or refrigerator to a farmers stand tile)
Would anyone still have this snippet?
making a mod way different then my others
I need a code has a random chance of giving me a moodlet when killing a zombie
Hey guys, how do i change infectionLevel?
you can't, as long as the player is infected the value is recalculated every frame
so any changes you make will just be overridden
sad
You can look into how the various zombie cure mods do it
that's what im doing but i can't come up with how to change the value to a specific number
like change it to 20% and other stuff
Which mod are you referencing?
antiserum hardcore
Hrmm... Have you looked at Dr. Hyde's ?
How about temporaily disabling infection if theres any and changing the infectionLevel then enabling it back?
does anyone have a mod I can refer too for this
maybe just the zombie kill give moodlet part
Try check zombieKillCount variable (that shows in UI) and if it increased - give moodle
where could I find that?
oh I see
as soon as you re-infect them it'll start calculating the value again
I see, thanks
Sorry I'm a little confused its my first time trying to create a moodle and stuff I'm using Moodle Framework for this
You want custom moodle? then check how framework works
Yeah I'm reading I just don't understand
like this
require "MF_ISMoodle"
MF.createMoodle(*);
I don't even get it am I supposed to change MF
When I add -debug to the steam parameters and logon to a multiplayer server with admin access, I don't see the game and a console window.
I see a bunch of windows like watch window, lua files, etc.
How can I get the actual game so I can move around and a console window?
does it work if you don't have any mods installed?
I don't really have a dedicated server I can uninstall mods like that
I just want to access the console commands window so I can paste lua directly into it for easy stupid things
What you see is the debug menu, likely hit an error on start. Press F11 to close it.
If you uncheck the "Break on Error" option at the top, it won't re-open in your session if you hit another error
Oh my god thank you
Google was returning the most unhelpful links thank you so much
Another dumb question. Once I get past that and I accidentally close the console command window how do I reopen it without relogging?
I checked the debug bug button, admin button and couldn't see a way unless I missed it
In the normal options under "Key Bindings" there is a "Debug" section which has "Toggle Lua Console" you can set to a key. Just press that key to show/hide the lua console, possibly need to set the key first.
Awesome tyvm
https://steamcommunity.com/sharedfiles/filedetails/?id=2998526012
If anybody wants to test it.
Alright. The main functionality is done (except for controllers), now to just go through and assign icons to all the actions.
how does setInfectionTime works?
when i try to change it, it just resets infectionLevel
Hello everyone, I am using (a lot) a "map" related to IsoRoom instances. That "map" is a lua table using tostring(isoRoomInstance) as key. I am wondering if I could and should use isoRoomInstance:getRoomDef():getID() as key instead. Any of you has an opinion on this ?
it calculates the infection level by the time since infection time
it randomly picks how long your infection will last based on your mortality settings and then it uses that to calculate what your infection level should be each tick
Also based on traits, ye?
no, traits don't seem to be considered
oh, sorry, no, they are
the traits are +/-25%
i wonder if i could reimplement infection too
this api's scope is ballooning a little 😅
I cant figure out this moodleframework. I got the moodle to work but im trying to make it scale from level 1 to level 4. but when I try to do that it breaks
so its only letting me start at badlevel 4 and go down to level 1
I am stuck again with running and sprinting. Both delay TimedActions. Any of you knows where that delay is handled the java code? . I insist, timed actions are played once I stop running / sprinting, when I add a TimedAction with ``` o.stopOnWalk = false;
o.stopOnRun = false;
o.stopOnAim = false;
TimedActions shouldn't be delayed if you are running/walking straight with those set, but it will if you are turning at all in my experience. The turning state seems to override everything.
I'm running straight
Hmm, strange. I guess you're right. Never noticed that. You might need to set the player's setRunning to false until you have verified your action has started (should only be like 1-2 ticks might not be noticeable). I had to do something similar in Brutal Handwork for turning so the "attack" would actually play even if turning; it locks you into place until the "StartAttack" animation event fires on animation start.
The start is called on the TimedAction, but the anim played by the timed action is not played and when I stop running/sprinting, start is played again.
Nice, I'll look into Brutal Handwork for tips then 🙂 thanx a lot
yo; what's the proper way to add a context menu option to an item in your inventory again?
For reference, this is the valid part:
function BHMeleeAttack:update()
-- we need to force the current facing direction until the animation starts
if self.lockDir then
self.character:setDirectionAngle(self.vec)
end
end
function BHMeleeAttack:animEvent(event, parameter)
if event == 'StartAttack' then
...
self.lockDir = false
...
end
end
function BHMeleeAttack:new(character, weapon, chargeDelta)
...
o.lockDir = true
o.vec = character:getDirectionAngle()
...
end
I would assume its something similar for getting the character to stop running for like 1-2 ticks using setRunning That's all it needs to get it going, then the ignores kick in.
https://pzwiki.net/wiki/Lua_Events/OnFillInventoryObjectContextMenu
Use this event, check for your item in the table of items, and use context:addOption(label, target, function, params...) for your stuff if valid.
I thought that's what I was doin'
function UIDisplayJournal_TatteredJournal.createMenu(_player, _context, _items)
local player = getSpecificPlayer(_player)
local clickedItems = _items
for _, entry in ipairs(clickedItems) do
if instanceof(entry, "InventoryItem") then
local item = entry
if item:getType() == "Journals.TatteredJournal" then
_context:addOption("Read Journal", clickedItems, UIDisplayJournal_TatteredJournal.onDisplayJournal, player, item)
end
end
end
end```
another part to note is the animation events, not sure if you've messed with those. But, the code I provided requires the following in your action xml file:
<m_EventName>StartAttack</m_EventName>
<m_Time>Start</m_Time>
<m_ParameterValue></m_ParameterValue>
</m_Events>```
Try:
if item:getFullType() == "Journals.TatteredJournal" then
Ah ! Sweet I knew it would be something dumb like that -- yeah these are modded items not base so I needed to include the module
yes, thanx. I heard (pretty recently) of anim events and use them.
Huh still didn't work. I'm at a loss. So close to getting a system down for making readable books/journals
Thanx a lot , it works* by enforcing (*with some side effects I still have to handle): ``` self.character:setIgnoreMovement(true)
self.character:setRunning(false)
self.character:setSprinting(false)
thanks
function UIDisplayJournal_TatteredJournal.createMenu(_player, _context, _items)
print("UIDisplayJournal_TatteredJournal.createMenu called")
local playerObj = getSpecificPlayer(_player)
local items = ISInventoryPane.getActualItems(_items)
for _, item in ipairs(items) do
if item:getFullType() == "Journals.TatteredJournal" then
_context:addOption("Read Journal", _items, UIDisplayJournal_TatteredJournal.onDisplayJournal, playerObj, item)
end
end
end
Events.OnFillInventoryObjectContextMenu.Add(UIDisplayJournal_TatteredJournal.createMenu);
got it working
how do we add line breaks in a string? 
<LINE> -- new line
<BR> -- new paragraph
this works only if richtext works
for plaintext i do not know solution
Any of Azerty keyboard users having their language set Autmatically to Qwerty when using PZ from time to time or is it just me pressing ALT+Shift without realising it ?
@bronze yoke, bro, you sure ZombRand(min, max) - max not include in randomizer?
yes
is there support for creating non-human non-zombie entities? like animals. (i know a future update will add animals, mostly curiosity)
there has been a dog mod, so i would say it is possible, but i wouldn't say there is 'support' really
i never looked at the code but he was working on that for a really long time
ah i see, i found what i think is the mod you were talking about and it does seem high effort
Hey guys I was wondering about one thing. What determines the loot spawns in containers on a map?
Specifically, I'm running Clear Cove and decided to attach other map mods for the heck of it, but even though I copied all files except the map file, the items don't seem to respawn in there?
Hello, any of you has an idea on where the bfalling comes from in the animation sequence in the attached picture ? This occures when I try to play a jump animation over a hole. leading to a fall as (nearly) allways in vanilla. Afaik, there is no call to setbFalling (that one is only called from ClimbDownSheetRopeState.java and ClimbSheetRopeState.java) and afaik, bFalling is never written directly.
this.setVariable("bfalling", ()->{
return this.z > 0.0F && this.fallTime > 2.0F;
});
```do animations modify the player's co-ords directly in pz? it could be triggering this
by setting fallTime to 0 iin the action update, I got rid of the setting, thanx a lot !!
oh my, with that and forcing the Z, I can fly :D. Jump is gonna be a thing
that's sick
Thank you for being so supportive and helpful.
is there a way to add properties to when characters use base game items? for example if i make a trait to make a character vegetarian, to penalize them someway with a mood penalty, or even just restrict them from eating it in the first place
The Pickaxe has a feature that makes it so, sometimes it will one-shot a zomboid
Is it possible to call for this in a different weapon?
Let's say, a long blunt
Like a Bat that has one big spike, which realistically, could also nail a head like the pickaxe does
How could that be accomplished?
im not entirely sure, but the wiki does have the code from the pickaxe that you can take a look through: https://pzwiki.net/wiki/Pick_Axe
you can also find it in the game files in the items_weapons.txt (Project Zomboid directory/media/scripts/)
o o theres also a list of parameters here: https://pzwiki.net/wiki/Scripts_guide/Item_Script_Parameters
i think specifically what your looking for is Crit chance?
I thought it would work differently in the Pickaxe, no entirely sure tho
is there a way to make a thrown item have knockback? or is it tied specifically to ranged/melee?
would it be possible to make moodles bigger?
Is there a way to add dynamically a valid square in the air in a current square ? I am currently trying (struggling) to add some object like ISBuildAction does and then call RecalcAllWithNeighbours on the grid square, but it is not clear to me what will produce neighbor square creation. Advices would be much appreciated.
it works with if not currentSquare:Is(IsoFlagType.solidfloor) then currentSquare:addFloor(''); currentSquare:RecalcAllWithNeighbours(true) end
hey guys, anyone have idea of any function where it gives you the X and Y coordinate of where your mouse is in relation to X and Y of game tile coordinate?
I know thre's Mouse.getX() and Mouse.getY() or getMouseX(), getMouseY() but these only gives the X and Y in relation to your screen.
I want game grid x and y where mouse is placed in. just like getPlayer():getX()
The reason why I want to do this is to get zombie deadbody ID below the mouse when left or key press happens
does anyone have any ideas on how I could make a custom gun use two different ammo types?
It's an assault rifle with an underbarrel shotgun.
I'm assuming i could bind a hotkey to switch between two different guns with the same models, but maybe theres a better way?
is it within the realm of possibility to make moodles bigger?
not really
the size bugs me too but moodles might actually be the least moddable thing i've looked at
you'd probably have to reimplement them entirely
thanks for the answer
convertion from display(mouse) to iso (world) ``` local xScreen1 = isoToScreenX(playerNum, isoX, isoY, isoZ);
local yScreen1 = isoToScreenY(playerNum, isoX, isoY, isoZ);
The other way around, most functions are based on the zIso of the player (isoPlayer:getZ()) ``` local xIso = IsoUtils.XToIso( xUI, yUI, zIso)
local yIso = IsoUtils.YToIso( xUI, yUI, zIso)
Oh i figured it out, I found a better solution though because if I added line breaks I ran into a different problem where the window wasn't resizing
where is xUI and yUI variable getting its float from? getMouseX and Y?
local player = getPlayer()
isoX = Mouse.getX()
isoY = Mouse.getY()
xIso = IsoUtils.XToIso( xUI, yUI, zIso)
yIso = IsoUtils.YToIso( xUI, yUI, zIso)
xScreen1 = isoToScreenX(player, isoX, isoY, 0);
yScreen1 = isoToScreenY(player, isoX, isoY, 0);
print(xScreen1)
print(yScreen1)
this produce "tried to call nil " error
for xScreen1 and yScreen1 variables