#mod_development

1 messages · Page 307 of 1

tacit pebble
#

unload the gun, and now you have 20 in your inventory

that is ISRackFirearm.lua

silent zealot
#

yeah, you'll want to change the unload/rack gun code too

ancient grail
#

what are you trying to do

silent zealot
#

this is the basic way to attach extra code to a function without replacing the function - so it's more compatible with other mods and updates.

require "TimedActions/ISReloadWeaponAction"

-- store a copy of the original function:
ISReloadWeaponAction.NepOGloadAmmo =  ISReloadWeaponAction.loadAmmo

--Replace the original function, but in a way that still calls the original:
function ISReloadWeaponAction:loadAmmo()
    -- Add my prefix code here
    self:NepOGloadAmmo()

    --add my postfix code here
end
#

(no promised I've got that 100% correct - the exact syntax is fiddly when dealing with lua lets-pretend-to-be-an-OO language)

ancient grail
#

@random finch if its a container
try getSourceGrid()

silent zealot
#

Then in the prefix part, you can put something like

if not self.bullets:isEmpty() and self.gun:getCurrentAmmoCount() < self.gun:getMaxAmmo() and self.gun:getType()=="MyCoolGun" then
  self.gun:setCurrentAmmoCount(self.gun:getCurrentAmmoCount() + 9);
end
#

So what that does is adds in 9 bullets before the main reloading code is called. (and you really want this to also go up to a max of 19 so you don't reload a gun with 18 shots and end up with 28)

tacit pebble
#

problem is, whenever I try to code it so that it focuses on the ammotype, instead of the max capacity, the gun doesn't consume 2 cells, and instead just adds the amount of ammo I want if I have at least 1 cell in my inventory

is this something you wanted..? I'm guessing

-- really basic example
if self.gun:getType() == "Ray Gun" then
  local rayGun = self.gun
  local modData = rayGun:getModData()

  if not modData.InsertedCell then modData.InsertedCell = 0 end

  if modData.InsertedCell >= 2 then return end -- do not insert more than 2 cells
                                              -- so if your gun has 11+ bullet count, you can't insert one more cell.

  modData.InsertedCell = modData.InsertedCell + 1
  self.gun:setCurrentAmmoCount(self.gun:getCurrentAmmoCount() + 10);
end 

you will also need modData.InsertedCell - 1 somewhere.

silent zealot
#

@random finch the B42 getSquare looks like exactly what you're doing, just... not in B41.

#

Is getOutermostContainer() in B41? Still leaves you needing the location, but at keast it gets the "top level" container for you.

silent zealot
#

So the good news is devs have realized what you want is a good idea...

tacit pebble
#

🤣

random finch
# silent zealot

I did try that:

---Gets the square associated with the item container.
---@return IsoGridSquare|nil --The square associated with the item container.
function Utility.getSquare(innerContainer)
    local square = nil
    local container = Utility.getOutermostContainer(innerContainer)
    local containerType = container:getType()
    
    if container:getVehiclePart() ~= nil and container:getVehiclePart():getVehicle() ~= nil then
        square = container:getVehiclePart():getVehicle():getSquare()
    end

    local containerSourceGrid = container:getSourceGrid()

    local containerParent = container:getParent()
    local containerParentSquare
    if containerParent then
        containerParentSquare = container:getParent():getSquare()
    end

    local containerContainingItem = container:getContainingItem()
    local containerContainingWorldItem
    local containerContainingWorldItemSquare
    if containerContainingItem then
        containerContainingWorldItem = containerContainingItem:getWorldItem()
        containerContainingWorldItemSquare = containerContainingWorldItem:getSquare()
    end

    if not square then
        if containerSourceGrid then
            square = containerSourceGrid
        elseif containerParentSquare then
            square = containerParentSquare
        elseif containerContainingWorldItemSquare then
            square = containerContainingWorldItemSquare
        end
    end
    
    return square
end
#

I have it all broken up like that for all my debug print lines

copper abyss
#

I also kinda realized I should probably have this script in the client side, rather then the shared

silent zealot
#

Want to know a secret?

#

It doesn't matter.

silent zealot
#

client and shared are treated exactly teh sam,e they just help you organize code.

#

Server is treated almost the same, but loads after the first two.

#

If you actually want a lua to only run on the server you need to code a check into the lua like if isServer() then return end

#

(And isServer() does not work the way you think it does)

#

but back on topic, what you're doing shoudl all be fine in client (other than any translation files)

copper abyss
#

testing it now with my frankenstein spaghetti code

#

errors, errors, and more errors

#

you'd assume I'd be able to do something so hypothetically simple

#

😭

silent zealot
#

If you were coding this normally instead of glueing on to existing code as a mod it would be simple.

#

But modding is both easier and far harder than normal coding.

copper abyss
#

two errors

#

unsuprising

ancient grail
copper abyss
#

ty

ancient grail
#

this function is already on the code

function RayGunMod.isValid()
    local pl = getPlayer()
    if tostring(WeaponType.getWeaponType(pl)) == "barehand" then return false end
    local wpn = pl:getPrimaryHandItem()
    if not wpn then return false end
    if wpn:isAimedFirearm() and wpn:getScriptItem():isRanged() and not pl:isDoShove() then
        local modData = wpn:getModData()
        return modData and modData.isRayGun
    end
    return false
end

you just need to call it



local isRayGun = RayGunMod.isValid()

--you still need to define self.ammo
if isRayGun and self.ammo then
    -- code here

end
ancient grail
# copper abyss

theres a chance that you need this too

local int = 10 --change here
self.gun:setAmmoPerShoot(int)

silent zealot
#

...I also suspect it does not work...

ancient grail
#

let me verify

silent zealot
#

Do any vanilla weapons have burst mode?

ancient grail
#

maybe its unused lua code

#

irc

silent zealot
#

It's all through the java code... except for the bit where the gun actually shoots AmmoPerShoot

ancient grail
#

    if isHandWeapon and instanceof(isHandWeapon, "HandWeapon") and isHandWeapon:getFireModePossibilities() and isHandWeapon:getFireModePossibilities():size() > 1 then
        ISInventoryPaneContextMenu.doChangeFireModeMenu(playerObj, isHandWeapon, context);
    end

silent zealot
#

Lots of set and get functions, but I can't see it actually used.

ancient grail
#
isHandWeapon:getFireModePossibilities() 
silent zealot
ancient grail
#

yep saw it too just now

silent zealot
#

it doesn't get set back to 1 anywhere in lua. A few reloading related functions check getAmmoPerShoot, but that's about how many bullets you need to rack the gun etc.

#

unless setFireMode also sets it to 1 every time, might be the case..

random finch
round kiln
#

thats a lot of mods

vague marsh
umbral raptor
round kiln
#

in theory it would be easy to port almost all the mods in b41 (that are not weapons or related to those mechanics that had been reworked so much) by just doing a little bit of folder directory changes

umbral raptor
#

its not a mod pack haha

round kiln
#

oh shi

vague marsh
umbral raptor
#

i made all these items

#

me and my team

round kiln
#

have u guys been working on it since b41

umbral raptor
#

nah just a month ago haha

vague marsh
#

i saw on desc it has heater?🤔

time to start cryogenic winter

umbral raptor
#

which pretty much only had this

round kiln
umbral raptor
#

it heats u while its in ur hand till i can write/figure out code to make it a heat source

#

however

#

there is a portable TV 3D model that lights up

#

this bad boi

round kiln
#

a tv item that works?

#

pog

umbral raptor
#

yeah, gives out light like a lamp when its on

round kiln
#

gonna go hold this like a lantern when i cant find any flashlights

umbral raptor
#

not in ur hand haha

#

one sec

silent zealot
vague marsh
silent zealot
#

Then fix up all the little things that broke in scripts and hope there are no big things to fix.

vague marsh
silent zealot
#

Updated Sapphire's heaters?

umbral raptor
#

thro the radio

vague marsh
umbral raptor
silent zealot
#

I mean the B41 update because the original B41 sapphire's heater stopped working

vague marsh
silent zealot
#

I should make a B42 electric heater mod, now that's winter in my main B42 game.

umbral raptor
vague marsh
umbral raptor
#

im trying to make a heater too

silent zealot
#

Core game has isofireplace and isostove, devs never heard of electric heat... so need to do all the work yourself and spawn/despawn IsoHeatSources as appropriate.

#

also heaters are strictly line-of-sight so I need to move my antique stove and that annoys me.

#

I like the spot it's in.

vague marsh
#

so im thinking we have now a hot water bottle, when filled up with hot water does it keep the heat? will it help warming up the character?

#

oh nvm its just a normal bottle...

bright fog
silent zealot
#

What heat? It's just a bottle with water in in.

#

A crucible of molten glass doesn't have any heat either.

vague marsh
#

it doesnt work, pz dont have proper cold and hot water system

silent zealot
#

...I still put a hot water bottle in my bed though.

vague marsh
silent zealot
vague marsh
#

maybe theyll introduce it in the future

silent zealot
#

If it would actually heat things I'd do it, but shrugs

#

Brilliant idea, it's just a item with a really big world-placed model you put on top of a bed.

vague marsh
silent zealot
#

I think 0 is the lowest it is possible to go inside a house. Which is still petty darned cold.

hollow radish
#

Hello everyone!
I'm new to modding this game and am still learning the functionality.
Please tell me where to dig. The model in the game is not displayed, although the game realizes that it is there. In other words, it's just transparent.
Perhaps there are some specific points about the texture that I haven't considered?

vague marsh
hollow radish
# vague marsh i'm not into modeling but have u tried flipping normals? also i think you can ge...

The normals look to be in the right direction. I modeled in 3ds max and checked there. I also checked in Blender, the direction is also correct.
There is one more thing to consider. I probably accidentally managed to reference the original plunger texture and the model displayed. For this reason, there are suspicions about the texture.

I originally posted in this thread, but it seems to be a bit of a different topic.

hollow radish
#

I also compared to a model from another mod and adjusted mine to fit. Still no.

bright fog
hollow radish
bright fog
#

Send your item and model scripts

hollow radish
vague marsh
hollow radish
vague marsh
hollow radish
hexed timber
#

Morning guys, do know a way to make a zombie speak?
zombie:SayShout("AAAAAAAH!") isnt working

#

nor is zombie:Say("AAAAAAAH!")

hexed timber
#

worked, ty crack @bright fog

hexed timber
#

so im spawning a zombie, but it sometimes does it and sometimes doesnt, it gets removed by this

#

how can i make it not being removed?

bright fog
#

How and when do you qpawn your zombie, but more important what do you do on your zombie ?

vague marsh
hexed timber
bright fog
#

You need to set its HP server side too

#

And uh ... I had issues trying to do that personally for my Bloater

#

You need to find the same zombie server side

hexed timber
#

Do you know of an approach i can take to this, I have a workaround for another bug and I make it look for the zombie in the square the player is, and modifies according to that found zombie, that wouldnt be server side, right?

Sorry im new to modding and pz aint easy to

bright fog
#

I suggest checking other zombie boss mods

vast pier
#

Hey is there a way to get the unspent ammo count from a gun? I wanna return the ammo to the player's inventory when this gun breaks cuz I'm creating a custom onbreak script for it

function OnBreak.ScrapRevolverSkeleton(item, player)  
    local inv = player:getInventory()
    inv:DoRemoveItem(item)
    inv:AddItem("RamshackleWeapons.ScrapRevolverSkeleton")
    local skeleton = inv:getItemFromType("RamshackleWeapons.ScrapRevolverSkeleton")
    skeleton:setCondition(0)
    inv:AddItem("Base.SmallHandle")
    local handle = inv:getItemFromType("Base.SmallHandle")
    handle:setCondition(0)
end```
#

The normal head/handle method crashes the game when using it on guns, so I'm having to make it myself

#

Everything is working so far, the gun gets deleted and the broken items are added to the inventory. Just wanting to make it so unspent rounds in the gun don't disintegrate when it breaks

#

I think getCurrentAmmoCount ?

queen oasis
#

iirc getCurrentAmmoCount() doesn't count a chambered round

vast pier
#

haha yeah

#

you had the same idea as them

queen oasis
#

1 year and 2 days since I did any gun modding. brain still ok

small topaz
#

Hi! Does anyone knows what the "<m_UnderlayMasksFolder>" folder in a clothing item's xml file does?

winter bolt
#

it hides parts of the body and clothing underneath the clothing item

small topaz
#

The 2nd picture is the version without the underlay. The model/texture now looks different. (There is an additional part above the chest.) No clothes worn under the yellow vest.

winter bolt
#

its hiding the chest

#

youre seeing the inside of the vest

small topaz
#

you mean the second version makes the player's chest invisible?

winter bolt
#

yeah

small topaz
#

Thanks for the help! I can fix the second vest by simply deleting
<m_Masks>12</m_Masks>

vast pier
#

is there an easy way to force an item out of the player's inventory and on to the ground?

bright fog
vast pier
umbral raptor
#

Can someone tell me how to module my mod?

#

I want to separate it into multiple mods that can be enabled or disabled

vast pier
#

What parts are you wanting to module? If it's lua stuff then you can put it behind sandbox options instead

bronze yoke
#

put them all in the same workshop item (in the Contents/mods/ folder) and they'll be uploaded together

#

as oreos says this isn't really a recommended practice though, most users are stupid and get confused by this, so if you can avoid it you should

nova dome
#

hey does anyone know how to use the console while in character creation? the cc window is on top blocking the console window :s

nova dome
#

to poke shit

#

different things are loaded while in that screen than in game with a character

#

I dunno, how do u figure out what lies inside some tables previously unknown to you

#

It's awfully cumbersome to reload for a new printline you figured to try in your code especially when the condition might require you to first die and then freshly load the charactercreation screen

small topaz
bright fog
#

Simply reload lua

nova dome
bright fog
#

Debug mode

#

It will make a small blue button appear on the bottom right of the main menu to reload lua

nova dome
#

menu then ig

bright fog
#

In the main menu

#

So yes in-game

#

Idk what you're asking

#

What character creation menu are you asking for exactly I'm confused

#

There's ways to reload specific lua files directly in-game

nova dome
#

You know, the one where you choose your profession and traits. It's pinned on top and that's my problem really

bright fog
#

Are you talking about the one in the main menu or the one when you're in a save

#

That's what confuses me here

#

Because if it's the main menu, then you can directly just reload the entire lua in the main menu

nova dome
#

the one you got when you have a world loaded and you died with a character and you create a new one

bright fog
#

If it's the one while in a save, then you can reload specific lua files with the community debug tools

nova dome
#

is this community debug tools different than just debug mode?

bright fog
#

Yes

#

It expands it

#

Notably adds a menu to reload multiple lua files while in-game

#

This is already a feature with the F11 menu

#

But the F11 menu is dogshit

nova dome
#

is it called imgui?

bright fog
#

No ?

nova dome
#

debug menu modding project? I'm having a hard time finding what you describe :D

bright fog
#

....

#

Check the wiki page, download the Steam mod

nova dome
#

oh sry missed it while responding lol

bright fog
#

Activate it

nova dome
#

thanks I'll f around and find out

small topaz
#

Is there a simple way to give a modded item the same display name as a vanilla item and so that this is also respected by translations in all languages? (Without manually defining the display names in the shared/translate folder ofc.)

umbral raptor
#

Its the item name that should never conflict or be similar to any other item

#

If you are working with fluids, wild guess, then you actually need to translate the fluid container/fluid.

small topaz
# umbral raptor There shouldnt arise any problem with display names. You can literally have it a...

I want certain items which have exactly the same display names as certain vanilla items in all languages. question is whether there is an easy way to do this (for example, a specific lua command, a specific parameter in the item's script.txt entry...). ideally without just manually defining the names in all languages in the shared/translate folder (which would work but will be very time consuming)

#

Btw there is the "getText()" command. Is this defined in lua or is it a java?

bronze yoke
#

java

#
local item = ScriptManager.instance:getItem("Module.MyItem")
item:setDisplayName(getItemNameFromFullType("Base.VanillaItem"))
#

i think this will only work if you don't have a translation for this item defined

small topaz
#

Thanks! I'll try this!

#

Many thanks @bronze yoke . Your suggestion works perfectly for my problem (as always 😄 )!

storm trench
#

Why does porting this mod link the original mod ahead of its scripts? Is this why the mod is having issues?

bright fog
#

Also I highly advise you pass on Visual Studio Code and use the addons to format the text files

storm trench
storm trench
#

Also, turns out I was correct. Part of the problems I had with the port was it, somehow, constantly referencing the original mod. I removed all instances of it and the game no longer recognizes the mod in the debug modlist I had saved for this. So I enabled the new one and here we go... time to find out if this was the problem all along.

bright fog
silent zealot
#

Nice!

#

To make you do extra work - any chance or also listing which bits can be programatically changed and how?

#

I converted a mod gasmask to a functional-in-B42-gasmask and most of it was super easy, including the "remove filter" recipe which was all tag based... but putting the filter back on required replacing the recipe because it doesn't use tags, it lists every possible gasmask separately then has an item mapper for each one.

#

Would it be possible to add the bits underlined in red via lua? For personal use just making a copy of the recipe is fine, but if I wanted this to be a released mod I'd want to not clobber the existing recipe (and break any other mods that also replace it )

bronze yoke
#

i'm probably gonna try work this stuff out soon

#

i think i discovered a lot of the tricks for doing stuff like this in b41 but i haven't really been super actively modding in the b42 days so i still don't really know what is possible now

#

when i first looked at it it seemed like it was probably going to be more defensive than b41 (a lot of copying objects instead of returning them) but field access can generally defeat anything like that

silent zealot
#

If we can get and set a field then a bit of lua magic will turn that into "get field/add my bit in/set field"

bronze yoke
#

we can't set a field but if it's an object we can mess with the boject

silent zealot
#

I wish we could make pull requests for the java code.

storm trench
#

Holy heck Copilot editor in VS is poopy. Might as well not even have it.

#

It's so hard to not give up. catlul

bright fog
lucid oyster
#

can anyone tell me why this mod does not load, i analized other mods and i just dont get it

#

like , it just wont show up on the mods tab, to enable

#

its a modification of ForcedSync mod, to force sync every 30 seconds cus we have a interesting ammount of desync and we are only two playing, this mod helps but its annoying to press a key every some bit of time, and i rather have it automated

vast pier
#

It's not pretty, but it should work

tacit pebble
lucid oyster
tacit pebble
#

do you mean ProjectZomboid\ ? then try %username%\Zomboid\mods or %username%\Zomboid\workshop

lucid oyster
silent zealot
#

It's just annoying that the new recipe system is so close to making this easy to do just with the item definitions!

silent zealot
#

I'll check that out a bit later, currently working on...um... adding nipples to spongies cahracter customiser.

warped pebble
#

craziest thing ive seen today LMAO well done

vast pier
#

Interesting!
You can use item mappers to specify more than one ingredient changing the outcome. It may show the item as correct in the crafting menu, but it keeps the craft button blacked out.

vast pier
vague marsh
#

unplayable without nipples

vast pier
# vast pier Interesting! You can use item mappers to specify more than one ingredient changi...

Funny because this means that you could theoretically compress the basic melee assembly recipes into smaller categories with the same amount of functionality
Actually I don't think they even give xp, you could compress all of them if you wanted to. At least the ones that use both a hammer and knife
And even if they do give xp, you could insert lua into the xp call to check what weapon was crafted and apply appropriate xp
Kinda weird that they intentionally set up this sort of functionality for ingredients, and they decide to use it for... seed packets?

umbral raptor
#

Simple mod I made 🙂

#

That's Sadam from Zomboid Newspaper in the picture btw haha

vast pier
#

lol nice, how's the mod work?

umbral raptor
#

pretty much u just put ur photo on a white square in the texture

vast pier
#

I like how I've been working on gun break logic and gun assembly, and during that you made a Sadam desk photo for zomboid

umbral raptor
#

thats it, the rest is in the mod. u acquire a camera, insert a film, and take pictures using recipes (which does nothing other than change camera state). then u extract the film and develop it and u get the photo. u get 7 photo items to put ur textures on (so 7 diff photos without needing to add anymore)

#

there is a photo developing system included haha

#

but i plan on adding polaroids too

vast pier
#

Too bad the mod requires editing the mod itself, don't think it will get much usage outside of roleplay videos

umbral raptor
#

well its super easy and u cant really do it any other way without complicated stuff beyond my capbailities

#

u know if its even possible

umbral raptor
vast pier
#

Not saying there's anything wrong with the mod. I don't think there's a reasonable way to actually take photos in game

umbral raptor
#

or did u release it

vast pier
#

I saw a cool mod, and asked the mod creator if I could port it to 42 or possibly help with development at all

#

bro said sure, I started working and he liked the ideas I had. So I've kinda just been hyper fixated

#

I've done all of this in like a day

#

well I think today is the second day actually

#

so two

#

I fully ported the mod to 42, got the models and guns working properly.
Then ported the recipes.
Then got side tracked with changing the recipes, which led into me making blacksmithing recipes for the pistols since they were more complicated.
Which then led into me making individual gun parts.
Which led to me making gun break lua logic.
Which led to me making gun assembly recipes.

#

And now I'm here

#

I had to make my own OnBreak logic because the vanilla head/handle system doesn't work on guns, and will crash.

#

It did originally have its own logic built in to randomize the conditions of the gun parts based on a random number roll and your maintenance skill

#

but I scrapped that idea after I realized you could craft a gun with almost broken parts, break it immediately, and possibly get better quality parts due to rng

#

so I'm opting for all parts break, but are cheaper to repair than they are to replace

#

except for the handle, handle will probably stay cheaper to replace

vast pier
# umbral raptor werent u working on alloys?

I'm still working on that, and having that mod will actually be a great framework for any future smithing mods I make.
Having access to a brass ballpeen hammer would actually justify being able to craft more complex gun components!

#

So while this mod I'm working on doesn't directly benefit the smithing mod, it indirectly benefits it due to the framework I'm setting up for gun breaking and gun assembly!

brave bone
vast pier
brave bone
#

quick question: do i need to put the original mod on workshop folder when creating an addon?

brave bone
vast pier
#

what difference does it make?

brave bone
brave bone
#

nothing yet loool.. still trying to figure it out..

vast pier
#

lol

merry patio
#

Hello! I'm trying to create a mod for a drink called "mate", which is similar to coffee but is consumed from a specific container (calabaza) with a straw (bombilla) and yerba. I've created all the textures and managed to make them visible when I run the game, but I'm having trouble getting the recipe scripts to work. I'm trying to understand how it's done in B42, could you give me a hand in the right direction?

For now, I have this!
craftRecipe PonerBombillaEnMateCuero
{
timedAction = Making,
Time = 10,
Tags = InHandCraft,
category = Cooking,
inputs
{
item 1 [ArgDrinks_M.bombillaMate]
item 1 [ArgDrinks_M.mateCuero]
}
outputs
{
item 1 [ArgDrinks_M.mateCuero_Bomb]
}
}

tacit pebble
#
craftRecipe PonerBombillaEnMateCuero
    {
        timedAction = Making,
        Time = 10,
        Tags = InHandCraft,
        category = Cooking,
        inputs
        {
            item 1 [ArgDrinks_M.bombillaMate],
            item 1 [ArgDrinks_M.mateCuero],
        }
        outputs
        {
            item 1 ArgDrinks_M.mateCuero_Bomb,
        }
    }

try this. you will need , last of each line.
Also i'm not sure about the reason but TIS didn't use [ ] for outputs.

bronze yoke
#

they wouldn't serve any purpose

#

[] denotes a list of acceptable items, but the output item isn't going to vary like that

tacit pebble
plucky summit
#

I've read the modding wiki basics at least, but I haven't found the answer to my question. I read about the media folder section and it says media/lua is where scripts go. How does tha behave? They get loaded when the mod is loaded?

bronze yoke
#

yeah

plucky summit
#

Alright. I'll try. I just need to modify a definition from animals. So I just need to do a

AnimalDefinitions.animals["cowcalf"].stressAboveGround = false;

I think? Or do I need to declare AnimalDefinitions first?

bronze yoke
#

you might encounter load order issues if your file isn't in the same folder (only the shared/ client/ server/ part matters) as the vanilla file that defines these but otherwise yeah that's all you need to do

plucky summit
#

Alright. Oof. I'll read about that, then.

plucky summit
#

Do I need the filename to be the same? Or do I need to differentiate the file names?

#

Just making sure to rule out the problem I'm encountering.

bronze yoke
#

the file name should be different, and ideally unique to your mod

#

if you have the same file name as a vanilla file (or another mod) your file will replace the original one

plucky summit
#

Alright. Thanks for the heads up. That's what I did wrong then as a first.

plucky summit
#

Hello again.

#

I am getting this message.

#

However...

#

There's also no .DS_Store found, so I'm quite lost

bright fog
plucky summit
#

tried ls and it's showing nothing.

#

except the mods folder ofc.

#

really weird.

bright fog
plucky summit
#

It might honestly be an iCloud issue.

#

I'll try uploading it on a Windows machine later.

bright fog
#

Hmm

#

Is that linux ?

plucky summit
#

MacOS

bright fog
#

Did you activate the ability to see hidden files ?

plucky summit
#

Tried it now. Really nothing inside Contents/

bright fog
plucky summit
#

@bright fog I used the same structure and files in Windows. No errors came up. May be a Mac-only bug?

silent zealot
#

Can you open a command line, go to the Contents folder and run ls -la to see if there is anything there being hidden by the GUI?

#

Assuming Macs still provide a linux-style command shell.

plucky summit
bleak bone
#

femboy mod when

merry patio
# tacit pebble ``` craftRecipe PonerBombillaEnMateCuero { timedAction = Making, ...

TY! your help is greatly appreciated! I wanted to mention that my "mate" has 2 separate processes. One is preparation. Grabbing the container (mate) and adding yerba would be one recipe. Grabbing the mate with yerba and adding a bombilla (straw) would be another. And vice versa. I should also be able to remove the yerba and bombilla to clean it, also as a recipe.
On the other hand, once I have the mate with yerba and bombilla(straw) prepared, I should be able to use a teapot to serve myself (in my mod, I've created a thermo, which is like a container that keeps the water hot). That should be another recipe, which I think would be similar to making coffee. The mate could be consumed at least 4 times each time you add water, if that's possible, and only then would the container be empty

craftRecipe PrepararMateAmargoConPava
{
    timedAction = Cooking,
    Time = 90,
    Tags = InHandCraft,
    category = Cooking,
    inputs
    {
        item 1 [ArgDrinks_M.mateCuero_Bomb_yerba],
        item 1 [Base.KettleFull],  
    }
    outputs
    {
        item 1 ArgDrinks_M.mateAmargo,
    }
}

?

drifting ore
#

If they all have the same display name, they will all stack like they are the same item

merry patio
# drifting ore If you want a food item to have a specific number of uses, I achieve this by hav...

Ah ok so...

craftRecipe PrepararMateAmargoConPava
{
    timedAction = Cooking,
    Time = 90,
    Tags = InHandCraft,
    category = Cooking,
    inputs
    {
        item 1 [ArgDrinks_M.mateCuero_Bomb_yerba],
        item 1 [Base.KettleFull],
    }
    outputs
    {
        item 1 ArgDrinks_M.mateAmargo_4,
    }
}

I can make sure that the result (output) can be consumed 4 times, right?

or...
....
item ArgDrinks_M.mateAmargo_4
{
ReplaceOnUse = ArgDrinks_M.mateAmargo_3,
...
}

item ArgDrinks_M.mateAmargo_3
{
ReplaceOnUse = ArgDrinks_M.mateAmargo_2,
...
}
etc

#

Another thing... for the thermo, should I use the same item configuration as the kettle, right? And how should I remove the bombilla (straw)?

merry patio
#

I attach the LUA

warm vector
#

Does anyone here know how modded maps handle zombie spawn/count in the tiles/chunks?

drifting ore
lucid oyster
warm vector
lucid oyster
#

it might have to do with the map being to crowded on decorations and lacking sufficient space for a valid spawn to be found, i think also the game wont spawn zombies were there is one already

warm vector
#

You know how I can go into like Taylorsville map files and just increase the zombie count?

lucid oyster
#

just increase the pop on the sandbox settings

warm vector
#

I did and still the zombiecount is no where near what some other maps are - which is my point.
From my understanding modded maps handle zombie population ontop of the sandbox settings

lucid oyster
#

not much else that you can do i think, i think the rest of the issiue is simply map geography

#

also if anyone wants to correct any wrong information on my side, please do so, im not reallly on technical project zomboid

merry patio
merry patio
# drifting ore I could help you better if I could see your items .txt file, where you have mate...

So far, everything seems to be working fine except for a few things. When I add only the bombilla to the leather mate, it disappears. This is the only combination that does this, the rest seems to be working well.
Another issue I'm finding is that for the mate amargo, the water should be hot, and I still don't know how to do that. But I think I'll mimic the teapot, although this is a problem for a bit later, I think

storm trench
vast pier
#

You can call existing oncreates inside of an oncreate function? neat

function Recipe.OnCreate.MinorCarving(craftRecipeData, character)
    local carving = character:getPerkLevel(Perks.Carving)
    Recipe.OnCreate.MinorCondition(craftRecipeData, carving)
end```
#

I'll keep that in mind

drifting ore
#

Unless you mean it is outputting correctly but destroying an input item it shouldn't

#

mode:keep add this to your item definition in that case

#

Example:

inputs { item 1 [ReeferMadness.cigShell] mode:keep, }

vast pier
merry patio
merry patio
vast pier
vast pier
merry patio
merry patio
merry patio
vast pier
#
craftRecipe MakeCoffeeMug
    {
        timedAction = MakeCoffee,
        Time = 20,
        category = Cooking,
        Tags = CoffeeMachine;Cooking,
        inputs
        {
            item 1 [Base.Coffee2],
            item 1 [*], --1 item, * means any fluid container
            -fluid 0.2 [Water;TaintedWater], --removes 200ml of water/tainted water
            item 1 tags[CoffeeMaker], --checks for cup that can hold coffee
            +fluid 0.2 Coffee, --directly adds 200ml of coffee to the container
        }
        outputs
        {
        }
    }```
merry patio
vast pier
#

I would try to find out how the game converts tainted water into clean water through boiling

merry patio
storm trench
#

I really, really hate to have to ask for help like this... but can someone tell me if they see anything wrong with this? I made the mistake of using the VS Studio assistant for my original code that didn't work, and now the AI assistant in VS has taken the code a little too far and I am just confused about it. I don't even know where to start on what's wrong with this.

(It's a dynamic spawning system, and yes I accidentally didn't save a backup of my original code [RIP]).

merry patio
vast pier
#

no the same way the coffee recipes shows

#

[Module.ItemName;Module.ItemName]

merry patio
# vast pier [Module.ItemName;Module.ItemName]

I checked it after asking and it didn't work. I'll check again to make sure I didn't forget anything. The kettle issue is now fixed, I'll adapt the "thermos" code to do the same.

item 1 [ArgDrinks_M.yerbaPlayaditoSP;ArgDrinks_M.yerbaRosamonte]

vast pier
#

Is there a comma at the end of it?

silent zealot
# warm vector I was kinda curious how some maps handle the zombie count, because I find some v...

There's some sort of "zombie density" included in maps, that gives the game a rough ide of how to spawn zombies, at least in outdoor areas. If you click the "zombies" button on the left on https://b42map.com/ you'll see an overlay, and I'm sure I've seen similar things with more detail for B41.

The problem is not every map maker uses it properly or has the same idea as you about what makes for a good zombie distribution; I found a lot of B41 maps were either crammed full of zombies everywhere or nearly deserted.

Someone with more map-modding experience can likely correct me/elaborate on this.

agile socket
#

I have no experience with making mods. If I wanted to make a mod which would let me put cheese into omelettes where would I begin learning on how to do that?

silent zealot
#

There's an existing omlette recipe, right? Is it "evolved" i.e.: you make an omlette, then can add toppings/seasonings to it?

agile socket
silent zealot
#

If so, have a look at the recipe and see how it lists what can be added.

agile socket
silent zealot
#

Check under \media\scripts\recipes to start

silent zealot
#

also scripts/evolvedrecipes.txt

#

Assuming you're on B42, I think the way to so it is ass the omelette tag to the cheese item in the EvolvedRecipe list

agile socket
silent zealot
#

items_food_dairy.txt:

agile socket
silent zealot
#

I think so. No promises though, and no idea what the numbers means.

#

Note that DoParam() or other programatic ways of editing the Cheese script may not work; I know changing tags doesn't affect recipes because the recipe parser asses tags when the recipe loads and never considers they might have changed.

distant inlet
#

anyone know how to store client-side data for use between sessions of the same save?

bronze yoke
#

use mod data

#

ModData.getOrCreate("MyModID or some other unique string") returns a table that will be saved and loaded with the save file

#

the easiest way to use it is something like this:```lua
local modData
Events.OnInitGlobalModData.Add(function()
modData = ModData.getOrCreate("unique id")
end)

#

once it's initialised, just treat it as a regular table

#

though keep in mind it can only save/load POD (numbers, strings, booleans, other tables)

agile socket
bright fog
#

Maaan that's old asf 😭

simple helm
#

Hey is there any vehicle devs here for PZ ?

silent zealot
#

Vehicle modders yes, actual PZ developers no.

merry patio
# vast pier Is there a comma at the end of it?

yes! i had it but i solved it by creating a second recipe. The only thing I still haven't been able to solve is how to make the thermos behave like a kettle. In build 41, I had the three versions: empty, with water, and with hot water. Now, it should at least have empty and with water, but I'm not being able to get it working... I'll have to investigate a bit more about this

silent zealot
#

or this in the same function.

simple helm
silent zealot
#

No worries, just making sure we're talking about the same thing before I say some will check in occasionly.

simple helm
#

All good man! I’m just used to just saying it specially when your used to a certain term.

silent zealot
#

If your question relates the lua code and vehicles I may be able to help, if it's about the model and stuff probably not. Either way, worth asking so if someone logs in later and scrolls back a bit to see what they missed they might see your question.

silent zealot
#
    {
        DisplayName = Empty Kettle,
        DisplayCategory = Cooking,
        Type = Normal,
        PourType = Kettle,
        Weight = 1,
        Icon = Kettle,
        MetalValue = 30,
        StaticModel = Kettle,
        WorldStaticModel = KettleGround,
        FillFromDispenserSound = GetWaterFromDispenserMetalMedium,
        FillFromLakeSound = GetWaterFromLakeSmall,
        FillFromTapSound = GetWaterFromTapMetalMedium,
        FillFromToiletSound = GetWaterFromToilet,
        IsCookable = true,
        Tags = Cookable;CoffeeMaker;HasMetal;SmeltableIronSmall,
        ResearchableRecipes = MakeKettleMaul,

        component FluidContainer
        {
            ContainerName   = Kettle,
            capacity        = 1.5,
        }

    }```
#

That DisplayName is replaced with the translate string ItemName_Base.Kettle = "Kettle", so it's just there to confuse us.

bright fog
#

@tacit pebble Are you sure all the recipes which involve these tags are even usable ? Some of these seem to be very obscure recipes

#

Actually I cannot find a single instance where these are used for output

silent zealot
#

Maybe they added the feature, then decided onCreate scripts were better?

bronze yoke
#

the fluid stuff is usually half finished

silent zealot
#

Or added teh feature after everything used onCreate and have not yet updated existing recipies.

silent zealot
bronze yoke
#

i'd be wary of guessing based on vanilla recipes, check the code if you want to know what something does

silent zealot
#

I've ended up with one VSCode instance set up with the media folder as a base directory, one VSCode instance set up with decompiled java as a base directory. Makes searching easy.

bright fog
#

So finished or not is not the problem

#

The problem is listing informations which aren't even used in the game, which don't have a single example and making sure these even have a point being listed if nothing can be achieved with them

bronze yoke
#

i can find the code where it does this though 😭

bright fog
#

Then perhaps @tacit pebble tested those

silent zealot
#

CraftRecipeManager.java

bright fog
#

But it'd be appreciated getting informations/examples

bronze yoke
#

which is why i say you should check the code, vanilla usages aren't going to tell you the full story

bright fog
#

I'm aware of that .........

#

But every flags that I listed in inputs have examples in the base code

#

Flags are just not a thing for outputs, I haven't found a single example which involves flags

silent zealot
#

Just tag them on the wiki with "not used in any vanilla recipe as of 42.3"

bright fog
#

That's why I'm doubting flags being used in outputs

bright fog
bronze yoke
#

well i can confirm they exist because i'm looking at the code right now

bright fog
#

Confirmed for outputs ?

silent zealot
#

Instead of having to solve this before you move on to edit the next thing, you just let the reader know there is reduced confidence in them working.

bronze yoke
#

yes

#

i cannot confirm 100% that they work because i haven't used them but the code does appear to do what the wiki says

silent zealot
#

They do look implemetd in java, though that doesn't mean they have been tested and work correctly.

#

I'm just repeating Albion now 😂

bright fog
#

Done

bronze yoke
#

idk how good vscode's java support is but in idea you can check stuff like this in 20 seconds (ctrl-n, OutputFlag, click usages, read them)

tacit pebble
bright fog
silent zealot
bronze yoke
#

yeah, in this case text search is very likely to find the results too, in other cases searching by usages rounds things down much faster

bright fog
#

The issue is mostly just that you listed something which is unused in the game so it made me very confused. Code seems to exist however for these

silent zealot
bright fog
whole parcel
#

I managed to do it using several workarounds, but the best one was patching the SandboxVars.lua every start to load custom lua code (so this is not even a mod!), but rather I realised that the exposed lua api for server-side is really basic, so I ended up using Frida to hook game functions and call back a Node.js application using sockets. It's hacky but I managed to get it working!

plucky summit
distant inlet
tacit pebble
# bright fog Flags are just not a thing for outputs, I haven't found a single example which i...

Yep I just read all messages 😆

Only thing that I doubt is: [AutomationOnly]; However you are correct, i haven't enough test yet. I do simple test before me alone, but it could be outdated already.
I wrote that thing yesterday from my memory at my work, and i was planning to test when I'm back to home but I fell asleep
I thought it would be okay for a day because wiki said "This section is under construction" 😭 😬

bronze yoke
#

if you really have to you can store all the information you need to reconstruct that object but it can be complex and not always even possible

storm trench
#

Eureka! It's totally wrong and spawned a giant amount, but I finally got PZ to spawn an object based on the room the game detects with minimal overhead (utilizes loadGridsquare but also only runs it very so often). I have been trying for days to get this to work and I have finally gotten somewhere.

Now just to figure out why it spammed a billion of them on one spot hahaa.

distant inlet
bronze yoke
#

with certain kinds of objects yes

#

universally no

merry patio
vast pier
quiet rain
#

Is there any specific way to see if a zombie is wearing a specific piece of clothing, or alternatively remove it from being worn by the generic01-05 outfits?

silent zealot
#

Maybe add a yerba mate fluid, then a recipe that takes thermos of water + other ingredients, leave the output empty and use OnCreate to replace the water with Yerba mate.

#

Would having a specific worksation make sense? Like the way you need a coffee machine to make coffee.

merry patio
# silent zealot If I understand B42 correctly: 1) you just make one Thermos object and 2) forget...

TY! that is what finally worked for me

    item termoEmpty
    {
    DisplayName = Termo,
    DisplayCategory = WaterContainer,
    Type = Normal,
    Weight = 0.2,
    Icon = termo,
    MetalValue = 10,
    StaticModel = termo,
    WorldStaticModel = termoWorld,
    FillFromDispenserSound = GetWaterFromDispenserMetalMedium,
    FillFromLakeSound = GetWaterFromLakeSmall,
    FillFromTapSound = GetWaterFromTapMetalMedium,
    FillFromToiletSound = GetWaterFromToilet,
    Tags = HasMetal;LightWhenAttached,

    component FluidContainer
    {
        ContainerName = Termo,
        capacity = 1.1,
    }
    }
#

I'm trying to translate the line that now appears in the Fluid_Container_Termo but I can't find the right one. It would be the final step to be able to launch it completely

umbral raptor
#

fluids and fluid containers are translated there

merry patio
merry patio
umbral raptor
#

thats because u did it wrong

#

Fluid_Container_AlcoholBottle = "Bottle",

#

See the difference?

#

It's not Fluids_Fluid
it's Fluid_Container_ItemNAME/ContainerName

#

@merry patio

merry patio
ancient grail
silent zealot
#

yeah, that's it - I just checked my proof of concept - can of tequila item and that's where the translation is for a fluid container.

#
Fluids_EN = {
    Fluid_Container_NepCanOfFun = "Can of Fun",
}
vast pier
#

Is there a way to target a specific item that was just added to the player inventory? and not a preexisting one?

grizzled fulcrum
#

vscode is just not built for java, so you will get things like random errors that aren't actually errors, or having trouble running gradle tasks

#

If you're just searching through a codebase and not actually writing heavy code though, vscode will do just fine

quiet rain
random finch
#

(B41) So we dont have access to any of the advanced pathfinding stuff, but we have pathToLocation. However, if the zed encounters obstacles it does not handle them. Are there any libraries or other mods that have pathfinding for zeds?

random finch
#

Its doesnt calculate doors/windows

bright fog
random finch
#

Say if you are in a building with doors/windows. You pathfind to the door way or the window and stop of they are closed.

bright fog
#

They won't thump them ?

random finch
#

nope 😦

bright fog
#

Tbf you should check how Bandits manages his AIs on that part as it's the only mod I know which fucks with zombie behavior in depth

#

I haven't done anything that fancy with zombies

random finch
#

Ill check it out

#

thanks

brave bone
#

just got my sub mod to show up in game, just want to confirm, can I require two main mods for a sub mod?

storm trench
vast pier
#

Is there a way to check an item's params? I want to retrieve the breaksound of an item.

#

I want to retrieve the param in lua
so that I can retrieve the sound from the item, and play it during lua events

    if item:getFullType() == "RamshackleWeapons.ScrapPistol" then
    player:playSoundLocal("M1911Break");
    inv:AddItem("RamshackleWeapons.ScrapPistolSkeleton"):setCondition(0)
    inv:AddItem("RamshackleWeapons.ScrapPistolReceiver"):setCondition(0)
    inv:AddItem("RamshackleWeapons.PistolGrip"):setCondition(0)
    elseif item:getFullType() == "RamshackleWeapons.ScrapRevolver" then
    player:playSoundLocal("MagnumBreak");
    inv:AddItem("RamshackleWeapons.ScrapRevolverSkeleton"):setCondition(0)
    inv:AddItem("RamshackleWeapons.ScrapRevolverCylinder"):setCondition(0)
    inv:AddItem("RamshackleWeapons.PistolGrip"):setCondition(0)
    end```I already know where the sounds are located, I want to in real time retrieve the break sound value to stick into 
```player:playSoundLocal()```I want to take steps toward turning this into more of a framework for future use.
And having the break sounds not be hard coded and instead taken from the gun itself would be a step toward that
vast pier
agile socket
#

So I'm working on uploading a Cheese in Omelettes mod, but Zomboid is telling me my mod is missign a mod.info file. I've followed the template provided by the game, and placed an updated mod.info file into the same folder that the template has, but it is still saying it's missing the file. What am I doing wrong?

small topaz
vast pier
#

I pretty much only mod B42

#

no way am I gonna attempt to make a gun assembly framework with B41's crafting system

small topaz
# vast pier I pretty much only mod B42

As a general tip, just searching PZ java doc for commands is always a good idea in case you are looking for a specific command (see here: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/ ).

In most cases the java doc does not contain any explanation of what the commands exactly do but it can often be inferred from their naming, arguments, return values and from the objects to which they are applied. Checking the vanilla code for how those commands are used can also help to understand them better.

agile socket
vast pier
#

Is there a way to check item tags for a partial match?

bright fog
#

I believe there's one for regex

#

So yea

frank elbow
#

string.find uses Lua's pattern format rather than regex, but it can be used for that yeah

#

If you wanted something that matches prefix_ plus 1 or more alphanumeric characters, for example, you can use the pattern ^prefix_%w+

small topaz
#

Irrc correctly, I think the game even has it's own command which searches for specific items whose script ID contains a certain string

drifting ore
#

In B41 it needs to be in the main mod folder next to media

#

This is my mod.info for B42

name=Reefer Madness
id=ReeferMadness
author=Bjørn
description=Made by stoners, for stoners. Seamlessly integrated into B42.
poster=preview.png
icon=previewmini.png```
vast pier
#

@plush wraith why is True smoking in two separate mods instead of just one?

drifting ore
#

Maybe because B41 not using common is stupid

vast pier
#

okay but I'm still confused on why two mods instead of one

#

cuz you can have them both be in the same mod still for two versions

#

I'm hoping I can set this up dynamically enough to work as a future framework for vanilla gun breakage, repair, and reassembly

#

So far it's working as intended 👍

#

I'm designing it to be mod compatible.
Meaning if you make a mod and want it to slot into the framework, you would just need to

  1. create the components.
    They must have the same module and name as the gun but with their component type added onto the end.
    So a gun with the ID of "ManicMods.PissingPistol" would need to two items called "ManicMods.PissingPistolSkeleton" and "ManicMods.PissingPistolReceiver"

  2. Add the appropriate tags.
    All guns will need the tag "SaltyGunAssembly" and then an additional tag specifying what type of gun it is, like "SaltyPistol" in this instance.
    All components will need "GunPart" to be able to be repaired in the repair recipes

  3. Add the onbreak lua to the guns they want to slot into the framework.

  4. Add in an Assembly recipe.
    I will try to find a way to make this part mod compatible, I may have to do some stuff with an oncreate lua, but currently this part will need to be done by the addon creator.

dull bear
#

Hi everyone. I am porting my mod from B41 to B42 and am facing some issue with my models. More specifically it looks like the surface normals are incorrect as the models look like they are "transparent" from certain angles. In Blender all the normals are as expected and this has also worked previously in B41 with no issues. Has anyone experiences something similar or have there been any changes to the way models work. How can i correct this?

tranquil kindle
dull bear
small topaz
small topaz
#

don't know what ItemVisual exactly is. therefore I ask here

small topaz
#

can this also assign a new xml file to a clothing item?

bright fog
#

This has nothing to do with creating clothing

#

These are used to store what zombies and players wear visually

#

What the visuals look like in a way

feral parcel
#

someone make a nomad mod in b42

storm trench
feral parcel
feral parcel
feral parcel
storm trench
#

RV Interior likely needs a lot of work done as there were changes to the systems it used in B41.

feral parcel
storm trench
vast pier
craggy nacelle
#

Hiho, i hope someone can help me out. I wrote a small mod and tryed it locally, it worked. Then i tryed to upload it, but i fail to even see it.

I even went as far to just make a copy of the ModTemplate, named ModTemplateCopy and simply modified the mod.info with the new id, but still dont get to even see it. Its probably a simple oversight on my site, but i cant see what im doing wrong. 😦

I should mention, its still a .41 mod

drifting ore
bronze yoke
#

you might have fallen for the fake mod folders in the game directory

willow mountain
#

does anyone know why players who have downloaded my mod don't see it in the list? that's already the second comment I've received, I also saw it under other mods, what is it?

plush wraith
drifting ore
willow mountain
bronze yoke
#

if it's a b42 only mod people just don't read that and expect it to show up in 41

willow mountain
craggy nacelle
craggy nacelle
vast pier
drifting ore
bronze yoke
#

the folders %UserProfile%/Zomboid/mods and %UserProfile%/Zomboid/Workshop are the only ones the game actually loads mods from

plush wraith
bronze yoke
#

the folders ProjectZomboid/mods and ProjectZomboid/Workshop (in the main game install directory) are fake and exist for no reason

drifting ore
craggy nacelle
#

Thank you @drifting ore and @bronze yoke that was the answer. Never even thought of looking there. I was already ready to give up. Honestly writing the mod didnt take as long as me trying to figure out what i did wrong. 🥹

storm trench
drifting ore
plush wraith
#

What do you guys use then Notepad++?

#

Can't imagine not using an IDE like vscode 😂

bronze yoke
#

most of the people not using vscode do use notepad++ 😭

plush wraith
#

IDE and version control like GIT, two big things that help developing a mod bigger than a file or two

ancient grail
cinder nebula
#

Hi all. Is there a "Reset Lua" button while in-game when debug mode is activated? Just like there is on the main menu screen.

plush wraith
#

If something is cached you need to go back to the main menu usually tho

bronze yoke
#

it might have been used before they had a cache directory or something but i don't really know

cinder nebula
umbral raptor
#

Reference the Support Goods mod's code for modding whatever you want. I pretty much modded most stuff possible except vehicles and maps.

Modding Items:- (Pretty much everything except weapons and clothes)
Requirements:-
Item script (Determines all the properties of the item)
Model Script (Determines the model's representation; mesh, texture, scale, attachment to world or hands)
Model (Model_X/WorldItems)
Texture (Textures/WorldItems)
Icon (32x32)
LUA Item Name Translation
LUA Tooltip Translation (If applicable)
LUA Fluids (IF IT IS A FLUID CONTAINER)

Item scripts:- https://pzwiki.net/wiki/Item_scripts

How to make any item:-
The best way to make an item is to copy the item scripts of the closest Vanilla thing.

Modding Clothing:-
Requirements:-
Clothing Item script (Determines all the properties of the item)
ClothingModel Script (Determines the model's representation; mesh, texture, scale, attachment to world or hands)
ClothingItem
Icon (32x32)
fileGUIDTable
Model (Models_X/WorldItems+Models_X/Skinned or Static)
Texture (Textures/Clothes)
LUA Item Name Translation

Clothing scripts:- https://pzwiki.net/wiki/Item_scripts

Modding Weapons:-
Item script (Determines all the properties of the item)
Model Script (Determines the model's representation; mesh, texture, scale, attachment to world or hands)
Model (Model_X/Weapon)
Texture (Textures/Weapon)
Icon (32x32)
LUA Item Name Translation

Modding Recipes:-
Recipe script (Determines all the properties of the item)
Items (Reference Modding Items)
LUA Recipe Name Translation

Modding Radio/TV:-
Radio Code (.xml in Radio) - WordZed does it for you
LUA radio translation (Radio_EN) - Use AI for that, trust me, they can do it and if you try to do it yourself you'll cry.

Modding Fluids:-
Fluid Script
Fluid Translation

#

Made a small guide, might help somebody 🙂

#

It doesn't include stuff that's lua-intensive.

#

I tried to cover as much of what needs to be done to successfully implement something

#

hehe forgot icons as usual

umbral raptor
#

oh didnt know this was a thing

#

haha

umbral raptor
cinder nebula
#

How do I disable the "Sit On Ground" within the right-click context menu after I have already added an option in the ModOptions tab and is enabled? Do I need to add a dependency?

ancient grail
drifting ore
#

Hell yeah I use Notepad ++

#

🫡

simple helm
#

are there any vehicle modders on

ancient grail
# cinder nebula Thank you.

https://steamcommunity.com/sharedfiles/filedetails/?id=3435613327
Adds AutoMode and sit button on the exercise panel
When AutoMode is checked the character will automatically sitdown
and automatically stand up
i have there a commented out version which is the entire context menu
since i removed it from previous versions
cuz i couldnt at first figure out what to do to be able to sorta replace the exercise button, but now it does that so iremoved the context menu. so thatcommented out part might be something you need

cinder nebula
#

I think you may have forgotten to remove these.

#

Also, the auto button is positioned strangely for me.

ancient grail
#

where do you want it?

ancient grail
cinder nebula
#

Also, what am I looking at exactly in your code to help me know how to disable the "Sit On Ground" feature in the right-click context menu?

ancient grail
#

b41

using xml



function ISAutoFitnessUI:isResting()
    return (self.player:getVariableBoolean("sitonground") or self.player:isSitOnGround())
end

function ISAutoFitnessUI:sit(sitDown)
    if sitDown then
        self.player:reportEvent("EventSitOnGround")
    else
        self.player:setVariable("forceGetUp", true)
        self.player:reportEvent("EventSitOnGround")
    end
end
#

b42

using timedactions

function ISAutoFitnessUI.setStand(pl, bool)
    if bool and pl:isCurrentState(PlayerSitOnGroundState.instance()) or pl:isSitOnGround() or pl:isSittingOnFurniture() then
        ISTimedActionQueue.clear(pl);
        ISTimedActionQueue.add(ISWaitWhileGettingUp:new(pl))
    elseif pl:isCurrentState(IdleState.instance()) and not bool then
        pl:setVariable("sitonground", true)
        pl:reportEvent("EventSitOnGround")
        ISTimedActionQueue.add(ISSitOnGround:new(pl))
    end
end
#
ISTimedActionQueue.add(ISWaitWhileGettingUp:new(getPlayer()))
ISTimedActionQueue.add(ISSitOnGround:new(getPlayer()))
ISTimedActionQueue.clear(pl)
pl:isCurrentState(PlayerSitOnGroundState.instance()) or pl:isSitOnGround() or pl:isSittingOnFurniture() 
ISTimedActionQueue.add(ISWaitWhileGettingUp:new(pl))
pl:isCurrentState(IdleState.instance())
pl:setVariable("sitonground", true)
pl:reportEvent("EventSitOnGround")
ISTimedActionQueue.add(ISSitOnGround:new(pl))
pl:setVariable("forceGetUp", true)
pl:setVariable("sitonground", false)
pl:isSitOnGround()
pl:isCantSit()
pl:setSitOnGround(false)

#

ISWaitWhileGettingUp and ISSitOnGround / ISSitOnChairAction

is vanilla b42 action
we cant use that b41 yet

shared\TimedActions\ISSitOnGround.lua
shared\TimedActions\ISSitOnChairAction.lua

#

shared\TimedActions\ISWaitWhileGettingUp.lua

ancient grail
cinder nebula
#

So add in somewhere in my lua file:

function ISAutoFitnessUI.setStand(pl, bool)
if bool and pl:isCurrentState(PlayerSitOnGroundState.instance()) or pl:isSitOnGround() or pl:isSittingOnFurniture() then
ISTimedActionQueue.clear(pl);
ISTimedActionQueue.add(ISWaitWhileGettingUp:new(pl))
elseif pl:isCurrentState(IdleState.instance()) and not bool then
pl:setVariable("sitonground", true)
pl:reportEvent("EventSitOnGround")
ISTimedActionQueue.add(ISSitOnGround:new(pl))
end
end

ISTimedActionQueue.add(ISWaitWhileGettingUp:new(getPlayer()))
ISTimedActionQueue.add(ISSitOnGround:new(getPlayer()))
ISTimedActionQueue.clear(pl)
pl:isCurrentState(PlayerSitOnGroundState.instance()) or pl:isSitOnGround() or pl:isSittingOnFurniture()
ISTimedActionQueue.add(ISWaitWhileGettingUp:new(pl))
pl:isCurrentState(IdleState.instance())
pl:setVariable("sitonground", true)
pl:reportEvent("EventSitOnGround")
ISTimedActionQueue.add(ISSitOnGround:new(pl))
pl:setVariable("forceGetUp", true)
pl:setVariable("sitonground", false)
pl:isSitOnGround()
pl:isCantSit()
pl:setSitOnGround(false)

random finch
#

In B42, we have OnZombieCreate. However, in B41, we use OnZombieUpdate. Say I want to determine if the Zed has freshly spawned. Use use zombie:getAge()?

random finch
#

zombie:getAge() always 25. zombie:getHoursSurvived() is not unique to each zed - It seems to be the the hours the server has been up or how long its owner has survived for.

cinder nebula
# ancient grail no

Lolz. I do not understand then.

Can you add a sandbox option so that for the autoexercise when the character goes to sit it won't put the game speed to normal, but will continue at x6 speed.

random finch
#

Bro, is anyone aware of a way to get how long a zed has been alive since spawned?

tacit pebble
#

Random Question:
Can I add my custom parameter in item script and read them in lua?

{
/*Vanilla Params*/
myCustomParam = Hello;World,
}

Currently I don't have any ideas with this but want to know possibility. 👍

bronze yoke
#

yesss but it's usually not the best way to do it

#

when you do this, whatever value you put in gets added to the item's default mod data

#

but generally you don't want script poperties to be copied for every item separately, it just bloats the save files

#

it's only really useful if it's a default value for something you were going to store in mod data anyway

#

if it's static then```lua
local myCustomParams = {}
myCustomParams["Base.Apple"] = "Hello;World"

--read with:
local myCustomParam = myCustomParams[item:getFullType()]

tacit pebble
#

oh wow that's what exactly I wanted to know! many thanks for details ❤️

#

yeah I may want to add custom modData for every InventoryItem which i added in the future. without setting one by one.

cinder nebula
random finch
#

Dude, nah. Using AI to code zomboid code will end in epic trash. You should understand what you are doing and why things are happening otherwise you will end up with an unsustainable shit show.

cinder nebula
#

Like I said, I have two succesful mods because of them. To each their own.

random finch
#

Im not saying you cant make a mod. But, anything complex, an issue arises, the AI or you have no idea what is going on.

cinder nebula
#

Prompt engineer should be a new occupation. 🙂

random finch
#

It could be but, as of now, you must be a developer and understand the code to write decent prompts to do anything complex. Simple junior level programming stuff is fine.

cinder nebula
#

Yeah, it can definitely help to know technical programming words.

silent zealot
#

The problem is when things don't work people post AI generated code here and want us to fix it.

#

And instead of the usual "here's the thing you need to look at/the sort of changes you need to make" then want all the work done for them, because they can't make use of advice.

#

So AI code is helpful for simple things that it manages to get correct, but annoying for a lot of people when it does not work.

ancient grail
#

not a sandbox option tho

cinder nebula
#

It doesn't work like that for me. When the cahracter sits it goes to x1 speed.

umbral raptor
#

Can someone tell me where I can find the scripts for the unique fliers?

#

Flier has an oncreate that creates a random flier

#

item Flier
{
DisplayCategory = Junk,
Weight = 0.1,
Type = Literature,
DisplayName = Flier,
Icon = Flier,
ReadType = photo,
StaticModel = Flier1,
WorldStaticModel = Flier1,
Tags = FastRead,
OnCreate = SpecialLootSpawns.OnCreateFlier,
}

#

SpecialLootSpawns.OnCreateFlier = function(item)
if not item then return; end;
local text
local bookList = PrintMediaDefinitions.Fliers
local book = bookList[ZombRand(#bookList)+1]
local text = getText(item:getDisplayName()) .. ": " .. getText("PrintMedia" .. book .. "_title" )
item:setName(text)
item:getModData().printMedia = book
end

#

I want to use the unique ones in recipe. Is there a unqiue item script for each one or are they randomly generated or what exactly?

bronze yoke
#

they share an item script

brave bone
#

is rip all temporary disabled in b42?

umbral raptor
#

is there a limit to the amount of different models that can use the same mesh?

#

it seems that when i use alot of models with the same mesh but diff textures the model breaks in-game

bright fog
random finch
#

Anyone ever notice zeds using the walk animation moving at sprint speeds when using pathToLocation?

drifting ore
#

I think he means rip all clothing when right clicking a clothing item

#

Maybe a common sense feature?

sinful ether
#

I have them on workshop too

#

Thats the co-op console log

brave bone
flint forge
#

Does anyone know how one would create a mod that can auto equip certain items or start a player off with said items?

#

I.E

My players spawn with a pip boy and vault suit, I was hoping to get it to where they can spawn with it equiped instead of in inventory

cinder nebula
silent zealot
#

My mod has infected Google AI:

plush wraith
#

You will be spared in the AI takeover nice

silent zealot
#
     local holster = playerObj:getInventory():AddItem("Base.HolsterSimple")
     playerObj:setWornItem(holster:getBodyLocation(), holster)
silent zealot
flint forge
#

Since the code from b42 and b41 are so different

silent zealot
#

Does setwornitem exist in B41?

flint forge
#

Im not sure, I'll have to see

#

I know its possible because Days End had this. If only I could find the mod they had

silent zealot
#

yup, it's in B41

ancient grail
granite ginkgo
#

Guys, any idea why I can't use textures greater than 516x516 on my model? (it breaks the UVs in game)

brave bone
#

how do i make my placed item use the 3d model. lool

WorldStaticModel = CollapsibleLadder,


`module Base
{

model CollapsibleLadder_model
{
    mesh = WorldItems/Items/CollapsibleLadder,
    texture = CollapsibleLadder_background,

}

}`

#

if i really squint really hard.. it is already in 3d,,, lmao.

brave bone
# bright fog Send your item script too

module Base
{

item CollapsibleLadder
{

    DisplayName = Telescopic Ladder,
    DisplayCategory = Furniture,
    Type = Normal,
    Weight = 5.0,
    Icon = CollapsibleLadder,
    IsTelevision = FALSE,
    IsMoveAble = ,
    Tooltip = Make_ladders_lighter_for_packing,
    WorldStaticModel = CollapsibleLadder,
    



}

}

bright fog
#

It's the wrong ID

#

Your model ID ends with _model

brave bone
#

.......... god im blind LOL

heavy phoenix
#

hey, anyone have any tutorial for making custom maps in pz ?

crystal sigil
#

Hey guys, need some help to reflect the state of the engine when the player is sitting in a car.

Something like:
local vehicle = player:getVehicle()
local engineState = vehicle.engineStateTypes()

I found the Enum Class BaseVehicle.engineStateTypes but im not really sure how to use it...

vast pier
#

Any idea how I would detect what gun attachments are present on an item?

silent zealot
silent zealot
#

I don't think engineState is explosed to lua at all, but BaseVehicle.engineState is public so you can try accessing is via Starlit API's magic.

#

If you can get the value it's an enum:

#

The vehicledashboard lua also includes it's own code to tell when the vehicle has been in a crash by constantly comparing the health of all parts to see when they decrease; getAlphaFlick and a few other functions related to the flickering dashbaord on impact will refer back to that.

crystal sigil
#

gotcha, vehicle:isEngineRunning() is already enough and worked well. But, will still look into Starlit API's magic. Looks more promising on future functions. Thanks for the tip!

silent zealot
#

Or something else under HandWeapon that repaltes to weapon parts

#

context menu code for "remove upgrade" :

vast pier
#

Will try

crystal sigil
#

Now my mind is blowing. So much things are possible ;D

vast pier
# silent zealot Try getDetachableWeaponParts

Calls an error when trying to use it

function: SaltyFirearmDisassemblyFramework -- file: SaltyFirearmDisassemblyFramework.lua line # 28 | MOD: Salty's Firearm Disassembly Framework
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@7f219fa1
function: saveAll -- file: ISItemEditPanel.lua line # 457 | Vanilla
function: onOptionMouseDown -- file: ISItemEditorUI.lua line # 100 | Vanilla
function: onMouseUp -- file: ISButton.lua line # 56 | Vanilla

Line # 28 is just local GunAttachments = item:getDetachableWeaponParts()

silent zealot
#

Try feeding the function an player object as the parameter

#

...don't ask me why because there shoudl be no need for this because if a gun has bits attached then it has bits attached and what the heck is the player object for? But... it needs one.

#

...apparently they are only detachable if that character can detach them.

vast pier
#

Yeah! I figured that much out, but I'm not sure how to extract the actual items from the arraylist

silent zealot
#

that looks like a table or array

quasi geode
silent zealot
#

It's an array, or the mutatad junk that pretends to be an array when lau and java get cozy. public ArrayList<WeaponPart> getAllWeaponParts()

quasi geode
#

its an ArrayList of WeaponParts, loop through it and check :getFullType() on each

silent zealot
#
local myArray = item:getAllWeaponParts
    for i=1,x:size() do
        local oneArrayPiece = myArray:get(i-1)         
    end
#

Note that the array is indexed starting from 0, not from 1.

vast pier
#

Why from 0?

#
        local GunAttachments = item:getAllWeaponParts()

        if GunAttachments then 
            print(GunAttachments)
            for i=1,x:size() do
                local Attachments = GunAttachments:get(i-1)
                local item = Attachments:getFullType()
                print(item)
            end
        end```
yay or nay
#

Don't bully me I'm new to lua ;w;

#

the answer is nay, idk how to use loops

silent zealot
#

Short answer: some langauage start from 0, some from 1, just know when to use which.

drifting ore
#

0 = 1

#

Because you start counting from 0

#

Or some bs

silent zealot
#

Back in ye olde days languages didn't do stuff for you like "arrays" and and "lists" and "strings". You had to make your own.

vast pier
silent zealot
#

So you want an array? Forst work out the size of each thing you will store in in, multiply by the max size, allocate that memoery and get a pointer to the start of it.

vast pier
#

#32 being for i=1,x:size() do

silent zealot
#

Want to get Array element X? its at <array adress> + <datasize> * X

quasi geode
vast pier
#

Ah, thanks

silent zealot
#

Want to forget how big your array is, write to element 123 in an array that only has space for 100 elements and randomly overwrite something elsE? Sure! You can do that!

#

But starting at zero is how you made <array adress> + <datasize> * X start at the begnning of the reserved memory

humble sluice
#

Hello! I have a question, is there any guide to make a vehicle mod support indoor RV, I'm trying to do it but I can't.

silent zealot
#

B42: wait for RV Interiors to be updated.

#

you can link your vehicle to an existing interior design, if you want to make your own custom interior hopefully the rv interiors mod includes some instructions; you'll have to make a map of interiors with some special considerations.

humble sluice
silent zealot
#

How did you link the interior

#

and what is the error

#

Also, I asusme you are on B41?

humble sluice
humble sluice
silent zealot
#
function GabAddRVInteriors()
    if getActivatedMods():contains("RV_Interior_MP") then
        Print("Mod RV_Interior_MP is enabled")
    else
        Print("ERROR! Mod RV_Interior_MP is not enabled! Enable the RV Interior mod to prevent the LUA error that is about to occcur..." )
    end
    RVInterior.shareInterior("Base.86bounder","Base.GabVehicle")


Events.OnGameStart.Add(GabAddRVInteriors)```
#

I think that's all the code you need

humble sluice
silent zealot
#

(replace "Base.GabVehicle" with whataver yourvehicle name is)

#

(and you can use a different interior, but I thin 86 bounder is the nice RV interior)

humble sluice
#

Got it, thanks!

storm trench
#

I just want to be done porting and working on this stupid freaking mod T_T

distant inlet
#

I have an interesting problem - check4 and check5 in the code below are nil

local check1 = nonFloorContainerSq ~= playerSq
local check2 = playerSq ~= nil
local check3 = playerSq:canReachTo(nonFloorContainerSq) == false
local check4 = nonFloorContainerSq ~= playerSq and playerSq ~= nil and
        playerSq:canReachTo(nonFloorContainerSq) == false
local check5 = check1 and check2 and check3

but check1, check2, check3 are each true

bright fog
#

That's fine, because nil is falsy

#

So if you simply do a check for falsy that's okay

#

For check5 I'm not sure

#

It should be true if all the three checks are true

#

What are you trying to achieve exactly here ? Because that's quite an unusual way of doing checks

distant inlet
#

this is testing/debug code for an if-statement that isn't evaluating to true so its body never executes. The statement is basically expressed in check4 or by check5

#

I'm trying to check if the player is near enough (and not blocked by obstacles like walls) to a container to access its inventory

#

the actual code is

if nonFloorContainerSq ~= playerSq and playerSq ~= nil and
        playerSq:canReachTo(nonFloorContainerSq) == false then
...
end

but the check1...5 message above expresses the head scratcher

distant inlet
vapid shore
#

Hey everyone. I have what I think is a simple question but I must not be phrasing it right to find a definitive answer online.
There's a mod I like playing with that adds new items to the game. I'm familiar with making crafting recipes for base items in the game, but I'm not positive how to make a recipe for a modded item. Do I need to like add the mod to my imports section of my recipe or can I still just reference it by name like usual?

bright fog
#

If you REALLY need a false, you can do local check1 = nonFloorContainerSq ~= playerSq or false

distant inlet
#

I guess you know they're nil if they don't appear under "LOCALS"

bright fog
#

The in-game debugger is terrible anyway lol

distant inlet
#

wait is there a better debugger??

bright fog
#

Eh no

#

But the debugger's interface is terrible anyway

#

I don't even know how to properly use it, never used it because the interface makes me want to die everytime I look at it, it's terrible to move around it

distant inlet
#

I don't disagree

crystal sigil
#

quick question: how can i get the type of a item? like weapon, container, cloth?

crystal sigil
#

that outputs me for ex. Base.Pistol

bright fog
#

that's getFullType

#

If you use getType I believe it's the one that doesn't have the module

crystal sigil
#

so its has to beitem:getFullType() and how to get the category?

bright fog
#

I'm sorry I read that wrong because you said type but type is the item ID <module>.<type> like Base.Pistol

#

Check the java doc of InventoryItem

crystal sigil
#

can you help me with an example?

distant inlet
crystal sigil
#

thats it! thanks boooooys

slim swan
#

Does Project Zomboid support 9-patch?

bright fog
slim swan
#

9-patch png texture

vapid shore
#

When making a recipe, what does the Recipe.GetItemTypes.* match in terms of an item?
Like if I wanted to make a recipe allowing for any soda(using the item below), not just a specific one, would I do Recipe.GetItemTypes.SoftDrink? Would it be Recipe.GetItemTypes.Food.SoftDrink?

item CherryCoke { DisplayName = Cherry Coke, DisplayCategory = Food, Type = Food, Weight = 0.3, Icon = CherryCoke, EvolvedRecipe = Beverage:4;Beverage2:4, FoodType = SoftDrink, CantBeFrozen = TRUE, EatType = popcan, Packaged = TRUE, ReplaceOnUse = EmptyCherryCokeCan, HungerChange = -8, ThirstChange = -60, UnhappyChange = -10, Calories = 150, Carbohydrates = 42, Lipids = 0, Proteins = 0, CustomContextMenu = Drink, CustomEatSound = DrinkingFromCan, StaticModel = CherryCokeCan, WorldStaticModel = CherryCokeCan, Tags = HasMetal, }

oblique estuary
#

So in this case that you said, it will use the "Food.SoftDrink" types

vapid shore
#

Ok, so I would but the Type.subtype to get more specific.

oblique estuary
#

If you as example have a recipe say

[Recipe.GetItemTypes.Sharpknife]

It will find all items using the tag "Sharpknife" as a possible option

#

I'm not exactly sure about the subtype, I haven't dvelved down into specifics like that my self yet, however I know I've been using the tags a lot for my own recipes

vapid shore
#

Like specifically the Tags property, or any tag applied?

oblique estuary
#

I'm not quite sure what you mean with that, but as example with the sharp knife, it will be able to add either hunting knife or kitchen knife to the recipe, but it will not find butterknife since that is a bluntknife, on the item script you need to specify the tag you want to use, or pull the tag from a different item to use that.

It's basically an easier way to put options instead of saying "Huntingknife/kitchenknife,"

#

I believe the Food.Softdrink means it will pull the foodtype instead

#

item Pop
{
DisplayName = Pop,
DisplayCategory = Food,
Type = Food,
Weight = 0.3,
Icon = Pop,
EvolvedRecipe = Beverage:4;Beverage2:4,

    _*FoodType = SoftDrink,*_

    CantBeFrozen = TRUE,
    EatType = popcan,
    Packaged = TRUE,
    ReplaceOnUse = PopEmpty,
    HungerChange = -8,
    ThirstChange = -60,
    UnhappyChange = -10,
    Calories = 140,
    Carbohydrates = 39,
    Lipids = 0,
    Proteins = 0,
    CustomContextMenu = Drink,
    CustomEatSound = DrinkingFromCan,
    StaticModel = PopCanDiet,
    WorldStaticModel = PopCanDiet,
    Tags = HasMetal,
}
vapid shore
oblique estuary
#

Hmm.. Good question. I actually do not know about that, hopefully someone else knows a little more, but it makes me wonder, are you trying to make an evolved recipe or a standard recipe?

vapid shore
#

I'm trying to make a standard recipe. I would like to say that you use any 3 SoftDrinks without individually naming them

#

recipe Mix Redbull
{
Butter/OilVegetable/OilOlive=1,
Water=3,
Soap=1,

   SkillRequired:Cooking=3,
   Result:Redbull,
   Sound:Hammering,
   Time:300.0,
   Category:SGRecipes,
   NeedToBeLearn:false,
}
#

So that's what I have now, and I wanted to add a Recipe.GetItemTypes.?? for the sodas and then = 3

oblique estuary
#

Let me get back to you, I'll try and see if I can figure it out otherwise I hope someone else with a bit more knowledge can help out here

tacit pebble
#

I really almost forgot everything about B41 however I remember there's a recipe related saw which allows multiple type of saws in vanilla recipe. (Heck Saw, Hand Saw, etc.) you can reference that.

oblique estuary
tacit pebble
#

Oh thats what you were talking about. I'm gonna turn on my laptop lol I stored B41 somewhere

vast pier
oblique estuary
#

I haven't dwelved into B42 as of yet

vast pier
# vast pier

I'm gonna be adding a few more default gun part items, but the framework majority is done I think

tacit pebble
#

lua/server/recipecode.lua

oblique estuary
# vapid shore I'm trying to make a standard recipe. I would like to say that you use any 3 Sof...

From what I can see it only works with the specific tags, as example oil

item OilOlive
{
    DisplayName = Olive Oil,
    DisplayCategory = Food,
    Type = Food,
    Weight = 0.2,
    Icon = OilOlive,
    CantBeFrozen = TRUE,
    EvolvedRecipe = Pizza:5;Sandwich:2;Sandwich Baguette:2;Burger:2;RicePot:2;RicePan:2;PastaPot:2;PastaPan:2;Stir fry Griddle Pan:2;Stir fry:2;Salad:2;Roasted Vegetables:2;Taco:2;Burrito:2;Soup:2;Stew:2,
    Packaged = TRUE,
    Spice = true,
    HungerChange = -30,
    UnhappyChange = 50,
    Calories = 2480,
    Carbohydrates = 0,
    Lipids = 150,
    Proteins = 0,
    WorldStaticModel = OilOlive_Ground,
    Tags = BakingFat;Oil,
    FoodType = Oil,
}

Even if the FoodType = Oil, it only counts the Tags
I can't seem to find a way around it easily, my best suggestion would be to add a tag to the softdrinks you want to be able to add or add them manualy

vapid shore
# tacit pebble lua/server/recipecode.lua

So that has specific functions in it like:

function Recipe.GetItemTypes.Rice(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("RiceRecipe"))
end

And that makes me wonder if there would need to be a function created to do a Recipe.GetItemTypes.Food.SoftDrink

oblique estuary
vapid shore
oblique estuary
# vapid shore So with that said, you mean specifically the Tags= part of the item.

Yeah, it specifically takes the tags and counts on it from there, on the softdrinks we had it says "HasMetal" but that's more for microwaves, I believe if you made your own function that would be the best way around it, the alternative is to add tags to the softdrinks you want to be able to add, or specifically write them with a "/" between each type of softdrink you want to be able to add

#

You could also make an evolved recipe, however I'm not sure how that would mount out in the end with the rebulls stats as the evolved recipes mix their stats.. And you'd have to add the evolved recipe to the individual items anyway

vapid shore
#

This was really good info! Thanks Foxy and fish

oblique estuary
#

Yeah, but it also depends if you plan to use the same thing later, because if you want to use it later the function is deffinately the way around it

oblique estuary
vapid shore
#

It does look like there's a cool example with the digitalwatch
function Recipe.GetItemTypes.DismantleDigitalWatch(scriptItems) local allScriptItems = getScriptManager():getAllItems(); for i=1,allScriptItems:size() do local scriptItem = allScriptItems:get(i-1); if (scriptItem:getType() == Type.AlarmClockClothing) and string.contains(scriptItem:getName(), "Digital") then scriptItems:add(scriptItem); end end end

#

Granted, that's using string for the second part.

tacit pebble
# vapid shore I mean that there is a property on the item called Tags(green). Are all the blue...

I'm sleepy so i might be wrong tho

function Recipe.GetItemTypes.SoftDrink_SpaceGhost(scriptItems)
-- I assumed scriptItems is arrayList of Item instance

  local items = getScriptManager():getItemsTag("SpaceGhost") -- get ALl items have "SpaceGhost" tag. if you dont wanna use tag then need something else
  for i = 0, items:size() - 1 do -- we find specific eat type from all items we just called
    local item = items:get(i)
    if item:getEatType() == "popcan" then -- if an item has popcan eat type then
      scriptItems:add(item)    -- add the item in the list
    end
  end
end

tbh, i don't really make mods related recipe so.. everything has written from guessing.

storm trench
#

I'm so tired of trying to fix this freaking mod to port it. Literally, this is in the console.txt - the original mods freaking mesh's don't even exist:

WARN : Script       f:0, t:1740855125194> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cartWithBaggage" for Base.TrolleyModelFull
WARN : Script       f:0, t:1740855125194> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart" for Base.TrolleyModel
WARN : Script       f:0, t:1740855125194> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart" for Base.TrolleyModel
WARN : Script       f:0, t:1740855125194> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart02WithBaggage" for Base.CartModelFull
WARN : Script       f:0, t:1740855125194> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart02WithBaggage" for Base.CartModelFull
WARN : Script       f:0, t:1740855125195> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart02" for Base.CartModel
WARN : Script       f:0, t:1740855125195> ModelScript.checkMesh               > no such mesh "weapons/2handed/trolley|cart02" for Base.CartModel```
vapid shore
vast pier
#

Is there a way to return a boolean on if an itemtype exists?

#

like lua if "Module.Item" then

eternal tiger
#

Could you use OnItemFound?

vast pier
#

Albion helped me

storm trench
#

I love having to delete out 800mb in debug saves a day.

vast pier
#

Anything ever come of this?

random finch
#

When is it worth writing getters rather than pulling from the table directly? I can understand why the API does it, but more so wondering why a mod would do this.

bronze yoke
#

this is something people have strong opinions about

#

performance wise, it is horrifically more expensive to have a getter

#

in most cases, i do not like getters for style reasons too

#

the reason you might want to write a getter is if either for some reason you do need to do something more complex than 'return the value' or you expect the functionality could change in the future

#

in java it's conventional to have a setter and getter for literally everything (and the cost of calling them is nowhere near as bad as it is in lua either) so the vanilla lua written by java devs is very often going to do that

#

in languages with visibility models getters can also make a lot of sense to implement a 'read only' value but we don't have that in lua anyway

#

in my view, most changes on that level are going to break compatibility anyway, so i don't bother with them in all but very specific circumstances

#

i suspect some mods just use them because it makes them feel professional 😅 or because they mostly copy the style of vanilla anyway

random finch
#

Interesting, did not know it was conventional in Java. In Zomboid thought it was more so to control visibly to lua.

storm trench
#

Alrighty. If anyone wants to take over the ZuperCarts port to B42, be my guest. The stable B42 port with minor issues is listed on the workshop. I tried implementing a dynamic spawning system; it works flawlessly, but it breaks the pretty shoddily put-together animation codes, item definitions, and equipping animations. I have tried everything to fix it, but to no avail. The original files and code aren't that great to begin with (iBrRus somehow has code linking to stuff that doesn't exist and it works). So, I don't have a solution, and I've wasted every non-working waking moment on this for the last 6 days (and I've worked on this while working my job too). I've even put in 40 hours on PZ just debugging for 10-15 minutes at a time. I miss having fun. If anyone has any questions about it I'd be happy to answer, but nothing about this mod makes a modicum of sense to me because the foundation is just too much of a mess for me.

random finch
#

Did you manage to fix the duping that happened in B41 version?

#

nvm

#

MP not out yet for B42 lol

storm trench
#

...I thought I read he took care of that. Or at least thought he did.

#

Unless this means something else.

2023-03-17

Мамкины хакеры не спят. Мамкины хакеры знали еще один способ дюпа. Этот способ заблокирован.

Mother'hackers don't sleep. Mother'hackers knew another way to dup. This way is blocked.```
#

In theory, though, my new dynamic spawn system should've. It changed the way trollies/carts were dropped by players. I even added a whole new .lua for dropping carts specifically.

#

But since implementing the new system, I've been stuck with the equipped carts being like this. And not using the original animations at all. No matter what. I tried everything.

random finch
#

In that case it may have had something todo with players grabbing it at the same time.

I was duping more recently on servers by accident. I would leave the cart on the ground after loading it with items - pick it up, unload and throw the trolley in a container. Then would get a disconnect due to my ISP being bad, then come back to the trolly being on the ground full of the items - at the same time the items would be in the container I unloaded to before the disconnect.

bronze yoke
#

i'm not sure how you were doing it before, but people were having a lot of trouble overriding animations in b42 and i recently found the solution

#

adding <m_ConditionPriority>10</m_ConditionPriority> to the animation's xml file allows it to take priority over vanilla animations (instead of the vanilla animation taking priority even when your custom one is triggered)

#

but if it was working previously it may not be the issue

storm trench
storm trench
bronze yoke
#

not having this may have caused that

vocal vector
#

confused about trying to teleport player in b42

#

i have this:

                    player:setX(tx)
                    player:setY(ty)
                    player:setZ(0)
                    player:setLastX(tx)
                    player:setLastY(ty)
                    player:setLastZ(0)```
and the print shows the variables are properly defined, but nothing happens
#

any help appreciated 🙂

bright fog
#

I think there's something to do with anti cheats

#

Like you can't tp without debug mode or some shit like that

#

And yes, even in SP bcs of how they wrote the code tired

vocal vector
#

you are shitting on my face

#

hang on, i am in debug mode

#

and it still doesn't work 🙃

storm trench
# bronze yoke not having this may have caused that

Well, now I'm very underwhelmed. For the most part, it didn't fix anything. I even used the copilot AI in VS Code to manually check every XML file (and there's a lot) that I didn't mess it up or miss any... and I didn't... and I still have the animation issue. Sighhh. (And this is using the published semi-stable workshop version only; none of my dynamic spawn code or any other edits. Such a bummer).

queen oasis
queen oasis
storm trench
# queen oasis is it just the equipped animations that are broken?

There's other relatively minor issues, but it's a pretty jarring animation issue. Every time the player switches from idle to moving, except when crouched, the trolley/cart animation flips the cart like the player is trying to put a weapon at their side, and then the mod animation kicks in moments after and works correctly. It also happens on equipping the trolley. But the more I fix other issues, the less likely the animations are to work. It's insanity sometimes. Every time I make progress on one thing, the animations break. If I didn't know better I'd say iBrRus somehow designed this mod with something only they know how to fix so that someone else can't port the mod correctly.

vocal vector
#

ok i figured it out

#
                    player:setY(ty)
                    player:setZ(0)
                    player:setLastX(tx)
                    player:setLastY(ty)
                    player:setLastZ(0)
                    getWorld():update()```
#

works in debug mode at least

bronze yoke
#

that's weird, that's the exact kind of thing conditionpriority was fixing for many people

queen oasis
storm trench
# queen oasis maybe it's missing a transition? I haven't messed with animations in 42 yet. You...

Yeah, maybe... I dunno. Either way I'm pretty sure I give up now. At least there's a usable (albeit finicky) item to more efficiently loot / haul heavy things around with. There's still other crazy freaking weird issues, like setting the capacity of the container to 49 but it's glitched at 27 or 37 (it changes on its own all the time). Another is if you have a primary attached you have to put it away, otherwise the cart will equip in your inventory for 3 encumbrance (but free weight because of the 100% reduction) until you go into your main character inventory and click-drag it to the ground.

I just feel it's getting to be more trouble than it's worth. Maybe I'll go trying to do my own thing. It's such a shame, I am pretty freaking proud of my dynamic spawn system lolll.

vocal vector
#

tested out of debug mode too and working

fleet bridge
brave bone
#

this 3D model almost broke me.. the issue was this.. a missing "S"

#

now i have a gigantic collapsible ladder out there..

queen oasis
brave bone
queen oasis
drifting ore
#

Right next to the bottle of lotion

queen oasis
queen oasis
#

it's cannabolish because reasons

storm trench
queen oasis
storm trench
queen oasis
#

I'll have a look. I'm kinda tired messing with what I've been messing with.

storm trench
#

Fresh eyes will probably help. Like I said earlier, feel free. I had it ported in an afternoon and have been through countless hours since trying to fix it and also improve it. But alas I failed, ha.

#

I was so sure when I nailed the dynamic spawning without causing much overhead that it would be downhill from there, but as soon as I tried equipping that first cart/trolley it was all downhill from there hahaa.

queen oasis
brave bone
storm trench
plush wraith
queen oasis
# storm trench Nope, that's new.

in ISTakeTrolley, comment out ln 35 and change it to:

createItemTransaction(self.character, self.item:getItem(), self.item:getItem():getContainer(), self.destContainer)

comment ln 69 and change to

if isItemTransactionConsistent(self.item:getItem(), self.item:getItem():getContainer(), self.destContainer, nil) then
  removeItemTransaction(self.transactionID, true)

and then in new, add

o.transactionID = 0
#

that will fix a bunch of errors

storm trench
maiden thistle
#

Is the og mod weird
yes
Was I bored
also yes
Do I regret it
Still yes

queen oasis
storm trench
#

Sooo I made those changes you suggested and now the animation is broken for me catlul I need to step away from this port before I take a bat to my computer hahaa...

cinder nebula
queen oasis
#

not sure if anyone figured out a capacity workaround yet. might see if the trolleys can be a vehicle trunk instead 🙂
the sweet cart flip is because of the way it's attached to the hand. might need to detach it before "grabbing" it
I'd still like to check on the momentum when you come to a stop, maybe change the anim to bend the hip a little so the feet are digging in to the ground

simple helm
#

any vehicle modders willing to help me out ?

queen oasis
storm trench
silent zealot
silent zealot
simple helm
#

if i go off of someone elses trailer mod can I basically just copy what they have if im adding a car carrier just change the names ?

silent zealot
simple helm
#

I believe i did most things right but bascially need a second pair of eyes to tell me what i am doing wrong

silent zealot
#

Using code from an existing mod as the base for your mod is the traditional way to get started, especially for stuff like vehicle templates (and there are also the vanilla trailers to look at) - just give credit to them somewhere if their code is helpful, even if it's only as a comment in your code for minor things.

#

Is this for the "put other vehicle on trailer" part or the gneral "make a trailer" part?

simple helm
#

yea, but right now im just trying to get it in game, but im also going off of the mod that lets you add cars on trailers,

#

also i just tried putting it in game and the mod is red

silent zealot
#

On the mod selections screen?

simple helm
#

yes

silent zealot
#

Is there a dependency you don't have?

simple helm
silent zealot
#

If it's not that, give us a screenshot of the mod selection screen and teh text of your mod.info.

#

Also, B41 or B42?

simple helm
#

is it bc i have require=

#

and for b41

silent zealot
simple helm
#

also i went through multiple mods, not sure where someone would put it for a certain version

silent zealot
#

any hints on the right side of the mod interface?

brave bone
#

can we move the position of an items attached to a belt? if yes, where can I find those values?

simple helm
#

nope, me deleting require= actually took it out of the mods

silent zealot
simple helm
#

so if i did a require= Autotsar Trailers - Hauler

is that how i would insert it ^

silent zealot
#

You use the mod id, not the mod name

simple helm
#

ahh okay thanks for that

silent zealot
#
poster=poster.png
id=NepUniversalRVInteriors
description=This mod allows you to add any RV interior to any vehicle without one.
require=RV_Interior_MP,

simple helm
#

it worked

#

showing white now

silent zealot
#

Hooray! The parser in this game is often janky, especially the mod.info parser.

#

Things that should trigger error messages just... break stuff.

queen oasis