#mod_development

1 messages · Page 361 of 1

raven epoch
#

instantly spawns 4 soldiers on the nearest door

#

my npcs have a weird delay

#

let me take vid

#

or it might be because im using ticks

#

havent migrated those to servertime yet

#

i switch to server time and performance tanks??

#

nvm

kindred walrus
#

does anyone know if the lightswitch -> lamp system is modifiable?

#

for example, making lamps that need batteries?

raven epoch
#

so i uploaded a mod to workshop

#

but now i cant see the original one on me pc

#

what do

#

only workshop one i see

sour wave
weak needle
#

I can’t wait

sour wave
#

Most everythings handled clientside and not physically currently, outside storing and showing the information

#

Now I'm stepping into making the actual grave appear in game.

#

And be interactable.

#

I plan to also make a sandbox option that allows you to define how many bodies per chunk you want, defaulting to 3.

modern veldt
#

is there a list on the wiki about current existing ui/windows types in the game?

dark salmon
#

I tried and still crash the reason is "Unknown recipe param", my item name is correct and exist but idk how to correct this
I have this:

module Base {

    craftRecipe RollSativaJoint_Debug
    {
        timedAction = Making,
        time = 60,
        Tags = InHandCraft,
        category = ZazaMod,
        inputs
        {
            item 1 Base.SativaBud_Debug,         
            item 1 tags[base:rollingpaper],
        }
        outputs
        {
            item 1 Base.SativaJoint_Debug,      
        }
    }
}
quasi kernel
dark salmon
quasi kernel
#

As in like, do you have to do tags[base:rollingpaper] or can you just do the base:rollingpaper thing

#

That's my first guess

dark salmon
dark salmon
#

in recipes_tobacco.txt

quasi kernel
#

Did you define that tag?

#

If the tag is invalid it's probably mad at that

dark salmon
#

not custom item just original items

quasi kernel
#

Heck

#

How strange..

#

Do you have the custom items defined under Base or

#

If not it's probably failing to find the items for input

#

(The recipe can be under Base, the items don't have to be.)

#

Well, "don't have to be", still has to include base or whatever

dark salmon
#

yep i changed everything under Base like this:

module Base {...}
#

or if you want the exact error:

ERROR: General      f:0, t:1766613981940> ExceptionLogger.logException> Exception thrown
    java.lang.Exception: unknown recipe param: Base.SativaBud_Debug at InputScript.Load(InputScript.java:822).
    Stack trace:
        zombie.scripting.entity.components.crafting.InputScript.Load(InputScript.java:822)
        zombie.scripting.entity.components.crafting.InputScript.Load(InputScript.java:604)
        zombie.scripting.entity.components.crafting.CraftRecipe.LoadIO(CraftRecipe.java:599)
        zombie.scripting.entity.components.crafting.CraftRecipe.Load(CraftRecipe.java:523)
        zombie.scripting.entity.components.crafting.CraftRecipe.Load(CraftRecipe.java:370)
        zombie.scripting.ScriptBucket.LoadScripts(ScriptBucket.java:258)
        zombie.scripting.ScriptBucketCollection.LoadScripts(ScriptBucketCollection.java:125)
        zombie.scripting.ScriptManager.loadScripts(ScriptManager.java:1642)
        zombie.scripting.ScriptManager.Load(ScriptManager.java:1577)
        zombie.GameWindow.initShared(GameWindow.java:217)
        zombie.GameWindow.init(GameWindow.java:1179)
        zombie.GameWindow.mainThreadInit(GameWindow.java:690)
        zombie.GameWindow.mainThreadStart(GameWindow.java:560)
        zombie.MainThread.mainLoop(MainThread.java:58)
        java.base/java.lang.Thread.run(Unknown Source)

Idk why

quasi kernel
#

It doesn't know what the Base.SativaBug_Debug is

#

That's what it's getting mad at

#

Did you define the item under a different module?

#

If so, use that module instead of Base.

#

(Not for the craftrecipe holder, just for the item name.)

#

MyModuleName.SativaBud_Debug

dark salmon
#

i defined this item in Base look:

module Base {
    /*imports {
        Base
    }*/

    /**************** DEBUG ****************/
    item SativaBud_Debug
    {
        DisplayName = Sativa flower DEBUG,
        DisplayCategory = ZazaMod,
        Tooltip = Tooltip_NLK_ReducePanic,
        ItemType = base:food,
        FoodItemType = Vegetables,
        Weight = 0.1,
        Icon = SunflowerHead,
        WorldStaticModel = SunflowerHead,
        StaticModel = SunflowerHead,
        StressChange = -15,
        UnhappyChange = -40,
        BoredomChange = -20,
        ReducePanic = 30,
        DaysFresh = 6,
        DaysTotallyRotten = 8,
        HungerChange = -1.0,
        ThirstChange = 4.0,
        /*Tags = nlk:cannabis_bud,*/
    }
    

    item SativaJoint_Debug
    {
        DisplayName = Sativa joint DEBUG,
        DisplayCategory = ZazaMod,
        Type = base:food,
        Weight = 0.01,
        Icon = CigaretteRolled,
        CantBeFrozen = true,
        CustomContextMenu = Smoke,
        EatItemType = Cigarettes,
        OnEat = RecipeCodeOnEat.consumeNicotine,
        RequireInHandOrInventory = Base.CandleLit/Base.Matches/Base.Matchbox/Base.LighterDisposable/Base.Lighter/Base.LighterBBQ/Base.Lighter_Battery,
        HungerChange = 0.0,
        StressChange = -4,
        StaticModel = CigaretteRolled_Lit,
        WorldStaticModel = CigaretteRolled,
        /*CustomEatSound = ,*/
        Eattime = 460,
        FoodSicknessChange = 14,
        InverseCoughProbability = 10,
        InverseCoughProbabilitySmoker = 2,
        Tags = base:useall;base:smokable,/*nlk:cannabis_joint,*/
    }


    /**************** DEBUG ****************/
}

Like i said, to be sure i changed every module NLK to Base

quasi kernel
#

..how weird.

dark salmon
#

yea..

quasi kernel
#

Maybe there's something wrong with the item def.

dark salmon
#

I just copied an item in game files to be sure it worked before the recipe thing

#

i think the recipe system is broken or idk

quasi kernel
#

The recipe system was working fine for someone else I was helping the other day, something is up with the script.

#

The issue is the scripts aren't typically the best at telling you what's wrong

dark salmon
#

you know what

#

i put in comments the recipe and the game doesn't crash anymore..

#

it is very weird

#

does in 42.13.1 the recipe systeme changed?

quasi kernel
#

The recipe system I think was mostly unchanged(?)

#

If unsure, just test with individual components.

dark salmon
#

yes i'll try it now

quasi kernel
#

Copy a vanilla recipe and just keep regular items, then try modded items and see if it does the same error.

quasi kernel
dark salmon
#

okay renamed vanilla recipe with regular items works and with modded items works too...

#

i think something messed up in my first recipe

sour wave
#

b42.13 changed the way recipes and such were registered.

dark salmon
#

oh okay? did you have an example for me please?

sour wave
#

I'm not sure, if you look at the website, it has an example mod that shows the new registration system in use

dark salmon
#

okay i check this out

#

in the indie stone forums or pz wiki modding?

sour wave
#

Indy stone, its in the updates forum

dark salmon
sour wave
#

Ill see if I can find it

dark salmon
#

okay thx

#

@quasi kernel thanks for trying helping me i found a solution that is very weird

dark salmon
#

i put the item name in [] and it works

module Base
{
    craftRecipe RolledSativaJoint
    {
        timedAction = Making,
        time = 60,
        Tags = InHandCraft,
        inputs
        {
            item 1 [NLK.SativaBud_Debug] mode:destroy,
            item 1 tags[base:rollingpaper],
        }
        outputs
        {
            item 1 NLK.SativaJoint_Debug,
        }
    }
}
#

i also changed my others module name from Base to NLK like it was originally

#

Did you know how to rename the recipe name? the text is RolledSativaJoint but i want with spaces like this Rolled Sativa Joint

#

I found it, in recipes_en.txt

quasi kernel
#

Sorry I got distracted

dark salmon
#

no problem, it's a little bit difficult for modding in PZ for the first time but it's very cool when all works

quasi kernel
#

Yeye! You'll pick up more little bits of knowledge as you go

dark salmon
quasi kernel
unique harbor
#

So I was trying to find out why my nested containers mod doesn't work in Multiplayer and it seems it has to do with a ItemTransactionPacket in the ISInventoryTransferAction:new function?
I'm kinda clueless now, does anyone had a similiar issue?

So basically I try to move the nails into the green backpack and I get a infinite action bar.
I traced it down to the action which fails because it get's a maxTime of -1

#

I'm not modifying the item move function itself, just adding container buttons and I have no idea what to do with that information.

#

I just overwrote the original function and added some debug prints to figure out where it actually fails.

unique harbor
#

I'm guessing it's because the mod files are inside lua/client so I'm only modifying the container buttons on the clientside I guess?
I read the API for Inventory Items.pdf but mate... no Idea what they want from me.

bright fog
unique harbor
fleet bridge
unique harbor
# fleet bridge Isn't this a shared timed action now?

Yeah I think the same but I'm just confused rn because I'm not doing anything with actions itself.
But I do modify the clientside inventory buttons which get used by the server in the actions so it's a indirect issue with that?

fleet bridge
#

If you've overwritten it in client then server won't be able to do anything

#

It needs to be in shared

#

(or server)

unique harbor
#

Yeah and that's what I have to adjust because simply making it shared breaks my modOptions somehow...

#

I bet there will be more issues on the way

fleet bridge
#

I am not sure why that would be, unless shared loads after mod options stuff?

unique harbor
#

Well I'll just give it a try but nothing has been easy modding for this game

#

Not even sure how PZAPI.ModOptions works on the serverside

bronze yoke
#

it doesn't

#

mod options are client options, it's not loaded on the server at all

unique harbor
#

Yeah thought so... so I can also modify the whole mod since I have a few options there for the client visuals inside the code.

bright fog
#

Any options which should affect every clients should use sandbox options

unique harbor
#

Yeah but it's a personalized setting for each client, that will be fun to do serverside.

local depth = 0
local function handleItemContainer( inventoryPage, itemContainer )
    if depth >= nestedOptions["nestedDepth"] then return end
    depth = depth + 1

    local inventory = itemContainer:getInventory()
    local items = inventory:getItems()

    for i = 0, items:size()-1 do
        local item = items:get(i)
        repeat
            if not item:IsInventoryContainer() then break end

            addItemContainerButton( inventoryPage, itemContainer, item )
            handleItemContainer( inventoryPage, item )
        until true
    end
end
#

I'm adding container buttons based on the users settings, which means I have to somehow let the server know the setting of the player so that the server can also load / add those containers...

#

Because every user has their own wish of how deep the containers nest

#

Simple example:
I'm adding the green backpack button on the right, so it's in inventoryPage.backpacks for the client, but the server doesn't have that rn, that's why the transfer fails.

#

I'll just remove the multiplayer buttons, problem solved.

shy mantle
#

There's this weird interaction between setting air tiles to solid, having other clients walk over them, and "walk to" combined. For some reason, characters that are not from the client that sets tiles to solid will disappear while on it, however, if you hover your "walk to" square over that set square, the player will come back and everything about that square will be treated as if you did actually set it to solid. I'm guessing because this would flag the solid tile as TreatAsSolidFloor as well? Honestly very confused by how that even happens and why they're different.

bright fog
#

Well simply have users send their settings on option changes

#

You can do that, you can detect when your mod options change

#

Check out the wiki page for mod options

bronze yoke
#

why does the server even have the concept of inventory pages? something doesn't sound right there

bright fog
#

Then with a simple command send you can load the current options

bright fog
unique harbor
bronze yoke
#

what exactly do you need to do on the server that requires the player's mod options?

silent zealot
bronze yoke
#

most likely you just need to allow the transfers, only the client should care about what items it can see and try to transfer

#

you don't even need to know the player's depth limit, you just have to disable the check for being inside a container entirely (assuming there is one), since they could always just set the setting higher it's not a security risk

silent zealot
#

I'd assume you just do the move on the client and then use these:

#

Odds are good the server doesn't care about containers being nested or anything, it just needs to know which container to add/remove the item from.

bronze yoke
#

the client can't call these, there would be no security at all and the entire thing would be pointless 😅

#

the server moves items and then sends the move, the client just asks it to

silent zealot
#

Actually I got it backwards - those commands are for the server sending the change to clients. I think. I'm still very new to multiplayer modding.

silent zealot
#

I was typing as he she said that! 😛

bright fog
#

she

unique harbor
bright fog
#

But yea the server knows all, the client doesn't now jackshit

bright fog
#

perform runs only client side

#

Complete runs server side only

#

SP both are ran

unique harbor
#

well there's no complete inside of that file

#

Where can I see the server code?

bright fog
#

There isn't

unique harbor
#

Awesome

bronze yoke
#

yeah i'm not really sure how the inventory transfer action works right now

#

it's not using the new network model

bright fog
#

That timed action is extremely weird

#

It's abnormal

#

Tbf that timed action is duct tape on duct tape

unique harbor
#

So I'm supposed to write code for a action which you can't understand, because there's no serverside code you can look into

bright fog
#

It's shit going everywhere when you study it lmao

bronze yoke
#

yeah i've never looked too close at it even in older versions because it seems to be extremely complex and unique among timed actions

bright fog
silent zealot
unique harbor
#

Yeah I noticed that the first time I tried to

bright fog
#

It doesn't follow the classic code of PZ and it' sone of the finest spaghetti you can find in PZ lmao

bronze yoke
#

it looks like createItemTransaction is probably doing the actual transfer

bright fog
#

No joke it's quite the spaghetti timed action 😅

silent zealot
#

We should have a little community competition for worst bits of code in Zomboid. Moving inventory items around is a good contender, I remember trying to make sense of it well enough to bypass weight restrictions and... ugh.

#

Not helped by weird hard coded limits in Java... that are enforced by lua and ignored by java.

bright fog
#

Tbf, that timed action is hard to organize I feel like

#

It's a lot of logic of don't do that in X Y Z condition and do that in I J K condition

#

The spaghetti comes from that

unique harbor
bronze yoke
#

it's java yeah

bright fog
#

Check the Java decompile

unique harbor
#

Yeah will have to do that, first need to decompile the new version..
never needed it and done it like once

silent zealot
#

Is Steam workshop down for everyone, or does it just hate me?

silent zealot
simple helm
#

Figured for the end of 2025 I would post this here letting you know it working with the help of another dev for the coding

silent zealot
#

I thought Street Smarts would be a big pain to update but in the end all I had to do was change one Z to z becasue a private java field I was accessing was renamed.

unique harbor
#

Am I supposed to get two other ultrawides so I can stretch it or is there another way?

silent zealot
#

look in console.txt

#

or might have a different name if it's from the server... but in single player everything on that lua console is also in console.txt

unique harbor
#

where is that file? user folder?

silent zealot
#

c:\users\<your username\Zomboid\

unique harbor
#

Alright thx

#

I get that information with the message that it timed out

#

That's a transfer that worked.

frail violet
#

I'm trying to update my mod to b42, but am having no luck especially since I chose the worst time to do this (steam is down?). Can anyone break the file structure changes down for me? The mod is showing in b42 mod selection window, but no clothing items are visible and the throw an error when selected in character creation.

silent zealot
#

The very short version is you need a 42 folder and a common folder in your mod. You can leave common empty, but it must exist.

#

If you want to support multiple versions of B42 you can have more specific folders and move things like images to common... but everything in 42/common is empty is a good way to get started.

frail violet
silent zealot
#

Almost certainly, but it depends on what the mod actually does.

#

Items and recipies need to be rewritten using the new format (NOTE: B42.13 makes more changes to these, so compare to vanilla instead of relying on tutorials)

#

Code stuff... depends what it does, could be anything to "works with a minor fix to name" to "complete rewrite needed"

silent zealot
#

I just managed to get the muzzle flash & bullet origin working properly for my guns. It's a mess! I think the new-ish muzzle flash code is exposing issues where things were not perfectly set up that previously were not obvious.

This tutorial is still accurate on the needed scale/rotation/orientation needed in blender before exporting to .fbx, and if you don't get this perfect you can end up with gun attachments working and muzzleflash being wrong: https://steamcommunity.com/sharedfiles/filedetails/?id=3060255898

The muzzle attachment point should look something like

        attachment muzzle
        {
            offset = 0.0000 0.1368 -0.0246,
            rotate = -90.0000 0.0000 0.0000,
        }

with a -90° rotation on X, then translate it to the right point. And hope that no-one is relying on the muzzle attachment point to stick attachments on your weapon because now those won't point in the proper direction.

Finally you need MuzzleFlashModelKey in the item script. Then it all mostly lines up... even the vanilla guns don't quite match if you look close.

frail violet
merry grove
#

Well my mod broke, found out its becuse now I need to add prefix forageSystem to everything
Also do you guys know a good way of testing spawns outside of just wandering for hours among the zones?

open fossil
#

Enable LootZed in debug mode, right click on a container that should have distributions for your item set up, and it should show you the probabilities.

merry grove
#

Ah I mean for forging forging not loots

grizzled fable
#

hi, please someone can tell how to add forage items ingame with 42.13, old way seems not to work ty

merry grove
#

spawnFuncs = { forageSystem.doWildFoodSpawn, forageSystem.doRandomAgeSpawn},
altWorldTexture = forageSystem.worldSprites.smallTrees,
itemSizeModifier = 1.5,

#

This solved my errors issue

#

Still have a issue with checking it ACTUALLY spawns

pliant pelican
#

Hey Guys, Im new to coding and im trying to make a simple mod food mod. I did alot of research and still actively learning as i go and reading. Im currently stuck at my LUA function not sure if this is whats causing infinite errors when trying to even click on the item in the crafting menu. this is my Lua Function:

merry grove
#

Aaaand the error?

pliant pelican
#

sending now

#

I asked another mod creator for advice and they told me to make a registries.lua

pliant pelican
#

hold on i think i left out the other errors

merry grove
#

One thing I see you calling the in game stuff to then call your own thing

#

function Recipe.OnCreate.JKGiveDriedMeat(craftRecipeData, character)
I feel this is the problem

pliant pelican
pliant pelican
merry grove
#

One second but I feel this should be a Event

pliant pelican
#

i can send my craftRecipes and items files, they are really short just 4 items lol. Starting small so i can learn and work my way up

merry grove
#

What exactly you want to do with this ? I know give random amount but for what

pliant pelican
#

So I created an Item aka DriedMeatPackage which then can be opened to randomly give one of the 3 Dried Meats

#

pretty basic just trying to learn

#

the recipes work and but the one recipe that calls the LUA function just causing mayhem

pliant pelican
merry grove
# pliant pelican

If I understand this right you want to give one of 3 random options?

pliant pelican
#

yeah

sonic needle
#

PTSD Simulator Tier audio.

merry grove
#

java.lang.IllegalArgumentException: Default namespace 'base:base.jkdriedchicken' is not allowed!

#

Somethings off here

#

Oh I see

pliant pelican
merry grove
#

You didn't put them as strings

#

Yeah they suppose to be in like that

#

You put them as refrences to nothing

pliant pelican
#

what strings would I put?

merry grove
#

Just put "
character:getInventory():AddItem("Base.JKDriedSteak");
sendAddItemToContainer(character:getInventory(), "Base.JKDriedSteak");

pliant pelican
#

should I keep or remove the registries.lua too?

merry grove
#

No clue never used that

#

It has to be either a string like I posted or
instanceItem("Base.JKDriedSteak")

#

From what I am reading in the docs

pliant pelican
#

function Recipe.OnCreate.JKGiveDriedMeat(craftRecipeData, character)
local meatChance = ZombRand(1,4);
if meatChance==1 then
character:getInventory():AddItem("Base.JKDriedSteak");
sendAddItemToContainer(character:getInventory(), "Base.JKDriedSteak");
elseif meatChance==2 then
character:getInventory():AddItem("Base.JKDriedChicken");
sendAddItemToContainer(character:getInventory(), "Base.JKDriedChicken");
elseif meatChance==3 then
character:getInventory():AddItem("Base.JKDriedPorkChop");
sendAddItemToContainer(character:getInventory(), "Base.JKDriedPorkChop");
end
end

merry grove
#

Yea try that if not try doing
local idstake = instanceItem("Base.JKDriedSteak"
character:getInventory():AddItem(idstake );
sendAddItemToContainer(character:getInventory(), idstake);

silent zealot
merry grove
#

local lid = instanceItem("Base.JarLid");
local mData = jar:getModData()
local cond = mData.LidCondition or 9
lid:setCondition(cond)
character:getInventory():AddItem(lid);
sendAddItemToContainer(character:getInventory(), lid);

silent zealot
#

And if you want to make use of the tag in lua later assign it to a global variable:

JKITEM_MEATPACK = ItemTag.register("jk:driedmeatpackage")
#

I don't know if you have to use all lowercase, but the examples did so I have stuck with that.

sonic needle
#

WAR's M9A4

silent zealot
#

Until something changes! Street Smart's B42.13 update consisted of changing one Z to a z.

silent zealot
sonic needle
merry grove
#

Still don't know if you can find my modded fruits

#

At least I killed all the errors

#

Pretty sure this is the correct way of registering stuff now?

hidden compass
#

How should I synchronize the Global ModData set on the client side?
ModData.transmit(“xxxxxx”) did not synchronize it.

quasi kernel
#

My first guess is you'd probably have to copy the table data manually-

#

Yeah

#

Global mod data in particular doesn't feel like the sort of thing to have a built-in transmit simply because it's global.

#

The rest are usually hooked to an object.

bright fog
#

Global mod data tends to have a lot of data

quasi kernel
#

Oh, it does?

bright fog
#

But this tends to be the kind of mod data with a lot of data stored by modders

quasi kernel
#

I mean, couldn't you apply that same logic to any object with mod data?

pliant pelican
bright fog
#

And it was already bad practice to try to use transmit because it wouldn't work properly

bright fog
quasi kernel
bright fog
#

But transmit for global oftened bugged out and a lot of data wasn't getting transmitted

bright fog
#

One object only gets its data synced

quasi kernel
#

Hm, interesting. I guess doing it manually you could narrow it down to what needs to be sent anyways.

quasi kernel
bright fog
#

Sending the whole table is costly for no reasons

#

You never need to sync the whole thing

quasi kernel
#

I think the horror mod I'm working on will be the first time I use global mod data actually lol

bright fog
#

And in fact, data should systematically be stored in the server for the most part now

quasi kernel
#

I've used object mod data every other time

#

Just to check, global mod data exists to be saved between sessions, correct?

#

Because otherwise I don't see the difference between using it and just storing stuff in modules like I do-

pliant pelican
# merry grove yea for each item

function Recipe.OnCreate.JKGiveDriedMeat(craftRecipeData, character)
local DriedSteak = instanceItem("Base.JKDriedSteak")
local DriedChicken = instanceItem("Base.JKDriedChicken")
local DriedPorkChop = instanceItem("Base.JKDriedPorkChop")
local meatChance = ZombRand(1,4);
if meatChance==1 then
character:getInventory():AddItem(DriedSteak);
sendAddItemToContainer(character:getInventory(), DriedSteak);
elseif meatChance==2 then
character:getInventory():AddItem(DriedChicken);
sendAddItemToContainer(character:getInventory(), DriedChicken);
elseif meatChance==3 then
character:getInventory():AddItem(DriedPorkChop);
sendAddItemToContainer(character:getInventory(), DriedPorkChop);
end
end

#

like this right?

bright fog
quasi kernel
#

I dont typically have a need to save much so

#

I would've used it to save checked chunks in my last mod, but I couldn't check chunks anyways on the server, not reliably anyways.

quasi kernel
#

Well, they existed, but were empty.

#

I ended up using a tile-based solution instead.

hidden compass
#

Thanks, I'll check server/client source.

pliant pelican
#

not sure whats wrong

merry grove
#

Send the new error log

pliant pelican
merry grove
#

base:base.jkdriedporkchop huh?

pliant pelican
#

im gonna remove the registry lua and see if it changes

pliant pelican
#

same thing

merry grove
#

base:jkdriedsteak
Where did you name stuff like it?

#

Also did you reload your mod

pliant pelican
#

Yes I in main menu reset LUA

merry grove
#

Try maybe not adding to the base then

pliant pelican
#

All those Vanilla lines break

merry grove
#

module MattSimpleAddons
{
imports
{
Base
}

Try this

pliant pelican
#

Then remove the crafting UI

merry grove
#

For item def

pliant pelican
#

Okay will try

merry grove
#

Just name it your way don't copy mine <w> I use it to keep track my mods

merry grove
#

uuuugh finally it woooorks

#

I can find them in the wild

#

alright, perfect my mod is working agin

silent zealot
#

You can still put items into Base, but any tags/traits/whatever that you add using the registry have to use a different namespace

silent zealot
#

Your mod adds items and recipes, correct?

#

I'd start by removing all recipes and justt getting the items working. Compare the item scripts to the vanilla 42.13 items to make sure you have the fields correct.

#

Then once that works (i.e.: you can start the game without issues and use the debug menu to spawn your items) work on the recipies.

#

You may not need a registries.lua, if you are not registering any new tags/etc.

pliant pelican
#

items work

#

and other recipes work just not the unpackage one

silent zealot
#

Post the recipe script

#

Also, if it's using an OnCreate function see if that is the cause by getting rid of it... though the error makes me thing it's something in the recipe itself breaking the UI

pliant pelican
#

module Base
{
imports
{
Base
}

craftRecipe OpenDriedMeatPackage
{
    timedAction = PackingBox_Small,
    Icon = JKDriedMeatPackage,
    NeedToBeLearn = false,
    Tags = AnySurfaceCraft,
    Time = 60,
  
    inputs
    {
        item 1 [Base.JKDriedMeatPackage]
    }
    outputs
    {

    }

    OnCreate = craftRecipe.OnCreate.JKGiveDriedMeat,

}

craftRecipe RehydrateSteak
{
   Time = 100,
   ToolTip = Rehydrate meat,
   Tags = RickClickOnly;InHandCraft;Cooking,
   SkillRequired = Cooking:2,
   xpAward = Cooking:3,
   AllowBatchCraft = true,
   
   inputs
   {
        item 1 [Base.JKDriedSteak],
        item 1 [*],
        -fluid 1.0 [Water],
   }
   outputs
   {
   item 1 Base.Steak,
   }
        
}

craftRecipe RehydrateChicken
{
   Time = 100,
   ToolTip = Rehydrate meat,
   Tags = RickClickOnly;InHandCraft;Cooking,
   SkillRequired = Cooking:2,
   xpAward = Cooking:3,
   AllowBatchCraft = true,
   
   inputs
   {
        item 1 [Base.JKDriedChicken],
        item 1 [*],
        -fluid 1.0 [Water],
   }
   outputs
   {
   item 1 Base.Chicken,
   }
        
}

craftRecipe RehydratePorkChop
{
   Time = 100,
   ToolTip = Rehydrate meat,
   Tags = RickClickOnly;InHandCraft;Cooking,
   SkillRequired = Cooking:2,
   xpAward = Cooking:3,
   AllowBatchCraft = true,
   
   inputs
   {
        item 1 [Base.JKDriedPorkChop],
        item 1 [*],
        -fluid 1.0 [Water],
   }
   outputs
   {
   item 1 Base.PorkChop,
   }
        
}

}

silent zealot
#

I think you need an output

pliant pelican
silent zealot
#

STOP! Do not trust ChatGPT

pliant pelican
#

I know lol

#

i was like fuck it see what it says

silent zealot
#
  1. it's always been terrible at anything Zomboid Specific 2) even if it wasn't, it hasn't been trained on recent changes.
#

try making the output something like a piece of Base.JKDriedChicken

#

in case it's unhappy because the output section is empty (presumably because it will get populated with the OnCreate)

#

although empty output is legal:

sonic needle
pliant pelican
silent zealot
#

What about without the OnCreate?

unique harbor
#

Maybe stupid question but when does that trigger?
if not server and not client

#

it's a shared lua file

silent zealot
pliant pelican
pliant pelican
#

i removed oncreate and left put 1 item in the output just to test and still crashes. Also deleted the lua file to since i removed oncreate

bright fog
#

Access squares

#

And I assume you could access chunks like that

#

Or anyway you can do some simple math to check the squares of the chunk

#

And whatever you need to do

silent zealot
#

One idea to isolate the issue; make the problem recipe a copy of another recipe, confirm that works, then change it one line at a time into the recipe you want and see exactly where it breaks

merry grove
#

try
module JKMods

#

and replace any mention to base next to your items with it

#

same with items try to have your own module instead of adding to the Base

merry grove
#

Ye test it alos change them in the Lua file

pliant pelican
#

i got rid of the lua files

#

tryna test the one recipe to get it working but idk its broken

merry grove
#

What is the error

pliant pelican
#

STACK TRACE

function: restoreJoypadState -- file: ISPanelJoypad.lua line # 344 | Vanilla
function: calculateLayout -- file: ISWidgetIngredientsInputs.lua line # 198 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 437 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 103 | Vanilla
function: calculateLayout -- file: ISCraftRecipePanel.lua line # 109 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 437 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 103 | Vanilla
function: calculateLayout -- file: ISHandCraftPanel.lua line # 112 | Vanilla
function: calculateLayout -- file: ISHandcraftWindow.lua line # 109 | Vanilla
function: prerender -- file: ISHandcraftWindow.lua line # 159 | Vanilla.
[25-12-25 08:10:37.640] LOG : General f:39775, t:1766668237640> __len not defined for operand.
[25-12-25 08:10:37.640] ERROR: General f:39775, t:1766668237640> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: __len not defined for operand at KahluaUtil.fail(KahluaUtil.java:99).
Stack trace:
se.krka.kahlua.vm.KahluaUtil.fail(KahluaUtil.java:99)
se.krka.kahlua.vm.KahluaUtil.luaAssert(KahluaUtil.java:89)
se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:542)
se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:167)
se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1756)
se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1600)
se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:35)
zombie.ui.UIElement.render(UIElement.java:1668)
zombie.ui.UIManager.render(UIManager.java:366)
zombie.gameStates.IngameState.renderFrameUI(IngameState.java:1189)
zombie.gameStates.IngameState.renderframeui(IngameState.java:1178)
zombie.gameStates.IngameState.renderInternal(IngameState.java:1290)
zombie.gameStates.IngameState.render(IngameState.java:1248)
zombie.gameStates.GameStateMachine.render(GameStateMachine.java:24)
zombie.GameWindow.renderInternal(GameWindow.java:460)
zombie.GameWindow.frameStep(GameWindow.java:846)
zombie.GameWindow.mainThreadStep(GameWindow.java:597)
zombie.MainThread.mainLoop(MainThread.java:68)
java.base/java.lang.Thread.run(Unknown Source)
.

#

its breaking Vanilla somehow

merry grove
#

you right nwo have only the two files yes?

#

the items + recipies?

pliant pelican
#

yup

#

i could join a vc and share screen to show my file and folders

#

could len not defined for operand be saying something is coing up nil like i forget to add a value to something that i shoul've?

merry grove
modern veldt
#

Guys, how can I achieve item drop on a box

#

like in the hotbar mechanics

pliant pelican
#

screen goes blank now on enabling mod

merry grove
#

Try this

pliant pelican
#

mod loaded but

#

.
[25-12-25 08:47:48.259] ERROR: General f:3605, t:1766670468259> KahluaThread.flushErrorMessage > dumping Lua stack trace

STACK TRACE

function: restoreJoypadState -- file: ISPanelJoypad.lua line # 344 | Vanilla
function: calculateLayout -- file: ISWidgetIngredientsInputs.lua line # 198 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 437 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 103 | Vanilla
function: calculateLayout -- file: ISCraftRecipePanel.lua line # 109 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 437 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 103 | Vanilla
function: calculateLayout -- file: ISHandCraftPanel.lua line # 112 | Vanilla
function: calculateLayout -- file: ISHandcraftWindow.lua line # 109 | Vanilla
function: prerender -- file: ISHandcraftWindow.lua line # 159 | Vanilla.
[25-12-25 08:47:48.259] LOG : General f:3605, t:1766670468259> .
[25-12-25 08:47:48.530] ERROR: General f:3605, t:1766670468530> KahluaThread.flushErrorMessage > dumping Lua stack trace

STACK TRACE

function: restoreJoypadState -- file: ISPanelJoypad.lua line # 344 | Vanilla
function: calculateLayout -- file: ISWidgetIngredientsInputs.lua line # 198 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 437 | Vanilla
function: calculateLayout -- file: ISTableLayout.lua line # 103 | Vanilla
function: calculateLayout -- file: ISCraftRecipePanel.lua line # 109 | Vanilla
function: updateTitleWidget -- file: ISCraftRecipePanel.lua line # 183 | Vanilla
function: update -- file: ISCraftRecipePanel.lua line # 143 | Vanilla.
[25-12-25 08:47:48.530] LOG : General f:3605, t:1766670468530> __len not defined for operand.

#

its just the OpenDriedMeatPackage

pliant pelican
#

tired this how it makign me feel lol

merry grove
#

You have level 2 cooking on the character?

pliant pelican
#

yup

#

plus im in debug mode

merry grove
#

Oh yeah

pliant pelican
merry grove
#

I made it so you need a soucepan or pot

pliant pelican
#

they still shouldnt cause the UI to delete to click the item to see what it requires in crafting menu

merry grove
#

Ah no it rehedrates correctly yes?

pliant pelican
#

yup

#

all other recipes work

merry grove
#

Alright, yeah I just made there mode:keep

#

but I think I can just delete the whole line there about it becuse its only needed for stuff

#

Also I am in a better Debug mode <w>

pliant pelican
#

you running the same scipts?

#

see you knocked down the to one error?

merry grove
#

Hm thinking about it

#

Complains about resolution of all things

pliant pelican
#

im just baffled on whats wrong

merry grove
#

Have a idea

pliant pelican
#

the amount of things ive been tweaking and trying

#

fried my brain

merry grove
#

I think I found it

#

Let me test it

#

Yup fixed it

#

You forgot a single comma here next to inputs

#

This one

#

Forgot that I also removed the icon for tests

pliant pelican
#

Aint no way

#

i swear to god i went and made sure to check for all the ,

#

man i feel so stupid LMFAO

merry grove
#

Check the rehydrated stuff recipies I fucked with them a bit and you might need to re-roll some of the changes I did <w>

#

You should be able to just run the Lue we finished now too

#

The last version

#

with isinstance

pliant pelican
#

bet

#

gonna try it

quasi kernel
#

Unfortunately, I tried it lol

#

World Items apparently spawn pretty late including after squares are loaded

pliant pelican
frank elbow
#

I could've sworn in the earlier 42 builds there was an isSingleplayer global function added (that would avoid having to write it as in that screenshot), but I guess it was decided to be redundant

knotty stone
frank elbow
#

& the info is available via isClient & isServer anyhow, it'd basically just be a shortcut for what NikkuMiru sent

#

Oh, if that was meant as a potential answer as to what I was thinking of: I meant a method exposed as a global Lua function in LuaManager.GlobalObject. Pretty sure it was added at some point & then removed

knotty stone
#

print(getWorld():getGameMode())
in sp you get Apocalypse -> Sandbox

in multi you get multiplayer, is that good enough?

raven epoch
#

how do i seperate the mod

#

i posted to workshop

#

and the one in me pc

frank elbow
frank elbow
#

I've moved away from a non-Steam game & just use a script to launch pz with different profiles (e.g., pz dev → dev mode, pz → playing the game), but the usual method is described there

raven epoch
#

oh

#

not sure if this is the same tho

#

wait

#

there no other way?

#

problem is that they both show up as the same mod

frank elbow
#

What is it about the way explained in that message that seems insufficient for your use case?

#

If you have 2 separate environments (i.e., Lua cache directories) for testing you won't see both

raven epoch
#

nvm i just renamed the dev one

#

why is steam workshop down 😭

#

what do u guys do when u run out of ideas

bronze yoke
#

something else

frank elbow
#

Shake and cry

raven epoch
sonic needle
raven epoch
#

me when peak mod crashes game

#

black screen when i exit to menu

#

its over

bright fog
quasi kernel
#

I'm working on The Horrors™ now

mellow frigate
#

Have you been able to create ItemActions with IsoGridSquare or InventoryItem instances as parameters for the creation function (new) in Multiplayer ? Here is my log of the function client side, notice the first parameter (IsoPlayer instance) being passed: LOG : Lua f:312, t:1766691459269, st:24,174,113> Arc.ISBuildFromBlueprintActionMP 1 IsoPlayer{ Name:null, ID:389 } LOG : Lua f:312, t:1766691459270, st:24,174,113> Arc.ISBuildFromBlueprintActionMP 2 zombie.iso.IsoGridSquare@746e9674 LOG : Lua f:312, t:1766691459270, st:24,174,114> Arc.ISBuildFromBlueprintActionMP 3 Arc.Blueprint:zombie.inventory.types.Literature@10f0ed3e Here is my log server side: ```
LOG : Lua f:83, t:1766691459284, st:24ÔÇ»174ÔÇ»131> Arc.ISBuildFromBlueprintActionMP 1 IsoPlayer{ Name:null, ID:56 }
LOG : Lua f:83, t:1766691459285, st:24ÔÇ»174ÔÇ»132> Arc.ISBuildFromBlueprintActionMP 2 nil
LOG : Lua f:83, t:1766691459286, st:24ÔÇ»174ÔÇ»133> Arc.ISBuildFromBlueprintActionMP 3 nil

#

Here is the code ```lua
function ISBuildFromBlueprintActionMP:new(character, square, blueprintItem)
local o = {}
setmetatable(o, self)
self.__index = self
o.character = character;

print('Arc.ISBuildFromBlueprintActionMP 1', tostring(character))
print('Arc.ISBuildFromBlueprintActionMP 2', tostring(square))
print('Arc.ISBuildFromBlueprintActionMP 3', tostring(blueprintItem))
bronze yoke
#

can you post the full new function?

mellow frigate
#

full function: ```lua
function ISBuildFromBlueprintActionMP:new(character, square, blueprintItem)
local o = {}
setmetatable(o, self)
self.__index = self
o.character = character;

print('Arc.ISBuildFromBlueprintActionMP 1', tostring(character))
print('Arc.ISBuildFromBlueprintActionMP 2', tostring(square))
print('Arc.ISBuildFromBlueprintActionMP 3', tostring(blueprintItem))

o.x = square:getX();
o.y = square:getY();
o.z = square:getZ();
o.isTargetPositionValidated = false;
o.item = blueprintItem;

if blueprintItem then
    local md = blueprintItem:getModData()
    local arcMD = md and md[Arc.Key]
    if arcMD then
        for bID,serializedData in pairs(arcMD) do--there is only one here
            if Arc.Verbose then print('Arc.getBlueprintItems SD',bID,serializedData) end
            o.serializedBuilding = serializedData
        end
    else
        if Arc.Verbose then print('Arc.getBlueprintItems no arcMD',tab2str(md and md[Arc.Key])) end
    end
end
if not o.serializedBuilding then
    if Arc.Verbose then print('Arc.getBlueprintItems building definition found.') end
end

o.stopOnWalk = true;
o.stopOnRun = true;
o.stopOnAim = true;
o.maxTime = o:getDuration();
o.pageTimer = 0;
return o

end

#

error on o.x = square:getX(); client side. ```attempted index: getX of non-table: null
ERROR: General f:83, t:1766691459295, st:24ÔÇ»174ÔÇ»141> KahluaThread.flushErrorMessage > dumping Lua stack trace

STACK TRACE

function: new -- file: ISBuildFromBlueprintActionMP.lua line # 108 | MOD: Architect
ERROR: General f:83, t:1766691459297, st:24ÔÇ»174ÔÇ»143> ExceptionLogger.logException> Exception thrown

bronze yoke
#

you're misunderstanding how this is called on the server

#

each parameter will be sent the value the client had for a field of the same name

#

so you receive character correctly because you assign it to o.character, but there is no o.square or o.blueprintItem so they are sent nil

#

i recommend doing anything complex with arguments in a separate helper function that calls new(), and having new() just assign fields from arguments

mellow frigate
bronze yoke
#

yeah use your best judgement, this looks much more complex than any action i've written so my experience may not apply to it

mellow frigate
#

I mean, I still misunderstand, but now I can use 😄

shy minnow
tulip valve
#
    local player = getPlayer();
    local stats = player:getStats();
    if player:hasTrait(CharacterTrait.Desensitized) then
       stats:remove(CharacterStat.STRESS, 100)
    end
end

Events.OnPlayerUpdate.Add(DesensitizedNoStress);```
Why dosnt this work? I get TONS of errors lol
shy minnow
#

And I was asking myself how you did such high quality texture on for example small 3d models like the scooter traveler

sonic needle
#

what is your texture res at?

shy minnow
#

I uploaded 2 screenshots of ingame and in blender

#

Like the render its really not the same in-game and I thought that maybe I did something bad

sonic needle
#

havent seen a texture at 2K get that minced before... its new

shy minnow
#

Ah crap, thanks for help tho lol

raven epoch
#

so i need to save some values that are not attached to any object

#

what is the best way to do that?

raven epoch
#

oh right

#

ty

#

another question

#

removefromworld cant seem to remove isoplayer characters

bright fog
#

Might be something related to that

raven epoch
#

lemme try that

#

removeFromSquare()

fleet bridge
#

I think you can't remove isoplayers that way?

#

I think that's for world objects

raven epoch
#

then what do

fleet bridge
#

What are you trying to do?

raven epoch
#

trying to remove isoplayer npcs

#

skyrim approach and teleport them far away and kill?

fleet bridge
#

This is single player?

raven epoch
#

ye

#

for b41

fleet bridge
#

Wasn't aware you could make isoplayer objects that isn't attached to a client

fleet bridge
#

Most time I see it's just a dressed up zombie

#

Ah

raven epoch
#

ye i saw the dressed up zombie stuff

#

went the other route

bright fog
#

Zombies are used bcs they work in MP

raven epoch
#

mod is mostly for learning how to mod anyway

#

but i guess

#

i teleport them off the map and kill them

#

only solutiion

bright fog
#

Can you ?

raven epoch
#

then what do

#

idk never tried

#

i guess i could

#

set them invisible then kill them

bright fog
#

Seems to run fairly well no ?

raven epoch
#

ye went to 40 fps but still good

#

tho not sure how it will do on other devices

main pasture
#

I was able to remove isoPlayers in b41 with removeFromSquare, removeFromWorld and update in that order. Not sure if all of them were actually necessary

raven epoch
#

ooh update

#

lemme try

#

ye that worked

#

ty

feral meteor
#

Hi, Is this where we can ask for help with modding?

I am probably missing something or this is a skill issue but I am having issues getting a simple object to load in.

I get this or I get no object at all.

I will apply the Item data and also the error for when it doesn't load my model

(the atari is from the video game consoles mod. I swapped mine out with it to make sure it wasn't my model that was the issue but this is the issue its managed to pull with that model).

(these scrips are in the b42 folder and the files are the same in all the media folders).

Any help and knowledge would be appreciated.

bright fog
#

You didn't put your mod in the right folder

#

I suggest reading the Mod structure wiki page if you haven't yet

feral meteor
#

I did read it but I will take another look, Thanks

bright fog
#

That folder shouldn't be used for mod development overall

feral meteor
#

That explains a lot actually as it turns out I had a older version without the newer assets in there

bright fog
#

Yup !

feral meteor
#

Same issue though, things are still not loading.

wet sandal
#

Why are you on Windows 98

#

How is this possible

#

Lol

#

Awesome skin

feral meteor
#

I am not on 98, I wish this was.

This is just windows 10

bright fog
feral meteor
#

the model it self isn't loading, or the texture, what I have placed isn't the model or texture.

bright fog
#

Wrong way to use the icon parameter

feral meteor
#

that is the icon name

bright fog
#

No that isn't

#

Read that wiki page

#

You'll quickly see your mistake

#

Item_ isn't supposed to be present in the script

#

In the file name yes

#

Yes it's confusing

#

Also verify that your model is in the right folder

feral meteor
#

ahhh,

The models are located here

worthy wharf
#

yooo, happy xmas
this doubt is probably the most asked

how to setup the VS Code project to enable intellisense and make coding easier?

bright fog
worthy wharf
#

thx will check

wet sandal
#

So I'm just contemplating the best way to refactor Inventory Tetris for the new TimesAction changes in MP.

I've previously avoided changing the signature to ISInventoryTransferAction:new as that would be a hard incompatibility point between mods that did the same. Instead I opted to push some extra data in immediately after creation of the action (data = where the item should be placed in the destination grid)

With the new server realization stuff for TimedActions, I'm not certain how to best get this data into the action without overriding :new().

Does anyone know if the game provides any packet order guarantees?
If I call a command to send some data before making the action can I trust that will always get to the server before the action?

If I have to I can just override the new() params, but it would be unfortunate for mods to have to be competely incompatibile over some fully serializable metadata.

bright fog
#

I highly advise you don't overwrite parameters, that's at least what I'd suggest rn for less problems later

wet sandal
#

I agree, it feels wrong, especially under the new system

bright fog
#

Timed actions are now expecting the parameters from the new to be as fields to that timed action class for the server to locate them

#

The problem is that this bitch of a timed action that we ISInventoryTransferAction follows absolutely zero codes from the new timed action synchronization system

#

And it is unclear if they'll properly port this monstrosity of a timed action over to the new system

#

So is it a good idea to overwrite the parameters ? Probably not
Should you give a fuck ? Idk 😅

#

Regarding the commands sent to the server, you can be sure that your action will be done before the server receives it, or at least you should consider that always

#

Because when you send the command, your code still runs, packet received or not by the server

#

And thankfully or everything would just freeze constantly

wet sandal
#

Ok, does the server at least guarantee action order?

bright fog
#

Wdym by action order ? Like command order ?

#

So if you send command1 command2 command3 it receives them in the right order ?

wet sandal
#

Nah, like if I send 3 rapid inventory transfers to the server, will they go in order?

#

I know Zomboid uses UDP, but they must be using reliable UDP at some points

bright fog
#

I probably wouldn't trust it ?

#

I have no idea tbh

wet sandal
#

Specifically TimedActions

bright fog
#

My knowledge on networking stops there I think

#

I don't remember of a case where respecting the order of timed action matters since you never run two at the same times ?

bronze yoke
#

i don't know about any order guarantees, but commands are definitely sent reliably

feral meteor
bright fog
#

Is your item in the world "invisible" ? Or is it still an icon ?

feral meteor
#

Its still an Icon, though it did nothing when the character attached it as primary. Hence why the atari model was borrowed from a kown working mod

#

Also blender is able to reimport my model.

bright fog
#

Verify your model scripts

#

Are you on B41 ?

feral meteor
#

B42.13 (before fix)

bright fog
#

The DisplayName parameter no longer exists

#

Not the source of your problem

#

But just noticed it

feral meteor
#

Removed, Better to catch now before I copy and paste this across all of the mod lol

bright fog
#

Yup

feral meteor
#

These are the 2 scripts currently.

bright fog
#

I don't notice anything wrong with model script definition but I could be missing it

#

What I would suggest is to download VSCode and the PZ script extension

#

It can possibly help you catch some problems

feral meteor
#

darn it, back to VS code I go lol

bright fog
#

Will also make it easier to manage your mods

#

VSCode is great, really

#

Get used to it

#

It's the norm in the modding community

open fossil
#

It helped me out a bunch, just being able to search for things in the vanilla Zomboid files.

feral meteor
#

I was removing it from my systems due to it enabling features that make no sense on some of my systems.

I guess I will remain stuck to it

feral meteor
#

Sticky scroll kept enabling randomly,

Some AI features.

To note is that my laptops are like 15 years old and so I don't want something too intensive as the batt lasts like 3 to 5 hours (good for its age but as its that old it risks degrading quickly)

open fossil
feral meteor
#

but oh well lol

open fossil
#

I shall elaborate, stand by.

bright fog
#

For the AI features, that was a discussion we had recently and you can disable those in the settings

feral meteor
open fossil
#

Nevermind, I dumbed again. I was looking in scripts/entities/blacksmith instead of scripts/generated/entities/blacksmith. I thought there were phantom files on my bitch.

bright fog
feral meteor
#

Its that bit at the top of the file

bronze yoke
#

it should only show the scopes you're currently in, your code may be weirdly complex if this is an issue?

#

and it's almost certainly something you can just turn off

feral meteor
#

Its that it turns it self on sometimes on some of my computers

#

that was my issue

#

not that its a feature, but when working on some projects it turns on and I then have to remember its name and disable it.

bright fog
#

I never had such problem

wet sandal
#

Think I have a plan now.
Keep my code changes to the ISInventoryTransferAction. But when I have grid data to go with one, create my own version of the action that extends the normal action and includes the grid data in the params.
Then all the functions other than new can just directly reference ISInventoryTransferAction.

No packet order to worry about.

bright fog
feral meteor
#

One day.

Its 2 to 3 devices that did it so far.

Anyway it didn't see anything wrong ether other then not recognising the ItemType.

bright fog
bronze yoke
#

where is your mesh located?

bright fog
#

I plan on updating it

bronze yoke
#

just double checking but mesh = TestPuter, would be looking for models_X/TestPuter.fbx

bright fog
#

Yea

#

That's what he has I believe ?

feral meteor
bright fog
wise plank
#

Howdy

scenic tusk
#

does anyone know anything about the umbrella plugin for vs code because someone told me something about it and how it can color code the syntax in the zomboid files just thought itd be nice to have

scenic tusk
#

thank you

winter bolt
wise plank
#

Should I ask it here or in the modding discord?

#

Does it matter?

#

Well, I've got some confusion regarding file structure. From what I've gathered, (since I'm making it strictly for B42) it should look something like Workshop>MyMod>Contents>mods>MyMod>42>media and then lua and scripts and what not. Since I'm only making it for 42, I don't need a media folder in the MyMod folder with common and 42, yeah?

#

and since I'm going to be adjusting existing systems, I shouldn't override anything and try to monkey-patch everything to avoid conflicts

winter bolt
winter bolt
#

b42 wont even read it i think

scenic tusk
#

does anyone have any experience adding items to be foraged in build 42?

#

I want to add an existing item and Ive already found the files and stuff holding the code for foraging categories Im just wondering what all I would have to add in my own lua script in order for it to work

silent zealot
#

There was a discussion on it recently in this channel.

scenic tusk
#

thank you ill look into it

wise plank
#

When I'm developing a mod, should it reside in Zomboid>mods or Workshop?

#

The wiki says that developing in Workshop makes it easier to upload, but its also forcing the mod to load even trying to play unmodded.

scenic tusk
#

I would reccomend workshop but I dont know if its supposed to be forcing the mod

modern veldt
#

Is there any way to use external libraries like lua websocket?

#

Or any way to send and get http requests?

#

Why there is strict restriction on modding in this game 🤨

brave bone
#

hey guys, where can I find the documents for 42.13 MP?

bronze yoke
acoustic thistle
#

is there a mod that can give me 106’s goggles

dreamy ivy
#

howdy folks, im looking to make an in depth pharmaceutical mod.

how do i go about making a mod that adds items into the game that can effect player stats and moodles?

it would basically be redoing the current in game drugs (painkillers, beta blockers, sleeping pills) with generic medications that achieve the same purposes

i know next to nothing about scripting, but im assuming that all i'd have to do is duplicate the code for the existing drugs, edit the values and names, and change the sprites

crimson ore
#

how to insert and remove from Distributions? such as inventorymale = {
suburbs distro has some nice functions but they dont seem to work?

worthy wharf
crimson ore
worthy wharf
grizzled fable
#

can't find any info about workstations, is it possible to mod them? ty

crimson ore
#

will need to verify it removes it just from that list but it does remove it via lootzed

worthy wharf
grizzled fable
dreamy ivy
worthy wharf
worthy wharf
dreamy ivy
#

its for a singleplayer world, idk if "severtest" means its specifically for a server or not

#

sounds dumb, but i just dont know

worthy wharf
#

good question, i never tried to change singleplayer settings

worthy wharf
# dreamy ivy its for a singleplayer world, idk if "severtest" means its specifically for a se...

Ever started with custom sandbox settings, only after hours of playtime to realize that you forgot to enable multi hit? 🔥
In this guide I will show you how to do that and a few other options as well 😄
Enjoy! :D

📜 Video Contents:
00:00 Intro
00:33 The sandbox options
01:06 The sandbox file
01:42 Test time
01:47 The zombie speed test
03...

▶ Play video
worthy wharf
grizzled fable
#

Workstations
"C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts\generated\entities"
Here you can find all entities=Workstations and all recipes related, yw 😉 i put the first word the title so if someone will search in discord will find this.

crimson ore
# crimson ore i used this (link to msg) but changed SuburbsDistributions (and the other) to Su...

to add to this, this is how ive setup my file

 local function postDistributionMerge()
    RemoveItemFromDistribution(SuburbsDistributions.all.inventorymale, "Wallet_Male", nil, true)
    RemoveItemFromDistribution(SuburbsDistributions.all.inventorymale, "Locket", nil, true)
    RemoveItemFromDistribution(SuburbsDistributions.all.inventorymale, "CigarettePack", nil, true)

    RemoveItemFromDistribution(ProceduralDistributions.all.inventorymale, "Wallet_Male", nil, true)
    RemoveItemFromDistribution(ProceduralDistributions.all.inventorymale, "Locket", nil, true)
    RemoveItemFromDistribution(ProceduralDistributions.all.inventorymale, "CigarettePack", nil, true)
end
Events.OnPostDistributionMerge.Add(postDistributionMerge)
crimson ore
# worthy wharf is it working?

well when inspecting with lootzed they no longer appear in male zomboid inventories. still havent checked any other container tho

#

eu5 time

worthy wharf
grizzled fable
modern veldt
# worthy wharf try this way as well

in addition to this, just open to pz steam folder and create .exe's shortcut and add -debug. then move to the desktop, can also pin to taskbar for quick access.

#

is there any one inside indie stone here? I believe modding is highly resticted cause of this limited lua support. it'd be awesome if they had extend this limitation.

modern veldt
#

nah, it'll take forever for them to implement

modern veldt
#

We can't utilize the power of Lua I believe

#

It'd be awesome for us to be able to use native libraries at least

#

Also, modding in Java also would be nice

frank elbow
#

Java modding is possible

frank elbow
#

e.g., rather than io, there are some global functions provided by the game's API that serve a similar purpose

raven epoch
#

me when i realise vector3 class exists

#

(code is cooked)

raven epoch
#

nah nvm its bad

bright fog
sour wave
#

I just realized I can reload scripts without having to open/close the game every time..

tranquil kindle
normal moth
#

Does anyone have a breakdown of what changed with B42.13?

My mod quit working, and I was wondering if anyone had ideas where I should start.

raven epoch
#

there is a sub topic tho im not sure if thats what ur looking for

#

modding migration guide 42.13 it say

normal moth
#

I'm a part time modder on PZ. It's not something I keep a close eye on.

I uploaded the ancient armor and weapons, from B41 to B42.

normal moth
raven epoch
#

the button on the left on top right

#

ok

normal moth
#

Ah I see it! Thanks!!

raven epoch
#

ur welcome

#

anyone know whats wrong with this?

#

it keeps printing no square

#

but ik the startposition is valid

bright fog
raven epoch
#

didnt have time to set it up

#

was too tired otherwise

bright fog
#

I swear this has been the 3rd to 4th time I've been telling you to use it to catch problems easier

raven epoch
#

so continued modding straight up

bright fog
#

It takes literally two seconds to setup

#

Also for array looping, don't use ipairs but use direct array size looping

raven epoch
#

oh thats faster right

#

i remember now

bright fog
#

Yes

raven epoch
#

ye should change those in me code some time

bright fog
#

And seriously I'm not joking, go install Umbrella

#

Stop asking modding question if you don't even use Umbrella, it'll catch half of your problems seriously

raven epoch
#

installing it rn hold on

bright fog
#

You're already using VSCode, so no excuses

raven epoch
#

done

#

wait

#

aight so im kinda new to modding and vscode so sorry about that

#

but

#

it doesnt seem to recognise

#

IsoPlayer etc

bright fog
#

How did you activate Umbrella ?

raven epoch
#

i installed emmyslua and enabled umbrella

bright fog
#

Enabled Umbrella ? You don't enable Umbrella

raven epoch
bright fog
#

What did you do to get Umbrella

bright fog
#

Not EmmyLua

#

Uninstall LuaLs

#

And read the Umbrella wiki page

raven epoch
#

alright i installed it and it works

#

though i dont understand why its warning in some parts

#

ah nevermind

quasi kernel
#

I still need to set that up

raven epoch
#

for an example how would i fix this?

#

it says cannot assign long to integer

bright fog
# raven epoch

Did you put your cursor on the thing that's highlighted

raven epoch
#

do i have to manually declare long?

bright fog
#

That one might actually be one of the rare times where it'll scream at you for no reasons

raven epoch
#

same as here

bright fog
#

@bronze yoke I assume in this case he should either do a --[[@as number]] typing to TimeMill ?

raven epoch
bright fog
#

It's not an error

#

When it's a straight line like that it isn't at error, it just means that you redefine a variable at some point

bronze yoke
#

what version of umbrella is this??

raven epoch
#

ah

#

it is 41.78.16

bright fog
bronze yoke
#

oh i see

bright fog
#

Oh you're on B41

#

Use LuaLs then

bronze yoke
#

the b41 version of umbrella is really old and blows

raven epoch
#

oops

bronze yoke
bright fog
#

I thought B41 Umbrella didn't support EmmyLua ?

raven epoch
#

well seems useful regardless so ill keep

bronze yoke
#

it doesn't support emmylua's extra features

raven epoch
#

i appreciate u guys helping btw

#

though i still cant fix my original problem

bright fog
bright fog
#

Fix those errors and it's likely to prevent problems before they even happen

bright fog
raven epoch
#

but most work fine tho

bright fog
#

That's good, it means you did things well the majority of the time then

raven epoch
#

hold up

#

just fixed an bug thanks to this

#

because of misspelling

#

ok fixed original bug

icy night
#

Question: I need to cancel the effects of one of my mods after the player exits the game to return to the main menu. Would OnSave or OnPostSave be the correct events for this?

bronze yoke
#

usually you don't need to do anything, lua resets when you exit a save no matter what

icy night
#

Well it reduces the volume, so when you return to the main menu, it remain a lowered volume until you start clicking stuff

bronze yoke
#

ah yeah, to be honest that's tough, i don't know if there is a good event for that

icy night
#

It's my functional ear muffs mod. I'm just trying to fix the script up nicer now that I know a bit more about lua

#

Ill try OnSave. I think it'll do it

raven epoch
#

why the space between sandbags?

#

dont squares only hold 1 tile object?

bright fog
#

Verify your code for placing and creating the tiles

raven epoch
bright fog
#

When you do add it doesn't create a copy I believe

raven epoch
#

ah

#

so it edits the original

bright fog
#

So here you're adding an offset of 4 or so

#

Yes

raven epoch
#

ye makes sense

#

annoying tho

#

ty

bright fog
#

Tbh I don't think you need to use vectors here

raven epoch
#

i wanted to do adding and subtracting easily

dreamy ivy
bright fog
dreamy ivy
#

im prolly doing something wrong with the mod setup 😭

bright fog
# raven epoch

Before running this, cache the coordinates of NewCenterPosition into x y z variables, then simply create new_x, new_y, new_z variables that you add the TileData coordinates to

#

Also I'd advise using key tables for your TileData here

#

It'll make it easier for you to manage and expand in the future

raven epoch
#

gimme a min

#

aight ty

shy minnow
#

How can I make the rally lamp bar light up too? I've already put the headlights in the texture mask and the headlights in the texture light. Can anyone help me?

#

And the rally lamp is an item that I can detach like that :

wet sandal
#

So whats up with moddata on servers?

#

Do I have to manually trigger send and receieve now?

bright fog
wet sandal
#

Hmm, maybe it was more so there was a local cache before?

bright fog
#

Wdym ?

wet sandal
#

Just for client stuff on the player

#

It persisted on its own I thought

#

But maybe I'm misremembering. I didn't have a good test workflow before for server stuff

bright fog
#

What persisted ?

wet sandal
#

Client side only moddata that I stored in the playerObj moddata

bright fog
#

That's persistent yes

#

player:getModData()

bronze yoke
#

it is server auth now

wet sandal
#

are clientCommands the go to way to sync mod data on objects that aren't the player?

bronze yoke
#

the server sets mod data and calls object:transmitModData() to update the clients: if you need to set it from the client, you need to send a command to tell the server to do that

wet sandal
#

What about things like InventoryItems?
They have moddata, but no transmitModData()

sour wave
#

Atleast, tahts what Ive had to do

bronze yoke
#

syncItemModData(player, item) where player is the player who has the item

#

i'm not entirely sure looking at that that this api accounts for the case where you change the mod data of an item that is not in a player's inventory

wet sandal
#

Hmm, gets me most of the way there.
Will need to explore ground items though, mainly for Inventory Tetris grids for bags on the floor

icy night
#

Hey so I'd like to make a clothing item that is invisible when worn. How can I do that?

willow tulip
#

and im like.. cool. more stuff for me to disable -_-

#

also fluid syncing doesn't work for objects inside vehicle containers

#

Im like this close to just writing all my own sync packets because all the vanilla functions seem broken.

winter bolt
shy mantle
#

@willow tulip

willow tulip
shy mantle
# willow tulip Kaboom?

Kind of? The results of flipping a car on its side violently does give off the same results, just add the pipe bomb explosion lol

bright fog
#

It doesn't explode yea 😅

#

I noticed that the other day too

shy mantle
#

I'm already seeing what I can do to add jump and landmine

shy mantle
#

You can actually make proper helicopters with this

#

That is if they ever plan on making it work for extended periods in the air lol

#

After too much time in the air, the car freezes up

bright fog
#

And in B42 they can even properly change Z level

#

And land on roofs

shy mantle
#

It feels like flappy bird

shy mantle
# willow tulip Im confused...

Imagine a car bomb from underneath, but without the explosion and the car nearly instantly flips to a position (not a teleport because it carries momentum). I have not tested this, but you need to define a square and a vehicle, so I'm assuming the square is the position the explosion is coming from?

willow tulip
shy mantle
#

Like I said, I haven't looked into it fully, but I'm going to try and implement it.

shy mantle
willow tulip
#

If you want to apply an impulse to a vehicle, there is a bullet function for that

#

public void addImpulse(org.joml.Vector3f impulse, org.joml.Vector3f rel_pos) on baseVehicle IIRC.

shy mantle
#

@willow tulip it's just vehicle:onJump() and vehicle:onHitLandmine(square)

#

Super basic

willow tulip
#

... who.... who spent time adding that...

#

shrugs

shy mantle
#

Well just hope and pray for better vehicle physics sooner than later lol

#

Not like this is related, but good for testing

#

Doing jump tests mass and suspension work, 1 jump can send the player into the shadow realm, so it's clear they need to work on that

willow tulip
#
    public void onHitLandmine(IsoGridSquare square) {
        this.ApplyImpulse(square.getX(), square.getY(), square.getZ(), 0.0F, 0.0F, 1.0F, 300000.0F);
        DebugType.General
            .println(
                "Hit a land mine! %f, %f, %f. isActive: %s, isStatic: %s",
                (float)square.getX(),
                (float)square.getY(),
                (float)square.getZ(),
                this.isActive ? "true" : "false",
                this.isStatic ? "true" : "false"
            );
    }
#

new to B42.13.1

#

also... not how impulse is used lol

#

actually wait I guess thats the offset position.. well whatever

#

... still pretty sure that should be a relative position to the car

shy mantle
#

Whatever they did, it's over the top for the current physics

willow tulip
#

yea that'd be the 300000 part.

shy mantle
#

lol I didn't notice that

willow tulip
#
        this.ApplyImpulse(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F, 1.0F, 1000000.0F);
        DebugType.General.println("Jump! isActive: %s, isStatic: %s", this.isActive ? "true" : "false", this.isStatic ? "true" : "false");
    }```
#

just.. sigh 😛

shy mantle
#

The jump is super weak though?

willow tulip
#

shrugs

#

actually nm they do subtract the positions in applyImpulse

#

Prob because jump has to lift the entire vehicle while landmine only has to flip it

shy mantle
#

Does the square actually matter when flipping the car? Like, less power from a further distance?

#

Or even just flipping in a specific direction

#

All things I will look at myself anyways because this is funny

willow tulip
#

Should.

#

the further the distance, the more it will rotate the car instead of lift the car

shy mantle
#

Cool, can't wait for B43 drunk

#

Driving over a landmine would be crazy

vague holly
#

Hey guys this is my first time in this discord server I don't know if anyone here is a modder but I had an idea if anyone sees this

#

I think it would be really cool if there was a stranger things mod like i know making the upside is probably impossible but i think it would be cool if you could make the zombeis like demogorgons and make the vines and stuff blue and make it dark and spooky

grizzled fable
#

broken timed action on MP, anyone have the same problem?

bright fog
silent zealot
#

Then start modding.

grizzled fable
red blade
#

Is it possible to mod in animals in PZ? With their own behaviors/AI and drops and such?

#

I tried looking but I couldn't find any (except Fauna but apparently they're "props" so I assume they dont move or anything)

#

I guess the overall question is how far can you mod PZ

#

Like in Minecraft you can virtually code in new game systems into the game, how about PZ

tranquil kindle
#

Its still wip i belive

#

Of course we talk b42+

raven epoch
#

does gametime.getservertime change with gamespeed?

#

my ai seems to go goofy if u speed up the game

silent zealot
# red blade Like in Minecraft you can virtually code in new game systems into the game, how ...

PZ is divided up into two major parts: Java and Lua. Anything in lua can be modded, and a lot of java stuff has a LUA API. But there are also lots of things that only exist in java with no easy way to mod them.

Java mods are possible, but require users to manually move files around and they tend to break with every update which is a pain with the unstable version.

So the answer is "technically you can mod anything, but in practical terms there are a lot of limitations"

upbeat turtle
#

we can give them custom behaviors, equipment items, you name it ~ all it needs is custom lua code cathappy

knotty stone
#

So, i wanted to update my torchrefill mod

   local items = craftRecipeData:getAllConsumedItems();
   local result = craftRecipeData:getAllCreatedItems():get(0);
   local previousBT = nil;
   local propane_refill = nil;
   print("Server - RefillBlowTorchMod OnCreate called - isClient: " .. tostring(isClient()) .. " isServer: " .. tostring(isServer()));
   
   for i=0, items:size()-1 do
      if items:get(i):getType() == "BlowTorch" then
          previousBT = items:get(i);
      elseif items:get(i):getType() == "Propane_Refill" then
          propane_refill = items:get(i);
      end
   end
   result:setUsedDelta(previousBT:getCurrentUsesFloat() + result:getUseDelta() * 30);

   while result:getCurrentUsesFloat() < 1 and propane_refill:getCurrentUsesFloat() > 0 do
       result:setUsedDelta(result:getCurrentUsesFloat() + result:getUseDelta() * 10);
       propane_refill:Use();
   end

   if result:getCurrentUsesFloat() > 1 then
       result:setUsedDelta(1);
   end
end``` 
Working fine now in sp, but in multiplayer it seems that its not loading the function when crafting, the print statement only triggers once, when the server loads?
raven epoch
#

heeelp

#

wait

#

does mod data not change from save to save?

bright fog
raven epoch
#

somethings wrong with my saving then

bright fog
#

You don't have to save jackshit

#

What's up with people having problems with that shit, mod data is a dynamic table, throw things in it and forget about, worst case you need to sync with the server/client

#

You shouldn't do any kind of saving of the mod data

#

It already saves the mod data itself when you quit a save

#

You don't have to hook to OnSave or anything to save

raven epoch
#

ah i mean the way i save my objects

bright fog
#

Uh ?

raven epoch
#

ok i save

#

a table that holds where npcs are going to be spawned right

#

and its called militarystructure

#

for some reason when i make a NEW save

#

fresh one

bright fog
#

Where do you save the table ?

raven epoch
#

global mod data

bright fog
#

In what way do you save ?

raven epoch
bright fog
#

What do you do to "save"

#

Mod data should have its data dynamically injected

#

You don't store ANYTHING with a save or whatever

raven epoch
bright fog
#

You don't SAVE

#

You just throw shit in it

#

See that's your problem here

#

You trigger that mod data on multiple events

#

And there's no reasons for you to do any of that

raven epoch
#

wdym

bright fog
#
local player = getPlayer()
local modData = player:getModData()
modData.myString = "Hello World"
modData.myNumber = 42
modData.myTable = {1, 2, 3}
modData.myBoolean = true
#

It's a table

#

Store things in it

#

That's it

raven epoch
#

yeah okey

#

thats what i do

bright fog
#

There's no saving to do

#

There's no SAVING to do

bright fog
raven epoch
#

isnt the only difference between a normal table and

#

mod data is that it saves to game files

bright fog
#

The fact you have a save function is the problem here

#

There's no saving to do

#

It's a table

raven epoch
#

oh

sour island
#

get or create also ...creates it

raven epoch
#

i thought it saved no idea where i got that from

sour island
#

chatgpt?

raven epoch
#

no just

#

misunderstood it i guess

bright fog
#

You're the second person to fall for some shit like in 2 days

#

I think I need to clarify this bit on the wiki page because that's abnormal, it comes from other games modding

raven epoch
#

so in order to make stuff persistent data on the same save

#

i need to save to a text file or smth?

bright fog
#

No !

#

You don't save jackshit

#

It saves itself

#

It's a table