#mod_development

1 messages · Page 266 of 1

deft vapor
#

could anyone help me? i can’t make a map on my device but id someone could upload a standalone map (either empty or we could work tg to finish it) or something for me

night iron
#

does anyone here ever used the steam deadicated PZ server?

ancient grail
#

the circle but i modify the radius on tick

ancient grail
#

omg the math

night iron
#

can someone help me figure out why my local dedicated server fails to lunch when i add some mods to the server.ini?

LOG  : General     , 1729009340017> 568,311,756> Workshop: onItemQueryCompleted handle=1 numResult=84
LOG  : General     , 1729009340023> 568,311,762> Workshop: GetItemState()=NeedsUpdate ID=2694448564
LOG  : General     , 1729009340025> 568,311,765> Workshop: item state CheckItemState -> DownloadPending ID=2694448564
LOG  : General     , 1729009340060> 568,311,799> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG  : General     , 1729009340063> 568,311,802> Workshop: download 0/0 ID=2694448564
LOG  : General     , 1729009340164> 568,311,903> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG  : General     , 1729009340165> 568,311,904> Workshop: download 0/0 ID=2694448564
LOG  : General     , 1729009340266> 568,312,005> Workshop: DownloadPending GetItemState()=NeedsUpdate|DownloadPending ID=2694448564
LOG  : General     , 1729009340267> 568,312,006> Workshop: download 0/0 ID=2694448564
LOG  : General     , 1729009340302> 568,312,041> Workshop: onItemNotDownloaded itemID=2694448564 result=2
LOG  : General     , 1729009340302> 568,312,042> Workshop: item state DownloadPending -> Fail ID=2694448564
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'CFileWriterThread'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'CFileWriterThread'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x00007FF99D741B60/0x000'
src\tier0\threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x00007FF99D741B60/0x000'
bronze yoke
#

is the mod private?

night iron
#

it feels like it's failing to save the file but i tried running this as an admin and still wont work

#

it's the same mods i have installed in my client and on my gportal dedicated server

#

trying to setup a local version to debug why i get that weird black screen when adding my mod to it

#

this is the steam version of the dedicated server, nothing changes regardless of running it through the steam luncher, or executing the bats directly from windows without or without admin priveledges

night iron
#

if anyone else runs into this issue there is a steam_appid.txt in the dedicated server folder which is corrupted

#

just edit it in notepad and put in PZ steam id of 108600

wet sandal
#

What did Steam do to the workshop front page?

#

The mods showing in the carousel are ancient (compared to my expectations).

drifting ore
#

Hello! Is there anyone who is very knowledgeable about mods? I need to communicate with such a person in private messages if he is willing to give me time. I have a small mod (not mine) that people say causes errors in saves. I tried to fix it, but I need someone to be able to look at it and draw conclusions

night iron
#

only reason i can think for a mod to mess with saves is if either messes with ModData or removes Item defenitions somehow, but i'm no expert here

#

ok i figured out the file that causes my stuck in black screen while loading when using my new mod in multiplayer....

#

it's my recipes file that suppresses existing vanilla and other mod recipes

#
module Base {
    recipe Make Stone Axe {
        IsHidden:true,
        Override:true
    }

    (...)
}
#

if i remove this file from both the client and server then it loads just fine anyone has any idea why this happens?

peak nymph
bronze yoke
#

i'd go for```Override:true,
Obsolete:true,

#

i'm not sure just setting hidden is enough (and some popular mods ignore it lol)

night iron
small topaz
#

not sure if this is the right channel to ask but has steam recently changed how the workshop can be searched?

until recently, when I checked for mods with setting "most popular" and time period "one week", steam apparently showed me all mods which have been popular during the last week. this almost exclusively included new mods.

since a few days, steam seems to show me simply the mods which are most popular all time (I see stuff like skill recovery journal, noir's attachments etc., all the old classics).

anyone else with this experience? maybe steam is just bugged at the moment?

small topaz
wet sandal
#

Yeah, the new ranking is cooked

small topaz
#

hope they bring the old system back soon. impossible to find new interesting mods currently.

quiet fulcrum
#

is IsoGameCharacter.die() the only place that creates a dead body when a character dies? And subsequently, does this mean that deaths are only triggered when in the PlayerOnGroundState?

winter bolt
wet sandal
#

Yea, I'm hoping its a bug, not a feature

winter bolt
#

praying its just a mistake because theres no way valve would make a change this terrible

chrome veldt
chrome veldt
#

I'm still working on optimizing it and fine tuning the flickering room chance

hallow prairie
#

Hello good night everyone ✌
Excuse me, I am looking for a group of modders who may be looking for more members for the team 😄 I have some years of experience in Blender.I would like to contribute my grain of sand to the game and his community. I enjoy a lot the game and could be awesome to continue polishing my 3D skills while working on the game

silk raven
#

I provide a comprehensive 3D character creation package, covering everything from advanced sculpting and detailed modeling to rigging and lifelike animation.

Utilizing the latest industry software, I ensure your characters are visually stunning and move seamlessly, whether for film, games, or interactive projects.

My focus on realistic texturing and optimized performance ensures your characters are platform-ready, tailored to your specific needs.

Let’s bring your vision to life!

hallow prairie
haughty fiber
#

Are there any highly-skilled Modders out there, who love both Project Zomboid AND Shadowrun / Cyberpunk?

If so, hit me up! I'll be reposting this question often, really want to create a 'Shadowrunner' type of PZ Server...!

bright fog
haughty fiber
#

what's the modding discord?

bright fog
#

Even if it says unknown

tame lily
#

guys

#

where are item icons stored?

#

are they stored in IconsMoveables.pack?

#

if so, how do i open the .pack file

bronze yoke
#

most of them are in UI2, some older ones are in UI, the ones for moveables are probably in IconsMoveables

#

you can open a pack with tilezed

tame lily
#

where might this TileZed be?

bronze yoke
#

spongies mentioned how to do this the other day

winter bolt
winter bolt
#

deja vu

bronze yoke
#

🙇‍♀️

tame lily
#

thanks for this

grizzled marsh
#

finally I found out this channel

grizzled marsh
#

Guys, if I just assign a .ogg file with the same name as the id of a line of WordZed, will it work?

rare mango
#

I wanna make a mod that alters a zombie's clothes, but have zero idea how to even go about this. Any ideas?

uneven ore
#

Is there any way to send http POST requests through Lua?

vagrant ledge
#

Just kidding! Found it.

tame lily
#

dudes

#

where might there be a list of the loot tables?

uneven ore
chrome veldt
uneven ore
chrome veldt
uneven ore
tame lily
#

i wanna know if it's possible to have some books spawn only in certain bookshelves

#

like survivor house bookshelves

#

but not bookstore shelves

chrome veldt
#

Variable and function names might need a rework I agree, I kinda let this project dust so tbh

uneven ore
chrome veldt
#

You could replace x by the message

uneven ore
chrome veldt
#

And the encodedGETRequest will chain all the field in the data table to construct a string like ?x=x&y=y&whatever=whatever&message=message

#

the 'x' doesn't really matter, it's just an example
You could do

    message = yourMessage
}```
uneven ore
#

alright, where would i put the webhook url?

chrome veldt
#
local function sendData(rawData)
    local data = {
        playersOnline=rawData.playersOnline, -- lets say 3
        worldAge=rawData.worldAge, -- lets say 24
    }
    local dataSuccess, encodedData = pcall(encodeGETRequest, data)
    ...
}

Here, encoded data would be ?playersOnline=3&worldAge=24

#

If you have different endpoints you might want to change it a little bit but, in the example, it's the second argument of this pcall function
local request = pcall(sendPostRequest, 'https://example.com/my-route', encodedData)

#

Mind you, I don't know if it'd work with discord. You might need a middleware

chrome veldt
ancient grail
chrome veldt
#

Huh, interesting, can’t think of a good use case but that’s nice. I don’t think that’s what @uneven ore is looking for however.

uneven ore
grizzled fulcrum
#

tl;dr it can't

ancient grail
drifting ore
#

Good afternoon! I will pay money to a person from Russia (unfortunately, I cannot transfer money outside the country) who can make an adequate version of the mod. I need someone with more experience working with mods for Project Zomboid. It is necessary to have successful work in the Steam workshop and provide proof that you are the author.
It is advisable to have experience working with vehicles, their modification and understanding how they are initialized in the game.
Write to me in private messages if you think you are suitable for the task. My mod will need to be finalized and supplemented, it is very small, but there are some problems. First, I will demonstrate it, we will discuss some points and decide whether it makes sense to redo it.

neon kiln
#

I want to get into Modding PZ. Is there a quick-start guide? I've never coded in LUA, but it seems similar to Ruby based on what I've seen. What IDEs' work best? How do I get access to all the PZ files?

digital basin
#

W Patrick youtube video gets you a good start on where to find things and how to upload

digital basin
winter bolt
#

i just use notepad++ lmao

bronze yoke
#

most people would recommend vscode

#

it has the best lua support out of any ide really and there's a lot of pz-specific tools developed for it

digital basin
#

I use vscode, but if changing a name in bulk i use ++

#

i find the replace just easier and nicer to look at

stable marsh
#

I am stuck; I'm trying to add sandbox options, even followed albion's guide. I have exactly the same and it just is not showing up in solo sandbox options

#

Do I need anything else other than the sandbox-options.txt and the Sandbox_EN.txt files for them to start showing up in the sandbox options menu?

red tiger
#

I write integration software for modding pz in vscode.

bronze yoke
#

you should only need the sandbox-options.txt to at least see them

stable marsh
#

Literally copy-pasted from your guide:

VERSION = 1,

option sapphcookingnebulafixes.Name {
    type = KEEP READING,
    numValues = 3,
    default = 1,
    page = MyPage,
    translation = sapphcookingnebulafixes_OptionName,
    valueTranslation = sapphcookingnebulafixes_OptionName_Values,
}```
#

Not exactly like that but yeah

grizzled fulcrum
grizzled fulcrum
#

you mean enum -_-

bronze yoke
#

type = should be the type of your option, i see that's not exactly clear in my guide

grizzled fulcrum
#

maybe you should put a disclaimer saying that the code provided is not universal or something lol

stable marsh
#

I've tried renewing the file 3 times with all correct stuff

grizzled fulcrum
#

huh

#

is that literally everything in the sandbox options file?

stable marsh
#

Refuses to show up, not a single type works

#

Yup

bronze yoke
#

is it in the right place? media/sandbox-options.txt

stable marsh
#

I'm basically just retrying until it magically works again like how it can be with programming at times

grizzled fulcrum
balmy swan
#

Would someone be so nice to help me with a sendservercommand problem that I'm having? I'm testing the following on a dedicated server:

I have a function on the server that grabs a player and runs
sendServerCommand(player, "testmodule", "test", nil)

and i have the following client function

local function HandleServerCommand(module, command, args)
    if module ~= "testmodule" then return end
    if command == "test" then
        print("Test")
    end
end
Events.OnServerCommand.Add(HandleServerCommand)

Instead of the function being called, I'm being kicked for a malformed packet. According to the API this should be correct, what could be wrong here?

bronze yoke
#

you passed nil instead of an args table

#

if you have no arguments pass an empty table

red tiger
balmy swan
#

Huh. Thought nil would work there. Let me try that out real quick.

bronze yoke
#

this actually does come out as nil on the other end which is nothing but annoying

red tiger
#

2-arg version??

bronze yoke
#

no such thing, though number of arguments is used for overload resolution so passing nil would still be invalid

grizzled fulcrum
stable marsh
grizzled fulcrum
#

I've seen some people forget to load the mod and then spend an absurd amount of time trying to fix a non-existent issue

grizzled fulcrum
stable marsh
grizzled fulcrum
#

turn it off and turn it back on 🙏

balmy swan
#

Nope. setting it to {} rather than nil gives me the same issue

grizzled fulcrum
#

by chance, does the start of the function get executed before the kick?

bronze yoke
#

that's really unusual

stable marsh
#

I'm fr just gonna restart everything in the hopes it magically works

balmy swan
#

The function on the client side doesn't run, there's no 'test' log being printed

grizzled fulcrum
#

dont even worry about translations lol

bronze yoke
#

oh if your mod is on the workshop already unsubscribe from it

#

for some reason sandbox options in particular really struggle when you have two copies of the mod

grizzled fulcrum
#

i hope that's the issue from their perspective lol

bronze yoke
#

most things will prefer the local copy but sandbox options seem to prefer the workshop one

bronze yoke
grizzled fulcrum
#

I feel like the malformed packet thing could be the underlying reason

#

as in it's a symptom

bronze yoke
#

yeah, i've never ever seen commands cause that so it has to be something weird

stable marsh
balmy swan
grizzled fulcrum
#

anything in the log when you get kicked?

bronze yoke
#

the server folder runs on the client, in fact most of the vanilla code in there is exclusively client code

#

the only way to ensure your code only runs on the server is to include a check for it in the file (usually if isClient() then return end at the start of the file)

#

if you're successfully checking the player's inventory that confirms your code is running on the client as player inventories aren't replicated to the server

grizzled fulcrum
#

you should get a stack trace when the game kicks you hopefully

balmy swan
#

Huh. That's odd. I thought it ran on the server side only, as the server function outputted the print in console rather than in player console. It's good to know that my thought process on that was wrong, at least 😅
I'll have to try with the if isClient() then return end that you mentioned

grizzled fulcrum
#

if not then 😰

balmy swan
#

Give me just a second, because I did already close the server

stable marsh
bronze yoke
#

yeah, i'm only really trying common pitfalls here, to my knowledge calling sendServerCommand on the client doesn't cause a kick (or do literally anything)

grizzled fulcrum
#

I have had sending commands cause kicks before, but it was almost always because of something pretty bad happening that it kicks you

bronze yoke
grizzled fulcrum
#

you shouldn't get any kick after changing from nil to empty table after looking at it more

bronze yoke
#

double checking myself it does seem like nil is valid after all

grizzled fulcrum
#

in that case surely there's a stack trace in teh console

balmy swan
stable marsh
#

I don't understand this anymore ded I just changed the sandbox-options.txt to EXACTLY what I had before, and it does work in a completely new clean mod folder....

#

Wait I just had a thought, I'm going to test something

#

Life of a developer in a nutshell I guess - stuff just magically decides to work sometimes and vise verse

balmy swan
#

Okay, I got it working- I think. Apparently you can't check the inventories from the server side. Thank you for your help.

bronze yoke
#

my best advice on how networking works in this game is that it's generally best to assume things are client only

#

especially if it would be a security issue 😭

balmy swan
#

That's fair! I've always been terrible at networking, and it would've been great if this could have been done from the server side to prevent potential tampering 🙂

bronze yoke
#

i genuinely would not even think about security with mod development

#

cheaters are essentially omnipotent already

balmy swan
#

Ahhh. Fair, fair. Gotcha.

stable marsh
#

@bronze yoke @grizzled fulcrum I found the solution

#

And why it didn't work-

#

When testing the mod on my own system, I have my mod in the C:\Users\%UserName%\Zomboid\mods folder. HOWEVER, when I had to upload it to the workshop, I had to put it in C:\Users\%UserName%\Zomboid\Workshop as well,

Apparently, they both need to have exactly the same files, for sandbox-options.txt to work........

bronze yoke
#

yeah, always make absolute sure you only have one copy of your mod when you're working on it

#

sandbox options in particular are a pain in the ass about this but it can cause issues with other systems too

stable marsh
bronze yoke
#

no, you can just use the one in workshop

stable marsh
#

That f explains

#

I did not know that XD

bronze yoke
#

i usually start in mods and move to workshop when i'm ready to upload (deleting the one in mods when i do), others will prefer to work from workshop from the start

stable marsh
grizzled fulcrum
#

i got a github folder like c:\github and all my mods in there I symlink to my zomboid dir at c:\dev\zomboid\mods

#

so I change it in github foflder and it updates

#

then I have a python script to generate the dist files, and the dist folder it outputs is symlinked to the workshop folder like c:\github\AoqiaZomboidUtils\dist\ <-> c:\dev\zomboid\workshop\AoqiaZomboidUtils\

bronze yoke
#

one day i'll get around to writing an upload script so i don't have to touch that workshop folder

grizzled fulcrum
#

well the python script doesn't matter that much

#

I only use it to remove not needed files before I upload to the workshop like the git stuff, docs if any, resource project files like psd and blend (they are still in the repo, just not in the steam workshop version)

#

so the file size isn't too big 😄

#

but I don't have a way to auto upload it without opening the game, I still have to do that manually lol

bronze yoke
#

i think the formats you need to set things up in for in-game upload are kinda gross and i'd like to automate version numbers and not have to manually convert my changelogs between github and steam

grizzled fulcrum
#

wdym convert changelogs between github and steam

#

I just copy my changelog.md over to the changelog box when uploading

bronze yoke
#

the formatting for each is totally different, i don't know what yours usually look like but i have to redo it all and i literally just do headings and bullet points

grizzled fulcrum
#

Then I just copy the markdown to the changelog box and remove the heading #'s

#

I don't really try to format them nicely to look good on steam because they're changelogs

#

as long as you can read it, that's good enough for me lol

warped ginkgo
bronze yoke
#

there should also be an extension called zedscript which adds some limited support for script files

warped ginkgo
#

Tysm i saw sumneko was high up, will try now Spiggo

#

ohhh typings drunk thank god

#

i was just wondering if lua had a typing/interface system lol

quiet fulcrum
#

how/where does PlayerOnGroundState get set?

#

I mean how/where does it get triggered

uneven ore
dull moss
#

tbh i never knew other option existed KEKL

stable marsh
chrome veldt
#

You could, in theory, convert a table into a stringified JSON (basically replacing my encoding function) and send like I do, then parse it afterward. But again, I'm not sure you can do it directly through discord, maybe you could setup a cloud functions to act a middleware

ancient grail
#

should work with tile making too cuz the png should be saved on both a folder for the mod then x2 folder
then needs to be transferred to the mod itself

ancient grail
#

my latest mod is broken
i cant seem to spawn a water barrel that functions

#

ive done

item script  spawn via recipe result
item script  spawn via  oncreate
contextmenu spawn client side
lua  spawn moveable item
lua spawn the tile itself using 3 different methods
fleet bridge
#

Water barrel is a special object isn't it?

ancient grail
#

ye global object

#

im gona try and use the build menus function that should work

#

i just dont know how to add options onto submenus after using getOptionByName or something like that

ancient grail
#

figured it out this way but i cant seem to insert it within the build menu owell

coarse sinew
#

Changing the name field of the RainCollectorBarrel object breaks the global object system, it should be the same as vanilla, like "Rain Collector" or something like that, because it's hardcoded. In BM I solved this problem and you can insert objects that collect water with different names, there is a guide on the project github on how to make addons.

ancient grail
#

i didnt change the name i only changed the context menu option

quiet fulcrum
#

just bumping this again in case somebody has an answer:
is IsoGameCharacter.die() the only place that creates a dead body when a character dies? And subsequently, does this mean that player deaths are only triggered from the PlayerOnGroundState? If so, anyone know if there's a way to jump in with lua just before PlayerOnGroundState.execute?

ancient grail
#

getPlayer():kill(getPlayer()

ancient grail
ancient grail
rare mango
#

Any idea how I can make a mod where I can alter a zombies clothing when it spawns?

quiet fulcrum
#

the best way would be to increase health just before so isDead() is false

#

but I need my lua code to jump in just before that and I'm not sure what the closest event is

topaz tangle
#

Added new models to my mod :3

magic eagle
#

I am trying to connect to my reinforcement learning model. Is there an API that can simulate keyboard control in the game? For example, is there an API that can directly pass in movement commands such as WASD (rather than directly using Lua to set the player's coordinates to teleport)?

#

😀

ancient grail
quiet fulcrum
ancient grail
#

might still work

local hook = die
function die(...)
end
#

idk

#

worth a shot.
it worked for print atleast

rich reef
#

Hello everyone. I have a quick question or two that I hope someone can answer for me.

First off:

I am creating a simple mod for Halloween that has some treat bags. I've made the bags, a few variants of them, and got the models to work on player/on ground as they should. All is well there. What I plan on doing though, is having the bags drop off of zombies, which I already know how to accomplish with distributions. But those bags I want to include a bunch of treats/candies/etc when they are found.

It seems I need to setup the distribution list for the bags, and include the items in those separately, but after a bunch of digging I just can't seem to find a good example of how to achieve this easily.

I am wondering how I can reference the bag/item by name within a distribution list, specifically. My items are not set to use the Base. prefix, and instead use the Mod-ID prefix to keep them from conflicting with other mods.

I've seen a few suggestions of making a list/table of the containers/items first, and then iterating through a loop to add them one by one, item by item, bag by bag to the distribution list, which seems the most efficient, since I have (13) variants of these treat bags, and I would prefer to make one list of items to include for all 13 bags, instead of 13 gigantic distribution lists.

Hopefully this is making sense, and someone can help me.

Also, one more question:

In regards to having items spawn into the game, will a distribution list still function if a mod isn't loaded that it's requesting items from, but continue to spawn other items without crashing?

I'd like to have all the base game/vanilla items spawn, as well as some of the items from a few of the very popular food/snack mods that are working. I think this would be cool to let people use the mod without it absolutely requiring those other mods to function at a base level.

Thank you to anyone that can help!

quiet fulcrum
mortal fable
#

Can someone please point me in the right direction to start learning how to make mods for PZ? Sorry if it’s already been posted/mentioned. Thank you in advance

bright fog
#

I'm pretty sure it doesn't sadly

#

I believe I tried to use that a few weeks ago to kill the player and play the death animation instead of instantly dying

grizzled fulcrum
#

So calls from Java to die() will not call your hooked function, only lua code that calls die() will use your hooked code

ancient grail
#

i see good to know

bright fog
#

Like attack

#

Which aren't decorations

grizzled fulcrum
#

but does that require some other method or is it just the same as normal?

bright fog
#

It's something completely different

#

I'm trying to find it again

#

Was albion who shared it to me a while ago

#

tho that doesn't explain what these are here

#

Might be that

#

Was when she mentioned it

grizzled fulcrum
#

I think LuaHookManager is for handling event callbacks on the Java side

bright fog
#

But it's good to know that it exists anyway

grizzled fulcrum
#

ill add support for it but rn just got bigger fish to fry

bronze yoke
#

the thing with Hook hooks is they aren't even hooks

#

they're like. the opposite of a hook

#

if you add a hook your code runs instead of some specific java code

#

this makes them essentially useless unless you actually want to e.g. reimplement the entire combat system in lua (which is what most hooks do)

grizzled fulcrum
#

oh so instead of hooking before/after orig it just replaces it? ;-;

fossil basin
#

Hello guys, I'm very far from modding Zomboid, but I have a low poly model that I would like to add to the game. I would like the character's body from the game to be replaced with the body of my model, is this somehow possible to implement? Maybe there is some kind of guide? I hear that custom characters can be added like costume

grizzled fulcrum
#

that is possible, but you might want to also ask in #modeling too

fossil basin
#

ok thx

vagrant matrix
#

im a bit at a loss here, where can i find a reference of the functions i can extend upon/hook in lua? specifically, i want to create a mod that changes the way the containers in inventories are rendered to include the Name of the container next to the Icon. i can look at examples from others, and i know the javadoc, and i know that the java objects are represented in lua as well, but still i cant find "ISInventoryPage" anywhere, and am confused

bronze yoke
#

ISInventoryPage isn't a java object, it's a lua object - you can look at the game's lua in the media/lua/ folder

vagrant matrix
#

❤️ thanks!

#

man i feel stupid, it was there all along

red tiger
#

You'd have to manually set up the symlink as a player

#

Oh wait old msg

#

Rip

grizzled fulcrum
#

lol

kind turret
#

lmao

rich reef
bronze yoke
#

you reference a bag in distributions by its type (look for vanilla bags in distributions for examples)

#

and yeah, you can just add the same table x times for x bags rather than writing x tables

rich reef
#

Alright. I've noticed that some of the bags are prefixed with "Bag_XXXX" Is this a requirement? Or is that just how those items are named in the vanilla system?

My mod prefix/item prefix would be GN84-AHE, and then the item name. Do I use that in place of Base.? I don't see the vanilla distributions using Base., so I'm not sure if it's calling the item by name in the script, or some other reference.

bronze yoke
#

that's just how they choose to organise the vanilla items, the bag_ prefix doesn't have any special meaning

#

i'll have to check how it treats items from other modules, hopefully it treats them properly but it's not unheard of for systems to simply only work for base lol

rich reef
#

Alright. I just wanted to avoid any conflicts in case my item matched the naming convention of someone else in the future. I'd assume that you could prefix your items with the module, but not 100% sure.

Mostly trying to figure out how to write the code that references the bag itself.

bronze yoke
#

it looks like it only checks the short type, so other modules will work fine

#

modules are how you're supposed to avoid name conflicts, but some systems such as this don't really utilise it properly (but at least it doesn't stop it from working entirely like some others do)

rich reef
#

Okay, thats good to know. I know when declaring the items you want distributed you can use the module. But wasn't sure when declaring the bag itself if I'm supposed to use the module, or if that name/ID is declared somewhere else. Sort of how sandbox-options are spread out in a few different spots.

#

You wouldn't by chance have something I can reference that does exactly what I'm talking about, would you? Trying to see how custom bags are coded in distributions, so I can figure out the details better.'

bronze yoke
#

i don't know of anything, sorry

rich reef
#

No worries, thank you for your help! Greatly appreciate it

rich reef
#

@albion

Well, I've got it working, to a degree. I was forced to use the Base module to create the items, as using my own module wouldn't work with the distributions. I'm wondering if their is some other syntax required to get custom modules to work with distributions?

Its not too big of a deal using the Base module with this mod, but for others I would like to figure out how to handle it. I'm looking at other mods that seem to use module names for the items and that works fine, but in this instance mine wasn't. Though I have another mod that does use the module for spawning items, so I'm just curious as to what the conflict is with this.

Thanks again for the help, at least I can continue with what I was working on now!

winter bolt
#

you have to put module.itemname

ancient grail
ancient grail
green jetty
#

log.deathCause

Anyone knows how to dig out what this function can return?

OR better question. Does the "Unknown" cause of death covers all non-zombie caused deaths?

rich reef
# winter bolt when you added it to the distribution did you just put the item name?

This is what I have that works. I tried using "modulename.itemname" at first, but it wouldn't show up in LootZed. Only after I made my module as Base instead of import>Base did it show up.

require "Items/SuburbsDistributions"
require "Items/ProceduralDistributions"
require "Vehicles/VehicleDistributions"


Distributions = Distributions or {};

local distributionTableHalloweenBags = {
    all = {        
        inventoryfemale = {
            rolls = 10,
            items = {    
                "HalloweenBagPumpkin", 9999,                
            }
        },
        inventorymale = {
            rolls = 10,
            items = {     
                "HalloweenBagPumpkinEvil", 9999,  
            }
        },
    },

}

local distributionTableHalloweenBagPumpkin = {
    HalloweenBagPumpkin = {
        rolls = 10,
        items = {
            "Bleach", 9999,
        }
    },
}

local distributionTableHalloweenBagPumpkinEvil = {
    HalloweenBagPumpkinEvil = {
        rolls = 10,
        items = {
            "Money", 9999,
        }
    },
}

table.insert(Distributions, 1, distributionTableHalloweenBags)
table.insert(Distributions, 1, distributionTableHalloweenBagPumpkin)
table.insert(Distributions, 1, distributionTableHalloweenBagPumpkinEvil)

print("Adding Bags to Zombie Loot Distributions")

ItemPickerJava.Parse()
rich reef
rich reef
# winter bolt you have to put module.itemname

I was trying to create a new list for the bags, as such, but it threw hard errors and crashed when loading.

local distributionTableHalloweenBagPumpkin = {
    GN84-AHE.HalloweenBagPumpkin = {
        rolls = 10,
        items = {
            "XXXX", 9999,
        }
    },
}

This is similar to what I had. The module prefix didn't work at all, so I couldn't link the bag by name to make it's own distribution.

abstract marsh
#

can anyone see any glaring issues with this item code? I have 2 other items in the same file that do appear in game leading me to think the issue is something to do with me tryin to combine properties of wine and a pop can but very new to modding so:

` item WineInaCan01Red
{
DisplayName = Wine in a Can Red,
DisplayCategory = Food,
Type = Food,
Weight = 0.3,
Icon = Pop2,
FoodType = Wine,
Alcoholic = TRUE,
AlcoholPower = 2,
CantBeFrozen = TRUE,
Packaged = TRUE,
EatType = popcan,
ReplaceOnUse = PopEmpty,
HungerChange = -8,
ThirstChange = -60,
UnhappyChange = -10,
Calories = 140,
Carbohydrates = 39,
Lipids = 0,
Proteins = 0,
CustomContextMenu = Drink,
CustomEatSound = DrinkingFromCan,
StaticModel = PopCanRed,
WorldStaticModel = PopCanRed,
Tags = HasMetal,

}`
tranquil kindle
abstract marsh
#

thanks for the jumping off point. Can confirm it still doesn't work even when using the default beer can values (altering nothing), do I have to do anything when referencing base world models/ icons from witihn my mods module? The other 2 items I have working do use custom icons/ defined world models, that's the only difference I can think of at the moment but I haven't noticed any other mods using Base.PopCanRed for example

tranquil kindle
abstract marsh
#

sorry, the item does not appear in game. I don't mean in terms of spawning in containers, I'm using a cheat menu to spawn in items to do testing with. The other 2 items I have in the items file do appear in the cheat menu so I know it's reading my items file, but this one doesn't, leading me to think I'm doing something wrong with this item specifically that the game isn't even recognising it as a valid item but i'm struggling to see what

tranquil kindle
#

Are all of those in same txt file?

abstract marsh
#

yeah, is there a limit/ should I use multiple files in any instances?

tranquil kindle
#

Can you just copy/paste whole txt file?

#

It shouldnt take much space if not expanded

abstract marsh
#

so only the bottom wineinacan is not working

tranquil kindle
#

Is it a mod that you released and just updating?

abstract marsh
#

There is a version on the workshop without the wineinacan but I'm just creating single player games with a loacl version to test this

tranquil kindle
#

If it uses same IDs then it will use steam version

#

So you either have to unsubscribe from it

#

or change id for testing

abstract marsh
#

ahhhh I feel stupid, I didn't even try to break it to see if it was using local files. Thank you so much

tranquil kindle
#

Happens to the best. Do let me know if it still doesn't work

abstract marsh
#

yup thta's all it was - thanks again!

fringe iron
#

Hello everyone. Please tell me where and in which file you need to register the path to your weapon model?

night iron
#

Hey hey hows everyone?

#

another weird question from my self.... is this 'LShift' thingy actualy a thing on this page or is this outdated because i can't seem to trigger the debug mode like that no matter what i do:
https://pzwiki.net/wiki/Debug_mode

bronze yoke
#

it'd be new to me

bright fog
#

I'm not aware of it personally

livid sluice
#

someone should totally make a gas mask mod that adds alot of popular gas masks, not alot of mods currently that add them

livid sluice
#

i dont know how to model

silk pike
#

hello everyone I need some help.
I created a trait in a mod and I would like this trait when selected to give the character the ability to wire vehicles. Is the ability to wire vehicles a recipe? If so what is it called?

fringe iron
#

It`s me again. How do I move the weapon so that the handle is in hands?

tranquil kindle
ancient grail
#

any way to fetch these from zombies ?

ZombieLore.Strength
ZombieLore.Toughness
ZombieLore.Cognition
ZombieLore.Memory
ZombieLore.Hearing
ZombieLore.Sight
bronze yoke
#

you can read the fields, but keep in mind some of their values don't line up exactly with the actual option

bright fog
#

yup

ancient grail
drifting ore
#

what's wrong with my script

bronze yoke
#

there's no such thing as setVisible on a profession

drifting ore
#

i am sorry mate but i am newbie and i used most chatgpt

torn rose
#

hey hello! I would be happy to help you guys with animations for ur mods. So feel free to contact me if you'll need any

flat timber
#

Hello, I'm trying to import a custom animation, just for testing. I replaced the sneakwalk animation with a crawling animation I made, and it does trigger the animation but it also stops my character from moving. Anyone know what I've done wrong?

bronze yoke
#

movement is controlled by animations, so if your animation doesn't move the character that would be why

flat timber
#

Do you mean the root joint needs to move forwards?

flat timber
#

I moved the root joint forwards throughout the animation and now my character does move. But now the animation loop is wrong, because the root position jumps back at the start of the animation.

ancient grail
spice edge
#

Hey there fellow modders! I'm trying to remove vehicles from the world and later adding them again without destroying the vehicle instance and recreating a new one again (I was able to do it this way). I've been using BaseVehicle functions like addToWorld. I'm able to enter the vehicle, turn it on and I see it accelerating but 3dmodel doesn't seem to follow. Even physics works because it bumps into other cars and make them move, but original car stays still. I've tried every possible update method from BaseVehicle and also GPT'ing a lot but nothing seems to work :/

I might need to copy all properties from the car into ModData and recreate it again but I was hoping to avoid that cause it's a lot of work.

Any suggestions here?

flat timber
ancient grail
ancient grail
ancient grail
# flat timber That worked! Thanks!

you might want to check out how the zed crawlers turns around by inspecting the xml
you will see that there are 2 types of crawler rotations(turning)

spice edge
vagrant ledge
#

Do radio stations startscript just fire when a save is created/server launched? Is there a way to manually trigger a reset if a save is already in progress?

modern hamlet
#

anyone with experience with ContainerButtonIcons (and a little free time on your hands) I'd love to pick your brain.

dusky quiver
#

I can't add movable items to inventory like that? 🤔

bright fog
dusky quiver
#

this obviously doesn't work but I wonder what's the correct way or where to find working example..

bright fog
#

Requires an InventoryItem

#

You're giving it a string

#

I'm not familiar with how tiles as items are handled tho so I can't point you in the exact direction on how to add tiles in your inventory, to be placed

dusky quiver
#

it works like this for regular items

player:getInventory():AddItem("Base.Twine")
#

but not for movables it seems

bright fog
#

You are right actually, there's other options that can take strings

#

Then it must be how tiles are handled

broken lake
fleet bridge
rich reef
#

Does anyone know off the top of their head if their is a rolls/item count limit for Distributions?

I've got a ton of small items I want to include, but it seems that some will never spawn even if all the weights/percentages are identical with 100 or more rolls. Only filling up maybe 20 total items/5 encumbrance out of a 20enc/50red bag I created.

Any ideas?

Previously for zombie loot I made multiple smaller dist tables and then inserted them one by one in code. Is that the solution to this?

Thanks for the help!

ancient grail
#

the way to determine spawn when modding is by using lootzed (load with -debug parameter)
turn on lootzed cheat(bottom option)
rightclick on the container icon
then loot zed there you can look at the loot table and you can check if your item is there

topaz tangle
#

Firetruck update has dropped!

naive basalt
#

Trying to make my first mod managed to get it working as it should and in the game but the weapon is invisible and im not sure how to fix it

tranquil kindle
# naive basalt Trying to make my first mod managed to get it working as it should and in the ga...

Things that could go wrong:
-You exported empty fbx file
-Your model is too big to fit into screen,
-Your model is too small and can't be seen (very rarely happens)
-Your origin point is so far from gun model that it makes it appear in diffrent place (possibly outside of screen)
-Your Model pathway is wrong: Texture Or Mesh, or both
-Your mod has more than one material, where UV map you used is on 2nd material or something like that.

ancient grail
#

what is the relation of infection level and isInfected?
can i toggle the isinfected just by changeing the level?

bronze yoke
#

you can't change the level directly, it is recalculated every frame

ancient grail
#

the level? well it works im able to set it
you may be refering to the sickness

the problem im facing now is that when i set tye infected to true my player dies instantly even tho the setting isnt set to instant

#

cuz i want to make the player zombie infected once blood level reached 100

#

BloodInfection = BloodInfection or {}

-----------------------          ---------------------------

function BloodInfection.getWornBloodLevel()
    local pl = getPlayer()
    local wornItems = pl:getWornItems()
    local itemBlood = 0
    local wornCount = 0
    local res = 0

    if wornItems ~= nil and wornItems:size() > 0 then
        for i = 0, wornItems:size() - 1 do
            local item = wornItems:getItemByIndex(i)
            if instanceof(item, "Clothing") then
                if item:getBloodClothingType() ~= nil then
                    local currentItemBlood = item:getBloodLevel() or 0
                    if currentItemBlood > 0 then
                        wornCount = wornCount + 1
                        itemBlood = itemBlood + currentItemBlood
                    end
                end
            end
        end

        if wornCount > 0 then
            res = itemBlood / wornCount
        end
    end

    return res > 0 and round(res) or 0
end

-----------------------            ---------------------------

function BloodInfection.getBodyBloodLevel()
    local pl = getPlayer()
    local vis = pl:getHumanVisual()
    local level = 0
    local maxLevel = BloodBodyPartType.MAX:index()

    for i = 0, maxLevel - 1 do
        local bloodLevel = tonumber(vis:getBlood(BloodBodyPartType.FromIndex(i)))
        level = level + bloodLevel
    end
    --level = the total level value
    if level > 0 then
        local res = (level / maxLevel) * 100
        --print(round(tonumber(res)))
        --res is the percent
        return round(tonumber(res))
    end
    return 0
end
-----------------------            ---------------------------
function BloodInfection.getTotalBloodLevel()
    local pl = getPlayer()
    local wornLvl = BloodInfection.getWornBloodLevel()
    local bodyLvl = BloodInfection.getBodyBloodLevel()
    if wornLvl == 0 then
        return round(bodyLvl)
    elseif bodyLvl == 0 then
        return round(wornLvl)
    else
        local res = (wornLvl + bodyLvl) / 2
        return round(res)
    end
end

function BloodInfection.isLeveReached(current, threshold, max)
    local res = threshold  * max
    return current >= res
end

#

heres how i did the blood level computation

bronze yoke
#

i guess you can set their infection level while they aren't infected

#

the instant death is usually caused by not setting their time of infection

golden minnow
#

Made Insurgent Jacket Rollable, rolled up model from SMUI, I don't have steam so feel free to upload it yourselves, edit it or whatever you want.

flat timber
#

Hello again!

Is it possible to get existing player animations into blender? (In this case I'd like to have a look at Bob_WalkBat)

naive basalt
nimble badger
ancient grail
#

the reason why i was dying was cuz of the sandbox option i didnt configure the right option, lol

ancient grail
dull moss
neon hamlet
#

In weapon scripts, what's WeaponSprite mean? I figured it was just another icon situation but uhh

#

I've no idea but I wanna know if it's drastically important

tranquil kindle
#

Its model of weapon

neon hamlet
#

ooh

#

should I put the FBX file name, then?

tranquil kindle
#

Model with texture, that you state in txt file. In vanila this file is in media>scripts>models_items.txt

#

So in your mod you create txt file, with diffrent name than that, preferably very unique

#

and there you declare your model

neon hamlet
#

I see

tranquil kindle
#

In terms of what is what, Weaponsprite and such

neon hamlet
#

Oooo

#

thank youu

peak nymph
#

wondering if anyone can help me figure out why my weapon model isn't rendering
defined my model like this

  {
    mesh = Weapons/1Handed/Macuahuitl,
    texture = Weapons/1Handed/Macuahuitl,

    attachment world
    {
      offset = 0.0000 0.1400 0.0000,
      rotate = 180.0000 0.0000 180.0000,
    }
  }```
defined my item like this
```  item Macuahuitl
  {
      DisplayCategory = Weapon,
      MaxRange  = 1.23,
      WeaponSprite  = Macuahuitl,
      MinAngle  = 0.7,
      Type  = Weapon,
      SwingSound = MacheteSwing,
      HitFloorSound = MacheteHit,
      ImpactSound = MacheteHit,
      DoorHitSound = MacheteHit,
      HitSound  = MacheteHit,
      MinimumSwingTime  = 4,
      KnockBackOnNoDeath  = FALSE,
      SwingAmountBeforeImpact = 0.02,
      Categories  = LongBlade,
      ConditionLowerChanceOneIn = 15,
      Weight  = 2,
      SplatNumber = 2,
      PushBackMod = 0.3,
      SubCategory = Swinging,
      ConditionMax  = 13,
      MaxHitCount = 2,
      DoorDamage  = 10,
      SwingAnim = Bat,
      DisplayName = Macuahuitl,
      MinRange  = 0.61,
      SwingTime = 4,
      KnockdownMod  = 2,
      SplatBloodOnNoDeath = FALSE,
      Icon  = Macuahuitl,
      WorldStaticModel = Macuahuitl,
      TreeDamage  =   10,
      CriticalChance  = 20,
      CritDmgMultiplier = 5,
      MinDamage = 2,
      MaxDamage = 3,
      BaseSpeed = 1,
      WeaponLength = 0.3,
      DamageCategory = Slash,
      DamageMakeHole = TRUE,
      AttachmentType = BigBlade,
      Tags = CutPlant;SharpKnife,
      DoorHitSound = MacheteHit,
      HitSound = MacheteHit,
      HitFloorSound = MacheteHit,
      BreakSound  =   MacheteBreak,
      SwingSound = MacheteSwing,
   }

The weapon works but the model is invisible

The model shows on ground (but way too big)
but not in hand

hollow quiver
#

Hello!

I'm trying to create a mod to put stews/soups into cans.
Everything works except for two things.
I cannot do it from the crafting menu, only by right clicking the empty can.
I canned a hot stew but I still got the cold negatives on it. I do not have the BadCold=True on it, I guess I need to adjust the finals with what it would have been hot instead?

I also do not wish to see the nutrients without the Nutritionist trait, how do I do that?

tardy glen
#

hello all, im new to PZ modding entirely and foreign to lua.

my goal is to add a "lung cancer" mod where you progress through stages of lung cancer based on how many cigarettes you smoke
my idea is to add a count variable to the cigarette item and as it increases we check the count based of whatever breakpoints we have
for the lung cancer stages and add that as a moodle, any tips on the process or how to start would be appreciated thanks!!!

grizzled fulcrum
# tardy glen hello all, im new to PZ modding entirely and foreign to lua. my goal is to add ...

well you definitely want to learn the very basics of Lua as a minimum, just enough to be able to read basic code should be enough to get you started.

when you want to set up your mod and need to know the structure, look at https://pzwiki.net/wiki/Modding/

For the cancer accumulation feature, you would want to use player mod data (player:getModData()) to store the cancer delta / cigarette count / whatever else you need

For the moodle you can use an api on the workshop to simplify things like MoodleFramework

For the trait if you decide to add one, there are trait apis to abstract stuff but its not hard to use TraitFactory global in Lua (vanilla)

My biggest tips are to learn the lua, read resources like pzwiki and pins in this channel, ask for help when needed!

This is supposed to help for a general guidance of what to do later after learning the lua, you are probably most likely going to need to ask for more specific things here when it comes time.

tardy glen
#

im semi-experienced in c#/python if that has any similarity to lua but im assuming not

grizzled fulcrum
#

Oh and don't forget to use and learn from the vanilla lua code in your games steam folder in media/lua

grizzled fulcrum
#

lua is more of a scripting language not like c# or python

#

think of lua like a really baby version of python with a lot of the functionality stripped away lol

tardy glen
#

i guess i will get on figuring out lua then

bronze yoke
#

imagine python if the standard library was like. fifty functions total

tardy glen
#

😔

bronze yoke
#

i think it's a pretty simple easy to learn language, especially for someone who already has experience

tardy glen
#

apparently the cigarette icon name is "icky stick" which is hilarious

tardy glen
winter bolt
#

in a lua file you do player:getModData()

tardy glen
#

because i would add my cigarette count there right and then on the cigarette item we can say that whenever you smoke one it just increases that

winter bolt
#

you would do something like player:getModData().myModData.cigCount i think

#

player:getModData() returns a table so you can just add your own tables and variables to it

#

myModData would be a table you can use to store all the stuff from your mod and then cigCount is just a variable

hollow quiver
winter bolt
#

this function gets called on the event "onnewgame" which is whenever a player is first created which is where you'd want to set up the initial cig count to 0

#

then you can access cig count and change it whenever you want

#

this file is in media/lua/client btw

bronze yoke
#

a lot of modders will prefer OnCreatePlayer for compatibility with existing saves

winter bolt
#

i had to load in some data from character creation so i had to use both

#

i have this for when creating the character and then it sets the data a different way in oncreateplayer if they dont already have moddata set

#

actually yeah for the cig count it'd be better to do oncreateplayer

tardy glen
#

is SPNCharCustom like a custom table then that you have in the modData?

winter bolt
#

yeah

tardy glen
#

modding is hard so im learning

tardy glen
winter bolt
#

give it a unique name though so it doesnt overwrite anything

tardy glen
#

oh like you made a custom lua file for that then?

#

or im tweaking because i dont see it

winter bolt
#

yeah you make it yourself

tardy glen
#

i see

#

okay

tardy glen
winter bolt
#

although albion just pointed out that the event should be OnCreatePlayer instead

tardy glen
#

yeah that makes more sense

winter bolt
#

i had to use OnNewGame instead because of something specific to my mod

#

when you use OnCreatePlayer though you'll have to add a check at the start of the function that returns if the player already has their modData set up

#

if player:getModData().myModData ~= nil then return end

#

OnCreatePlayer is called when any player loads into the game so the code to set up your mod data will only run if their character was made before the mod was added

tardy glen
#

so do i have create like a myModData file or table thing somewhere then?

winter bolt
#

no that all gets done in this function

tardy glen
#

is it necessary for me have that if im just having one variable to keep track of

#

could i just say like player:getModData().cigCount

#

or something like that

bronze yoke
#

you can but you risk name conflicts

winter bolt
#

yeah

tardy glen
#

something like this?

#

im really just going off your reference

tardy glen
winter bolt
#

its checking if cigcount is nil when it should do the opposite

#

it needs to return if the cigcount already exists

tardy glen
#

oh rightttt, if its not nil then skip

winter bolt
#

yeah

tardy glen
#

something like that?

winter bolt
#

actually i think that would also return an error

#

remove the cigcount part so it just checks lungcancer

winter bolt
tardy glen
#

hell yeah

winter bolt
#

the issue is that if the player doesnt have modData then lungCancer is nil so trying to get cigCount from it will cause an error

#

so just remove cigcount i think

tardy glen
#

ahh okay

#

so then i could just add to the cigarette item that it increases that count by one and then do whatever other moodle logic based off that count

winter bolt
#

im not sure i've never messed with item stuff rip

tardy glen
#

how would i actually check the console in game to see if it get initialized

grizzled marsh
#

hey guys, what is "cdt=" in radio and tv files?

tardy glen
#

i just cannot find where that is

winter bolt
tardy glen
#

thx

#

do you know if like with OnCharacterCreate, i would add onto this, can i just modify it here and it would work

winter bolt
#

it stores the original OnEat_Cigarettes function as a variable called originalOnEat_Cigarettes and then you replace the function but call the original function at the start

#

so you can essentially add your own code onto the end of the original function

tardy glen
#

would i do within the actual lua file with the OnEat_Cigarettes function or in a new file or even the same one with the OnCharacterCreate

winter bolt
#

in a new file or the same as the create character one

#

character here is just the player so you can still do character:getModData etc as well

tardy glen
#

something like that?

#

but function not fuction

winter bolt
#

yeah that looks good

#

replace player with character though

tardy glen
#

oh right

#

so my question is like, how is this file implemented when running the game? like how is OnCharacterCreate actually added on to with the new mod data initialization

winter bolt
#

this line subscribes your function to the game event so whenever the game decides to call that event it will trigger any function subscribed to it

#

OnCreatePlayer is triggered whenever a player loads into the game so when you load it will run the code that adds your data to their moddata table

tardy glen
#

okay i see

#

that makes more sense now

#

what about for the OnEat_Cigarettes thought? we arent saying .Add() for that one

winter bolt
#

im not really sure how it works lol but i know it does somehow

tardy glen
#

hey you know if it works it works

#

i guess i will add some console logs and then test it out

bronze yoke
#

food items can just set a function that's called when they get eaten, what you're doing here is replacing that function so yours gets called instead

#

but since you don't actually want to get rid of the vanilla behaviour you save the original and call it in your overwrite

winter bolt
#

then when you open the game you get a console window at the bottom

tardy glen
#

amazing thank you

winter bolt
#

whenever you get an error in debug mode though it'll open a fullscreen error monitoring window so you have to press f11 to close it

#

unfortunately this is as much as i can help with i think since ive never touched anything like moodles or status stuff

tardy glen
#

not related to development but how did you guys get into modding in the first place

tardy glen
gilded glade
#

Hi, I'm improving the sound of my guns and I'm wondering if it's possible to change the sounds of gunshots according to the environment (like vanilla) through lua. Is there any guide or something like that?

rich reef
# ancient grail how do you know they dont spawn? the roll doesnt have to equate to 100 as total...

As far as I can tell, some of the items in the distribution list don't spawn at all in the bag, it's only the first few.

I set it to 100 rolls, just to make sure the bag got fully populated, so I could test what got spawned in.

Unfortunately, being it's a bag, lootzed doesn't seem to work like it does with other containers.

Trying to determine if their is an item limit in distribution tables, or if it's something I'm doing wrong with the code for it, possibly a misspelled item, or something else causing the list to truncate? I'm not sure.

fleet bridge
#

Do you have commas after every entry

#

Just dump it in a Lua compiler and see if the table throws errors

rich reef
#

Yes, I do. But, I noticed just now while looking at the commas, that there was some white space afterwards on some of them. That may have been the problem.

rich reef
# fleet bridge Do you have commas after every entry

Okay, that seemed to fix one of the issues. I guess the extra whitespace at the end of a line will truncate the rest of a table/list. Thank you for pointing me in the right direction to see the issue.

Now, my bag still only gets filled with a few items, although they are from the entire length of the list still. Only fills about 5-6 out of a 20 sized bag.

fleet bridge
#

There's a maxroll for containers iirc

#

Except for zombie bodies

rich reef
#

Any reference to look at?

ancient grail
ancient grail
# rich reef Any reference to look at?

distro sample 1

local toSpawn = 'Base.Whatever'
local roll = SandboxVars.myMod.distroRoll or 2

local locations = {
    "RandomFiller",
    "GasStorageMechanics",
    "MetalShopTools",
}


Events.OnPostDistributionMerge.Add(function()
    for i = 1, #locations do
        table.insert(ProceduralDistributions.list[locations[i]].items, toSpawn)
        table.insert(ProceduralDistributions.list[locations[i]].items,  tonumber(roll))
    end
    ItemPickerJava.Parse()
end)

distro sample 2

local demoSpawnTable = {
    { location = "RandomFiller", item = "Base.Whatever1", roll = 2 },
    { location = "GasStorageMechanics", item = "Base.Whatever2", roll = 3 },
    { location = "MetalShopTools", item = "Base.Whatever3", roll = 1 },
}

Events.OnPostDistributionMerge.Add(function()
    for i = 1, #demoSpawnTable do
        local spawnData = demoSpawnTable[i]
        local location = spawnData.location
        local item = spawnData.item
        local roll = spawnData.roll
        
        table.insert(ProceduralDistributions.list[location].items, item)
        table.insert(ProceduralDistributions.list[location].items, roll)
    end
end)
rich reef
#

Thank you for the information!

tardy glen
#

could someone explain whats wrong with this and why it doesnt work when you smoke a cigarette? thanks!

peak nymph
#

does anyone have any idea why my weapon model is showing on the ground but not in hand when equipped

I can share more info if needed, I’m just not sure what’s relevant

ancient grail
#

refer to my substance x mod

winter bolt
# tardy glen

you might have to try requiring the original file at the top of your lua file

#

put something like require("FOLDER/Whatever file OnEat_Cigarettes is in")

#

the filepath you put in there already starts inside media/lua/client

grizzled fulcrum
#

you have to edit the jso launcher config files ProjectZomboid64.json or make your own and use that like -pzexeconfig ProjectZomboid64Aoqia.json where id recommend to just completely remove the minimum and maximum memory for the jvm and to just let it manage it on its own like literally every other application

#

or you can edit the bat scripts but that's ugly for end users

winter bolt
#

my head hurts

grizzled fulcrum
#

I don't even know why the devs kept the 3g ram maximum in the config in the first place

grizzled fulcrum
#

I looked at the launcher in ida and it only loads jvm args from the json config file

#

BTW for context ProjectZomboid64.exe isn't an actual game exe, its just a wrapper that basically parses the args in the json config, starts the game and sends those args to the jvm

#

if you look at the working set to test with those args, it doesn't increase the minimum, and also you will notice in your log file that it says like invalid arg or something

#

the args getting passed to ProjectZomboid64.exe (that aren't for the launcher) like -debug get passed to the Java program itself (in this case they get passed to the main entry point like how normal Main Java funcs work with the string args param)

#

so tl;dr is it won't work because you're technically passing the ram args to the Java program instead of the jvm which will obviously not work

bright fog
winter bolt
#

yeah i thought so too but i cant think of why it wouldnt work

grizzled fulcrum
#

idk it should just be calling it there isn't any other reason why it wouldn't

grizzled fulcrum
#

if so, that means the func isn't being hooked properly

winter bolt
#

it calls the original function though so it should still decrease stress

grizzled fulcrum
#

ik, but if the hook isn't working properly, the stress will decrease but you wont get the print in the console

#

thats how u tell if it is calling the orig or not

bright fog
# tardy glen

Let's just start by having you sharing the script file of your cigarette here

#

There can be many reasons why it doesn't work properly but it's better if we see the cigarette script to verify that aspect

winter bolt
ancient grail
#

is it possible to add moddata to room/buildings?

bright fog
#

to buildings are least

#

for rooms idk

ancient grail
#

i was just curious.. do we treat them as squares? with transmit? or like characters?

#

would probably nice to be able to name rooms

bright fog
#

Check how Cordyceps Spore Zone associates mod data to a building

#
local buildingDef = IsoBuilding:getDef()
local sq = buildingDef:getFreeSquareInRoom()
#

Something like that

ancient grail
#

since i dont know much abt building and rooms i was wondering if i can use it lol

#

otherwise ill just save the data to the player

night iron
bronze yoke
night iron
#

require is very useful to control loading order though, it forces the file that requires it to be loaded after the required file

bronze yoke
#

but you can't control the loading order of vanilla files

night iron
#

no no that's not what i meant at all he he

bronze yoke
#

require is definitely one of the most important functions in lua, it's the only reason the module structure is even possible

grizzled fulcrum
#

I don't get how lua load order using require could be useful at all

bronze yoke
#

i was going to nitpick that myself but the main reason is that even though you shouldn't write your mods in a way that load order matters, most mods *are* written that way and you may need to interact with that for compatibility

#

for example a lot of api mods aren't written as modules

grizzled fulcrum
#

I thought they should be

#

like an API should use modules more than any other mod, because other developers are going to use it and it makes more sense imo to modularise your api

bronze yoke
#

they should be, but the unfortunate fact is that even if you do everything right you're still stuck in an ecosystem that doesn't

grizzled fulcrum
#

but I see a lot of API just shove all their funcs in a global table and call it a day ;-;

bronze yoke
#

it really comes down to vanilla lua not using modules

#

most mods just copy the vanilla lua, even people with prior experience with programming who have the sense to structure things that way will look at all these references and just assume you can't write lua that way

grizzled fulcrum
#

is that bc most people use vanilla code as reference?

#

oh lol

bronze yoke
#

they use vanilla code as reference, and other mods which probably also used the vanilla code as reference

grizzled fulcrum
#

I see, so its like infectious lol

bronze yoke
#

i urge people to just read the damn book lol but if you looked at nearly any example you would have no reason to think require can do that (or is even a function lol)

grizzled fulcrum
#

one thing that I sadly think about is that removing the major performance impacts of Lua for pz might make some people lenient to writing good code and then we will have a problem lol

#

I mean like, right now if someone writes bad code, they are usually punished for it. call getPlayer():getInventory() without any variables every tick and it will have issues with func call overhead. remove the overhead then people can and I know will assume that they won't need to use a variable to cache things like you usually do in good practice

#

kinda like people who used to make games for consoles like SNES and PS1 had to really optimise their game to get good results, and now we have UE5 where developers just slap lumen on everything and wonder why performance is in the bin

bronze yoke
#

to be honest i don't see this as a major issue because people already commonly write code that way, it don't think it would get worse in a notable way

grizzled fulcrum
#

not against the engine btw lol just how ppl use it

bronze yoke
#

and there are ways in which the performance issues punish writing good code

grizzled fulcrum
#

both true

bronze yoke
#

particularly the overhead on lua functions is really punishing

grizzled fulcrum
#

even moreso than Java calls?

bronze yoke
#

the java overhead is much heavier but i can't really avoid calling java beyond caching where possible

grizzled fulcrum
#

our you mean just in general like you expect lua to be fast

frank elbow
bronze yoke
#

the lua - lua function call overhead is still pretty high, it discourages writing smaller functions or using functions within loops

grizzled fulcrum
#

I do it anyway cause ik im gonna fix it later but I see your point

bronze yoke
#

you should, because it's good for maintainability

#

it just sucks that we have to balance performance and good code

grizzled fulcrum
#

ye sacrifice little bit of performance to make it readable is a win

bronze yoke
#

i think this is an issue all but lua jit faces but kahlua is a lot worse than standard lua from my testing

grizzled fulcrum
#

I'm still on the edge about the whole lua in Java thing

#

like I'm all the implementations I could find are ancient

#

the closest I could see to good is native functions in Java but they have to be compiled and all this wasteful processes

#

our I just write one myself but I take that not so lightly as that will take a while

bronze yoke
#

yeah, i can find java lua implementations that boast much better performance than kahlua but i can't find one that actually looks maintained

grizzled fulcrum
#

I got an idea to communicate like Java - C++/Rust - Lua

#

and it might just work but will require some more effort

#

just so many caveats

bronze yoke
#

and what's worse is you don't even know it'll run well until you do it

#

for example just using luajit with JNI could improve a lot, or the double interop might just make all the common performance issues even worse than before

grizzled fulcrum
#

yep 😭

#

then I get so many different ideas I start and stop stuff a lot so it's hard to finish what I've half done

open sierra
#

Got a dumb question: a mod I am using on a server needs me to make a new mod to store its configurations. How do I make that empty mod, to start? Just duplicate the exampleMod folder and go from there?

grizzled fulcrum
#

yep

#

example mod is a good start

open sierra
#

Okay. How do I get a mod ID for that mod? Or is that in the info file, or other loose files, etc?

hollow quiver
#

Is it possible to reload the lua in game? or do I need to restart each time I change my mod?

dusky quiver
#

in debug mode you can use f11 and reload files but I think it does not always work as you wish

grizzled fulcrum
#

make sure it doesn't collide with another mod, eg just make it something really unique

bronze yoke
#

if you're in debug mode you can just reload the save

silk pike
#

Hi everyone!
I'm creating a mod that adds various traits.
I would like to associate recipes to some traits.
This is the code I created
local expertFishermanTrait = TraitFactory.addTrait("ExpertFishermanTrait", "Expert Fisherman", 10, "3 points at Fishing.", false)
expertFishermanTrait:addXPBoost(Perks.Fishing, 3)

-- Force adding recipes to the character with the trait, regardless of magazines
expertFishermanTrait:getFreeRecipes():add("Make Fishing Rod")
expertFishermanTrait:getFreeRecipes():add("Fix Fishing Rod")
expertFishermanTrait:getFreeRecipes():add("Make Fishing Net")
expertFishermanTrait:getFreeRecipes():add("Get Wire Back")

The trait is created and is working but the recipes do not work. the character doesn't know the recipes
Where am I going wrong???

bright fog
#

Does it work ?

bronze yoke
#

those are vanilla recipes

bright fog
#

Didn't notice

grizzled fulcrum
# silk pike Hi everyone! I'm creating a mod that adds various traits. I would like to associ...

UNRELATED but still kinda related

local expertFishermanTrait = TraitFactory.addTrait("ExpertFishermanTrait", "Expert Fisherman", 10, "3 points at Fishing.", false)
expertFishermanTrait:addXPBoost(Perks.Fishing, 3)

-- Force adding recipes to the character with the trait, regardless of magazines
local recipes = expertFishermanTrait:getFreeRecipes()
recipes:add("Make Fishing Rod")
recipes:add("Fix Fishing Rod")
recipes:add("Make Fishing Net")
recipes:add("Get Wire Back")
#

please put it in a local variable instead of calling it multiple times 🙏

bright fog
#

cache it

bronze yoke
#

are you making a new character? the recipes won't be applied to existing characters who gain the trait, if you're trying to test it that way

silk pike
#

it doesn't work....but i'll keep trying

hollow quiver
#

Some food items use OnCanPerform and some use OnTest. Which one would be correct? I want to prevent adding a uncooked stew/soup to a can.
I copied the logic from the make bowl of stew (OnCanPerform:Recipe.OnCanPerform.SliceCooked)
But with that I cannot put the stew into my can from the crafting menu (all items are highlighed, craft button is grayed out)
But I can craft with right clicking the item in my inventory. Removing that line and I can craft both ways.
I don't get this part

bronze yoke
#

OnTest is for checking if an item is okay to put in a recipe, OnCanPerform is for checking if the player is currently able to perform the recipe

#

you would want to use an OnTest here

hollow quiver
bronze yoke
#

they probably did that on purpose, with the crafting menu you can't select the ingredients so you wouldn't know which stew you're separating anyway

hollow quiver
ancient grail
#

like cache it outside?
tho im pretty sure this will error

bronze yoke
#

definitely the first one

#

caching it outside isn't viable because you don't know which player the function will be called for

#

even without splitscreen the player object can change

ancient grail
#

cuz the player isnt loaded yet at some point but i couldnt comeup with better sample

ancient grail
bronze yoke
#

they meant most people don't cache at all

ancient grail
#

ah just directly use getPlayer():getInventory():stuff
?

bronze yoke
#

yeah

ancient grail
#

i see

grizzled fulcrum
#

yep that is what I meant 😄

#

I have really really thought about making a modding series on YouTube

#

not sure if it would be that helpful but it's something interesting to pursue once I get the java project rolling

grizzled fulcrum
#

unironically I grew up watching modding tutorials for java and c when I was like 10 and they helped me a lot so I figure someone might get some value out of it

ancient grail
#

youre goin to do with voice?

grizzled fulcrum
#

If i do end up making it, I feel like it would be pretty annoying to follow along with text

bronze yoke
#

i don't feel like an unvoiced one would really have any value tbh

grizzled fulcrum
#

yeah, might as well follow a docs guide lol

#

but visual feedback is still important regardless

ancient grail
#

actually!
there are people who prefer youtube cuz its more visual

grizzled fulcrum
#

thats why I started out watching youtube tutorials because it's easier to watch someone do something and then follow in their path than read a wall of text

bronze yoke
#

if they still have to read text it's just a text guide with weird forced pacing, a text guide with pictures or even gifs would be better

ancient grail
#

so they tried and search google and only saw a few
and probably would always show map modding cuz of daddy dirk

grizzled fulcrum
#

even more so if you have adhd or anything similar

bronze yoke
#

i don't personally find video tutorials very useful over text guides but i have noticed half the people who come here open with 'hey i just watched x tutorial' so having some decent ones would at least have a pretty large audience

ancient grail
# bronze yoke if they still have to read text it's just a text guide with weird forced pacing,...

yeah
which is why i asked if its voiced
cuz it would be very helpful for people to understand stuff that are important but they wont learn not unless they ask here

such as when to use local function
and how to write the code that other people can use instead of writing everything using local function
would force people to overwrite it if incase they need to add compat

and placing print on stuff that are ontick omg

grizzled fulcrum
#

And it being in voice also allows to go in depth more on certain things

#

at least more naturally anyway

Here's an analogy I thought of to explain why to use modules:
Modules are like containers with ingredients. You want to separate all your cooking ingredients into other containers. You wouldn't put your flour, milk, and butter inside of the same container, because then it will be very hard to separate! Keeping your ingredients separate makes them easy to look at, grab and use, especially at speed. Keeping your code separate in modules allows for easier readability on your end and also for other modders who want to read your code.

fleet blaze
#

I have been working on getting these tiles I made into the game for a few hours now and having trouble.
I made the tiles, then placed them with tiled. I didn't do any tile defs at the time.
After nearly getting done tried uploading it to the mod to see them ingame wouldn't load was just base grass and dirt and wood plank floor where it was saying it was missing the floor.
Later found out I needed to do the tile defs I followed the guide I found on the forums and referenced the tile defs post and added isfloor to my tiles and floor overlay to the ones that was corner pieces.
After messing with the mod settings I finally got black tiles where they should be but the corner pieces dont have any presentation.
Please help me.

#

I got this error as well when reloading that tiles file

#

Could this be an issue? Its not loading the bottom half of the list i never noticed that before

finite rover
#

Hello! Does anyone know how to disable bandages and wounds from spawning on zeds? Simple solution is to make them transparent, but this way they will be transparent on players too and thats not great.

obtuse sparrow
#

Hi! Does anyone know how to replace a model from vanilla? I made a new gas mask model but I can't get it to work properly on zombies. They just wear the regular one, even though I added a new file in scripts defining a new hat_gasmask with my model, plus the xml file and guid, still they spawn with the default one

bronze yoke
#

there is no override property for items, that's specific to recipes

#

simply making a new item with the same name in the same module is enough to overwrite it

obtuse sparrow
#

Yeah, that's true

#

My issue is the guid stuff, so when you're making new outfits for zombies, right?

#

It's a headache to explain, ugh

bronze yoke
#

if you replaced the actual model and texture by placing yours with the same filepaths i think it'd work

#

otherwise i don't really know if there's a simple way to replace clothing xmls

winter bolt
#

i think the only way to replace the zombie spawning without replacing the original gasmask clothing xml would be to replace the entire zombie outfit that has the gasmask in it

obtuse sparrow
#

Alright, how about... should overwriting outfits in clothing.xml work? Like replacing FiremanFullSuit with my own FiremanFullSuit using the same GUID, would that work?

winter bolt
#

that does work

#

the only problem is that you have to include every vanilla item used in the outfit inside your mods fileguidtable

#

its really annoying

obtuse sparrow
#

Right, in your clothing mods to add people using open jackets and such, is that what you do?

winter bolt
#

yeah

obtuse sparrow
#

Whew, looks like it's gonna be a loong day ahaha

winter bolt
#

if you only need to replace the gasmask it'll be really easy

#

just grab the guid of the original gas mask and search for it in clothing.xml

mellow frigate
night iron
#

hum i'm having 0 success with removing existing vanilla recipes in multiplayer using a new recipes file redeclaring the desired recipe with the same name, 'Obsolute:true' and/or 'Override:true'... feels like i'm missing something...

grizzled fulcrum
#

post the script

#

or the def

fleet bridge
grizzled fulcrum
#

that would be funny if it is the reason

#

happened to me too

night iron
#

sorry i had a typo on my message i am using 'Obsolete:true' already

bronze yoke
#

obsolete is both

fleet bridge
#

why do you need to obsolete it?

night iron
#

it just wont go away in multiplayer mode

#

it works for singleplayer as far as i can tell though

fleet bridge
#

want to post your script file?

night iron
#

Override does not remove the recipe @fleet bridge it allows you to change it, and if i try that with isHidden:true then the client just hangs in a black screen (not frozen) while loading into the server

#
module Base {
    recipe Make Stone Axe {
        TreeBranch,
        SharpedStone,
        RippedSheets/Twine/RippedSheetsDirty/DenimStrips/DenimStripsDirty,

        Result:AxeStone,
        Time:80.0,
        Category:Survivalist,

        Obsolete:true
    }
(...)
}
grizzled fulcrum
#

no comma at the end?

night iron
#

i've also tried with both Override and Obsolete

fleet bridge
#

IsHidden

#

not isHidden

#

also, you need a comma after Obsolete:true

#

Obsolete:true,

bronze yoke
#

don't set up a whole recipe, just do override and obsolete

night iron
#

i tried that too albion no difference

#

and i just tested with the dangling , just for sanity sakes even though i was 99% certain that was not going to make a difference and voila still showing

bronze yoke
#

i recommend always having a 'dangling' comma because some script types literally do not work if you don't use them

#

i don't think recipes need them, i'm sure items don't, but for example sandbox options scripts break without them

night iron
#

i have yet to see that happening albion

#

and being old fashioned i dont use dangling , anywhere

#
module Base {
    recipe Make Stone Axe {
        TreeBranch,
        SharpedStone,
        RippedSheets/Twine/RippedSheetsDirty/DenimStrips/DenimStripsDirty,

        Result:AxeStone,
        Time:80.0,
        Category:Survivalist,

        Obsolete:true,
    }

    recipe Make Stone Hammer {
        Obsolete:true,
    }

    recipe Make Stone Knife {
        IsHidden:true,
        Override:true,
        Obsolete:true
    }
(...)
}

none of this works

grizzled fulcrum
#

could it be because of the braces on the same line? just throwing stuff out there

bronze yoke
#

they've never caused a problem for me

fleet bridge
#

i always put the braces after the recipe

#

never done without, maybe give it a shot

grizzled fulcrum
#

I wanted to but thought it would cause issues if they're on the same line

fleet bridge
#
    {
        ScrapMetalBits=30,
        Result:ScrapMetal,
        Time:15.0,
        Override:TRUE,
    }```

this works for me, i dont need to obsolete it though
night iron
#

i mean guys its not related to the formatting, this works just fine in singleplayer and i have plenty of other new recipes in my mods with this formatting

#

are you trying to remove it @lect since i have no problem changing existing recipes it's removing that is proving to be tricky in multiplayer only

fleet bridge
#

i've always used lua to recipe:setIsHidden(true) and recipe:setCanPerform("myfunction")

#

myfunction just returns false

#

scriptManager:getRecipe('Gather Gunpowder'):setLuaTest('alwaysfalsefunction') also works

ancient grail
#

also server folder?

bronze yoke
#

do it in shared, and if it's unconditional no point waiting for an event

ancient grail
#

makes sense

#

how do you make sure its the right recipe? cuz you can name them the same

bronze yoke
#

if there's multiple you need to

#

ohhh fuck that's why it wasn't working LOL

fleet bridge
#

i've never actually tried it with multiples...

bronze yoke
#

override: will only override one of them

fleet bridge
#

ohhhh, yes. override only does it for one of them

bronze yoke
#

if there's multiple you need to do it through lua, and by looping through scriptManager:getAllRecipes() rather than using getRecipe()

fleet bridge
#
local recipes = getScriptManager():getAllRecipes()
    for i = 0, recipes:size()-1 do
        local recipe = recipes:get(i)
        local name = recipe:getOriginalname()
        if recipesToUnyeet[name] then
            recipe:setIsHidden(false)
            recipe:setCanPerform("yeppers")
            unyeeted = unyeeted + 1
            print ("Unyeeted \""..name.."\"..")
        end
    end```
bronze yoke
#

almost like this 'multiple recipes with the same name' structure is highly impractical for literally every system that interacts with it and already needs several workarounds just to work

fleet bridge
#

something like that (i was undoing some previously blacklisted recipes mid-wipe and didn't want to touch another person's mod)

night iron
#

i reduced the mods down to the minimum to ensure there are no multiples declarations of the recipe i want to supress still wont work, in fact after more extensive tests even for single player it realy only works if i combine override + ishidden, as soon as i get obsolute into the mix it also stops working in singleplayer. however for multiplayer the override + ishidden causes the black screen issue

bronze yoke
#

there are multiple definitions in vanilla though

night iron
#

really? hummm dam it

#

i can only find one 'recipe Make Stone Axe' on my vanilla media folder 😕

bronze yoke
#

oh wait sorry i got you confused with something else earlier

#

i don't know why the script approach isn't working but doing it through lua instead might work

night iron
#

yeh i have been trying to leave it for last resource... really wanted to learn why this doesn't work

bronze yoke
#

i definitely remember someone having an issue exactly like this where it worked in singleplayer only but i don't remember what the solution was or anything searchable 😔

night iron
#

yeh google hasnt been much help on this matter for me either

mellow frigate
#

someone answered with a solution to the recipe problem

mellow frigate
orchid drift
#

Hey everyone! I've recently decided to learn how to mod for PZ after falling in love with the game and I'm trying to make a new type of window barricade or a "curtain" item. However, I think there might be some java coding involved. I have little knowledge of how to mod in general, but I'm willing to learn if anyone is willing to teach me.

I have searched videos, forums and the back of my skull for anseers and only made some progress. The main reason for this is because I have no clue if Im going the right way or not.

I'm using the metal sheet codes as a basis for this mod, but also tried using the Sheet codes. Both lead me to the same part of unknown which is "how do I know this is all I need to make it work". I did the whole lua/server script and created a recipe as well as the item. The recipe and item work, but I can't apply the new barricade on the windows

I've posted on reddit 2 times about this mod if anyone would like to take a look r/JonascomC

ancient grail
night iron
# mellow frigate see message above

I ended up using lua to just hide all the recipes i don't want, though i'm not happy about it, just wated to use the recipes method to supress them

#
local recipes = getScriptManager():getAllRecipes()

local suppressedRecipes = {
    ['Make Stone Axe'] = true,
    ['Make Stone Hammer'] = true,
    ['Make Stone Knife'] = true,
    ['Make Stone Sledgehammer'] = true,
    (...)
}

DarkhoundsTweaks = DarkhoundsTweaks or {};
function DarkhoundsTweaks.supressRecipe() return false; end

for i = 0, recipes:size() - 1 do
    local recipe = recipes:get(i);
    local name = recipe:getOriginalname();

    if suppressedRecipes[name] then
        recipe:setIsHidden(true);
        recipe:setCanPerform('DarkhoundsTweaks.supressRecipe');
    end
end
bright fog
night iron
#

that's what i ended up doing yes, and just updated to include a bogus onCanPerform that always returns false to also suress it from the context menu

bright fog
#

That doesn't remove it from the context menu ?

night iron
#

nope it removed it from the crafting window but still had it on my conext menus

bright fog
#

Lmao

#

Yikes

night iron
#

this just feels as dirty as it gets

bright fog
#

That means profession recipes can technically be accessed by anyone ?

#

Unless they handle that a different way

night iron
#

wtf i just had a issue where the client would refuse to use my mod from the workshop dev folder and instead would prefer the steamaps installed mod version instead??? 1st this happened, had to deleted the installed version for it to start reusing the dev folder 😕

bright fog
#

That's a known problem that you'll have to deal with when modding drunk

night iron
#

is it just random? or is there something that triggers it?

bright fog
#

It's not random

#

Just whenever you have mods with the same modID they will fuze together

#

You can't do anything about it

night iron
#

hum this is a new mod, with a single mod inside it

#

it's also unlisted

bright fog
#

Either make sure your version in the workshop folder is the same, or you have different modIDs, which you need to remember to change back drunk

#

Just make sure to unsub from your workshop mods

#

That's usually the way to go

#

B42 will fix this problem

winter bolt
#

multiple times ive had issues that drove me insane for a whole day before i realised it was because i forgot to unsub from the mod

#

horrible experience

ancient grail
ancient grail
bright fog
#

And in the case of mods that take a while to develop and you might use the mod itself I make beta versions where I change the mod ID

#

And the uploaded version has a different one

#

So I got my unstable version and stable version

#

Also allows me to upload that unstable in another mod to make MP tests

fleet bridge
#

Oncanperform just means you can't do it

fleet bridge
night iron
fleet bridge
#

I don't remember off the top of my head

#

Lol

#

-modfolders mods,workshop,steam

night iron
#

interesting, thank you @fleet bridge

fleet bridge
night iron
ancient grail
#

you might want to try that approach if youre still having problems

not the cleanest way but it works

fleet bridge
#

Iirc the recipes may still show up in craft helper menu

#

But that's probably nbd

bright fog
bronze yoke
#

i don't know about craft helper specifically but i've seen other crafting menu rewrites ignore it for performance reasons

magic eagle
#

Is there any Lua function for sprinting?
Currently, the only function based on movement seems to be

getPathFindBehavior2():pathToLocation

ancient grail
#

zombie:setWalkType("sprint1")
or maybe
setWalktype()

#

yeah its the first one

magic eagle
#

Thanks! Is there any function for players? I can't seem to find the answer in all the current mods and documents.

bronze yoke
#

have you tried setForceSprint/setForceRun?

subtle flume
#

yes it does

stable marsh
#

Is it possible to check if a plastic bag has items within through .LUA or something? Plastic bags gonna be used in a recipe but don't need filled plastic bags to be used, only empty ones.

bright fog
#

wtf

subtle flume
#

I had time to kill

velvet pulsar
#

can a mod change a specific value on an object as it is being used? specifically thrown? I can't think of any examples where the base game does this, but if I hook into an event that the object triggers when thrown, can I modify, say, 'radius' or 'volume' of that object?

#

similarly, if I override a base object with my own, does setting a value inside an itemData() object persist? especially if it is a new variable of my own creation?

bronze yoke
#

to the first question, yes

#

i'm not sure what itemData() refers to

velvet pulsar
#

er, item.getDeviceData()

bronze yoke
#

no, it will not persist

#

if you want persistent data attached to an object look at mod data

velvet pulsar
#

yeah, I'm trying to think of an example mod that does something like that

#

I guess it'd make more sense to figure out how to get a volume control, but I think making the thing a radio means the frequency manager comes along for the ride

#

huh. a cdplayer is a radio with a volume control, and it even has a frequency range. but I can't see anything in the item definition that causes it to not have a frequency listing. custom java?

velvet pulsar
#

oh, huh. I have no idea why, but when I created a radio object and removed the accepted media type, I got just a battery slot and a volume control. but of course it's not throwable because it's not a trap.

#

here's where multiple inheritance would be really handy. I'd like this item to be both Type = Radio and Type = Weapon...

velvet pulsar
#

ah, I guess this is why everybody falls back on the recipe system. I wanted to make the volume remote-controllable, but that's just not possible without reinventing the entire volume system. so I guess three or five recipes, each consuming all of the items and pooping out the item with the setting you want is the way to go.

stark tusk
#

Hi, im just starting out with modding and I tried going for food, I was wondering how we'd achieve

  1. the mechanic where if a food is not hot then it gives unhappiness / reduces the unhappiness a hot version of the food would usually provide?
  2. Reducing unhappiness and boredom only if the food is cooked? (OnCooked function?)
  3. Any best practices on how to implement the above mechanics?
night iron
#

only place i personally know of where to do this is in the item inventory pane, maybe in renderDetails which triggers every tick as long as it's visible, but there may be some triggers you can bind to, maybe some of the more experienced modder in the room can help you with that

barren kraken
#

WIP of my own mod similar to SMUI, currently showing the M1951 field jacket & M1951 ridgeway cap, and type 1 & 2 OG-107 uniforms

night iron
# fleet bridge You want onluatest to remove from context menu

Ok so i just tested using setLuaTest and works exactly like setCanPerform, as in they both remove it from the context menu but i still need to hide the recipe with setIsHidden with either so is there any strong argument on why we should use one or the other?

main pasture
minor estuary
#

(Moving this from #mod_support)
hey yall!
Is anyone open to modding commissions for project zomboid? I was looking to make a personal change to something, but open to possibly comissioning a new trait. I would happily pay. Please DM me if interested, thank you

Edit: hey yall! I’ve got the help of someone already! Thank you for all interest

stark tusk
ancient grail
bronze yoke
#

test is for testing ingredients, canperform is for testing everything else - structurally it makes way more sense to gate it at canperform and it also means your function only runs once per recipe check instead of once per every remotely possible ingredient

night iron
#

ok i have a puzzle that is driving me crazy... RecipeManager.getSourceItemsNeeded is returning a zombie.inventory.types.ComboItem when my character starts a saw log recipe but the instance doesn't seem to have any of its parent itemInventory methods 😕

#

pretty sure it's the log item but i cant find a way to get it's name

bright fog
#

Should have the parent methods

bronze yoke
#

what do you mean it doesn't have the methods? it's a child class

bright fog
#

I've used those in the past

bronze yoke
#

how are you determining this?

#

i don't think vanilla even spawns raw InventoryItems in most cases

bright fog
#

Hmmm

bronze yoke
#

ComboItem is the 'no special properties' subclass

bright fog
#

There are items which aren't any of the childs tho

#

No ?

bronze yoke
#

that's what comboitem is for

night iron
#

print('--==--==>', tostring(items));

#

print('--==--==>', tostring(items.getName));

fleet bridge
#

items:getName()

night iron
#

that will throw an error @fleet bridge because it's nil

fleet bridge
#

getDisplayName()

night iron
#

getName is a method of it's parent

fleet bridge
#

its a ComboItem, what is that?

night iron
#

in any case getDisplayName is also nil

#

this is what i'm trying to understand, it;s a source for the saw logs recipe, which i'm nearly certain is the log

bright fog
#

for some reasons

#

That must be it then

bronze yoke
#

understandable, there is a drainablecomboitem too

bright fog
#

Ah perhaps yeah

bronze yoke
night iron
#

hummmmm

bright fog
#

Classic

bronze yoke
#
for i = 0, arrayList:size()-1 do
    local obj = arrayList:get(i)
    -- do something with obj
end
night iron
#

i forgot what is the proper way to get the length of a java array?

#

ha size

bright fog
#

suize

#

:>

#

made me smile

night iron
#

i'm blaming my fatty fingers 😛

#

thanks guys i managed to fix another bug related to this! 😄

#

a side effect is it now equips the log while being sawn along with the saw since its listed as prop in the recipe he he

sonic bloom
#

Does someone have the base male_body.fbx file?

#

I am trying to look through it the game files but I only see a file named W_Female_Body.FBX

#

If anyone can provide it or help me with that I would really appreciate it 🥹

velvet pulsar
#

so items all have getModData() implying they have an open-ended table of data that mods can set. can this only be done in lua, or can variables be set (e.g. defaults) in the text files in scripts/?

#

alternately, is there a way to declare a new type of item?

ancient grail
sonic bloom
ancient grail
velvet pulsar
#

is there an example anywhere? like a mod that does this?

#

looking at, say, functional chainsaws, it has a custom fuel amount but doesn't set it in the text file

bronze yoke
#

you can but generally you shouldn't

#

all you have to do is add a parameter to the script that isn't recognised by the game as anything else

#

e.g. MyValue = 5, will add moddata under the key MyValue

#

it's not generally advised because then your value is stored per-instance in the save file, but if it's universal and unchangeable to the item then it could just be in a table somewhere and stored only once and not in the save file at all, and if it is actually meant to differ per instance then the default can be set in code that uses it anyway

orchid drift
# ancient grail most mods use lua

Do you think this will work?

if isClient() then return end

local ClientCommands = {}
local Commands = {}
Commands.object = {}

Commands.object.addRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoDoor') or instanceof(o, 'IsoWindow') or instanceof(o, 'IsoThumpable') then
o:addRippedBag(player)
elseif IsoWindowFrame.isWindowFrame(o) then
IsoWindowFrame.addRippedBag(o, player)
else
noise('expected door/window/thumpable got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end

Commands.object.removeRippedBag = function(player, args)
local sq = getCell():getGridSquare(args.x, args.y, args.z)
if sq and args.index >= 0 and args.index < sq:getObjects():size() then
local o = sq:getObjects():get(args.index)
if instanceof(o, 'IsoCurtain') or instanceof(o, 'IsoDoor') then
o:removeRippedBag(player)
else
noise('expected curtain/door got '..tostring(o))
end
else
noise('sq is null or index is invalid')
end
end

Events.OnClientCommand.Add(ClientCommands.OnClientCommand)

ancient grail
#

i just reposted cuz its hard to read im using mobile





if isClient() then return end

local ClientCommands = {}
local Commands = {}
Commands.object = {}


Commands.object.addRippedBag = function(player, args)
    local sq = getCell():getGridSquare(args.x, args.y, args.z)
    if sq and args.index >= 0 and args.index < sq:getObjects():size() then
        local o = sq:getObjects():get(args.index)
        if instanceof(o, 'IsoDoor') or instanceof(o, 'IsoWindow') or instanceof(o, 'IsoThumpable') then
            o:addRippedBag(player)
        elseif IsoWindowFrame.isWindowFrame(o) then
            IsoWindowFrame.addRippedBag(o, player)
        else
            noise('expected door/window/thumpable got '..tostring(o))
        end
    else
        noise('sq is null or index is invalid')
    end
end

Commands.object.removeRippedBag = function(player, args)
    local sq = getCell():getGridSquare(args.x, args.y, args.z)
    if sq and args.index >= 0 and args.index < sq:getObjects():size() then
        local o = sq:getObjects():get(args.index)
        if instanceof(o, 'IsoCurtain') or instanceof(o, 'IsoDoor') then
            o:removeRippedBag(player)
        else
            noise('expected curtain/door got '..tostring(o))
        end
    else
        noise('sq is null or index is invalid')
    end
end


Events.OnClientCommand.Add(ClientCommands.OnClientCommand)
ancient grail
astral turtle
#

could anyone teach me how to add a model i made in blender with the vanilla male body and make it a zombie in game

ancient grail
#

you have to turn off godmode btw

#

other wise it will remain 0

#

press , to open up the mini window panel to see the stats

modern hamlet
#

i'm having trouble syncing an objects inventory with the client, any suggestions of code i could look at?

true nova
#

here's one that may actually do this proper isoObject:sendObjectChange('containers')

stark tusk
#

Hello, Im encountering an issue where adding a spice to a food im coding changes the unhappiness and boredom change to -30 for each spice added, what is causing that behavior (i have not made any changes to the code in my mod that could introduce this kind of behavior)

astral turtle
#

i got the model to mod in game, but it wont show up when i wear it how do i fix this

uneven vessel
#

is there a simple process to adding vanilla attachments such as the laser to a custom weapon?

bright fog
#

If you use the right way to create or move items, you shouldn't need to sync anything from my experience

modern hamlet
#

it was a crate, but i figured it out ty 🙂 now i have a brand new problem. idk how to refresh synced inventories client side without swapping which container i'm looking at

bright fog
#

Not sure what you mean here

modern hamlet
#

the item is in the inveitory but i don't see it unless i cycle through the tabs and back to the crate

bright fog
#

OnContainerUpdate

#

triggerEvent(OnContainerUpdate)

#

That should do it

#

Whenever you add or remove items, always do that or you create duplication glitches

modern hamlet
#

so, when i do a containerupdate, (becasue my item is near other items) it refreshes, and but i'm not longer looking at the correct inventory, i'm looking in the cabinet instead

#

any way to fix that?

bright fog
#

There's a huge confusion on wtf you're doing here ngl

#

What is your mod ? What are you trying to achieve here ?

#

Bcs I don't understand a single shit of what you're trying to do

#

And that doesn't help me understand what your problem is

#

Are you trying to create an item within a container ? Moving them ?

#

Or completely something else ?

modern hamlet
#

i'm spawning an item in a crate from the server.lua, when the item is in the crate, it's invisable until i rotate through other containers (or the ground) back to the container i spawned the item in.

bright fog
#

I've never added items server side so idk how that handles

modern hamlet
#

it doesn't like it, but, it's not a huge deal,

modern hamlet
#

the oncontainerupdate doesn't refresh the single container, (unless the container is at the top of the buttons) (i'm sorry i don't know how to explain exactly)

#

I speak very little projectzomboidese

bright fog
#

OnContainerUpdate tells the client "update what the player sees to the recent changes"

#

Where do you trigger it from ?

modern hamlet
#

client

bright fog
#

Server side ?

#

Idk then

#

What do you use to create your item ?

#

And add it in the inventory

modern hamlet
#

you know it jsut dawned on me, i'm not technically adding stuff to the inventory, (the player adds it) the server determins what needs to be deleted, and deletes it, so what remains needs to be updated to the client

#

so i guess this is it:
for i = 1, stuff do
local item = stuff[i]
container:Remove(item)
end

ancient grail
modern hamlet
#

yeah i've been coding for like 3 days so