#mod_development

1 messages · Page 323 of 1

hexed stirrup
#

what im loving about this game is that the file structure is easy to understand like im just looking at the game files and replicating what i see adn for the most part its working

#

also is it called preview.png in b42? its called thumb.png for me

thick bobcat
#

But you have done ✨ Something ✨

hexed stirrup
#

Its only showing up in the solo menu

#

I cant select it as a spawn location in my server

#

It doesnt show up

#

I hosting from ingame

#

how do i make it available on the server too?

hexed stirrup
#

Ah nvm my bad

#

I forgot to add it in the server settings

topaz tangle
topaz tangle
#

perchance does anyone here know how to add a third tow attachment point to a vehicle? i tried just adding a new one but that didnt work

main pasture
#

It should work the same way. You just have to ensure the trailer has the correct canAttach (normally just "trailer"), so it can actually use the attachment

topaz tangle
main pasture
#

I think every vehicle would need to have the canAttach configured to be able to connect to it. Did you check the trailer connects when the attachment has the standard name?

#

I had hard time trying to connect a semi trailer I was trying to make, even when it "worked"

topaz tangle
topaz tangle
main pasture
topaz tangle
#

doesnt seam to have worked

currently looks like this
truck
attachment TrailerTruck
{
offset = 0.0000 -0.2747 -1.1703,
rotate = 0.0000 0.0000 0.0000,
zoffset = -1.0000,

trailer
attachment trailer
{
offset = 0.0000 -0.0549 1.0110,
rotate = 0.0000 0.0000 0.0000,
canAttach = TrailerTruck,
}

clever quarry
#

My life would be so much simpler if there was an event on the server that did this, but now I need to implement a filter for /whisper and some Sanbox settings.

clever quarry
#

remember to always test your code

frank elbow
#

I have some other points of feedback if you're interested, but holding off unless you indicate that you are to not be rude

clever quarry
#

but know that I don't know lua very well, I write C and ASM

frank elbow
#

Gotcha, all good. The main thing: you should prefix your variables with the local keyword—this makes the variables local to their scope. The default is global, so everything you defined there will be polluting the global scope

clever quarry
#

@frank elbow any more tips?

frank elbow
# clever quarry <@288127781383045121> any more tips?

Looks good to me. I'd probably extract it to a function on a table returned from the module just in case someone else wants to override it for mod compatibility reasons, but for logging messages idk how likely that'd be

#

What I mean by that, if you do end up wanting to do that:


local YourModName = {}

function YourModName.OnAddMessage(message, tabId)
  -- ...
end

Events.OnAddMessage.Add(YourModName.OnAddMessage)
return YourModName
#

(the return with access to the function is so someone can remove your listener & replace it if they so desire)

clever quarry
lavish zenith
#

When I test this recipe in game, it makes 250 nails. What am I missing?
recipe Carve Wooden Pegs
{
Log,
keep [Recipe.GetItemTypes.SharpKnife]/MeatCleaver/SharpedStone,
Result : Nails=50,
Time : 1000,
Category : Carpentry,
CanBeDoneFromFloor : True,
Sound : Sawing,
AnimNode : SawLog,
Prop1 : Hacksaw,
Prop2: Log,
OnGiveXP : Recipe.OnGiveXP.SawLogs,
}

#

Nevermind, I think I see it. this is from base
recipe Open Box of Nails
{
NailsBox,

Result:Nails=20,
Sound:PutItemInBag,
Time:5.0,

}

silent zealot
#

Good thing the Australian game rating is based on Vanilla and not modded gameplay.

mellow frigate
silent zealot
#

A strain of Marijuana, apparently,

brave bone
#

I love my AK-47 sealed, ready to pewpew..

silent zealot
#

Also a very good example of why you need to use unique names for items if they are in the Base namespace when Rain's Gun mod and this drug mod both added Base.AK47

lament zodiac
#

does anyone know why my custom clothes are crunchy? XD

lament zodiac
#

if anyone has exported .fbx clothes for project zomboid before, may i request a quick walk through on how to do it? im not sure whats going on.

tranquil kindle
#

Oh now I see... It's hard to notice on phone

lament zodiac
# tranquil kindle What do you mean by that?

yeah for some reson its bugging out when i try to load them in game, but they look okay in blender. ive tried exporting the clothing as .FBX and .X and neither work. X files are invisible, FBX are crunchy

tranquil kindle
#

Or at all.

tranquil kindle
# lament zodiac

Did you parent then to armature and weight paint parts to corresponding bones for it to move with character?

#

It looks oddly similar to vanilla player model that has been modified. If that's the case you do need to check if every part of model has at least one bone affecting it. If there is a part that's not weighted it will act like on picture you've send

lament zodiac
tranquil kindle
hasty hill
#

I would assign vertexes instead of painting

#

It is less messy

hasty hill
#

how big is your texture?

lament zodiac
#

512

#

its something to do with the mesh.

#

but idk what

#

like it crunches and spazes out in game

tranquil kindle
lament zodiac
#

its fine in blender...

lament zodiac
tranquil kindle
#

But are the bones named correctly to those from vanilla?

lament zodiac
tranquil kindle
#

I have one more thought but as I said I'd need to see your clothing item XML file

lament zodiac
#

okay so i think it might be that im exporting it wrong? because of how its fine and following the skeleton on blender but buggy in game. i had this issue on another platform and it was an export issue, so im trying to figure out whats going on. and this for now is a direct replacement of another clothing object. i do not understand XML so i am not touching that file.

tranquil kindle
#

Can you show whole blender window opened with everything?

lament zodiac
lament zodiac
tranquil kindle
lament zodiac
lament zodiac
#

im not a maya user

#

im basically just doing a reskin of some of the primative survival mods as a placeholder for when a friend of mine finishes his mod.

#

but ill convert it to the blender file you linked and try it

tranquil kindle
#

Everything or?

lament zodiac
tranquil kindle
#

I was wondering why your files were so small in terms of size

lament zodiac
#

okay fair... translation data... gotta figure out what that means

lament zodiac
tranquil kindle
#

Let's just say that Translation Data MUST be there when you have weighted model

#

It makes character move, so probably clothes

#

I don't know exacly how it works.

lament zodiac
#

yeah the game i made for previously only has you exporting the clothing and nothing else. not sure if there ever was, im guessing so, i never touched it

tranquil kindle
#

For animations its required to be moved when you want to make character's animation move actuall character

lament zodiac
tranquil kindle
# lament zodiac that is fair. im self taught so i have blanks in my knowledge LOL so thank you. ...

#modeling message I can suggest using this. I've made it some time ago. I know it has some "duplicated" bones, but i've been using it so far and had no issues. You can always just delete duplicated ones. It has Both characters on same armature, aswell as female player model positoned pretty much 1 to 1 as ingame character. When using other's files i had issues when i made Jackets and such that arms were not in same positions when imported to game. It turned out that when i made clothing item of that model and equiped it, arms and some other parts were not perfectly placed, making clothing models out of it troublesome as you had to tweak them after.

lament zodiac
#

THANK YOU

tranquil kindle
#

I on the other hand rely mostly on software for textures. Substance painter my beloved

#

Yay!

lament zodiac
lament zodiac
tranquil kindle
#

You don't owe anything. We're modders and were here to help eachother.

#

"Double it and give it to the next person"

lament zodiac
ancient grail
ancient grail
#

o wait youre talking about clothing mod

damn i need to sleep

lament zodiac
winter bolt
#

if you have a hat or something you can just delete everything except the head bone to lower the file size

topaz tangle
#

anyone know why thistexture thing is happening?
working on the b42 port of my mod, i know its the overlay textures but not sure why

hybrid edge
#

Hi everyone, I'm looking to make a small mod that changes the flag of a certain item. Specifically I'm trying to add the RepairWithEpoxy flag to the Metal Baseball Bat with Sawblade. How does one create a mod for this?

storm trench
#

If there's one thing I hope AI figures out, it's how to be more of an "automatic photoshop". Reskinning stuff this way gets old. Unless anyone else knows of a better way than manually...?

topaz tangle
#

Use paint.net
It’s what I use for all my re-skinning

#

Just, fill tool

bright fog
storm trench
storm trench
#

I'm just saying it would be nice if I could just tell an AI "hey, turn this red" and it will do so with minimal input. I just don't like photoshopping hahaa.

nimble yew
#

I can't find references to how to know if a square has power and how to "register" usage of power. Does anyone know?

topaz tangle
#

Takes longer to ask something to turn something red then it takes to use a fill tool

nimble yew
#

also, can I suscribe to an event conditionally like

if SandboxVars.FunctionalCarLift.ConvertVanilla or SandboxVars.FunctionalCarlift.RevertVanilla then Events.LoadGridsquare.Add(functionalCarLift_OnLoadGridSquare) end
main pasture
storm trench
topaz tangle
#

Turn the tolerance to zero

storm trench
#

I'll "outline" an area so the fill tool doesn't mess it up, but that's about it.

storm trench
storm trench
tranquil kindle
#

Can't you like select by color then colorize it?

#

Though im not sure what software it is. I use gimp, but im also lazy so i usually screnshot my models and make it an icon

main pasture
topaz tangle
storm trench
#

It's alrighty, I'll just keep doing it the way I was doing it. Grayscale turned out kinda... meh... and it's really not a huge deal, I was more or less expressing that it would be really cool if AI could handle something tedious like this in the future (it can't, I've tried, it doesn't understand the image is a UV map or icon or anything like that. It'll mess it up one way or another and isn't worth the hassle).

topaz tangle
#

But, why ask an ai do do something that take like thirty seconds?
It just doesn’t make any sense

#

If if you can’t do it in photoshop, only takes a few seconds to load up another program where you can do it

storm trench
#

I'm just gonna drop it because we're not talking on the same wavelength here.

bright fog
storm trench
# bright fog I mean you asked if anyone had a better way than manually and I asked what you w...

Because there really is no other solution. That's why I brought up how nice it would be to have something like that. I can't really "simply" do any of it; so I ask again, won't that be nice when AI gets to the point where it can 'photoshop' anything automatically? I could just say "hey, turn this cart red" and it would change everything to the color shade equivalent on its own (and probably be able to ignore the boxes).

nimble yew
#

for me, short answer is "it would be nice". the long answer questions the impact on human stupidity in the near and not so near future...

nimble yew
#

on a question of my own, I'm having issues creating an object with a specific sprite.

The reference of IsoObject constructor goes something like this IsoObject(IsoGridSquare square, String tile), but I'm not getting the result I'm looking for when executing this:

if spriteName == "location_business_machinery_01_11" then
      -- column W
      print("[FunctionalCarLift] Replacing car lift tile "..spriteName.." with car_lift_01_0 at X="..square:getX()..", Y="..square:getY())
      square:RemoveTileObject(obj)
      square:AddTileObject(IsoObject.new(square, "car_lift_01_0"))
end
#

basically, I'm not getting the sprite rendered on the map. Instead, when debugging the map I see an "empty" object with no name and no sprite

#

and this is what I'm looking for

nimble yew
#

nvm, found the isoObject:setSpriteFromName() and skipped removing the undesired object and reusing it:

if spriteName == "location_business_machinery_01_11" then
      -- column W
      print("[FunctionalCarLift] Replacing car lift tile "..spriteName.." with car_lift_01_0 at X="..square:getX()..", Y="..square:getY())
      obj:setSpriteFromName("car_lift_01_0")
end
nimble yew
#

I don't know why it didn't work before... I just grep'd the vanilla lua folder and found tons of identical references 😦

#

./client/DebugUIs/Scenarios/Trailer2Scenario.lua: sq:AddTileObject(IsoObject.new(sq, "overlay_blood_wall_01_3"));

ancient grail
#

is there a way to determine if the contextmenu is open?

ancient grail
nimble yew
silent zealot
#

Most vanilla stuff only considers outside tiles to have power when the electicity is on if they are inside.

#

As for registering with a generator... pretty sure you're out of luck if it does not already work, it happens in IsoGenerator.Update() and is hardcoded on object type.

nimble yew
#

oh, so I won't be able to register a power consumption from the Car Lift. The tiles are simple IsoObjects. I will still be able to check for power availability at least

#

you got me confused with the inside/outside thing. Should it matter? I mean:

if getWorld():isHydroPowerOn() or square:haveElectricity() then doSomethingOrNot() end
ancient grail
nimble yew
#

I don't exactly know where this is running. I read somewhere that it depends from where it's called, not on the folder is placed on. It's executed on this subscribed event Events.LoadGridsquare.Add(functionalCarLift_OnLoadGridSquare)

#

At this moment I'm trying on SP and I'm still having issues with tiles, but I think isServer() and isClient() both return false on SP. I guess I don't need to sync on SP

topaz tangle
#

updated version of all the "all of it" reference template since it got changed in b 41

#

better color choice

slender thistle
#

does anyone know if tilezed has been updated for b42? I am thinking of maybe trying to make a custom map but I dont wanna go through the whole thing if it turns out it doesnt work anymore or whatever

nimble yew
slender thistle
#

didnt know that was a channel, ty

nimble yew
#

they helped me a lot when dealing with TileZed and its convoluted tile properties

bright fog
ocean crow
#

Hello chat,I need someone who knows how to use the debug mod, and who can tell me how to change the configuration of my game, I want to change from rainy to normal.

ancient grail
ocean crow
#

Yo chat,The "better fps" mod It doesn't work anymore for this update, and I really need it, can someone make a patch?

tranquil kindle
#

Have you done it AFTER it updated?

ocean crow
ocean crow
#

You're going to fix it ?

ocean crow
bright fog
ocean crow
#

The better fps mod..

bright fog
#

You think modders here are your slaves or what ? You think every modders will fix every mods out there ?

ocean crow
#

Can i make it work? Bc in new update not working

#

I don't want it to be an discussion or am I obligated to, I'm asking you, if you can't, thank you and have a nice day.

bright fog
#

Like any other mod, just wait

ocean crow
#

It's incredible how someone can take something like that so badly.

bright fog
#

You're coming here thinking modders will do it for you ?

ocean crow
bright fog
#

Have a bit of respect for modders ?

#

Just wait for the modder to update

#

Accept the fact java mods need to be updated every game patch

#

Your save will work fine without the mod anyway

ocean crow
#

👀I guess you're having a bad day for being so aggressive.

bright fog
ocean crow
#

Bye. If anyone could make a patch I would appreciate it.

bright fog
ocean crow
#

Ignoring is the best option

icy night
#

Lol what

ancient grail
#

i have no words

terse charm
#

I'm only here for 20 hours now, but I think everyone would appreciate it to have this channel for development instead of personal conversation.
(In my opinion blaze was just very direct but not aggressive or disrespectful. Just not very polite. )
But anyway, would love to have this thread here to scroll through some useful information 🙂

ancient grail
#

try the mod resource and mod tool threads

terse charm
#

Useful in that way, that here we can talk about mod development, issues, fixes & solutions 🙂

ancient grail
#

well thats the point of this main channel

#

what you just witness rarely happens here

thats for the #mod_support
non modders who needs help from modder i guess

ancient grail
#

you can also just spawn the item using debug console

terse charm
#

yeah, found it out myself already.
Finished my first mod tonight

#

Thank you !
Very surprised of this big Zomboid-Modding-Community!

topaz tangle
#

yeah the modding community hjere is huge, mostly because of how intergrated modding is in game

bright fog
summer sequoia
#

Hi guys, new aspiring mod creator here (mainly focused on QoL enhancements and not actual gameplay), I started yesterday and was realizing some things but wanted to confirm. I have questions around I/O.

Is it actually true that getFileReader is protected only to have access to the Zomboid/Lua folder? but not Zomboid root? I noticed this behavior when trying to access files console logs at the root directory (Zomboid/coop-console.txt and Zomboid/console.txt).

The filepath resolves, but throws an IOException if I try to read nil. I'm trying to figure out if this is because I indeed cannot access these files or if it's because LoggerManager.class is recreating these files and so at time of read it's technically not available to find yet (though, I have tried Events.OnTick.Add and delay() but looks like the engine doesn't like that, which makes sense).

I ended up finding this: https://theindiestone.com/forums/index.php?/topic/6111-lua-file-io/

I'm trying something like this: local filePath = Core.getMyDocumentFolder() .. getFileSeparator() .. "coop-console.txt"

local reader = getFileReader(filePath, false)

#

I am able to read in Zomboid/Lua, so my thinking is that we indeed are protected against Zomboidroot. If so then how can I actually read console.txt and coop-console.txt. I was thinking maybe creating a new LoggerManager instance and logging to Lua, but I'm worried about reducing performance for players by duplicating files just to Read.

soft temple
#

My brain thought that functional stovetops would be easy af to mod in. turns out I should spend some time learning lua first. I was thinking oh i'll just hook into the ovens code and just run it on the outside, nope. time to simulate every facet of the oven. T.T;

thin swan
soft temple
#

tbh, that seems to be PZ in a nutshell. if it looks easy, it's not.

nimble yew
whole vessel
#

can anyone explain to me why there is a discrepancy between ingame info and source code here?

#

ok on second glance, every plant is 1 number staggered in terms of months to their real life month

nimble yew
#

looks like january would be 0, right?

thin swan
#

Feels weird that sowMonth and bestMonth would be 0-indexed but not badMonth (since it has 12)

whole vessel
#

it seems like it goes from 1 to 12

#

except 1 is december

thin swan
#

lmao, so 12 is january?

#

or 2 is jan?

whole vessel
#

12 is january, 1 is feb, 2 is march, 3 is april

#

so I got it wrong

#

1 is feb not dec

thin swan
#

Jesus christ, that is a mindfuck

nimble yew
#

should I back up my saves if I want to switch to B42 for porting and testing my mod?

#

or I can just leave them be if I'm not using them?

thin swan
nimble yew
#

thanks, I was looking for this kind of guides

queen oasis
#

the best issues

bronze yoke
summer sequoia
#

Anyone know of a way to intercept what LoggerManager is streaming at least? D:

topaz tangle
#

anyone have any idea why this is happening?

bronze yoke
#

that function doesn't exist for lua usage

flat bluff
#

Would someone kindly tell me how to give 2 items from a single recipe result?
I am looking for an example in the game's recipes but can't find any.

nimble yew
bronze yoke
#

which build? build 41?

flat bluff
#

b41, apologies.

bronze yoke
#

yeah, you need an oncreate function to add the extra item(s)

flat bluff
#

Thanks both of you <3.
Going to search here, didn't occurr to me because tired as hell.

soft temple
delicate solar
#

hello guys, can i ask a question about zombies spawn control ? (WorldEd:ZombiesType/ZombiesZoneDefinition.lua)

safe lagoon
#

so how does one make a mod to make something normally uncraftable craftable

in this case my intent is to make pasta with Flour and eggs.

thin swan
thin swan
delicate solar
#

i try to define specific zones in my map, ZombiesType zones in WorldEd refer to white pixels in map_ZombiesSpawnMap.bmp
ZombiesType names refers to ZombiesZoneDefinition specitfication, where i try to force zombies only with my defined outfit.
i can spawn zombies with outfit, but i always see other random zombies. And i don't understand why.
ZombiesType zone cover white zone in BMP file.
i use mandatory=true with ToSpawn=15 for example, or chance=100 but random zombies stil spawn with mine

#

is there a vanilla force chance random zombies ?

#

ZombiesZoneDefinition.ZoneGardes2 = {
chanceToSpawn=100,
ZekeGardes2 = {
toSpawn=15,
gender="male",
mandatory="true",
name="ZekeGardes",
},
};

safe lagoon
#

NGL i jsut copied the "make bread dough" recipe to a new file in notepad plus and made some adjustments to it

bright fog
#

That works too

safe lagoon
#
    {
        timedAction = MixingBowl,
        Time = 50,
        NeedToBeLearn = True,
        category = Cooking,
        Tags = AnySurfaceCraft;Cooking,
        xpAward = Cooking:10,
        AutoLearnAny = Cooking:7,
        inputs
        {
            item 1 tags[MixingUtensil] mode:keep flags[MayDegradeLight],
            item 1 [Base.Bowl;Base.ClayBowl] mode:keep,
            item 1 [Base.RollingPin] mode:keep flags[MayDegrade],
            item 6 tags[Flour],
            item 2 tags[Egg] flags[IsUncookedFoodItem;InheritFoodAge;ItemCount],
            item 1 tags[DullKnife;SharpKnife;MeatCleaver] mode:keep flags[MayDegradeLight],
            item 1 [*],
            -fluid 1.0 [Water],
        }
        outputs
        {
            item 1 Base.Pasta,
        }
    }```
bright fog
#

If you ever want to modify some bits, don't hesitate to read the wiki page I sent

#

It has all the info for B42 crafts

#

Here the recipe looks good, you're not overwriting anything

safe lagoon
#

hmmm, might also have this be learnable from the "Italian Delights" magazine and/or from traits

bright fog
#

You'll have to check recipes that do that then, I'm not sure how to make a recipe learnable from magazines

safe lagoon
#

seems simple enough, though how to make it compatible with anything else that modifies those is probably a bit much for now

#

i think i'll just have "need to be learn = False" for now

or maybe "autolearnany = Cooking: 1"

#

or both

bright fog
#

I don't see any incompatibly issue that could arise from your current script for the craft

safe lagoon
#

my concern was also having it change the script for the magazine and traits

bright fog
#

Like I said, no idea how these work but I doubt it'll cause much incompatibility if you do it right

#

And I'd be surprised if it required a huge amount of work to do right

safe lagoon
#

this is mainly for me right now, i will upload it to the workshop once i am sure it wokrs right and if people ask for it then i'll make it more "progressiony"

#

hmmm, where do i put the file in my game to test it?

#

i have it heer but it's not showing up in the modlist?

topaz tangle
#

make sure your file structure is correct, should go
mod name -> media -> whatever folders are relevent

also make sure you have a mod.info and preview photo in the same folder as media

#

I’ve got no clue then, sorry!!

safe lagoon
#

what i have in the Mod.info file

name=make pasta
id=make_pasta
icon=icon.png
poster=preview.png
description=make pasta using Flour and Eggs
modversion=42.7```
bronze yoke
safe lagoon
#

did catch i forgor to rename the photos in the second pictures file

bronze yoke
#

the one in the ProjectZomboid folder is fake and exists for no reason 🤷‍♀️

safe lagoon
bronze yoke
#

oh add a common folder in mods/Make Pasta/

#

it refuses to load the mod if there isnt a folder in it called common, it can just be empty though

safe lagoon
#

i was able to make 10 pastas from 1 item worth of flour babyyyy

#

which is slightly more than what you'd get out of the same flour using a make bread recipe

#

specifically 9% or 2,744 more calories

#

though accounting for the eggs it'd be 4.8% or 1,484 calories

safe lagoon
#

okay don't know what i did but i fixed it

bright fog
#

Add & at the end

bright fog
#

It'll update way later once Discord resets cache

#

That happens bcs you sent it the first time the moment your mod was hidden due to changes to description, new upload etc

safe lagoon
#

oops

#

anyway

#

enjoy for all my yeast and salt haters

#

(assuming i didn't brokes it)

queen oasis
#

just want to check - there are no issues with adding a required mod to an existing mod?

summer sequoia
#

What is the best testing flow people are using? Is it quite literally editing in VSCode and opening up the game to test every single time? Closing the game (or relaunching Lua depending on what's changing), making the code change, saving, and then reopening?

frank elbow
#

Unit tests are possible but require a lot of mocking for stuff using global game functions

summer sequoia
#

Yeah, I was trying to figure out how unit tests would be done for games (new to game modding), ty!

frank elbow
#

I use busted to write unit tests for my library mod, but idk if I'd do it for a regular mod. Doesn't seem worth the time sink imo, but it certainly has been useful for catching stuff

summer sequoia
#

In my case, I was making main menu and OptionSheets code changes, so it really meant either refreshing Lua at main menu or if the menu got hung up then close/reopening. :/

frank elbow
#

Ah, gotcha—that's unfortunate

topaz tangle
#

(persists after fixing center of mass)

blazing halo
#

Hello, I'm not sure if I'm in the right place but I have an idea for a mod but I have no experience developing mods so I am certain that I am not capable of making it yet. I am hoping someone can point me in the right direction to starting learn to do somethin like this. I want to start small so, I want to add a single throw that will takedown Zomboids, to the game initially. I have a complete vision for what I'd like the mod to look like eventually but I want to start here. Are there any resources online that I can learn from to be able to do something like this?

bright fog
#

But yea that's basically it

thin swan
thin swan
#

Has anyone played around with attaching stuff to backpacks?
I found that the bedrolls are attached by just putting
AttachmentType = Bedroll in the item script, and this can be used for any item it seems.
But what if I want the item to be attachable to both backpacks and back? So like having AttachmentType = Bedroll;Shovel
I'm thinking I could add another attachment type as modData and then hook into the context option to add my custom option.
But if there's an easier solution that would be nice

bright fog
thin swan
# bright fog You mean attachment slots that appear in your hotbar ?

Yeah, and have it visible on the backpack. If I change my weapon item script to have AttachmentType = Bedroll then it works exactly as I want. I can attach it to a backpack and when activating the hotbar slot it's equipped into my hands.
But when i don't have a backpack I want to still be able to attach it to my back

bright fog
#

No idea how that'd be doable. You can probably fuck around with hotbar stuff bjt I'm not familiar enough with it

thin swan
#

Ah okay, yeah it seems the attach submenu is created in ISHotbar.doMenuFromInventory so I'll try messing around with it when I get home

queen oasis
#

So confused. I uploaded a new version of a mod last night and checked 2 hours later before going to bed to make sure I didn't break anything and I have these comments. I've done everything I can to figure out what the issue might be. I uploaded a test mod so I can go through the upgrade path they did, which includes a new mod requirement. Everything works fine for me.

The snippet of error log shows it couldn't find a variable, which it gets from either from player mod data or, if it can't find that, it will set a default value. But none of that should cause a black screen. The B41 version didn't change a bit, only the B42 code so the mod.info's are different . The 42 version has a new mod requirement. 42 also has mod options now. Those are the only big differences.

If anyone has any ideas on what I should look for, I would be forever grateful.

https://steamcommunity.com/sharedfiles/filedetails/?id=3468612770

bright fog
#

Kind of hard to find much just from that

queen oasis
#

I know. It's works fine for me so I'm hoping someone can drop an error log. I was kind of hoping y'all be like, "you're mod info is jacked bro" or something else stupid I overlooked

elfin stump
#

Hello all I am curious if anyone has a good guide on making traits. I found this one: https://steamcommunity.com/sharedfiles/filedetails/?id=3022905387 which is great for the covering how to make the framework of them, but it does not cover how to actually have the trait do anything to the player as far as I can tell. Does anyone have that part? Or know where and how to actually modify the player stats using a trait? Thanks! 🙂

This guide will teach you the basics of how to create a custom trait and profession for Project Zomboid....

#

My approach I plan on using is to find out how to check for the trait from the API and then apply things using a function on character creation etc. I think this will work well but haven't dug into these systems yet. If there is a better way, let me know! 🙂

thin swan
# elfin stump My approach I plan on using is to find out how to check for the trait from the A...

I haven't dug very deep into it either, but I think you're on the right path. From what I gathered when I last checked the traits are basically just params that are checked before performing certain actions, as modifiers for certain stats and settings, etc.
So for example when creating the context menu option for reading, it checks if the player has the illiterate trait and disables the reading option if they do.
Or it can be used to modify the player stats. So if you know how to check if your player has your custom trait, and you know how to write the code for modifying the stat you want, then that's all you need

elfin stump
finite scroll
#

desensitized is specified as "far less prone to panic", can anyone clarify how exactly it works?

#

or at least if it's different in b42

thin swan
finite scroll
slim swan
#

Is there a way to get the untranslated item name, or to force it to return the English name?

bronze yoke
#

you can get the internal name with item:getFullType()

slim swan
#

But the same fulltype can have different names representing different items, so I need to retrieve and record that name. But after reloading the game, it can no longer recognize names in languages other than English.

#

Just like Base.PopBottle, it represents several different items — cola, orange soda, etc.

bronze yoke
#

they're the same item, they just have different fluids in them

slim swan
#

I know they’re technically the same item, but I want a more accurate way to identify them.Other than using the item name, I can't think of any other way to distinguish each item like the inventory pane does.

queen oasis
#

I'm going to preface this by saying that everything works when I run this mod. The only actual logged error that is reported is:
function: HighlightMouseSquare -- file: JB_ASSUtils.lua line # 223 and function: onTickEvent -- file: JB_ASSUtils.lua line # 135
which has to do with color, which to me doesn't make any sense because there are defaults set in case it fails:

-- fires on right-click menu
local highlightColorData = modOptions:getOption("Select_Color"):getValue()
JB_ASSUtils.highlightColorData = { red = highlightColorData.r, green = highlightColorData.g, blue = highlightColorData.b }
playerObj:getModData().highlightColorData = { red = highlightColorData.r, green = highlightColorData.g, blue = highlightColorData.b }```
```lua
-- in mod options file
local colors = { 0.2, 0.5, 0.7, 1 }
config.colorPicker = options:addColorPicker("Select_Color", getText("UI_options_JBLogging_Select_Color"), colors)```
```lua
-- how the selection utility retrieves a color
function JB_ASSUtils.GetPickedColor(playerObj)
    local highlightColorData
    if playerObj:getModData().highlightColorData then
        highlightColorData = playerObj:getModData().highlightColorData
    else
        highlightColorData = { red = 0.2, green = 0.5, blue = 0.7 }
        playerObj:getModData().highlightColorData = highlightColorData
    end
    return highlightColorData
end```
Is there something obvious I'm doing wrong here that could cause a black screen and/or the getPickedColor not to be able to get the highlightColorData?
and sorry for the wall of text.
bright fog
queen oasis
#

ooooh

bright fog
#

Normalize that anywhere you use key colors to r, g, b as it's kind of the norm, is easier to manage overall I'd say, takes less space etc

#

The game uses r, g, b, and everyone uses rgb

#

That's probably the problem here I guess

bronze yoke
#

you should define it as a type

#

---@class (exact) JB_ASSUtils.Colour : {r: number, b: number, g: number}

---@type JB_ASSUtils.Colour
local colour = {red = 0.5, green = 0.5, blue = 0.5}
-- shows warning because red, green, blue are not valid keys in JB_ASSUtils.Colour
terse charm
#

Do you guys know if theres any event called while the ingame "helicopter event" starts?
Maybe even with the location of the helicopter?

I've found out that the helicopter is an invisible physical object.
Want to play around with it, but can't find a lua-event.

bright fog
#

Have you checked the event list on the wiki ?

#

@sour island might know more as he's the creator of Expanded helicopter events

bronze yoke
#

the helicopter event is basically unmoddable

#

ehe just remakes them in lua

bright fog
#

I believe I remember a function that allows you to check if the event is started

craggy nacelle
#

Urgh, sorry for the less technical question: I got dragged in an argument on a server im playing about patch mods. There is an argument that you need the consent from the original mod author to override or remove stuff. Like for example: remove an item from the distribution table, or overriding a fix so that you cant repair an item with jsut a torch but need metal, little stuff like that.
Whats the stance on that from indi and the modders in general? I personal always thought thats ok, but i might be wrong so i wanted to ask.

terse charm
#

That would be all I need. Actually

bronze yoke
#

all you can really do is check if it's started, and either start or stop one

terse charm
#

But I think theres somewhere the helicopterfile with the code in it to spawn the helicopter.
I think I just reedit the file.

bronze yoke
#

the helicopter event isn't lua

bright fog
bronze yoke
#

but ignoring legality, most modders won't mind if you do something like that

bright fog
#

You can make an addon that overwrites one of the mod files and have the original mod be required

#

So modifying distribution can be done without any issues, just don't reupload the original mod and make it an addon to the original mod instead

#
  • what albion said
frank elbow
#

To answer the "stance on that from TIS" bit: if you're ever in doubt about that, check out the modding policy. What you described is not prohibited by that

craggy nacelle
#

So as long as i use the original mod and then write a mod addon thats ok? Thanks, that clears it up for me. Was worried i was wrong about that. And no, except from learning from other mods, i dislike stealing their stuff. Better to use the original mod and then just change the things that are are problem with a second mod. 🙂

#

Aprechiate the help and fast answer guys. Thx. 🙂

bright fog
#

Exactly, make a second mod which requires the original mod and change things there

lavish zenith
#

Speaking of patching existing mods, what's the best way to remove duplicate recipes?
It looks like they can share names, so how exactly do Obsolete:true and Override:true work?

bronze yoke
#

if they do share names, they don't work

#

obsolete/override target only the first recipe defined with that name

#

that's one of many reasons the ability to have more than one recipe with the same name was removed in build 42

lavish zenith
queen oasis
#

so I downloaded the broken mod zip from my steam change notes and it's missing the common folder.... .. .

bronze yoke
queen oasis
#

and now my main menu is gone. Never been more thankful for an error screen

queen oasis
#

anyway, as usual you guys are correct. it is indeed the janky way I was setting colors

terse charm
#

Little question:
Is there only pzwiki and demiurgequantified.github.io for documentation?

For example I'm searching for the perks a player currently has.

If I take a look on IsoPlayer it does inherited several methods like "getPerkList" from IsoGameCharacter
But the Doc says kinda less.

Is the PerkList what I need to get the active perks?

public ArrayList<IsoGameCharacter.PerkInfo> getPerkList()

When I dive deeper into "PerkInfo" I see something like:

int level
PerkFactory.Perk perk

Diving deeper into "PerkFactory.Perk" turns out theres a String getName()

Feels like the doc is a whole labyrinth.

getPerkList() gives a list of IsoGameCharacter.PerkInfo
But this class only has a method called getLevel()
even if it has the fields

int level
PerkFactory.Perk perk

So I'm struggeling on how to find which active perks the player has including their level.

Is there a way to reload the mod while the game is running?
Than I can debug and try&error myself through it.

Would really really appreciate helping me with the knot in my brain.

bright fog
#

For your first question, give me a sec to check again on how to do that as I always forget it

#

player:getPerkLevel(Perks.Fitness)

bright fog
bronze yoke
#

if you want all perks you'd just iterate over the perks table and call that each time

terse charm
#

Yaa. simply said 😄
since visualX studio is not displaying all the possibilites it takes quite a lot of time to find all the classes I can call from the IsoPlayer class.

bright fog
#

I'll try to document that on the wiki

bronze yoke
#

if you're using a lua plugin with support for luacats typings you can use umbrella for intellisense

bright fog
#

It's not a Java object right ?

#

Wait no it is

blazing halo
terse charm
# bright fog Added a wiki entry https://pzwiki.net/wiki/IsoPlayer#Retrieve_player_stats

I know this, but what I was struggeling with was to find the list of perks a player has.
I that it would be as simple as something like player:getPerkList()

This is my solution so far:

function get_perks(player)
    -- get all perks available in the game
    local list_perks = PerkFactory.PerkList
    local player_perks = {}

    -- get perk from list
    -- get level of perk from player
    -- put perkname and level as keyvalue into a table
    -- return table with all perks and levels
    for i = 0, list_perks:size() - 1 do
        local perk = list_perks:get(i)
        local perk_type = perk:getType()
        local string_perk_type = tostring(perk_type)
        local player_perk_level = player:getPerkLevel(perk_type)

        -- debug
        print(tostring(perk).. ": " .. player_perk_level)
        player_perks[string_perk_type] = player_perk_level
    end

    return player_perks
end
frank elbow
#

“Perks” is used for skills, which all players have, at some numeric level (even if they don't have experience in it, they have the perk)

terse charm
#

This code above lists all skills (in lua called perks) ingame.
That was was I was looking for.

Its just veerrry struggeling to crawl my way through not simple to understand code.

Especially this one makes no sense in my brain:
Imagine I want to add a players skill (perk) level.

local perks = get_perks(player)
player:getXp():setXPToLevel(Perks.Aiming, perks["Aiming"] + 1)

player:getxp() in my brain returns the XP
player:setxp() would set it

I wonder what the programmer made here.

I also would understand

player:xp:set
player:xp:get

The part whats freakin' me out is that there are different methods used for the same result.
logically "getPerkLevel(perk)" adds in my brain the function "setPerkLevel(perk, level)"
but why player:getXP():setXP..?

This is insane 😄

sour island
#

Xp is the object that houses all the xp's and methods related to it

#

One of which is setXPToLevel

terse charm
#

Yeah... I see.
I just found out that the docs aren't really helpful.
Instead I've put the whole zomboid folder into my workspace and search there.
Thats >the< solution so far!
Thanks Chuckle!

bright fog
#

The same way looking through the game code doesn't hold all the answers either

#

You're supposed to use all of them together to have a good picture of the game code

#

The java doc gives you all the possible methods. The game code shows you how most of it can be utilized, but it doesn't give you all the possible uses either

silent zealot
#

And the decompiled java shows you what the java methods actually do.

#

Since it's not wlways obvious from just the name.

silent zealot
errant elbow
#

Hi!
I'm working on a mod for Project Zomboid that is supposed to make certain melee weapons not lose durability when attacking zombies, but still lose durability when hitting objects like doors or windows.

However, the mod doesn't seem to work as expected, and it's even throwing an error during runtime.
I'm not sure where the problem is, so I'd really appreciate any help or suggestions!

Thanks in advance!

silent zealot
#

function: Add -- file: NoZombieWear.lua line # 22 | MOD: ZombieSafeWeapons

java.lang.RuntimeException: Object tried to call nil in Add

First question: what is NoZombieWear.lua line 22 doing?

"tried to call nil in Add" means you probably have an issue with something being nil instead of a valid object, so look at line 22 and think "what could be nil here that should have a value?"

#

Unfortunately the copy-paste you did makes it a bit of guesswork as to the line numbers.

errant elbow
#

a lot of the code was written with help from a friend, so I'm still learning how all of this works myself.

#

😦

soft temple
#

i feel dumb as hell yall i've combed thru this lua as much as i can I can't find where the stoves 'burn' the food I have no idea what file even has the stove functions T.T

bronze yoke
#

it's not going to be lua

soft temple
#

I kinda assumed there'd be a burned flag but does it just rename it and adjust it?

bronze yoke
#

it just sets a flag on the item yeah

silent zealot
#

There's a lot of stuff in there that you'd think whould have been lua (like a washing machine choosing what to clean)

silent zealot
silent zealot
#

try

#
instanceof(weapon, "HandWeapon")
#

with the quotes around HandWeapon

errant elbow
#

The core function of this mod is to prevent certain melee weapons from losing Condition and HeadCondition when attacking zombies, animals, and windows.

silent zealot
#

Since that function is expecting an object and a string that it can match up to a Java class from a list

errant elbow
silent zealot
#

Without the quotes the second argument is the variable HandWeapon. which is probably not defined and is therefore nil

errant elbow
#

And new version is here

silent zealot
#

I think this needs quotes too:

local trackedWeapons = {
    [Base.BaseballBat] = true,
    [Base.HandAxe] = true,
}

so it would be

local trackedWeapons = {
    ["Base.BaseballBat"] = true,
    ["Base.HandAxe"] = true,
}

since you want the string "Base.BaseballBat" to be the key.

#

(or I may be wrong because there are a dozen slightly different syntaxes for tables in lua!)

errant elbow
#

OK

silent zealot
#

Is playergetLastHitZombie()defined somewhere else in the mod?

bronze yoke
#

it looks like the ai you used stripped out a lot of important characters

#

so the syntax is all messed up

errant elbow
#

How should I solve it

silent zealot
#

Short version: learn some basic LUA.

#

I asusme you're using AI to generate the code?

#

It's very difficult to help because we suggest a specific fix, and suddenly the code is completely restructured and works in a different way.

errant elbow
bronze yoke
#

i don't approve of intentionally concealing your usage of ai either - you posted earlier that you had used ai, and then deleted the message and posted a new one saying 'my friend'

silent zealot
#

That's fine, it just makes a big difference to how we can help.

bronze yoke
#

it's true that some people won't want to help with ai code, but it's also important context for people who still want to help

silent zealot
#

If I understand Vibe Coding correctly, the way to do it is just keep telling the AI what error is generated and asking it to fix the code until it eventually works.

bright fog
silent zealot
#

...which sounds like a terrible workflow to me, but ¯_(ツ)_/¯

bright fog
#

Yea it is

silent zealot
#

It's getting advertised as a job description now.

#

I think it sytarted as a joke, and managers/HR have taken it seriously 😦

bright fog
#

💀

bronze yoke
#

it'll die off quickly when managers realise they're paying people to do literally nothing

silent zealot
silent zealot
#

oh god I feel so dirty saying that

#

even as a joke

bronze yoke
#

ai bros say stuff like this and think it means anything

bright fog
# errant elbow my fault

Anyway basically what Albion said. AI currently can't mod PZ and I've yet to see a functional mod made fully from an AI

Codes made by AI can be noticed fairly easily most of the time. A single completely imaginary function and that's pratically an instant sign of AI usage

The important part is learning that, that AI currently in any shape or form just can't make your work if you don't know your work already. And it won't be amazing at teaching you from 0 either, you need to get started with learning how to mod PZ before starting to use AI and AI shouldn't be used to write PZ code

silent zealot
#

I'm going to cross that out now and pretend it never happened

bright fog
silent zealot
#

I had my first successful use of AI to code yesterday! Hacking together a quick cheat engine table I can never remember WTF is going on with floating point operations so I asked it how to do movss [rbx+rax*8],xmm6 only if the value in register xmm6 was bigger than [rbx+rax*8]

#

...then I had to doublecheck it all anyway because you can't just write to a random register and hope it's not soing something important, you really need to check that sort of thing...

#

...and then I found that I could have just swapped the two things because the floating point compare comiss xmm6, [rbx+rax*8] is perfectly valid but you can't have a memory address as the first argument. So... half points to ChatGPT I guess.

nimble creek
#

Why my mod dont show up in the mod list? I uploaded it to the workshop? B42.7

lavish zenith
#

I think I might be going mad.None of these recipes are showing up. I copied and pasted the third one directly from another mod that was working but is not active.

    {
    Water;10,
    Salt;5,
    PopBottleEmpty/WaterBottleEmpty,

    Result:Disinfectant,
    Time:100.0,
    Category:Survivalist,
    }

    recipe Make Disinfectant
    {
    Water=10,
    Salt=10,
    PopBottleEmpty/WaterBottleEmpty,

        Result:Disinfectant,
        Time:50.0,
        Category:Survivalist,
    CanBeDoneFromFloor: True,
    }

    recipe Make DisinfectantEC
    {
        Water;5,
        Salt;5,
        PopBottleEmpty/WaterBottleEmpty,

        Result:Disinfectant,
        Time:100.0,
        Category:Survivalist,
        NeedToBeLearn:true,
        CanBeDoneFromFloor: True,
    }
nimble creek
#

Yes

silent zealot
#

Don't subscribe to your own mod, that ends up with two copies (one downloaded by Steam, one in your Workshop folder)

#

And was it showing up before the steam upload?

nimble creek
#

no, not at all,

#

thats why i tried upload to the workshop

terse charm
#

When I put the mod into the mods folder of Zomboid inside steam it does not show up.
Have you put it in C:/User/Zomboid/mods?

silent zealot
silent zealot
#

Where is your mod located?

#

Do you have both a 42 and a common folder in it

nimble creek
#

C:\Users\Freeman\Zomboid\mods\MakeshiftGuitarAmp

#

Its a buildable noise maker mod what i am trying to do

silent zealot
#

Is there a mod.info in one of those, and what are the contents?

nimble creek
#

yes

#

name=Craftable Guitar Amp
id=MakeshiftGuitarAmp
description=A handmade guitar amplifier that attracts zombies with noise.
poster=poster.png

silent zealot
#

Doesn't matter what the mod does, showing up in the mod list is just a matter of correct folder structure and a valid mod.info

nimble creek
#

I have the example mod at the same older, and that did not sow up too

silent zealot
#

(also, good mod idea)

nimble creek
#

I dont know why, back then B41-i do see example mod in the mod list...

silent zealot
#

Are you on B41 or B42?

nimble creek
#

B42.7 right now

silent zealot
#

Is there a 42 folder in C:\Users\Freeman\Zomboid\mods\MakeshiftGuitarAmp

#

Is there a common folder in C:\Users\Freeman\Zomboid\mods\MakeshiftGuitarAmp

nimble creek
#

mod.info is in the C:\Users\Freeman\Zomboid\mods\MakeshiftGuitarAmp

#

42-folder is needed?

silent zealot
#

That is for B41

#

Yes

#

See sticky posts in the channel

nimble creek
#

Thanks for helping me

silent zealot
#

Short version: make a folder called 42 and put everything in there

#

Make a folder called common, it can be empty but has to exist

nimble creek
#

Its working now 🙂, (at least shows up in the modlist)

#

Now i have to test what chatgpt did with the code:D

#

Add a 3d prop

#

i already have some planed

#

This mod.info file have to be in multiple folder?

silent zealot
#

Only if you want the mod to work on B41 as well

#

Due to bugs a few things only work on the 42 folder, not common, so most modders are putting everything in there

#

There's not really much value to the new structure right now unless you're crazy enough to want to support multiple versions of B42 instead of just the latest one, but it will help when B43 comes out.

nimble creek
#

B43 will come that soon? 🙂

silent zealot
#

No, this is for when your grandchildren make mods.

#

"A society grows great when old men improve functionality in whose features they shall never code" - Ancient Greek proverb,

topaz tangle
#

Don’t think any ancient Greeks said that

thin swan
#

Aristotle wrote recursive functions while still wiping his ass with clay plates

silent zealot
bronze yoke
#

it was called the halting problem

silent zealot
#

Lucky AI has solved that for us.

#

Yep, defnitely 100% solved.

#

AI makes everything so easy.

topaz tangle
#

👎

silent zealot
#

Rebuttal:

#

Sorry everyone I've forgotten how to code properly and will have to resort to old fashioned methods like "have a vague plan and some basic knowledge of how coding works, then bash the keyboard until it works."

#

(I sure as heck am not paying money to code with ChatGPT!)

strange cobalt
#

Hi guys, could someone please tell me how to animate shotgun model to be functional in game? I know how to render and do other important stuff but i cannot manage how to animate that shotgun. If I need to use parent and use armatures to make it work. Iam kinda new to this stuff and saviour would be welcome, it would be sufficient to send me link to some acient forum that i haven't found. Thanks

thin swan
# strange cobalt Hi guys, could someone please tell me how to animate shotgun model to be functio...

Hello there! How are you implementing the shotgun? Are you basically just duplicating the current shotgun weapon script and putting in your own model? Or do you have have custom animations for holding/shooting it as well?

If you want it to use just the base animations that already exists for the vanilla shotgun then you don't really have to do anything at all in terms of animating the shotgun, you just have to make sure it's exported properly and set up with a weapon script that mimics the vanilla shotgun.

If you want to actually use custom animations for reloading/holding/equipping/shooting the shotgun then you just animate the right hand prop since that's the default bone that weapons attach to.
I can give more info on custom animations if that's what you're looking to do.

silent zealot
thin swan
silent zealot
#

Good timing for your question, Alex is probably the most experienced at animating "weapons" after his the skateboard/kickscooter/bicycle mods.

#

Do any vanilla weapons animate? The double barrel breaks open for reloading, but that is probably just a model swap during the reload action.

strange cobalt
#

Thanks for the fast response. I wouldnt waste much time animating my hotgun in complete new way. I would just use Vanilla anims to make it pump after shooting. i will post screenshot of my model just in case, and if you be so kind and just tell me what to do, I've already wasted much of my sanity

thin swan
bronze yoke
#

items are never animated

thin swan
bronze yoke
#

some gun mods fake it by toggling weapon part models

silent zealot
#

The pump could do the same thing - swap to a model with the pump back.

#

That's more animated than any vanilla pump action shotgun.

strange cobalt
silent zealot
#

To be honest, at the level of zoom you're playing at it's not very noticable... that's why weapons get away with the ka-chunk racking sound and no animation.

#

We'd need "heroic scale" proportions to be able to see the details well,like some tabletop miniatures games/RTS/ARPGs use.

#

And that is not going to look good if only one mod does it.

bronze yoke
#

if you didn't even know the vanilla shotgun wasn't animated, that's proof that it doesn't matter

thin swan
strange cobalt
thin swan
# silent zealot The pump could do the same thing - swap to a model with the pump back.

I've been thinking about making a bow and arrow mod using a method like this. undrawn bow is one mesh with string straight, drawn bow has string pulled. I could have it be one handed so the bow is animated using prop1, and when you equip the bow it automatically equips an arrow in your left hand which I then animate with prop2 so I can make a grab from quiver animation and have it look like it's being pulled back

thin swan
strange cobalt
#

Thanks guys, I've learned to much. So youre telling me I should just leave it be and add it into the game as it is? No parenting and armatures needed like in other games or edit my script to change models(if it is possible)?

strange cobalt
#

I just want my character to pump it and my shotgun pump to move after being shot/after empty mag *reload

thin swan
thin swan
# strange cobalt I just want my character to pump it and my shotgun pump to move after being shot...

Ah okay, to animate the pump is a bit more tricky, you will basically have to make one model that has the pump in neutral position and one when it's pumped back, and then you have to switch between those two models between shots. So it won't actually be animated, just a visual trick.

For the character to just move their hand as if they're pumping, it should work with just the vanilla pump shotgun animation.

strange cobalt
#

This is what i have been looking for, very nice. So any advice how to do it?

#

Oh, I get it now. Thanks for your time guys, you're very helpful and saved me some sanity.

silent zealot
thin swan
#

But bow would be so satisfying 😄 Maybe the projectile aspect could be cheated a bit by making a new bullet tracer effect that is just a long dark brown line. Not sure how that system works though, might not be accessible to mod in Lua

silent zealot
#

And put a bolt or broken bolt in the inventory of any zombie killed.

thin swan
#

Yeah! good idea

thin swan
#

Feels like a java thing for sure

silent zealot
#

And given how all over the place the aiming system has been, not a place worth trying to mod.

thin swan
#

Low-key been wanting to make an MMA mod, just a bunch of custom animations that are triggered by different hotkey combinations

silent zealot
#

Hopefully devs rmember they were excited about converting other throwables to physics aiming.

thin swan
#

Oooooh, I think I might make a quick one-off mod that adds a dropkick

silent zealot
#

hahahaha

#

autokill zombie, but leave player prone?

thin swan
#

Haha I was thinking 100% knockdown chance, but takes a second to get back up

silent zealot
#

As useful as sprint-charge with a spear

#

Make a full on pro-wresting mod.

thin swan
#

Oh fuck

#

That would be fun

silent zealot
#

hahaha

thin swan
#

Make the chairs and ladders equippable weapons

silent zealot
#

grapple with opponents that will kill you with one bite lol

#

hahahah

thin swan
#

What can go wrong?

silent zealot
#

Sledgehammers everwhere, but when you use them in combat you short-handle them and do no damage.

queen oasis
#

we're cooked now

silent zealot
#

I'm putting zero effort into supporting modded multiplayer

soft temple
#

vibe coding is cool an all, but it makes things SOOO much more difficult, can make a 4 hour project take days because the llm is trying to solve for syntax by writing 100s of lines of debug junk. I use it for bug checking my shit sometimes but you've gotta take it's code with a grain of salt for the most part it's a crutch that can make things worse.

silent zealot
#

Out of curiosity I asked chatgpt to make a Zomboid mod to increase headlight distance, and it hallucinated four very useful looking functions to do this.

queen oasis
#

I'm perfectly capable of turning a 4 hour project in to a days long project all by myself

silent zealot
#

Good point, if I need someone to try random stuff until something works I can do that myself.

queen oasis
#

I tried qwen locally and lemme tell you, I wish I saved that code because it was an absolute mess

#

I'll code myself right in to a wall and then spend 4 hours staring at it wondering where I went wrong

silent zealot
#

I did get working code when I told it to make a zomboid mod that does something, I didn't care what just make it work.

But that's a lot of GPU time to put "Hello World!" into the console log.

queen oasis
#

I might run a local llm again this winter to keep my feet warm

#

my poor little 3080 was screaming in pain

silent zealot
#

I feel like I'm stuck with a 3060 12GB for a few more years looking at the mess (and price) that is nvidia's 5000 range.

soft temple
queen oasis
#

My wife is still rocking my old 2070 super. That thing is a beast.

queen oasis
soft temple
#

oh i don't use mine for code most the time, i was letting them 'live' in a node.js mud i was working on

#

had them 'wacthing' movies and listening to music via subtitle tracks and kareoke lyrics

queen oasis
#

I asked it to check my code for any optimizations and it spat out some 5.4 code. I told it "no goto's, this is 5.1" so it came up with a goto function that took in a function as an arg and then called that function.
I was done at that point.

#

killed at least 12 trees for that one

soft temple
#

"we have goto at home"

#

either it's too early or i'm too stoned. I can't for the life of me figure out how to get this thing to play sounds.

queen oasis
#

what thing are you trying to get to play sounds?

#

and it's too early to be too stoned

#

sawed my first log in 42... can you only saw one log at a time now?

brave halo
#

Hi everyone! 👋

I'm working on my first local mod for Build 42, and I'm trying to implement a manual save/load system, like classic single-player games. I managed to make the mod appear in-game and even added a button in the ESC menu using Lua, but I’m having trouble triggering and debugging the Lua code (no print() or UIManager:queueMessage() is showing anything so far).

I wrote a detailed post with screenshots on Reddit:
🔗 https://www.reddit.com/r/projectzomboid/comments/1k62k5t/need_help_with_my_first_project_zomboid_mod_build/

Any tips or examples would be greatly appreciated – I’m new to Lua and learning as I go. Thanks so much in advance 🙏

Reddit

Explore this post and more from the projectzomboid community

soft temple
#

Like i know each food item has a cooking sound i just keep getting nil everytime i try to pull the sound

queen oasis
soft temple
#

i'm trying to use the built in sounds, thought maybe i could bypass that

queen oasis
#

that should be fine. are you triggering it on an event or with playSound()

soft temple
#

for dx = -1, 1 do
for dy = -1, 1 do
local sq = cell:getGridSquare(px + dx, py + dy, pz)
if sq then
for i = 0, sq:getObjects():size() - 1 do
local obj = sq:getObjects():get(i)
getSoundManager():PlaySound(obj.getCookingSound(), false, 0.5);
if instanceof(obj, "IsoStove") and obj:Activated() then
local heatFactor = getStoveHeatFactor(obj)
local worldObjects = sq:getWorldObjects()

Play sound but i'm fairly certain it's how i'm trying to get the sound

queen oasis
#

I'm pretty basic, I would square:playSound("sound")

soft temple
#

but like, soup

#

some objects boil some objects fry, how would i go about getting the right sound if i'm not obj.getCookingSound()?

#

like item:PlaySound("FryingFood", false, 0.5); should work right?

queen oasis
#

I'm not sure 'item' would have a playSound. if your object is a food item, you 'should' be able use getCookingSound

#

have you tried printing obj.getCookingSound to see what it's returning?

#

maybe throw some checks in there too, like "if instanceof(obj, "Food") then"
you can also use script manager to get the sound I believe

queen oasis
#

this is fun. run RecipeTestOne("whatever") and if it fails, your player inventory disappears

brave halo
#

Hey! Still trying to figure out how to trigger custom buttons from Lua in the ESC menu for Build 42.
My mod shows up in-game and the structure is fine, but I can’t debug OnGameStart or print().
Anyone got a working Lua UI mod example or some tips on where to hook into the menu?

thin swan
brave halo
frank elbow
#

Part of the setup for that is to clear the inventory

#

Presumably the same for the "unit tests" in the b42 debug menu (or at least one of them)—found that out when exploring that

queen oasis
#

I didn't look in to it because it seems like a debug thing. but you better be sure it's there.

#

I know this crafting system is giving me a headache. doesn't help I keep getting distracted.

#

I might have to roll my own recipe for "saw all logs" since the crafting menu seems to only want to do them one by one, even when crafting "max"

thin swan
slim swan
#

Does anyone know how to set hotkeys in-game? I want to set them through a UI instead of using ModOptions.

granite ginkgo
#

first test

topaz tangle
granite ginkgo
topaz tangle
#

Aye could still be worse

granite ginkgo
#

Yeah

terse charm
#

Hey, I might need some help in here, since I've done know 4 hours of debugging and my brains stops working:

function get_perks(player)
    local list_perks = PerkFactory.PerkList
    local player_perks = {}

    for i = 0, list_perks:size() - 1 do
        local perk = list_perks:get(i)
        local perk_type = perk:getType()
        local player_perk_xp = player:getXp():getXP(perk_type)
        if perk then
            print("adding perk "..tostring(perk_type))
            player_perks[perk] = player_perk_xp
        else
            print("error (nil) - skipping perk "..tostring(perk_type))
        end
    end
    return player_perks
end

local function OnPlayerAttackFinished(player, weapon)
    print("dbg1")
    local perks = get_perks(player);
    print("dbg2")
    print("printing perklist: "..tostring(perks))
    for perk, xp in pairs(perks) do 
        if perk then
        print("perk not nil")
    end
    print("dbg3 "..tostring(perk).." "..tostring(xp))
    if xp > 0 then
        print("dbg4")
        player:getXp():addXP(perk, xp)
    end
    end
    print("dbg5")
end```


It throws error "nil"  after dbg4.
"Object tried to call nil in OnPlayerAttackFinished"

running the "get_perks" function throws no error, adds all perks without problem.
the loop mostly goes until the first perk with xp appears (like here Axe)
#

Any ideas?
How can something be nil when I check before?

knotty hornet
#

Hey all! Im looking for a way to create a mod to replace the generic audio that plays over the TV and possibly the radio. It irks me that the audio is audible enough to clearly not be talking about what is being said. I have VO experience and am more than willing to VO the lines if someone can help me replace them as a mod?

fleet bridge
#

Sorry the a should be capital. AddXP

terse charm
#

Capital is right actually.
Copied from game folder

fleet bridge
#

Yours is lower case addXP

terse charm
#

This is insane.
Thanks for fixing four hours of thinking.

topaz tangle
#

I fixed my suspension on my vehicles finally: :3

silent zealot
silent zealot
#

Actually recording all the lines, processing them into the sound files and linking up all the guids is a lot of work, but shouldn't be technially challenging - just extremely tedious.

silent zealot
#

Add in the Umbrella plugin and it also has a lot of awareness of Zomboid's available functions/objects

trim skiff
#

hello,im curious, is there a mod to count and located all the items in the pz world. so i can track down massive amount of item in a container anywhere on the pz world

silent zealot
#

I'm not aware of any such mod, and it would be a massive amount of data to track.

trim skiff
silent zealot
slim swan
silent zealot
#

So you can set them any way you set a variable. You probably want to set them to something in the Keybaord global instead of using numeric values; run for k,v in pairs(Keyboard) do print(k) end to see all the possible values for Keyboard.KEY_SOMETHING

slim swan
soft temple
#

is there a decent video or tutorial explaining the soundManager? I don't think i'm understanding emitters

dense goblet
#

I'm trying to do a simple client->server command and I'm just not sure what I'm doing wrong. VERY new to zomboid mods:

client\mymodclient.lua

print("[mymodclient] client file loading....")
// ...
local function trySpawnZombie()
    print("Sending server command")
    sendServerCommand("MyMod", "Command", {})
end
// ...
print("[mymodclient] client file loaded.")

server\mymodserver.lua

print("[mymodserver] server file loading....")
// ...
local function onClientCommand(module, command, playerObj, args)
    print("onClientCommand")
end

Events.OnClientCommand.Add(onClientCommand)
// ...
print("[mymodserver] server file loaded.")

I self host a game and the console outputs:

[mymodclient] client file loading....
[mymodclient] client file loaded.
[mymodserver] server file loading....
[mymodserver] server file loaded.
Sending server command

but I never see a console.txt line with "onClientCommand"

bronze yoke
#

check coop-console.txt for server log

#

console.txt is only the client log (server files do run on the client which is why you are seeing some of the prints)

dense goblet
#

it IS THERE!! thank you

bronze yoke
#

if you don't want the server files to run on the client (generally preferable since you specifically wanted them on the server) you can add to the start of your file if isClient() then return end to exit the file immediately on the client

bright fog
bright fog
dense goblet
bronze yoke
#

the client should send a client command, not a server command

#

the commands are named after the sender

dense goblet
#

client -> server is sendClientCommand -> onClientCommand and server -> client is sendServerCommand -> onServerCommand ?

bronze yoke
#

yeah

dense goblet
#

man scratching my head for 2.5 hours on this haha

#

is there any good documentation on this? I looked at the wiki and see the java objects, but no real like detailed documentaiton

bronze yoke
#

for this game the general answer to that question is 'no'

#

but there is no real large scale documentation for modding

bright fog
#

Currently the modding wiki is still in development and as such you won't find a lot of stuff

#

Also I'm not making pages for B41 stuff

#

It's a loss of time

#

Especially for things that we don't know if it'll change or not with B42

silent zealot
#

I wouldn't call it "good" documemtation though.

thin swan
#

Well hmm... Should I try making a boat? If I make it equip as a clothing item you could still equip a fishing rod 🤔

silent zealot
#

kayak?

thin swan
#

oooh yeeeah

#

I was thinking row boat, but kayak would be dope

silent zealot
#

Back to the Future hoverboard is already done as a mod for your mod.

#

kayak better fits the "wearable" design IMO

#

rowboat should be a vehicle.

thin swan
#

Yeah I agree, I could even make the paddle a weapon that you have to have equipped along with the kayak in order to move

bright fog
thin swan
#

Seems setGhostMode or something like that should work

#

But I need to play around with it to see if it does what I think it does lol, you never know

bright fog
thin swan
#

Hmm, maybe it's possible to hook into some functions and just override the isDebugEnabled() checks. Wishful thinking though

silent zealot
bright fog
silent zealot
bright fog
#

I believe the way the game checks for debug mode is completely different in the java

bright fog
sonic needle
#

updating the water tileproperties could work?...

thin swan
bright fog
thin swan
#

Not a bad idea

silent zealot
#

If you make them passable then you need to implement swimming, not just kayaking

#

otherwise it will be weird when everyone can walk on water.

thin swan
#

I don't think I'm gonna do it anytime soon tbh, it's gonna be too much work. Would rather just focus on making the other mods better 😄

thin swan
#

Hmm, what if I make a new custom tile that acts as a floor, but it's invisible, and then if I have the boat equipped and I try to go on a water tile, it automatically builds my custom floor tile so it allows me to walk on it.
Would just need to make a good system for spawning and removing the tiles, but shouldn't be crazy hard right?

silent zealot
strange gorge
silent zealot
#

Debug mode.

thin swan
silent zealot
strange gorge
#

Oh, nice, do are they planning to have them in the actual map in B42 release? Or are you just playing around with it for the sake of it?

silent zealot
#

I'm sure they showed off a parking garage at one point.

bright fog
silent zealot
#

Can't drive from a ramp to flat tiles.

bright fog
#

You could on unstable release

#

Try different vehicles

silent zealot
#

just hits the end of the ramps and stops. Tried two, no luck for either. fast and slow.

bright fog
#

Uh

silent zealot
#

I might have picked two cars that don't work with ramps, I didn't try any vanilla cars.

sour island
#

I assume that's not a vanilla location?

#

Could be related to Z levels? maybe the tiles right after the ramp need some kind of special flag

silent zealot
#

Not worth putting a lot of effort into when it's clear ramps aren't supposed to be done yet.

sour island
#

Are there no vanilla ramps yet?

#

Stairs had a similar issue (unsure if it was fixed) where you (on foot) couldn't cross from 1 set to the next (side to side)

#

Making wide stairs not really functional

bright fog
#

Anyway that doesn't sound like the same issue

bright fog
silent zealot
#

The "don't fall off the side of the stairs" barriers don't account for putting two staircases side-by-side.

dry isle
#

Hi everyone! I'm currently working on a mod for Build 42 that adds a perk to the game. This perk gives a new character a custom melee weapon upon spawning, with completely new attack mechanics such as faster and cancelable LMB attacks, powerful charged attacks, and parrying instead of pushing...

I've spent 3 weeks coding and haven't made much progress — so far, I’ve only managed to get the perk to show up and give existing in-game weapons, but not the custom one. Are mods like this even possible in this game? Because in the entire history of the game, I haven’t seen a single mod that does something similar...

I’m looking for any kind of advice or help that could get me unstuck. I can share all the current files and error logs if needed.

I’d be truly grateful for ANY help.

fleet bridge
#

Probably best to study an existing mod that attempts to do the same. I believe dhert's brutal handiwork mod does something with the combat system?

dry isle
thin swan
# dry isle Hi everyone! I'm currently working on a mod for Build 42 that adds a perk to the...

It's possible, but you will have to mess around with the animsets and custom animations if you don't want to use existing ones.
To make attacks faster you would just increase the speed scale of the animation. To make it cancelable you'd have to make a hotkey that when enabled will interrupt the animation. I think there's a way to do it without messing with animsets, but it should for sure work if you make it so when you press the hotkey it changes a variable that is checked in your animation, and if that variable is changed then the animation cancels.

Were you planning on making custom animations for these, or just use existing ones from vanilla and just manipulate how they're played/used?

dry isle
thin swan
dry isle
thin swan
dry isle
thin swan
#

You're definitely gonna want some custom animations then. There's no very up-to-date guide on custom animations in B42, but I hope to have time to make one pretty soon, like in the next week or so.

dry isle
dry isle
lavish zenith
#

How do I get my mod/patch see a different mod for items or to override recipes? I thought it was just a matter of load order but I must be mistaken.

bronze yoke
#

if you're in b41 using the recipe override: thing, you just need to make your file alphabetically later than the one that has the recipe you're overriding

#

for anything else it should just work regardless of load order

lavish zenith
#

Does the local mod folder not see the Steam mod folder then?

queen oasis
#

there has got to be a better way to check if you can craft a recipe. I mean, holy ifthenfordo. Is there something akin to 'canCraftThisRecipe(sawlogsrecipe)' I'm missing? or better yet, getRecipesWithOutputItem("Plank") would be neato

if instanceof(o:getItem(), "InventoryItem") then
    local recipes = CraftRecipeManager.getUniqueRecipeItems(o:getItem(), playerObj, containers)
    if recipes then
        for i = 0, recipes:size() - 1 do
            if clickedFlags.sawRecipe then break end
            local recipe = recipes:get(i)
            for j = 0, recipe:getOutputs():size() - 1 do
                local resultItems = recipe:getOutputs():get(i):getOutputMapper():getResultItems()
                for k = 0, resultItems:size() - 1 do
                    if resultItems:get(k):getName() == "Plank" then
                        print("Planks are delicious!")
                        clickedFlags.canSawPlanks = true
                        clickedFlags.sawRecipe = recipe
                        break
                    end
                end
            end
        end
    end
end
thin swan
queen oasis
#

trying to future proof this thing. I guess I could stick with just the SawLogs recipe

thin swan
queen oasis
#

I'm trying to get all recipes that output planks

#

just seeing that staircase of "end" makes me sad

thin swan
pulsar osprey
#

Anyone have any Superpower Mods in development?

bright fog
#

The true heros are the one that simply just try to mod 😎

hybrid edge
#

Anyone with experience with PZ models able to shed some light on a fairly simple question?

sharp umbra
#

is there a way to increase the washer/dryer speed with a mod?

proud temple
#

Hello everyone, can anyone tell me how to implement automatic wipe of houses?

#

I've seen this feature on various servers, but I don't think it's listed as a workshop mod.

bright fog
#

For loot you mean ?

#

That's a sandbox option

#

Vanilla

#

Loot respawn

proud temple
#

I don't mean vanilla options

#

full wipe of the building, restoration of destroyed boxes, windows, doors, etc.

granite ginkgo
#

is the damn lib id damnlib both for b41 and b42?

errant elbow
granite ginkgo
#

name=BasicVan
id=Van
description="My Summer Car Van, the Hayosiko Pace from 1977!"
---Please report any bugs!---
poster=preview.png
icon=Icon.png
category=vehicle
require=\damnlib
versionMin=41.0.0
modVersion=1.0
author=Aeronava

#

Is there any problem with require line for B41?

#

Some say it does not work to enable the mod because it can't find damnlib, same script works on B42

bright fog
#

For B41

granite ginkgo
#

aight, appreciate it

bright fog
#

\ is needed for B42

granite ginkgo
#

such simple fix

bright fog
#

Also you probably shouldn't put 41.0.0 for the version

#

Even if I believe thqt's unused for B41

#

At least put the last B41 version

#

Bcs your mod won't work for 41.0.0 most likely lol

#

Tho that really doesn't matter anyway

granite ginkgo
#

yeah yr

strange cobalt
#

Hey guys, quick question. What defines the firerate of weapons in code? Iam using automatic pistol and I want it to shoot slower, what props should I edit in my code?

thin swan
#

Some people using the bicycle and scooter mods are having a very strange bug that I'm struggling with.
The bicycle appears in the world when placed, but when equipped the model goes invisible. The animations play and it "works", you just can't see the bike. The skateboard and folded scooter works fine, but the unfolded scooter has the same issue as the bike.
Only two people so far have reported it, but I can't reproduce it no matter what.
Tried changing graphics options, accessibility settings, using controller etc.
One of them plays on a docked steam deck, the other I'm not sure if he is as well, waiting for him to respond.

The only difference between the skateboard and folded scooter, and the bicycle and unfolded scooter is that the former two are weapons and attach to Prop1, while the latter are containers and attach to Prop2.
But it's weird that it seems to work for majority users still.

#

I hope that switching the bike and scooter to weapons will resolve it, because I plan on doing that anyways. But I still want to try and figure out what could cause it

strange cobalt
thin swan
# strange cobalt Sadly, it does nothing. Also I tried to edit "RecoilDelay" = 0 to 0.5 and that j...

I think actually that the firerate is tied to the animation, there's <m_SpeedScale>singleShootSpeed</m_SpeedScale> in the AnimSets\player\ranged\handgun\HandgunDefault.xml.
Depending on whether or not this singleShootSpeed is fully Java controlled or not, your approach will be different.
If it's something that can be accessed in Lua and it's supported decently then there's probably a setter you can use.
If it's fully Java side, then you'd have to make your own animset that activates when you hold your gun, and change the speedScale variable to your own calculation.

plush jackal
#

Is there a tutorial on how to make a weapon mod? I want to try make 1 but I dont know where to start

thin swan
plush jackal
#

firearm and ideally I want to try using custom animation

thin swan
# plush jackal firearm and ideally I want to try using custom animation

For firearm this is the best guide https://steamcommunity.com/sharedfiles/filedetails/?id=3060255898
For custom animations there's no up-to-date guide at the moment, but if you download https://github.com/Paddlefruit/ProjectZomboid_CommunityRig I can tell you how to set it up

Your first time trying to create your own gun mod, or struggling with making it work? I've been there. I've spend days figuring out why my gun model does not show / is semi transparent / is upside dow

GitHub

Contribute to Paddlefruit/ProjectZomboid_CommunityRig development by creating an account on GitHub.

flat bluff
#

Hello again folks.
I'm trying to add a function in build 41 that plays one of 10 random sounds when hitting with a specific blunt weapon.
For some reason they are not playing. Perhaps I have messed up the sound definitions.
Has someone here made something like this in the past ?

plush jackal
#

I'll let you know once I have time to set it up

strange cobalt
thin swan
bright fog
thin swan
#

(auto IK as in the pose option)

bright fog
#

Paddle's got IK bones too. You will ALWAYS need Blender knowledge to animate it

#

Any rig you use

thin swan
thin swan
# bright fog Paddle's got IK bones too. You will ALWAYS need Blender knowledge to animate it

I get what you mean, but I had never used Blender before and when I tried Mystery Rig it was all there already set up, and the animation guide uses mystery rig so it was easy to follow along.
When I started using Paddlefruit's rig I had to google some stuff to be able to get the same UI setup as I had on mystery rig.

For a complete beginner to get started it's slightly easier with myster rig, but it's really only because of like 3 settings that needs to be toggled in paddlefruit's. The rig itself is excellent and very intuitive to use once you get into it

thin swan
# bright fog What's auto IK ?

It activates IK for the parent bone and the parent's parent etc, I think it just affects the arms, but I feel it's easier to work with it when enabled

bright fog
#

Hmm

bright fog
#

Don't hesitate to give feedback directly to paddle

#

Also you can always fork it

thin swan
#

Oh yeah, I just didn't think it was that big of a deal, and as you say most people will have or want to have some blender knowledge before going in.
I was going to include a .blend file with everything set up when I make an animation tutorial

vivid imp
#

Dont enable auto ik! That just interferes with the already created ik

#

On the github it explains how to enable IK for the arms

thin swan
#

Ah okay, thanks for the info! I have been using it and it felt okay, but maybe I've just been lucky and haven't run into any bugs yet. I'm gonna disable it from now on

thin swan
#

Is it bad if I kind of prefer having FK on and using Auto IK? I feel it gives me so much control, and as long as I'm careful not to rotate things weirdly, I haven't really had any issues with it

thin swan
slim swan
#

Does anyone know which file contains the game version display in the bottom right corner?

silent zealot
#

For fully automatic, B42 is broken and just spews out pullets at an insane rate.

#

For burst fire, it doesn't seem to work at all. Don't use it; none of teh vanilla guns do.

granite ginkgo
#

Anyone else ever had problems with vehicle editing menu where it is all grey when accesing it and requires game restart???

granite ginkgo
#

I literally can't edit my vehicle bruh

#

anyone interested in helping me, maybe i can send the mod over and you can tell me if you encounter the same issue

#

Till then, I'll do a verify of installed files

main pasture
#

I think that happened to me with a vehicle script that tried to access body model that didn't exist, or something like that

inland socket
#

Does anyone know if it's possible to assign names to zombies and display them above their heads like it works for players in multiplayer? Or maybe someone has already made such a mod

inland socket
# bright fog What's your goal ?

I want all zombies to have their own random name displayed above their heads. The dictionary of names is known in advance. If there is an example of a mod that does something like this, or code examples I would be grateful. Or at least a direction where to dig

bright fog
#

You've got many ways to do that

#

Either have custom nametag visuals

#

Or use addLineChatElement (which I wouldn't suggest tbf)

#

This is one of my mod where I do that

#

However it might be complex to retrieve the code that might interest you

#

I got a better example wait

inland socket
#

Thank you very much! I will check that

distant fractal
#

Does anyone know how difficult it would be to embed a commodore 64 emulator into the command line interface mod?

bright fog
granite ginkgo
coarse sinew
# distant fractal Does anyone know how difficult it would be to embed a commodore 64 emulator into...

It's technically possible, but extremely complex to do inside Lua because of PZ's Lua environment limitations.

Why?
PZ Lua runtime doesn't include bitwise operations (bit, bit32, etc.) which most emulators heavily rely on, because emulating hardware like the C64 needs to manipulate bits a lot (e.g., shifting, masking, setting CPU flags).
PZ's Lua also doesn't allow native C libraries or external compiled modules, meaning you can't easily load a real emulator library like VICE or even something lightweight like fake6502 without rewriting huge parts manually.

Unless someone reimplements an extremely stripped down, integer-only C64 CPU core directly in pure Lua without bitwise ops (emulating bits using math), the emulator would either need to be fake (like a "simulation" running pre-coded scenes, not an actual CPU emulation) or you'd need to handwrite a minimal pseudo-emulator that interprets basic instructions manually. This would be super slow but possible if you only wanted to "simulate" some commands.

Realistically you'd need to build a custom Java mod to embed a Java-based C64 emulator. Because it's Java-side, this would require users to manually install the Java mod, it's not pure Lua, so it won't work automatically through Steam Workshop.

I'm currently working on a S.C.R.A.P. Terminal mod (name will probably change), basically a retro CRT-style terminal interface with modular apps (modules) like a lore database, admin tools, a directives system (server wide events) and a game module (I already implemented Snake, Tetris, Pac-Man, and a copy of Doom). It has CRT screen simulation (flicker, scanlines, dynamic UI with boot sequences, animations), custom sound manager for keyboard clicks, hums, etc. And it's extensible: you can register new terminal modules using an API (but you still have to write your own code to render the elements ...).

inland socket
fleet bridge
#

getPlayer():getStats():getNumVisibleZombies()

inland socket
queen oasis
queen oasis
distant fractal
inland socket
queen oasis
bronze yoke
#

if you're expecting an array that's your first problem 😅

coarse sinew
distant fractal
#

Like sometime in the next couple months or is it still a long way from done?

inland socket
# queen oasis can you post your code?
HandleVisuals = function(_)
  local zombieList = getCell():getZombieList()
  for i = 0, zombieList:size() - 1 do repeat
  local zombie = zombieList:get(i)        
  if zombie.IsVisibleToPlayer then
    print("not nil")
  end    
  until true end
end

Events.OnTick.Add(HandleVisuals)
queen oasis
#

if zombie:isVisibleToPlayer(playerIndex)
if you don't have the playerIndex you can use getPlayer():getPlayerNum() for testing
that's a hefty call for OnTick too

coarse sinew
# distant fractal Nice, any idea when it’ll be ready for the workshop?

It's a pretty complex project, between MP syncing, fixing texture rendering quirks and finding new methods for storing dynamic data efficiently, it's taken a lot of extra work. Right now I'm aiming for a preview build release in about 1–2 months for closed-testing on a server first. If that goes well, it'll move toward full release.

bright fog
dry isle
inland socket
dry isle
granite ginkgo
#

So I want to ask again, Grey bugged vehicle editor is duo to unexistent models or what?

#

because it worked once on same mod, now it won't anymore

#

because i checked and all models load, i really don't know what causes it

lavish zenith
#

Can I get a little help understanding "Override:true"? I thought I needed to copy and paste the original recipe exactly and just add Override:true before making a new entry with my recipe but it must not be working since both are showing up in game.

main pasture
granite ginkgo
#

i will post it then, but its really unfinished btw

main pasture
#

I think the broblem should be in the script

granite ginkgo
#

here

#

i thought u might need the model too

#

i found an issue with rear window i think

#

it should load in the gas tank but it does nothing

#

might be the issue

#

talking about the rear window

bright fog
#

You want the item to be granted when creating a new character ?

#

Or when doing something ?

dry isle
#

OnNewSurvivor - doen´t work

#

OnCreatePlayer - doesn´t work

#

i´ll try OnPlayerLogin...

bright fog
#

There's an event when you create a new character

#

Looking for it

bright fog
dry isle
bright fog
#

Maan that's a looooot of code that you shouldn't ever need

bright fog
#

You're doing sooooo many checks here that are just straight up not needed and will bloat your code if not slow it down for literally nothing

#
    -- Проверяем валидность объекта игрока (оставляем проверки на всякий случай)
    if not player or type(player) ~= "userdata" or not player.isPlayer or not player:isPlayer() or not player.getUsername or not player.HasTrait or not player.getInventory then
        print("KatanaMasterMod.OnPlayerLoginHandler: Invalid or incomplete player object received. Type: " .. type(player))
        return
    end

This is straight up bloat

dry isle
#

i´m ready to kill myself 🥹

#

joke

bright fog
#

Also make sure to clear all these prints when you release the mod, do not leave a single one

#

See this

dry isle
#

Yeah

bright fog
#

Anyway give me a minute to verify your method to adding items to the player

dry isle
#

Ty!

bright fog
#

You managing to spawn the item from the debug menu ?

#

Code looks good

dry isle
bright fog
dry isle
#

oups

#

wrong file

dry isle
bronze yoke
bright fog
#

So you manage to spawn the item in game from the debug menu ?

bronze yoke
#

recipes with multiple definitions (multiple recipes with the same name) cannot be overridden this way

dry isle
dry isle
bright fog
dry isle
#

Gimme a moment

bright fog
#

And the issue is not that you're trying to add an item that actually can't physically exist

#

I got my answer already

#

That's not needed

#

Anyway try doing that code on a completely different event

#

Like OnKeyPress or something like that, and see if it gives you your item

#

That way you can verify if the issue is the event or your item spawning

#

Imo the item spawning method looks good but I'm not familiar enough with it to recognize the proper way

#

I checked based on stuff I personally did and this looks good, from memory too

dry isle
#

Alright, I'll make the changes and try again!

lavish zenith
bronze yoke
#

yeah that's right, but keep in mind that also won't work if it has duplicates

lavish zenith
#

As the nuclear option, if a mod is not on lockdown and conflicts with other mods, is it appropriate to rewrite the pieces needed and incorporate it into the new mod and then credit the original author/modder?

#

Etiquette

bright fog
lavish zenith
#

They each work individually.

bright fog
#

Not sure what you mean

#

You need to require the original mod

#

And make sure to load the other mod first

lavish zenith
#

Can you clarify what you mean by require the original mod. Is that in the Steam setting or us there a part that needs to be done in my local folder too? Load order is set by name and double checked with mod manager.

main pasture
# granite ginkgo

Removed static = FALSE, from every model definition and the editor works (for me at least)

lavish zenith
bronze yoke
#

the override is not dependent on mod load order or even requires

main pasture
# granite ginkgo Thanks, ill do it

It seems to have something to do with the models (or lack of them for me), because it works with the static line when the model is replaced with one from a vanilla vehicle

granite ginkgo
bronze yoke
#

you might need to make your file alphabetically later than the original file that defines the recipe (script files load in alphabetical order and ignore mod load order)

bright fog
bronze yoke
#

scripts still load that way

#

and also they're talking about b41 recipes so

bright fog
#

👌

#

yea idk what they are trying to override anyway

granite ginkgo
#

getting somewhere

queen oasis
amber osprey
#

I've got programming experience and I've certainly looked into modding this game before, just never got fully into it. How difficult is it? I know it uses Lua, I've got no experience with that, but I've made a few games from scratch before if that tells you what level programmer I am.

thin swan
amber osprey
#

Dope. All I need is an idea lol. Something will come to me when I'm playing

thin swan
silent zealot
#

The hardest part of code based zomboid mods is 1) figuring out where you need to make a change, and asking in here will often get you pointers to the bit you need and 2) coming up with elaborate workarounds when the thing you want to change is in java and not accessible in lua.

amber osprey
#

They're my specialty

silent zealot
amber osprey
#

Bahaha

#

My code used to be so unreadable, I got so good at deciphering strange code just trying to refactor

silent zealot
#

useful non-obvious lua tip if you're coming from other languages: if you see a function named ObjectType:function(arg1, arg2) that is just a quick way to write ObjectType.function(self, arg1, arg2), where "self" is used as a variable passed around so you can fake object-oriented design.

nimble yew
#

heyy, TeachedRecipes in B42 now must refer to the <recipeID>?

ie, in B41 I have this working:

module FunctionalCarLift {
  item CarLiftMag {
    DisplayName = Carzone Commodities: Car Lift,
    DisplayCategory = SkillBook,
    Weight = 0.1,
    Type = Literature,
    Icon = CarLiftMag,
    TeachedRecipes = Craft Car Lift Column; Craft Car Lift Center,
    ReplaceOnUse = CarLiftMag,
    StaticModel = Magazine,
    WorldStaticModel = FunctionalCarLift.MagModel,
  }
}