#mod_development

1 messages · Page 176 of 1

distant crow
#

I was just gonna set up a vanilla+ pack (do people in this game use such term?) for my first play through and noticed there wasn't a regeneration (the yellow explosion -> new character) one, which caught me off guard considering how people seem to deal with death in this community

#

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)

winter thunder
#

rq, anyone know a simple way to mess with happiness? Its not explicitly listed in Stats, so I assume it is named something else...?

bronze yoke
#

isn't it unhappiness?

bronze yoke
winter thunder
winter thunder
#

Unless it is morale

#

But anger and sanity are also in there, so idk if there are diff unused I shouldnt touch

bronze yoke
#

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

bronze yoke
#

iirc morale is unused

winter thunder
#

I did. There is an "unhappyness" level. but I dont know if that is equivalent to the Stats versions for editing...

bronze yoke
#

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

winter thunder
#

Love that 😅

bronze yoke
#

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

hidden jungle
#

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

bronze yoke
#

you can addOptionAfter

hidden jungle
#

how does that work? the only context menu functions i know of are addOption and addSubMenu

bronze yoke
#

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 unhappy

hidden jungle
#

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 FeelsHappyHug

tardy wren
hidden jungle
tardy wren
#

The setter for it does appear to be coded in

bronze yoke
#

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

tardy wren
#

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.

bronze yoke
#

don't use capsid

#

it's very outdated

tardy wren
#

What decompilation thing should I use then?

bronze yoke
#

decompile it normally or use beautiful-java if you want something a bit easier to read

tardy wren
#

Uh...

#

Please do elaborate

fast galleon
#

I think capsid decompile is safest right now because it includes an older decompiler, while the updated one throws errors.

bronze yoke
#

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

tardy wren
#

Ah, so I have too new Gradle, probably

bronze yoke
#

if you want the lua libraries capsid generates, candle (bundled in umbrella) is way better and doesn't need you to generate them yourself

tardy wren
#

I think I only need the Java code for what I need

#

I have the Lua libraries for development already

tardy wren
tardy wren
#

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

tardy wren
fast galleon
tardy wren
#

Okay

#

Well, I can't get it uploaded to my file comparison place

abstract raptor
tardy basin
#

Is there any way to make corpse sickness start at 1 corpse? Not seeing any options for it in the packaging

tardy wren
#

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?

neon bronze
#

Yes it calls ISInventoryPaneContextMenu:removeAllPatches

#

And passes self.chr, self.clothing, self.parts and needle

tardy wren
#

Wait, so all functions for various interactions with items are in there?

#

I can pass in any lua function into addOption, right?

neon bronze
#

Yep

#

Should work

tardy wren
#

Hmmm... Okay then

#

This is gonna be very hard

mellow frigate
#

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

fast galleon
tardy wren
#

Right, yes ,that's what I meant... Still... what I want is gonna get a little awonky

fast galleon
fast galleon
tardy wren
#

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

fast galleon
tardy wren
#

Sure is... I actually cannot do what I want with it because it's all hard-coded

#

A shame, really..

red tiger
#

Would a extension providing the same tools bother you in any way?

abstract raptor
#

Works perfectly for generating tapes

red tiger
#

I'm a very active vscode extension developer right now with PZ tools.

abstract raptor
#

I mean be my guest you can borrow the code haha

#

Might need tweaking

red tiger
#

Oh. I'd do my own code but I might reference the tool to learn the format.

#

All my work is in Typescript.

abstract raptor
#

Oh for sure

#

Ywah its a good idea though. The more access people have to tools the easier it will be to mod

red tiger
#

Working on this right now

abstract raptor
#

nice work!

red tiger
low crest
#

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

novel barn
#

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.

worthy sparrow
#

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:

drifting ore
red tiger
#

I wrote code to do just that. I have all of this in a JSON format.

#

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.

#

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.

worthy sparrow
# red tiger I'm interested to know why you want to do this.

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

red tiger
worthy sparrow
#

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

worthy sparrow
#

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.

red tiger
#

That uses an aggressive lexer. The vscode extension is a WIP on a passive lexer and linter.

red tiger
#

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.

worthy sparrow
#

Yeah, totally agree. That's why I asked first before trying to implement my own 🙂

red tiger
#

I'm very glad that you did.

worthy sparrow
#

But I was close lol

red tiger
red tiger
#

My PZ-Rosetta project does this.

worthy sparrow
#

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)

red tiger
#

At this point I guess you could say that I'm building an entire suite for modding PZ. =)

worthy sparrow
#

Definitely following this

red tiger
#

It's for everyone here to use.

worthy sparrow
#

Open-source is the way.

deft plaza
#

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

worthy sparrow
#

^ The tool here would help 🙂

red tiger
#

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.

deft plaza
red tiger
#

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.

worthy sparrow
red tiger
#

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.

deft plaza
#

how do I use it?

red tiger
#

Syntax highlighting is already implemented too btw.

#

It uses TextMate Regex.

worthy sparrow
#

I will dive into it

worthy sparrow
deft plaza
#

oh

worthy sparrow
#

soon™

crystal oar
#

what attributes does a recipe have when i find it through local recipe = getScriptManager():getRecipe(recipeName)?

#

like anything i can set?

#

name or anything?

red tiger
#

=)

crystal oar
red tiger
#

It exposes and types all the API in the modding environment.

crystal oar
#

i thought there was a link to umbrella on the modding page of the wiki, do you have a link handy?

red tiger
crystal oar
#

thank you

red tiger
#

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.

crystal oar
#

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?

red tiger
#

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.

nocturne swift
#

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?

crystal oar
#

i can browse the umbrella stuff tho in the project, not sure what i am doing wrong

red tiger
crystal oar
#

so i need to put my folder in the umbrella folder in the workspace?

red tiger
#

You need to put the umbrella folder in your workspace.

crystal oar
red tiger
#

That might be the reason.

#

I keep forgetting about this json file lol

crystal oar
#

where do i find that file?

red tiger
#

You'll see it in my root project folder.

#

I should make a template repository tbh

#

Sorry for the little technicals.

verbal yew
#

guys, how to add item in distribution.

me need industrial zones (Black zones on map)

red tiger
#

Provided it works for you, this'll expose everything you'll need for API.

crystal oar
#

now maybe i close and reopen?

red tiger
#

Yeah.

#

Point it to where your source folder is.

#

That file tells the extension where to look for lua files to digest for IntelliSense.

crystal oar
#

it says cached files 14/14, that doesn't seem right

red tiger
#

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?

crystal oar
#

i think i did that right

red tiger
#

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.

crystal oar
#

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

red tiger
#

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.

red tiger
deft plaza
#

Sorry for asking again but can someone tell me what's wrong the problem is its not showing up ingamew

bronze yoke
#

item block isn't bracketed

deft plaza
#

what do you mean?

#

item block

bronze yoke
#

the data for your item

#

it should be enclosed in these guys { }

deft plaza
#

like this?

bronze yoke
#
item MyItem
{
    
}
red tiger
#

@worthy sparrow A visual GUI editor for scripts will help this dude out.

deft plaza
#

Sorry

#

okay I know stunbaton is spelled wrong

hidden jungle
#

is there a page somewhere with all of the loot distribution categories?

deft plaza
#

is this what your looking for?

#

if not there is more distributions in /steamapps/common/ProjectZomboid/Media/lua/server/items

hidden jungle
#

sort of, i'm trying to add loot spawns for items in my mod and i want to make sure i do it right

deft plaza
#

try going here

hidden jungle
#

already am, thanks

deft plaza
#

np

hidden jungle
#

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

deft plaza
#

not sure

bronze yoke
#

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

hidden jungle
#

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

bronze yoke
#

i think it goes through the list multiple times? not really sure, never messed with a container that even has a rolls value

bronze yoke
#

you can see the actual spawnrate in lootzed

worthy sparrow
#

Ill put it on my website

red tiger
#

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.

deft plaza
#

holy crap I got it working and it was like seeing heaven

#

now I just need to correct the model and the angle

hidden jungle
bronze yoke
#

it goes in server, it doesn't really matter where else you put it

hidden jungle
#
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?
bronze yoke
#

that looks right, have you checked lootzed?

hidden jungle
#

no, what is it?

#

found it, i had a double parenthesis further down the script.
i wasnt seeing the compile error

red tiger
deft plaza
# red tiger =)

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

red tiger
#

It's literally to help people out.

deft plaza
#

oh okay

red tiger
#

You're not stealing anything. You could even make your own.

#

No disrespecting either.

deft plaza
#

what is pushback mod and knockdown mod

#

I'm looking to change the time of the zombies down

crystal oar
wet sandal
#

Its built-in to Umbrella

crystal oar
#

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" ] } ] }

deft plaza
#

anyone know

red tiger
#

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.
crystal oar
#

today is my first day using vscode, i'm a notepad++ guy

red tiger
crystal oar
#

ah perfect

deft plaza
#

what's a good spawn rate

#

I'm picking like 20s and 30s

#

like is this a good spawn rate

crystal oar
#

oh now it's loading like 1400 files

red tiger
#

That bothered me for a while.

deft plaza
#

Jab can I have your thoughts about the spawn rates?

red tiger
#

I'm a very niche modder here.

deft plaza
#

okay no problem

red tiger
wet sandal
#

Gah, luas being a weirdo

crystal oar
red tiger
wet sandal
#

Schrodinger's code coverage.

#

Code coverage fails 50% of the time to even work

#

Unless I add a break point

red tiger
#

I hate leaving people with broken tools I make.

wet sandal
#

Which causes it to work 100% of the time

red tiger
#

This PZ related?

wet sandal
#

Ye

red tiger
#

race condition?

wet sandal
#

In lua?

red tiger
#

Those suck.

#

Yeah that's what you're describing.

wet sandal
#

Hmmm

red tiger
#

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.

wet sandal
#

Hmm

#

Even observing the F11 menu once seems to be enough to make it work everytime

crystal oar
#
 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) ?

red tiger
#

Don't pass self

#

This is an artifact from EmmyLua

#

Those are Java calls.

#
recipe:setOriginalName(recipeName, starterKitName);
crystal oar
#

getting there i think, that time it didn't do what i wanted but didn't throw an error

red tiger
#

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.

crystal oar
#

ya this is rad

red tiger
#

Glad that you got it working.

wet sandal
#

Refactored where the coverage hooks occur and its Just works

#

Good enough

red tiger
#

I feel like you're writing Jest in PZ.

wet sandal
#

I'm pretty much done at this point.
Last thing is right clicking a failed test to open the error.

crystal oar
#

is it possible that setOriginalname just doesn't do what it says on the tin?

wet sandal
#

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)

crystal oar
#

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?

crystal oar
#

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?

worthy sparrow
crystal oar
#

on a plank, so technically a weapon

worthy sparrow
#

try with conditionMax=10.0

#

oh wait I think thats related to vehicles?

#

im not sure

crystal oar
#

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

worthy sparrow
#

Ohh you mean to like give it random number (condition) between 0 and X

crystal oar
#

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

worthy sparrow
#

Ah I see, yeah lua is the way here

dusky moss
#

Hey you guys know the metal gates zombies can see you through? What are those under in the building editor?

worthy sparrow
#

The fence gate?

crystal oar
#

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?

dusky moss
worthy sparrow
crystal oar
#

so something like CraftedPlank:setCondition(player:perkLevel(Carpentry)) to set it to the player's carpentry level?

dusky moss
crystal oar
dusky moss
#

Anyone know what the lines for the parking spaces is under, or is that considered grime?

crystal oar
#

CraftedPlank:setCondition(math.floor(1,player:getSkillLevel(Carpentry))) i think i'm getting there

worthy sparrow
#

Im working on something that will help you modders create items

crystal oar
#

you damn dirty modders! lol

worthy sparrow
#

lol

abstract raptor
dusky moss
#

Is there a hotkey to flip tiles in the building editor or no?

worthy sparrow
#

You just gave me an awesome idea

crystal oar
#

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

rain shard
worthy sparrow
red tiger
#

math.floor

crystal oar
abstract raptor
#

It works perf tho I am pleased with my first ever python tool

rain shard
#

now recode WordZed and you'll be a deity amongst mortals...

worthy sparrow
red tiger
#

Oh my God I actually couldn't figure out why I couldn't use string templates for a minute.. In Lua..

#

Wow..

bronze yoke
#

i think you're confusing it for something else

crystal oar
#

trying to make sure that i don't make a plank with 0 durability

#

using it like min

bronze yoke
#

you're thinking of math.max

crystal oar
#

math. max takes the largest argument?

bronze yoke
#

yeah

crystal oar
#

lol what does math.floor do?

bronze yoke
#

it rounds it down

crystal oar
#

good to know!

abstract raptor
worthy sparrow
#

Oh okay, thanks

abstract raptor
#

the colors get turned into rgb floats

crystal oar
#

and should i use player:getSkillLevel(Skill.Carpentry) or player:getPerkLevel(Perks.Woodwork)?

bronze yoke
#

perklevel

crystal oar
#

k thank you

abstract raptor
#

... Why did I get Timed Out?

worthy sparrow
#

@red tiger The ItemScript class in ZedScriptParser and all of its inheritances are up to date?

red tiger
abstract raptor
#

whatever I guess they don't like blocked formatting in the channel that uses CODE specfically lmao

red tiger
#

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.

worthy sparrow
#

It's alright, I just need all the possible properties

novel barn
# wet sandal

Seriously can't wait to see this in action. 😍 😍

red tiger
#

Just wrote this without testing it:

worthy sparrow
#

typo 🤔

red tiger
#

Ah fuck

#

I wrote that thing manually for over a week.

#

I'm cooked.

worthy sparrow
#

Gotchu

red tiger
#

Curse these bloated jointed fingers.

crystal oar
#

now back to this, recipe:setOriginalname(starterKitName) unclear why this doesn't throw an error or seemingly do anything

novel barn
#

👋 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())
red tiger
#

Tested / debugged code:

#

A working ping-pong client-server communication example.

crystal oar
#

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

red tiger
worthy sparrow
#

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

worthy sparrow
red tiger
#

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.

worthy sparrow
#

Well if it works

red tiger
#

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:

red tiger
bronze yoke
#

that is actually in the script format

crystal oar
#

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

red tiger
#

I haven't played it in many months.

red tiger
#

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.

novel barn
#

@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.

novel barn
novel barn
#

@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())
verbal yew
#

not sure

novel barn
#

yeah. /shrug

verbal yew
#

but it should be from space

#

like get inv

#

also getitembytype

#

no?

#

player:getinventory:getitembytype

bronze yoke
#

getItemsByType looks for type (internal name) not type (type)

novel barn
#

@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.

verbal yew
#

ou

novel barn
#

this is the second time I've been burned by type not being type. 😢

bronze yoke
#

i don't think so, the loop is fine

#

most scriptmanager stuff shouldn't be happening during gameplay, so the performance isn't critical

novel barn
#

Very fair point. Thanks!

tawdry solar
#

whens this out

tawdry solar
#

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

#

?

tawdry solar
#

im only adding 1 itme but my code that i posted is right?

verbal yew
tawdry solar
#

og

#

oh

#

thanks

verbal yew
#

or without imports

#

just module base

#
module Base
{
  item myItem
    {
      *stats here*
    }
}
tawdry solar
#

ty man

tardy basin
#

begging for help here with one thing

#

is there a way to make corpse sickness start at one corpse and not 5?

bronze yoke
#

not without reimplementing corpse sickness entirely

tardy basin
#

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

verbal yew
#

max numbers of holes on bodypart?

#

13?

crystal oar
#

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

bronze yoke
#

i think there's a nutrition.java

#

it could be spread throughout the character classes too though

crystal oar
#

do you know how fast a character loses weight if they eat nothing normally? is it 1 weight per day?

verbal yew
#

getActivatedMods():contains()

crystal oar
#

how do you do a += in lua? just var = var + value or is there a more elegant way?

crystal oar
#

vscode is complaining about it

worthy sparrow
#

Okay read about it, lua doesnt have that

#

Just use var = var + 2

crystal oar
#

okay that works i just feel weird not using +=

novel barn
#

yeah Lua doesn't support ++, --, +=, -=, etc

humble raft
#

Does anyone know off of the top of their head where zombies are defined in the lua?

#

Or is their logic all java-side?

neon bronze
#

All java side but you can access their IsoZombie class with lua

humble raft
#

Ah I see- thank you

earnest wigeon
#

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?

verbal yew
#

how to overwrite recipe file with mod?

verbal yew
#

BodyLocation - it's inventory slot.
BloodLocation - it's defense location.

earnest wigeon
#

Ah, I see, now this makes sense

#

For that one paticular jacket I was using BloodLocation is Shirt

earnest wigeon
#

While BodyLocation is Jacket

#

That's kinda weird

verbal yew
#

how to overwrite recipe file with mod?

mellow frigate
#

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.

fast galleon
red tiger
#

Soooooooo

#

What should I make as templates today?

#

Maybe file-reading / file-writing.

nocturne swift
#

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?

mellow frigate
mellow frigate
red tiger
#

Just made the vscode extension 'PZ-Wallet' more powerful, allowing for templates to include other templates.

worthy sparrow
#

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

red tiger
#

There's no set standard for item naming conventions.

worthy sparrow
#

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

abstract raptor
#

Heya -- guidance on making a UI system similar to notes for a "FoundJournals" series of items?

worthy sparrow
ivory gyro
tardy wren
bronze yoke
#

no, i wasn't really interested in the dedicated server

tranquil kindle
#

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`

tardy wren
#

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

bronze yoke
bronze yoke
tardy wren
#

I don't remember exactly

#

It could've been... Decompiler jank?

tranquil kindle
#

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.

bronze yoke
tardy wren
#

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...

tranquil kindle
# bronze yoke yeah, that would be my first guess

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)

worthy sparrow
# tranquil kindle I have no knowledge in it so ive been testing blindly, i want my recipe to use ...

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...

tranquil kindle
winged vortex
#

Hi sorry if this isn't the right place for this but are there any modders out there taking commissions atm?

wet sandal
#

@novel barn

novel barn
#

YESSSSSSS

crystal oar
#

i feel like a lot of neat tools for pz modders have come out recently

novel barn
#

@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.

verbal yew
#

when func a local

bronze yoke
#

doesn't matter, Item is still global

#

the world if local was default...

jaunty marten
#

I'm a bit hater of camelCase but Pascal.. bruh

bronze yoke
#

it's very unusual

novel barn
#

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.

bronze yoke
#

can't stand snake, love camel

novel barn
#

honestly I just prefer standardization over everything else.

wet sandal
novel barn
verbal yew
#

BodyLocation - it's inventory slot.

#

emm...

fading horizon
#

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?\

fading horizon
#

That's perfect, thank you so much

tardy wren
grave fractal
#

What does GUID mean?

neon bronze
#

The id the game assigns to each item to distinguish from each other

#

You can generate one online

grave fractal
#

alright, thanks

mellow frigate
grave fractal
#

what could be causing my model to come out crooked like this?

peak shell
#

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

worthy sparrow
peak shell
peak shell
#

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?

worthy sparrow
#

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

peak shell
#

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

storm finch
#

How hard would it be to learn to make mods for zomboid? I don't know anything about coding

worthy sparrow
#

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.

loud python
#

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?

verbal yew
#

to the part where coding begins in conjunction with the C

#

after Zomboid API on PZ wiki / moding

fast galleon
#

Are headphone types hardcoded in java? <.<

worthy sparrow
#

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)

proven raptor
#

Hello! Is there any modder capable of making vehicles, specifically, that are open to commissions?

verbal yew
#

guys, help me to inject into the function

#

function ISHealthBodyPartListBox:doDrawItem(y, item, alt)

low crest
#

Hello! I'm looking for someone who can help me create a custom power generator in LUA. Im offering payment for the job

bronze yoke
#

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

bronze sand
#

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

bronze yoke
#

i haven't seen it done but it looks possible to me

#

it would require lua and not just recipe scripts though

bronze sand
#

Someone must have an idea

verbal yew
#

function MyLuaFunc
cheking stuff
end

#

in stuff we can add sandbox var

#

done

neon hedge
#

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

bronze yoke
#

you can get the infection level of a character with IsoGameCharacter:getBodyDamage():getInfectionLevel()

verbal yew
bronze yoke
#

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

bronze yoke
#

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

verbal yew
bronze yoke
#

sounds janky

verbal yew
#

That's why I'm a work-arounder xD

novel barn
#

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?

verbal yew
#

getCapacityWeight()?

novel barn
#

Those are both exposed in the itemContainer object. The objects I'm getting don't inherit from there.

worthy sparrow
bronze yoke
#

yeah, unfortunately not all properties are exposed on the script

#

you can create an instance with InventoryItemFactory

novel barn
#

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 🤦‍♂️

bronze yoke
#

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)

novel barn
worthy sparrow
# worthy sparrow You have to get InventoryItem then getItemCapacity()

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

novel barn
bronze yoke
#

InstanceItem(String param) param???

worthy sparrow
#

np 🙂

bronze yoke
#

that is the most confusing name that variable could possibly have

worthy sparrow
#

i didn't come up with it 😄

bronze yoke
#

i'll go check the source

worthy sparrow
bronze yoke
#

i want to know what that's supposed to mean

#

if you want to instance items i'd stick to inventoryitemfactory

novel barn
#

yeah... InstanceItem isn't written very intuitively... also my instanced item returned a capacity of -1. :/

bronze yoke
#

it seems to set the colour of the item, i'm unclear of the actual syntax though

worthy sparrow
#

maybe the param is wrong

bronze yoke
#

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

worthy sparrow
#

what the...

novel barn
#

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
bronze yoke
#

can you try getMaxCapacity()?

novel barn
#

also -1 😒

bronze yoke
#

who knows what these do

novel barn
#

fuck me. :getCapacity() works. Successfully returned 18.

#

but I could do the same with inventoryitemfactory in less lines

bronze yoke
#

i wonder if one is more performant than the other

novel barn
#

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.

worthy sparrow
bronze yoke
#

in the end the factory just calls instanceitem and does a few extra things that don't seem important for you

novel barn
#

so technically I'm using instanceitem either way 😂

bronze yoke
#

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

novel barn
#

I'll just use instanceitem then.

#

Thank you both!

bronze yoke
#

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

novel barn
worthy sparrow
#

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

novel barn
worthy sparrow
#

According to my handy cheat sheet there are 28 deprecated fields

bronze yoke
novel barn
bronze sand
#

But does it work on servers?

#

Like, can the server admin change the recipe for all players?

bronze yoke
#

oh sorry, i meant editing the recipe object automatically in lua

#

server-side file changes are no good

bronze sand
#

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?

bronze yoke
#

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

bronze sand
#

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

novel barn
bronze sand
#

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,
}```
novel barn
#

so the gist of what you want to do is either remove that recipe, or add a carpentry level requirement?

bronze sand
#

With a low Woodwork requirement

bronze sand
bronze yoke
#

woodwork is carpentry

bronze sand
#

Yeah

novel barn
#

did you find your bug? 🙂

bronze yoke
#

not all of the perks' internal names match their english names

bronze sand
#

Anyway, level 4 seems pretty cheap for what's essentially unlimited Baseball Bats

bronze yoke
#

yeah logs are not exactly a limited resource

bronze sand
#

You can't even put together a decent chair until like level 7

bronze yoke
#

carpentry skill is always going to be an awful balancing tool when it's so easy to level

novel barn
#

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

bronze yoke
#

you'd need to rewrite it to work for recipes

novel barn
#

Ohh good point. In my excitement to be helpful I failed to realize this is for items and not recipes.

bronze yoke
#

i should probably get around to actually writing the mod i needed to write StatsAPI to support 😅

novel barn
#

@bronze yoke I don't know how you get ANYTHING done with how often you're answering questions here.

bronze yoke
#

most of the questions here are very easy to answer

novel barn
#

I aspire to reach this level of understanding and clarity. Catch me here in 3 years knowing what's up.

bronze yoke
#

LOL i've only been at it for about half that

novel barn
#

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

bronze yoke
#

D:

#

i'm surprised you got so much mileage out of it

novel barn
#

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()

bronze yoke
#

are you checking the right directory?

novel barn
#

I (probably foolishly) thought it would appear in the same directory as the file that called it. I might be having another silly moment.

bronze yoke
#

it appears in Zomboid/Lua/

novel barn
#

Yup. There it is. :/

bronze yoke
#

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

novel barn
#

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. 🙃

bronze yoke
#

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

novel barn
hasty horizon
#

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?

novel barn
#

recipe name might need to be one word

bronze yoke
#

surprisingly no

#

i see this very often caused by the result item being unable to be found, but i think Base.Machete is correct...?

hasty horizon
#

ill try that real quick

bronze yoke
#

you shouldn't need to include the Base. part since you imported base but idk that's the most common cause

hasty horizon
#

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,
}

}

novel barn
#

what error is the console spitting out at you?

hasty horizon
#

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

novel barn
hasty horizon
#

idk if you need me to scroll down the stacktrace

novel barn
#

if you don't mind. I suspect it's the same error but it might be different. that log sorts oldest to newest

hasty horizon
bronze yoke
#

the getFullType is the classic 'can't find result' error

hasty horizon
#

wait does it need to be result= or result:

bronze yoke
#

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

novel barn
#

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.

hasty horizon
#

this the right one?

novel barn
#

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.

bronze yoke
hasty horizon
#

no no, its 'tatersMod items.txt'

bronze yoke
#

ok good

hasty horizon
#

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?

bronze yoke
#

it definitely hates your items then

hasty horizon
#

sounds like my code alright lmao

#

when i code in java intellij carries me

bronze yoke
#

intellij my beloved

hasty horizon
#

ill try seeing

#

if removing my items

#

makes the recipe work

#

nope, it do be the recipe

novel barn
#

@hasty horizon I'm pulling your code into a mod to test it myself. See if I can get it working.

hasty horizon
#

this is all the code rn, and the path of where the files are

#

could it be my syntax?

novel barn
#

@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.

bronze yoke
#

the file is definitely loading so it should be fine

#

it's not something i've seen before though

hasty horizon
novel barn
#

this thing is cursed

#

I'm still working on it

hasty horizon
#

idk why its being difficult either looking at the fwolfes github page, and some workshop mods i had downloaded

bronze yoke
#

it does look correct to me

hasty horizon
#

hmm, is it important if i use a space or a tab

novel barn
#

no

hasty horizon
#

ok i was thinking "maybe notepad translates 4 spaces and tabs differently" for a second

novel barn
#

THAT would be fun 😮

bronze yoke
#

all the whitespace gets nuked before parsing, it's just for looks

hasty horizon
#

good to know

#

at least i know im not crazy in all this tho

novel barn
#

got it. capitalize the R in Result

bronze yoke
#

seriously? that's the one thing that's case sensitive??

novel barn
#

I tried EVERYTHING else

#

I spent about 10 minutes on commas alone

hasty horizon
#

aaaa thank you lmao

#

now to readd what i had before trying to debug

#

i appreciate the help!

novel barn
#

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

hasty horizon
#

i just tried it with the R, it do work

novel barn
#

I was trying Module Base {}, commas, adding different parameters

#

awesome :spongebob_phew: I'mma take my dog for a short walk to celebrate.

hasty horizon
#

give em a treat they deserve it

novel barn
#

I finally helped someone in here instead of begging for help 🙂

hasty horizon
#

big mood

crystal oar
hasty horizon
#

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,

novel barn
#

try Category:Welding,?

hasty horizon
#

ye that worked

hasty horizon
#

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

bronze yoke
#

in ProceduralDistributions.lua you can see all of the game's distributions

hasty horizon
#

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?

bronze yoke
#

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

hasty horizon
#

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

bronze yoke
#

the server/shared/client placement does matter

#

but other than that it's just organisational really

hasty horizon
#

im guessing that server has prescendence over shared, then shared has prescendence over client?

bronze yoke
#

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

hasty horizon
#

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

hasty horizon
#

if im understanding correctly

bronze yoke
#

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

hasty horizon
#

so that would be a situation to run a shared file after server than before then i think? neat

tardy wren
#

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

tardy wren
#

I have no access

tardy wren
#

Oh, by Albion...

#

I was about to ask why nobody is running it, then saw the release date...

#

Yeah, yesterday

plain crane
#

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?

worthy sparrow
plain crane
sharp minnow
#

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?

undone tapir
#

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?

deft plaza
#

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

neon hedge
#

Hey guys, how do i change infectionLevel?

bronze yoke
#

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

neon hedge
#

sad

tardy wren
neon hedge
#

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

tardy wren
#

Which mod are you referencing?

neon hedge
#

antiserum hardcore

tardy wren
#

Hrmm... Have you looked at Dr. Hyde's ?

neon hedge
#

not yet

#

i can check it

worthy sparrow
deft plaza
#

maybe just the zombie kill give moodlet part

tame mulch
deft plaza
#

oh I see

bronze yoke
deft plaza
tame mulch
deft plaza
#

like this
require "MF_ISMoodle"
MF.createMoodle(*);
I don't even get it am I supposed to change MF

undone tapir
#

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?

hasty horizon
undone tapir
#

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

dark wedge
undone tapir
#

Oh my god thank you

#

Google was returning the most unhelpful links thank you so much

undone tapir
dark wedge
undone tapir
#

Awesome tyvm

dark wedge
#

Alright. The main functionality is done (except for controllers), now to just go through and assign icons to all the actions.

neon hedge
#

how does setInfectionTime works?
when i try to change it, it just resets infectionLevel

mellow frigate
#

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 ?

bronze yoke
#

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

tardy wren
#

Also based on traits, ye?

bronze yoke
#

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 😅

autumn temple
#

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

mellow frigate
#

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;

dark wedge
dark wedge
# mellow frigate 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.

mellow frigate
mellow frigate
abstract raptor
#

yo; what's the proper way to add a context menu option to an item in your inventory again?

dark wedge
# mellow frigate Nice, I'll look into Brutal Handwork for tips then 🙂 thanx a lot

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.

dark wedge
abstract raptor
#

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```
dark wedge
dark wedge
abstract raptor
#

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

mellow frigate
abstract raptor
#

Huh still didn't work. I'm at a loss. So close to getting a system down for making readable books/journals

mellow frigate
abstract raptor
#
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? thonk

mild venture
#

this works only if richtext works

#

for plaintext i do not know solution

mellow frigate
#

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 ?

verbal yew
#

@bronze yoke, bro, you sure ZombRand(min, max) - max not include in randomizer?

bronze yoke
#

yes

hasty horizon
#

is there support for creating non-human non-zombie entities? like animals. (i know a future update will add animals, mostly curiosity)

bronze yoke
#

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

hasty horizon
#

ah i see, i found what i think is the mod you were talking about and it does seem high effort

abstract raptor
plain crane
#

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?

mellow frigate
#

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.

bronze yoke
#
        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
mellow frigate
#

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

bronze yoke
#

that's sick

mellow frigate
hasty horizon
#

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

bronze sand
#

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?

hasty horizon
#

you can also find it in the game files in the items_weapons.txt (Project Zomboid directory/media/scripts/)

hasty horizon
#

i think specifically what your looking for is Crit chance?

bronze sand
#

I thought it would work differently in the Pickaxe, no entirely sure tho

hasty horizon
#

is there a way to make a thrown item have knockback? or is it tied specifically to ranged/melee?

abstract raptor
crystal oar
#

would it be possible to make moodles bigger?

mellow frigate
#

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.

mellow frigate
#

it works with if not currentSquare:Is(IsoFlagType.solidfloor) then currentSquare:addFloor(''); currentSquare:RecalcAllWithNeighbours(true) end

open drum
#

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

fading horizon
#

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?

fading horizon
#

finally getting back to working on this. Made my first gun

crystal oar
#

is it within the realm of possibility to make moodles bigger?

bronze yoke
#

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

crystal oar
#

thanks for the answer

mellow frigate
#

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)

abstract raptor
#

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

open drum
#
       
       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