#mod_development

1 messages ยท Page 311 of 1

turbid ruin
#

thank you kind sir!

jaunty gate
#

In Debug, make sure Health Panel Cheat mode is on. Then open the Health Panel. Right-click a body part > Visual Change > Add Blood.

If the body part has clothing on it, the blood gets added to the clothing item.

drifting ore
#

Thank you, it is all of the sudden working now for some reason

umbral raptor
#

well i need an example for how to do it since im just starting in lua haha

drifting ore
#

I see, the problem is it won't apply blood to both the left and right item with BloodLocation = LowerArms when they are equipped at the same time in b41

ancient grail
#

anyone knows if theres a counterpart for non inventory item containers? like the object containers
i need to limit a container
or maybe an item being on container,.. if theres non then i guess i should make a function to just drop the item on the ground automatically

silent zealot
#

Do you have one item equipped to both lower arms, or on item on each arm?

#

If it's two items you likely need the blood locations for each lower arm seperately

silent zealot
#

Can't remember what they are called in the scripts, but I'm pretty sure that if you add a container it can have an accept function

#

Like stoves and crates and shelves and stuff

ancient grail
#

no its like keyrings only accept meys

#

keys

ancient grail
silent zealot
#

Accept functions

#

See if the scripts for world objects support them when you add capacity

bright fog
#

Nah but you can do it via Lua

#

You could even link to the timed action of attaching attachments

#

There should be one I guess

fleet bridge
#

Or do you mean sprites?

ancient grail
fleet bridge
#

that might tell you how its done i think

simple helm
#

Did more digging and seems like adding vehicles/boats on a trailer and unloading shares something with Tsar library not sure what but finding the source and reference will help

ancient grail
# fleet bridge you can look at the manage containers mod?

i encountered an issue so i might not need the restriction anymore..
basically what im doing is a cooking vat on top of the campfire
at first i thought to change the campfires type but the game automatically changes it back so now im gona need to use the cooking vat and just spawned it ontop of the campfire

queen oasis
ancient grail
# vast pier oh cool, brewing mod?

moonshine distillery
its overwhelming
i dont know what to look for. like how do i convert the data from campfire to the cooking vat
and then the item its suppose to be cooking

plus i dont know much of food cooking but i know it should be 1 item only per dish right
hmm....i feel like i need to hook onto campfire data
but its got a lot of code

queen oasis
ancient grail
#

thats doable
but the thing is campfires are global objects

#

so it might die without client knowing

#

idk

umbral raptor
#

can someone help me fix this lua? easy one

#

function OnEat_Handwarmer(food, character, pct)
local bodyDamage = character:getBodyDamage()
bodyDamage:setWetness(bodyDamage:getWetness() - 0.001)
bodyDamage:setTemperature(28)
end

cinder nebula
#

How may I enable or disable the digital watch HUD from the debug menu options in-game? I cannot remember where that button is.

fleet bridge
umbral raptor
#

cant figure out whats wrong

fleet bridge
#

well, whats the error/bug?

#

what does getWetness() and getTemperature() return? start there i guess

#

those are float values, maybe setTemperature is from 0 to 1? shrug

cinder nebula
#

You are not understanding what I am saying. What is your native language so I can use a translator to explain the issue to you?

#

Or not. ๐Ÿ˜‚ ยฏ_(ใƒ„)_/ยฏ

jaunty gate
main pasture
#

POC of randomized, persistent, procedural in-world license plates. Supports getting/setting the value (so movable from vehicle to another), can be added by just editing the vehicle script. Full range of possible combinations 3x A-Z + 3x 0-9 and two randomized backgrounds

umbral raptor
queen oasis
#

either my code is wonky or the military base has some more secrets?

#

those are only squares that have a room

queen oasis
#

well, nevermind. I guess I never explored below 13. I didn't know it went deeper

wise musk
#

Anyone developing an amputation mod for b42?

oblique estuary
#

Anyone know how to get a lua code to check an item condition?

grizzled fulcrum
#

getCurrentCondition for a 0-100% value, getCondition for the item's condition as an integer (more of an internal thing, like scripts)

oblique estuary
#

Thank you, I've been scouering the lua codes for hours, but haven't been able to find it, much apreciated @grizzled fulcrum

grizzled fulcrum
oblique estuary
#

Thanks a bunch, that website is gonna come in handy

cinder nebula
grizzled fulcrum
#

step 1: dont use ai

umbral raptor
#

Can someone tell me why SetTempereture doesn't work?

cinder nebula
#

Yeah, everyone says that, but I have used Grok3 to make two successful mods.

grizzled fulcrum
#

it hurts you more than helps, and when you dont understand the code, you dont understand how to fix errors, so then you are out of luck

umbral raptor
#

and what it was replaced by

grizzled fulcrum
umbral raptor
grizzled fulcrum
#

bodyDamage:setTemperature(temp)

umbral raptor
#

doesnt work

#

i tried all forms of settemperature

#

it doesnt work

grizzled fulcrum
#

b41 or b42?

umbral raptor
#

42

grizzled fulcrum
#

because in b41, player:setTemperature(temp) is the way to do it

umbral raptor
#

Recipe.OnCreate.Handwarmer = function(CraftRecipeData_, Character_)
local pl = getPlayer()
local bd = pl:getBodyDamage()
local wet = bd:getWetness() + 40
bd:decreaseBodyWetness(wet)
bd:setTemperature(28)
end

grizzled fulcrum
#

rip, I am of no help then

oblique estuary
grizzled fulcrum
oblique estuary
#

Initially I thought I didn't need to specify it since it's part of the recipe

grizzled fulcrum
#

^ exactly

oblique estuary
#

But since I added it, it doesn't seem to work

#

Hmm.. lua without prior knowledge is quite difficult ๐Ÿ˜…

grizzled fulcrum
#

hopefully a little more helpful than the monotonous lua manual

oblique estuary
#

Thanks a lot, at least there's a lot of material to read and learn

grizzled fulcrum
#

this is the params you should have in your oncreate function ( and it explains them )

#

would highly recommend using vscode for lua dev

oblique estuary
eager quartz
#

I would guess it's not an issue, but does Zomboid care about using ' ' instead of " "?

bronze yoke
#

no

#

it might be bad in translation files/other files that use quotation marks as syntax but at least for lua there's no difference whatsoever

eager quartz
#

Awesome, ty

granite ginkgo
#

WIP with working doors/hood animations

drifting ore
granite ginkgo
hollow radish
#

One day I'll definitely finish it and put it in a game. ded

eager quartz
#

Is it against any rules to ask for coding help when your making personal edits to a mod that you won't be re-distributing?

bronze yoke
#

if you're not going to redistribute it then it's personal use and you can do whatever you want

eager quartz
#

Yea, just want to double check before I ask for help with the code as there is a weird oddity I am trying to figure out but can't seem to figure it out

#

Cause I don't know if I could share some of the code / translation files as at least the translation file is theirs originally minus what I added

silent zealot
#

Asking is fine

#

Sharing code is also fine; any mod published on steam has the code publicly available.

storm trench
#

I wonder if there's any way to give users a lua to run to remove the extra dynamic spawns from the carts & trolleys dynamic spawns and then have them remove it. Or would that be too complicated? I kinda feel bad some users have had this issue and it will persist in their world. hmm

silent zealot
#

Option1: Add a function to the mod that does the cleanup but never gets called, and tell them to go into debug mode and type "TrollCleanup()" into the lua box. no seperate download needed.

#

Option2: add a "clean up on next game start" option that calls the cleanup code, possibly with a safeguard so it only gets called once.

eager quartz
#

Is comments allowed in translation files?

storm trench
silent zealot
silent zealot
eager quartz
#

Dope, this code is all over the place, reworking this is gonna take a bit, it seems their using two types of translation files with both files having the same translations ๐Ÿ˜…

storm trench
silent zealot
#

that adds config to options -> mods -> <your mod>

#

There's a "mod options example" mod that is a big help getting the syntax right

eager quartz
silent zealot
#

you can add mod options into any lua file.

storm trench
#

Just making sure I'm looking at the right stuff hahaa.

silent zealot
#

For a one-lua-file mod I just shoved the options in like that

storm trench
#

Ahhh, I see what you mean. That makes more sense. Thank you!!! โค๏ธ

bright fog
#

Sums up very well the entire thing

#

I believe I linked the mod example too ?

#

I don't remember lol

silent zealot
#

Yeah, that's a better resource... I needed to figure it out in ye-olde days when there no wiki page for this

bright fog
#

yup

storm trench
#

I can't wait to be done forking this carts & trolley mod lol.

queen oasis
#

is there a path find test or did I dream that? Just need to test if the player can path to somewhere

vast pier
eager quartz
#

Is there a way to run a function or something when either the player ticks a tickbox or when they click apply?

#

Honestly kinda wish the addTickBox() had a function arg

sturdy silo
#

In what context? I know code for when a player "eats/uses" an inventory item but I know almost nothing regarding the UI

eager quartz
#

In the mod options, apologies

sturdy silo
#

ah, sorry chief, I haven't messed with options unfortunately

eager quartz
#

All good

queen oasis
#

function Options:addButton(id, name, tooltip, onclickfunc, target, arg1, arg2, arg3, arg4)

eager quartz
#

Yea, the thing is I'd rather it be a tick box as it's enabling & disabling something and having it be a tick make more sense imo, unless the button can be a tick box too?

#

Are you able to run a function when the apply button is hit?

queen oasis
eager quartz
#

Yea, that's what I just thought of too

#

Guess it'll do till I can run a function on tick boxes ๐Ÿ˜…

storm trench
storm trench
# queen oasis no menu for you

I just want to be done ffs hahaa. I fixed the duplication issue and all that. I just want to get it out but also give users the option to erase the present spawns from their saves so they don't have to start a new save.

queen oasis
storm trench
queen oasis
#

lol, yea I looked at it and said "not today satan"

#

and not sure if you know but there is a bug if you climb through a window with a trolley equipped

cinder nebula
#

Is there a way to connect a lua file that is in the 42\media\lua\client\ISUI and connect it to a lua file handling the mod options code in the client folder?

storm trench
#

(I'm not really sad, I kinda figured there would be an issue there...)

#

Appreciate it.

queen oasis
#

you have more patience than I do

#

very helpful...

public boolean TestPathfindCollide(IsoMovingObject obj, IsoGridSquare from, IsoGridSquare to) {
  return false; }

public boolean TestCollide(IsoMovingObject obj, IsoGridSquare from, IsoGridSquare to) {
  return false; }
storm trench
#

Might help if I don't forget the local config at the header. I blame the jet lag. tired

queen oasis
#

and I still can't find the path find test so I must have fever dreamed it

eager quartz
#

Kinda of a silly question how do I see the console where prints are sent too?

eager quartz
#

No, though I am on B42, I thought it was pre-enabled?

storm trench
queen oasis
storm trench
eager quartz
#

If I recall correctly I need to set the launch perimeters with -debug right?

storm trench
#

Anybody know how to center text in the workshop mod description? I assume probably not able to do it, but... maybe... idk... hahaa.

#

I finally got on to making that less ugly lol

queen oasis
storm trench
#

Laaame. Hahaa. Figured, though. Oh well.

queen oasis
#

it looks like ass on a phone so I quit using it

cinder nebula
#

Is there a mod you guys can think of that has a Mod options button that resets the values to default in the MODS tab for B42? I am having trouble getting a "Reset Values to Default" button working and would be nice to reverse engineer a mod with a working "default reset" button .

storm trench
storm trench
grizzled fulcrum
storm trench
#

I mean... yes, but also no. Okay to reference 100%, but copy-pasting is a little shady imo.

#

I can't remember who Rocco is in chat here, but holy crap that CleanUI mod looks incredible now.

sturdy silo
#

Has anyone here messed with the in game lighting yet for build 42? For reference I made a UV Bulb and I have the prompt showing up to install it in lamps but nothing happens.

silent zealot
storm trench
silent zealot
#

That's me!

#

Lighting is very much java based with limited options to mess with it,

#

What do you want the UV bulb to do?

#

Since there are coloured light bulbs making a dull purple light should be fine.

sturdy silo
#

Thanks @storm trench. I need to be able to install it in lamps and other house hold objects.

silent zealot
#

But making things under the light react by having blood and white clothing glow...

storm trench
# silent zealot That's me!

I freaking love the mod. I've been waiting forever for the new B42 lighting to finally have decent car headlights lmao.

silent zealot
#

I'll add version 2 WIP to the download as a seperate mod shortly, it gets even more light by using the "rear headlights" as well

sturdy silo
#

See my code checks sunlight and UV light (It's a dying light inspired mod). I've been trying to get the bulb to install into light fixtures but I might have to settle for a purple

silent zealot
#

My suggestion would be make a purple bulb, track an array of where your bulbs are installed and then when you check for UV you can see if any installed bulbs are nearby and on.

storm trench
silent zealot
#

You could also make a dedicated "UV lamp" and/or daylight lamp placeables

sturdy silo
#

lol, fair point. I'll just settle for the games purple bulb. I already track it with.

function UVLightChecker()
local player = getPlayer();
local playerdata = player:getModData()
local Sqr = player:getSquare()
local B = Sqr:getLightInfluenceB()
local G = Sqr:getLightInfluenceG()
local R = Sqr:getLightInfluenceR()
if player:HasTrait("LabRat") then
if Sqr then
if R == 85 and G == 0 and B == 255 then
playerdata.InfectionImmunityTimer = 120 + playerdata.ImmunityBonus
playerdata.inUVrange = true
elseif not R ~= 85 and G ~= 0 and B ~= 255 then
playerdata.inUVrange = false
end
end
end
end
Events.EveryOneMinute.Add(UVLightChecker)

#

@silent zealot You are a saint, that's what I will do

silent zealot
#

I'm not sure how the light influence stuff works, but will that get thrown off if there is a normal bulb as well?

sturdy silo
#

That's a very fair point, I haven't gotten to test that yet as I've been fighting the bulbs. It probably will so I might swap for an array to track them

silent zealot
#

For what it's worth, 90s UV bulbs for normal sockets were not great. I used once in a roleplaying game so the room could being near darkness but it was still possible to read things printed on flourescent paper, but there was not much glow.

#

Flourescent UV lamps work fine though, since flourescent tubes produce UV that gets converted to visible light by the inner coating on the tubes

#

same for LEDs, a white led is blue light that gets converted down to all wavelengths, so skip that step and push the frequency a bit and you have modern UV LEDs.

#

But... other than some people telling you that you're wrong in the mod comments no one will mind if you go gameplay first (or "I can make the mod work this way" first)

sturdy silo
#

See I have a hand held lamp made but I haven't gotten it to work. (I've been trying to change the color.) So I just make a check so if the player is holding it then they're in UV.

silent zealot
#

Pretty sure colour is fixed for hand held torches, as that is 100% set in java code that ignores whatever the list gives it

sturdy silo
#

My released mod checks total light level constantly so realistically I also don't need to change it but I'm doing it for a friend.

#

oh.. so many hours down the drain

storm trench
# sturdy silo oh.. so many hours down the drain

Don't feel bad. I tested my B42 fork of the trolleys mod for 5 days before realizing my issue was (thanks to someone else) that I didn't have a second media folder in the top level... hahahaa.

silent zealot
#

Functionally handheld torches seem to be VehicleLights but the code gets confusing

sturdy silo
#

that's strange, okay, so thats just beyond my control then. I'll just assign a inUV = true to the player while holding the lamp

silent zealot
#

Likely the best way for hand-held lights. If I can figure a way to hack the light colour/intensity I'll let you know

sturdy silo
#

You're a savior. I was playing with the Isolight and it says you can set the RGB. All this is from the javadocs for

silent zealot
#

Isolight will handle a fixed position light

#

VehicleLight is when a torch/headlight is moving with the player

#

And the stupid lighting code just says "lol nope get the range and intensity based on part condition if its attached to a Vehicle part"

#

And you can't get part condition above 100 with damage(-100) because I tried ๐Ÿ˜ญ

sturdy silo
#

I see, that is very unfortunate

silent zealot
#

Maybe if I learn the dark art of java reflection via lua and can get write access to some things that we're not meant to have write access too...

#

But I'm not sure if that's even theoretically possible.

#

Read access is, Albion has done great work there in the starlit library

sturdy silo
#

question then. Regarding the games preset lamps in bedrooms and what not. IsoLightSwitch seems to handle (I may be wrong) these fixtures, could I not override the addLightBulb(IsoGameCharacter chr, InventoryItem bulb) to fit a special bulb. I'm very new so sorry if I'm a bit slow to understand

storm trench
#

Ahhh nevermind it's that darn generative fill. How do I keep missing this dumb crap? SCsigh

#

I think I'm going to freaking bed. Nite all.

sturdy silo
#

Night, thanks you two for the help

bronze yoke
#

you can write in debug mode only

#

i never bothered adding api for it since it's only mildly useful for debugging and way too annoying to find out you accidentally made a mod that doesn't work without it

silent zealot
#

Just need to reflection the bit that makes it debug only then reflect the bit you want, easy. <if there was an emoji for being insane I would put it here>

cinder nebula
#

Hi, guys. I am trying to get a "Reset to Default" button in the MODS tab to work, but it's not doing anything when I click it. Here is the lua file I have made. Lines 70-99 are the respective code. But 89-99 just doesn't work when I click. Not sure what's up?

silent zealot
#

No wonder light placement can be weird on oddly sized vehicles, offsets are multipled by vehicle size.

#

instead of adding the vehicle size

cinder nebula
#

Ah, thank you! OK, now I am running into other errors I have to fix. ๐Ÿ˜…

bronze yoke
#

by the way, what is the usage of mod data here trying to accomplish? it seems really odd

bronze yoke
#

i don't think you're needing to use mod data here, mod data is for persistently storing data with the save file

cinder nebula
#

Oh, good to know. I do not know what I am doing, because I am using Grok3 to help lolz. Everything but the "Reset to Default" button works thus far.

bronze yoke
#

that makes sense

cinder nebula
#

๐Ÿ˜…

#

Does modData reduce game speed if it continuously stores data into the save file?

bronze yoke
#

with proper caching no (but it doesn't look like your ai is caching basically anything based on the file you posted), but it bloats the save file and is just more complex to work with

#

in this example the mod options and the mod data are two opposing systems fighting each other ๐Ÿ˜… but if it works

cinder nebula
#

Haha. Wild.

cinder nebula
silent zealot
bronze yoke
#

it's global mod data, so it saves when the world does

silent zealot
#

I know chunks can take a long time to save based on rollback from a crash after organizing my entire $%@#$ing base. I assume they just stay in memory with no save while still active.

bronze yoke
#

yeah, they save when they unload / the save is exited

#

servers can set an autosave interval too

cinder nebula
#

Does anyone else REALLY like the new debug icon in-game? What an upgrade from the other one.

silent zealot
#

I like the old one more

#

This one does fit the new UI art style though

cinder nebula
#

Yeah, I just think it looks adorable.

empty bramble
#

Are the devs planning to make map-making more intuitive at all?

vast pier
#

got randomized attachments working

vast pier
bronze yoke
#

no

#

the exception is that during timed actions, animation events trigger a function in the timed action

#

๐Ÿค” you could use the GrapplerLetGo event to trigger lua code actually

#

it triggers the lua event of the same name with a string argument

#

you'd have to store any necessary information to recognise your specific triggers and any extra data you need in that one string

knotty stone
#

its not rly blonging here but i need some smart ppl to answer it. Why do we only get 1/4exp of the recipe exp if we dont have a trait belonging to it(exp modifier). Lets take tailor, ripping cloth gives 1xp, without trait 0.25, with 1. (only have that 1 mod active and apoc setting, so no changes to any multiplier)

silent zealot
#

instead of 100% and multiply everything by four.

#

If you start with points in the skill, that increases.

#

Pretend an average human has 2 in all skills, and our characters are morons. Or something.

knotty stone
#

yeah ok, its just super strange and unnecessary. one of the reasons i never go without eletric trait anymore xD

granite ginkgo
#

How can I add 4 wheels in the back? I checked a mod and it had files only for 4 total wheels, not 6

silent zealot
#

If you want double tires you can cheat and just make a double-wide tire axle.

#

If you want an extra axle... I don't think I've ever seen a mod do that.

knotty stone
granite ginkgo
granite ginkgo
#

Btw, I also checked the [B42] Tatra 815 and I didn't see any custom ATA template or anything like that, I wonder how does it work

knotty stone
#

he is using the rearleft and right wheel, the model of each is the same, with tires on both sides

granite ginkgo
#

Ill try to add it with tsar lib for now

muted garnet
#

for the mod to work in build 41 and 42, do I need to put the mod data into the 42 and common folders? Or what?

drifting ore
#

You can have common be empty and have your b42 files in 42, and your b41 files in that parent folder

silent zealot
#

You effectively have two 100% separate copies of the mod.

granite ginkgo
#

But I keep it empty

drifting ore
#

Except that 41 doesn't load common

granite ginkgo
#

Also, another question, if I want to add 3 seats, I cange the template to 3 and simply name the extra seat any name I want?

#

Also, I think I added the ATA template wrong?

#

I put the file in the scripts folder first, made 2 more model templates in main file for middle wheels with the same name as the ones in the template script and called the template in the main file

muted garnet
#

thanks

granite ginkgo
#

the game only loads the default wheels I had

#

+I added tsar lib b42 to my mod list

knotty stone
#
        part TireMiddleLeft
        {
            model InflatedTirePlusWheel
            {
                file = ATAPetyarbuilt_WheelRear_L,
                offset = 1.3 0.0 0.0,
            }
        }

        part TireRearLeft
        {
            model InflatedTirePlusWheel
            {
                file = ATAPetyarbuilt_WheelRear_L,
                offset = 1.3 0.0 0.0,
            }
        }

        template = ATA6Wheels/part/TireMiddleRight,


        part TireMiddleRight
        {
            model InflatedTirePlusWheel
            {
                file = ATAPetyarbuilt_WheelRear_R,
                offset = -1.3 0.0 0.0,
            }
        }

        template = Tire/part/TireRearRight,
        part TireRearRight
        {
            model InflatedTirePlusWheel
            {
                file = ATAPetyarbuilt_WheelRear_R,
                offset = -1.3 0.0 0.0,
            }
        }
        ```
granite ginkgo
knotty stone
#

you dont need that line

granite ginkgo
#

Hold on, I had "," after the model name, I think this is the issue

granite ginkgo
knotty stone
#
        template = ATA6Wheels/part/BrakeMiddleLeft,
        template = ATA6Wheels/part/SuspensionMiddleRight,
        template = ATA6Wheels/part/SuspensionMiddleLeft,``` you need this too
granite ginkgo
#

At least for spare wheel

knotty stone
#

just look at the template_ata_petyarbuilt

granite ginkgo
#

+I think I also need to do the same thing for the suspension

#

So i will have wheels, brakes , suspension

#

nvm, you sent it...

knotty stone
granite ginkgo
#

Haven't slepttired

#

Im dead

#

4 WHEELS BABY

#

Thanks @knotty stone ๐Ÿ’ฏ

knotty stone
#

you should resize the model a bit its looking super tiny for a truck ^^

granite ginkgo
main pasture
#

Any ideas on why OnMechanicActionDone event is not triggered after an install/uninstall of a part? "receiveObjectChange" is printed without string after it and the event is not called (B42)

storm trench
#

Coding a culling of spawned carts & trolleys that are spawned in the world to be run out of the mod options menu is going super bad. Doesn't even work when trying to get it to run. Sigh.

granite ginkgo
storm trench
granite ginkgo
#

it is, I resize my models after I finish the hard work

storm trench
#

I cannot figure out how to get this game to run a removal for all world objects spawned by the mod AlienHmm AlienHmm AlienHmm

storm trench
#

Holy s---... wait... did I finally do it!?!

I did... but only sorta. Only works on presently loaded cells sadCat

Guess I'll just keybind it/keep a local despawner in the mod options... let players clear as they wish and add a spawner in the mod options menu to spawn the carts & trolleys they lose. Bummer, but better than nothing I guess.

gilded crescent
#

where on earth are the recipes for forging items, like axe heads and such, I've looked all over in the game files recipe folder but can't find a single thing to do with forging axe heads, knife blades or anything of the sort

queen oasis
storm trench
storm trench
# queen oasis cell is probably the best you could hope for

Do you think CTRL+ALT+SHIFT+L is too cumbersome of a keybind? It'll be in the mod options menu, but I want a not-so-easy-to-mistakenly-bump keybind to allow players to clear their current cell of cart & trolley spawns without having to go into the mod options menu. (You can spawn new carts & trolleys in that mod options menu tho to replace one you'd lose by running the culling tho btw).

queen oasis
storm trench
gilded crescent
queen oasis
#

<@&671452400221159444>

left plank
vast pier
#

Straight mag feed version

broken kayak
#

I'm currently trying to do stuff when the player equips a clothing item, as OnClothingUpdated is being called when the clothes gets bloody and dirty, it doesn't sits right by me to loop through the inventory every time, right now I'm using the getItemsFromCategory function to only iterate through relevant items, but I was wondering if anybody had a better way to detect an item that was just equipped ? Or maybe get the last equipped item.

queen oasis
broken kayak
queen oasis
#

I would go with the "Store the original function in a local variable. If your overwrite doesn't need to run, call the original." option

broken kayak
#

Yes I am on that guide right now

bronze yoke
#

in this case you very likely want to always call the original

broken kayak
#

I'll try this out.

#

Though I'm not seeing a ref on the item being equipped

queen oasis
#

when I see albion typing after I post and I'm like uh oh, what'd I get wrong ๐Ÿ˜„

#

it would be self.item

broken kayak
#

Yeah just noticed that, I really should look harder before typing ๐Ÿ˜ญ

#

Well thanks, it does seem like a better option.

cinder nebula
#

Hi, all. How may I make sliders in the MODs tab refresh it's numbers live and/or do a UI refresh when I click the "Reset to Defaults" button I made? I have the following code, which resets the numbers on my sliders, but the numbers only refresh after hitting Accept and going back into the MODS tab:

-- Attempt to refresh the parent panel
if config.options and config.options.instance and config.options.instance.refresh then
config.options.instance:refresh()
print("[ModOptionsSetup] Refreshed mod options panel")
elseif config.f4_slider and config.f4_slider.parent and config.f4_slider.parent.refresh then
config.f4_slider.parent:refresh()
print("[ModOptionsSetup] Refreshed parent panel")
end

queen oasis
cinder nebula
# queen oasis I don't know much about mod options, but maybe your "Reset to Defaults" button f...

A good idea, thank you. I actually have the default slider values stored, and the sliders do reset to those numbers when the reset button is click, it's just the UI is not refreshing for some reason.

For whatever reason, when I click the Reset to Defaults button, it's like there was no actual user input, because the Apply button at the bottom of the Options screen doesn't highlight/cannot be clicked on, but when I click on a slider arrow, then the Apply button is highlighted and can be clicked on, thus updating the UI.

storm trench
#

This mod options BS is going to make me lose my freaking mind. This is wild. I have been fighting with it for hours now. It just will not freaking work lolll.

outer crypt
#

is it possible to change a sound script after the game loads in lua? Like changing the clip filename on the fly?

cinder nebula
storm trench
cinder nebula
#

"It" being what, exactly? The text in your UI_EN file?

storm trench
#

My stuff, which would show up in the mod options menu before I added the keybind alternatives, now does not.

queen oasis
storm trench
# queen oasis I'm guessing there's no errors?

Nope, it just won't work. I have even tried staring at multiple mods that use it and referencing mine and it just doesn't work. Who knows. About to just delete all the related stuff and start back over from scratch again.

#

I can't wait to stop working on this mod.

cinder nebula
#

You have at the top the ones you are using of your script?

local config = {
keyBind = nil,
checkBox = nil,
textEntry = nil,
multiBox = nil,
comboBox = nil,
colorPick = nil,
slider = nil,
button = nil
}

and local options = PZAPI.ModOptions:create("UNIQUEID", "Example")

queen oasis
cinder nebula
#

If it helps, I have been using Grok3 for all my coding purposes, and have been getting by with making mods, even getting mod options to work. I fed it the original code from the ExmapleModOptions mod and that helped greatly for Grok3 to figure out.

storm trench
#

It's fine... I'll figure something out, idk. I appreciate the effort to help tho, I do.

cinder nebula
#

Does anyone know if the author (Rezistor) for the Combat Text (B40+B41+B42) mod is active in this discord?

storm trench
#

These mod options are just kicking my butt.

cinder nebula
#

Want to share what you have, maybe I can help?

bright fog
storm trench
#

Thank you. I am almost there, I hope. I got it to show the mod name in the mod options menu, just none of the options.

umbral raptor
#

How do I make a fluid container return to it's original item?

merry patio
#

Hi there! question, does anyone know how to modify the value of beds to increase the quality of sleep?

umbral raptor
#

For example. I want a large pop bottle of coke to return to being an empty bottle instead of an empty version of the bottle of coke

cinder nebula
# storm trench Thank you. I am almost there, I hope. I got it to show the mod name in the mod o...

If you want to add a keybind, you need to add it to the top on local config and then add in config.keyBind = options:addKeyBind("0", getText("UI_options_UNIQUEID_keyBind"), Keyboard.KEY_Z, getText("UI_options_UNIQUEID_keyBind_tooltip")) in the main body of the code somewhere.

The "UI_options_UNIQUEID_keyBind" and "UI_options_UNIQUEID_keyBind_tooltip" are the text that displayed for the button and are drawn from the UI_EN .txt file, located in Workshop\Your mode name\Contents\mods\Your mod name\42\media\lua\shared\Translate\EN

Like I said, I explained to Grok3 my issue and what I was trying to achieve, and attached my mod's lua file, the ExmpleModOptions.lua file and my UI_EN.txt file in the chat box for Grok3, and it was able to add in the proper mod options code.

storm trench
cinder nebula
#

What exactly are you trying to do again? Temporarily disable CleanUI and see if that fixes the issue.

storm trench
# bright fog Snowball effect ?

Yep, for whatever reason those keybinds have been hurting my ability to implement mod options. I had them all set and working before I did it.

bright fog
storm trench
bronze yoke
#

yeah but like, what's happening?

#

if the keybind options appear but stop others from appearing there's probably a runtime error somewhere between that and wherever you add the others

#

do you get any errors?

cinder nebula
#

OK, how do I disable the stuff that appears/happens when I am in debug mode and hit F2 (a bunch of overlays), F3 (character going invisible) and F6 (long string of text that appears next to character)?

storm trench
bright fog
#

This literally doesn't say anything about what your problem is

storm trench
#

Sigh. I dunno. I have been fighting with this all day. 12 hours. I'm fried.

cinder nebula
#

Yeah, take a break. Definitely do something else, so you can come back and tackle it when you are refreshed another day.

gloomy kite
#

Is there any kind of audio monitor tucked away in a debug menu? Something to tell me what audio files are playing? I'm trying to track down the body-dragging sound, I've searched all the keywords I can think of

#

thinking they might just be reused vehicle sounds but still an audio monitor would be a nice thing to have

winter bolt
silent zealot
storm trench
silent zealot
#

If you want, send me your mod and I'll have a look at your mod options. Took me a bit longer to make them all work than it should have, so I'll see if I can figure out why they don't like you.

#

I need a good sitraction, my jaw has locked up and instead of being able to wiggle ita bit and clunk it back into place I just.. can't open my mouth more than ~cm without pain, like I've badly pulled a jaw muscle.

#

And after an ER visit turns out that just like teeth are luxery bones, so is your jaw and I will need a TMJ dentist if it does not go away on it's own so... disctration good lol

storm trench
storm trench
silent zealot
#

What if you made a new mod, copied over the mod options, and all the new mod does is a function called MizzOptions() that prints out the options?

#

easy way to test without dealing with everything else

queen oasis
#

"luxury bones" - must be in the US too

#

I want zombies to grab animals and drag them off.

storm trench
whole yoke
#

how can i make a hair use hair gel to put on? Like the mohawk or smt?

#

for my mod that is

#

from what i REMEMBER i think it was a certain true/false thing in hairstyles but digging in the vanilla files there i cant find it

#

NVM, no longer needd

#

needed*

grave blade
#

Is there any mod/api that can provide server information?

silent zealot
silent zealot
grave blade
#

all kind, players(name, id, location in map, zombie deaths, all i can track), inserver time, day, power is down or not, etc.

#

is there anything already built somewhere i could take advantage of or should i just build it from scratch?

silent zealot
#

Those things are all available, but all in different places.

grizzled fulcrum
#

I think that would have to be a mod installed on a per-server basis for it to work right?

silent zealot
#

Maybe not total zombie deaths.

grizzled fulcrum
#

Because the servers dont expose stats like that unless you join the game as a client, unless im mistaken

bronze yoke
#

if you're trying to get that data for your server you can make a mod that writes that stuff to an external file (presumably you want to use it for something external?)

grave blade
#

i was already thinking about creating a mod to get that information cause i know most of the info is not exposed to the public, i was just wondering if theres already a mod or tool that does that kind of thing

silent zealot
#

e.g: power is getWorld():isHydroPowerOn()

grave blade
#

so i can get real time info

silent zealot
#

check to see if any existig mods do that

#

Figure out how you're getting the info from the server to whatever will make it public; I don't think there are any lua-accessible function for pushing data to external servers for example.

#

Then just work trough the list of stuff you want to collect piece by piece.

grave blade
#

i can just log into a json file no?

#

or... idk i guess ill figure it out eventually

silent zealot
#

Keep in mind that (in theory at least) lua functions that can affect things on the filesystem or outside the gane shoud be removed or locked down.

silent zealot
#

You can print text to console.txt and have some application consume that.

grave blade
#

but that would require me to perma log something on a file

#

instead of just pinging the information on a request for example

silent zealot
# grave blade wdym

Think about security: what happens if you let any mod on steam do anything it wants to player's computers?

grave blade
#

im not uploading the mod anywhere but my machine

#

this is for private server purposes

silent zealot
#

Sure, but the games implementation for lua wasn't built for your single server. It was built for everyone.

grave blade
#

oh wait

#

you mean that for security reasons i might not be able to do what i want right?

#

sorry my english aint that good

silent zealot
#

I'm not saying you can't do it, I'm saying don't assume that all general purpose lua functions for making external API calls/hosting something that can accept external API calls/writing to files will be available.

#

I recommend figuring out how to get data out before spending time collecting the data to send out.

silent zealot
#

If there are any existing mods that do that, checking how they did it is an easy first step.

grave blade
silent zealot
#

(I don't have the B41 link handy anymore)

grave blade
#

42 info aint gonna work for me since mp isnt available yet SCwhattheheck

silent zealot
#

I know; that's why I mentioned the version. There is a zomboid B41 javadocs hosted somewhere, I just.. forget where.

#

Thanks Sir Doggy!

grave blade
#

lovely

storm trench
#

Yeah I'm 100% just deleting everything I worked on today and starting over. This is ridiculous.

grave blade
#

like here or somthn

grave blade
#

has to be real time info, not just on shutdown or start

#

but thanks anyways

grave blade
#

where do you put the mods you are testing?, i dont have workshop id or anything so how do i install them in the server?

storm trench
queen oasis
storm trench
#

lol it's fix was to add a commented line...

covert cape
#

I've seen that tires in game have a friction attribute, is it possible to add low friction tires (drift purposes)?

vague marsh
queen oasis
storm trench
storm trench
#

All of em, really.

queen oasis
#

so it looks like you need a checkbox to enable key binds, some key binds to spawn carts / trolleys, and a button or key bind to remove carts / trolleys? @storm trench

#

the announcements you could probably get away with an OK modal if you needed that

storm trench
# queen oasis so it looks like you need a checkbox to enable key binds, some key binds to spaw...

Really just a button to spawn carts, spawn trolleys, remove all spawned carts/trolleys in as wide an area as possible, and turn on/off dialogue above the player head an enable/disable the keybinds. I've worked all day just to make this work. I had everything else working as of last night. But being that this update is geared to players with existing games with the (fixed, but unreleased) overspawning issue, I don't want to roll out the fix and leave everyone completely stuck with it.

#

The keybinds are only 1 each for the spawning and then remove all spawned carts/trolleys.

vague marsh
queen oasis
storm trench
queen oasis
#

nice

storm trench
#

Yeah, I couldn't and still can't make any sense of it.

queen oasis
#

hang on, I'm learning with ya here. I've never played with mod options before...

grave blade
#

that didnt took long to make Happy_Gabe

bronze yoke
storm trench
bronze yoke
#

yeah, ai really isn't effective for modding at all

storm trench
#

Closest I got was the name of the mod appearing in the mod options only when I had an error for using the wrong property. And only that one property.

queen oasis
#

I just don't know how to read

pine patio
queen oasis
queen oasis
# storm trench Closest I got was the name of the mod appearing in the mod options *only* when I...
local config = {
    checkBox  = nil,
    button    = nil
}

local function ZuperOptions()

    local options = PZAPI.ModOptions:create("ZuperCartModOptions", "Zuper Cart Mod Options")

    options:addTitle("Zuper Cart Mod Options")
    options:addDescription("Grok can f itself")
    options:addSeparator()

    config.checkBox = options:addTickBox("Chatty", getText("UI_options_ZuperCartModOptions_Chatty"), false, getText("UI_options_ZuperCartModOptions_TickBox_Tooltip"))
    
    options:addSeparator()

    config.button = options:addButton("SpawnCart", getText("UI_options_ZuperCartModOptions_SpawnCart"), getText("UI_options_ZuperCartModOptions_SpawnCart_Tooltip"), spawnCartFunc)

    config.button = options:addButton("SpawnTrolley", getText("UI_options_ZuperCartModOptions_SpawnTrolley"), getText("UI_options_ZuperCartModOptions_SpawnTrolley_Tooltip"), spawnTrolleyFunc)

    options:addSeparator()

    config.button = options:addButton("Remove", getText("UI_options_ZuperCartModOptions_Remove", getText("UI_options_ZuperCartModOptions_Remove_Tooltip"), removeCartsFunc))

end

ZuperOptions()

To access your options from your code:

local options = PZAPI.ModOptions:getOptions("ZuperCartModOptions")
local tickBoxValue = options:getOption("Chatty")
#

you'll obs need to make the translations

bronze yoke
#

not sure what you'd need to delay it for

queen oasis
#

learning complete, time for more drink

storm trench
queen oasis
#

because a lot of us have been waiting for it ๐Ÿ™‚

storm trench
#

Hahaa I know, I was one of em. Hahaa.

grave blade
#

Hey @silent zealot, just to let you know i finally made it work SCwhatiscatwant, also i realized server-side mods are not a thing in Zomboid, but i also realized as long as players have a mod with the same id it will still let them in so they can install an empty mod with the same id and they will be able to join.

silent zealot
#

Nice

#

What method did you end up using to exfiltrate eeh data?

grave blade
#

when theres players inside the server the mod just writes info in a json and updates it every 1m (i guess if theres no LOGS in console this wont be a problem at all), then i just use an api to read that file and print the info

#

imma still check if i can get events like player death, or player shoot etc.. i want my discord bot to say: Shotgun shots heard in "city"!

#

tomorrow imma buy a few redbulls and make somethin gud Happy_Gabe

silent zealot
#

Good idea!

grave blade
# silent zealot Good idea!

I just realized something, mods wont work if theres no players in the server, so i cant know if theres 0 players Happy_Gabe

#

im just gonna check if the mod is updating, if not imma put players: 0

bronze yoke
#

most are

grave blade
#

noice

#

The trick seems to be working...

When im playing:

#

After 30s with no updates: (clears player list)

muted garnet
#

is it possible to get the exact degree of the angle where the character is looking? And is it possible to turn the character exactly by a degree during timedaction?

slim swan
#

anyone know how to make a patch for other mod?

#

i make that cleanui mod,but the position of autoloot button is not good for my mod

knotty stone
#

if getActivatedMods():contains("\\AutoLoot") then --autolootbutton function--- end something like that? just copy the function that creates the button and change what you need?

granite ginkgo
#

Should I add a trunk door if it has a flatbed?

knotty stone
#

depends how realistic you want to have it i guess? if it has a door at the back why not. its the same for the pickups, you can still loot them even if the door is closed

granite ginkgo
#

part SeatMiddleLeft
{
door =,
}

granite ginkgo
knotty stone
#

explosion? ๐Ÿคฏ ๐Ÿ˜„

granite ginkgo
vast pier
#

less total item sprites, even more possible variety.
not really sure how to do the math this time, since 2 of the weapons can't use the mag feed attachment, and 2 of them can't use the stock attachment
4 weapons total, 2 bolt action and 2 semi auto

#

Now I just need to edit the code so it knows what color the mag tape should be as well

vast pier
#

Mags are now appropriately colored ๐Ÿ‘

granite ginkgo
#

Anyone has experience with adding custom number of seats? I tried 3 different ways already and nothing worked, I need 3 seats (Front left, right and middle)

main pasture
granite ginkgo
#

ill check this script, but tried with templates and so on

main pasture
#

So there are incorrect number of seats?

granite ginkgo
#

since i want 3 seats i said seats = 3

#

i guess i did that right

main pasture
#

Yes. Then just add FrontLeft, FrontRight and MiddleLeft (for example), seats, their corresponding areas and set their position correctly in the editor

granite ginkgo
#

what if i use 6 seats and delete 3?

main pasture
#

Just quick and dirty "middle seat". You have to select which side of the vehicle player can enter the middle seat (when you are setting the area)

granite ginkgo
main pasture
tranquil kindle
#

Doesn't RV's for RV interior mod does this, or busses? IIRC you enter bus in all seats with a only entrace being side one?

silent zealot
#

There are also two door cars with four seats

#

And if you have a seat with no door I believe sitting in it makes you safe from zombies.

granite ginkgo
slim swan
#

I found a serious bug.

#

When you enable group attack and attack both zombies and windows at the same time, the game crashes.

vast pier
bright fog
#

Cool stuff !

granite ginkgo
#

Is there any way to remove the 3 rear seats of a 6 seats template?

#

These only appear in the seats UI as I removed them from the script

tacit pebble
ancient grail
tacit pebble
#

I heard a lot of people has said same as rocco said so.. that should be a bug.
Because since B42.0, there's a bug that window is also destroyed when you attack zombie, when window is located at same direction. (Like bullet tracer // I felt like player's melee penetrated zombie and destroy window behind of zombie)

bright fog
granite ginkgo
main pasture
granite ginkgo
queen oasis
bright fog
queen oasis
bright fog
#

Anything that is user depend, like UI elements and shit, can be mod options

granite ginkgo
#

Fixed the size

#

Now I gottta fix the seats template, physics and minor texture, then make the other variations

main pasture
granite ginkgo
gilded barn
#

guys I've discovered a different issue, I deleted my mods everywhere, even used the safe launch but my pz just keeps the mod files there.

gilded barn
storm trench
queen oasis
#
local options = PZAPI.ModOptions:getOptions("ZuperCartModOptions")
local tickBoxValue = options:getOption("Chatty")

if tickBoxValue then "do announcements code" end

same idea for the key bind. you'll want to pull the keybind value into your code and set an Events.OnKeyPressed.Add(function) to your code and then check if the key pressed was your keybind value

storm trench
#

I'll give it a go again, but we'll see if it works.

#

Thanks!!!

storm trench
slim swan
#

i test it without any mod loaded

storm trench
#

...wait... where would I put a java folder? In just \42? Or would I need a top level one like media as well? Or just within media so it goes where that goes?

bright fog
#

Java mods require manual installation

queen oasis
bright fog
#

Requires manual installation

#

Java folders are not a thing in mods

storm trench
#

Well that makes my life a whole lot easier, but not everyone elses.

#

I suppose I'll work the alternative means first.

thin walrus
#

Hello, can I ask a question? If the mod I want to translate and create a separate translation mod for already has a built-in translation into my language (but of poor quality), how can I make my translation take priority? Currently, only the existing built-in translation is being displayed.

tacit pebble
#
  • Make a new own mod
  • Put your mod bottom of original mod
  • Done

Detail: Original mod will be loaded first
and your mod will be loaded later
(Top to bottom sequentially)

So your mod will be able to override original mod's translation key

(translation key is something like.. IGUI_HelloWorld_EN = "Hello, World!")

storm trench
# bright fog Java mods require manual installation

Maybe I should just make a java mod for the fix I need, entirely separately from the main mod, and set it as a requirement. That way maximum capacity changes can be used by others and not simply by only the carts in the mod? I am mostly worried about description bloat and people not following directions.

bronze yoke
#

haven't people already fixed that without java? you could add the mod that does that as a dependency

bright fog
sand abyss
#

We are looking to recruit a staff member in exchange for 10% of all server donations. We are looking for help in specifically adding SSR quests into our server. If youโ€™re interested, please reach out

storm trench
#

...such as? @bronze yoke @bright fog

Also Albion, weren't you the one who told me fixing this limit in java would be my best option? lol

bronze yoke
#

it would be the easiest way to do it but i don't really encourage anyone to make java mods, it's too annoying for the end user

#

i can't find that mod because iirc it was a default icon mod with a terribly unhelpful name and description

bright fog
#

I'm 100% certain mods already do it

#

And I believe some exist that do java-less

#

CapacityLimitBypassB42

#

This mod has a submod

#

It's a manual install

bronze yoke
#

how did they even need to change 20 java files for this

bright fog
#

Did they ?

#

I didn't check

#

There's other standalone mods for it

bronze yoke
#

i'm 100% sure there's a pure lua one that they just made completely fucking impossible to find

storm trench
#

Maybe we can just yell at TIS to stop introducing dumb stuff we can't mod around.

#

Easily, anyway.

storm trench
bronze yoke
#

there was no limit in b41

#

that's why people are so mad about it now

bright fog
#

But I haven't seen many requests actually being introduced in the game, or when they did they didn't even do it properly issoumini

storm trench
bronze yoke
#

yes

storm trench
#

Thanks.

bronze yoke
#

it wasn't something that interested me so i didn't subscribe to it or anything but they were bragging about it a bunch here

thin walrus
bright fog
#

But finding it, yikes

thin walrus
bright fog
storm trench
#

Welp, without finding that mod I guess the best thing is to introduce a limited one for the mod fork.

bright fog
#

Can't seem to be able to find the lua fix

bright fog
#

What is your mod about ?

storm trench
#

I need a break a bit from modding for the day, so I'm just gonna pester a bunch of AIs about running through the decompiled code to find a flaw I can maybe exploit.

storm trench
bright fog
#

Hmm

#

Yea

#

This applies to every containers

#

But I bet it has something to do with the timed action of putting items in containers

#

And so you might be able to just ignore the check. But if it's hardcoded to stop putting items in containers if it goes over the limit then you're fucked

#

And java it is

queen oasis
#

the only real lua flaw I found is you can increase the capacity during transfer. it breaks animations though and probably other important stuff

storm trench
bronze yoke
#

what i'll say is that even though the limit is defined in java, it is 100% enforced by lua

#

by patching the right methods you can definitely bypass it without a java mod

bright fog
tribal iris
#

I wasn't able to find one but does anybody know if there's a mod that turns hay bales into usable hay for animal feed?

south bear
#

Does anyone know where to find the vehicle collision sound? I'd like to trigger it during a certain code event in my mod!

Thanks in advance! kardchalice

queen oasis
#

is there somewhere already to post code snippets?

#

besides in here

south bear
# bright fog Probably in the bank files

Sorry - totally new to the sound portion of this - bank files? Where/what is that? (Also - Thank you so much Jvla!)

Another question: I have been able to update the condition of all parts on a vehicle from client side, but it doesn't sync to the server.

How can I get the vehicle condition set on client side synced to the server?

bright fog
#

Bank files are files that store a lot of sounds

mellow ravine
#

where would you find hat models?

#

or the textures...

long grove
#

Want to get started with modding zombie spawning and behavior. Can someone recommend the best decompiler and some essential up to date tools to get started looking at the source code? Have some low level programming experience. Feel overwhelmed by the mod tools and resources thread.

bronze yoke
#

for browsing the source code i recommend intellij idea but a lot of people here will use vscode since you'll probably use that anyway for actually writing mods

main pasture
bright fog
fleet cloak
#

Does anyone know if itโ€™s possible to make mods that add custom radio stations or TV shows?

hollow finch
silent zealot
fleet bridge
silent zealot
storm trench
#

Welp, I got the trollies to hold 50... but still can't equip it if it is holding more than 37 encumbrance.

silent zealot
#

You need to be able to pick up a bag (or trolley-shaped bag) before encumberance reduction to equip it.

#

And your character has a hard-limit of 50 kg held

#

I think if you make a function that 1) adds trolly item directly into player inventory then 2) removed item from world and 3) equps it it will work around that, since you would code that without the capacity checks - I don;t think java ever checks cpacity, it trusts lua to do that.

long grove
silent zealot
long grove
#

I got that. All I see is a bunch of objects and a .class object

bronze yoke
#

i'm really surprised you can even get that error, but that error just means the logger failed to create its file which doesn't prevent the rest of the program from running

silent zealot
#

it's a .jar file, no need to extract anything.

#

You can extract things, since a .jar is like a zip full of .class files and other bits, but you should leave it as a jar to run.

long grove
#

ok so, is java not installed properly or something? Do I open it with java?

#

because its showing up as winrar file

silent zealot
#

I suspect java is not installed =- have you manually insatlled a Java run time on your system?

long grove
bronze yoke
#

they did get some java output, my guess is maybe it doesn't have a file association?

#

the normal operation is to just download the jar and then double click it and wait

long grove
#

if I double click it, it opens in winrar and I see a bunch of folders and module-info.class

silent zealot
#

that's a file asociation thing

#

try right click -> open with

long grove
#

so right click the 'zip file', open with Java SE binary?

bronze yoke
#

yeah

#

java's jar files are literally just zip files with java stuff in them, they aren't actually different formats other than the fact that specific files are expected inside them to be a runnable java program

long grove
#

ok doesnt work, because the command line didnt work either

bronze yoke
storm trench
long grove
# bronze yoke you say `etc`, do you get other errors? the one you posted doesn't really tell m...

C:\Program Files\ZomboidDecompiler>java -jar ZomboidDecompiler.jar "C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid"
java.io.FileNotFoundException: logs\main.log (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:295)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:185)
at java.base/java.io.PrintStream.<init>(PrintStream.java:364)
at com.github.zomboiddecompiler.FileLogger.<init>(FileLogger.java:11)
at com.github.zomboiddecompiler.ZomboidDecompiler.initLoggers(ZomboidDecompiler.java:253)
at com.github.zomboiddecompiler.commands.Decompile.call(Decompile.java:177)
at com.github.zomboiddecompiler.commands.Decompile.call(Decompile.java:17)
at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at com.github.zomboiddecompiler.commands.Decompile.main(Decompile.java:188)

C:\Program Files\ZomboidDecompiler>

silent zealot
long grove
#

permissions issue maybe?

silent zealot
#

Permissions error? Can't create the log file?

#

Where are you running it from

bronze yoke
#

that's possible but this exception is caught, it shouldn't really matter```java
try {
log = new FileLogger(new File(logDirectory, "main.log"));
} catch (FileNotFoundException e) {
e.printStackTrace();
log = new DummyLogger();
}

silent zealot
#

try: make a logs directory and a ``main.log` file in it

long grove
#

the jar file is in C:\Program Files\ZomboidDecompiler

bronze yoke
#

it might need more permissions to do stuff in program files

#

try putting it in C:\ZomboidDecompiler or something

long grove
#

ok

silent zealot
#

Make a c:\pz\ with Everyone/full permissions to rule out it being a permissions issue.

#

I think Albion might be right about Program Files being a bit more locked down to random processess creating files.

long grove
#

moved to C:\ZomboidDecompiler

#

still looks like a rar file, couldent open with. Had to run command line again but now there is log and output folders created as expected

silent zealot
#

yay

bronze yoke
#

glad it worked out, i'm reshuffling a couple things internally so it'll log stuff like this better in the future

silent zealot
#

you can fix the file association if you want, but you're probably only going to use this once per Zomboid update.

long grove
#

I changed association now it looks like an executable jar file at least

#

tried running with double click but don't see any change in the main log file

bronze yoke
#

i actually had issues with the file association too (mine was stuck on a way older version of java) and it's a real pain to set up properly

#

if you know how to use it from the command line it's probably not worth the effort

#

i don't remember exactly what it was but you have to edit the file association using some command line crap because it needs something more complex than the windows picker allows

#

i think if you just have the association the normal way, it tries to run java ZomboidDecompiler.jar when it needs to be java -jar ZomboidDecompiler.jar

long grove
#

Please advise how to search through multiple files with VS code. For example all occurrences or origin of "ZombieGroup" from zombie\ai\ZombieGroupManager. As I want to learn how the grouping and instance deactivation works. I'm not used to dealing with multiple large code files

bright fog
bronze yoke
#

if you open the whole source folder, you can use ctrl-shift-f to search the entire directory for text

bright fog
bronze yoke
#

i assume you have a java extension (or maybe vscode comes with one), you can most likely use that to jump to the definitions/usages of elements

long grove
#

I remember there was a way to do it with notepad++ but I don't know how to do it with VS

bronze yoke
#

i'm not in vscode so the shortcuts are likely different but when i press ctrl-n it opens a search window for class declarations (or i can move to the symbols tab to search for functions and fields too)

#

when i'm there i can click the 16 usages text or ctrl-click the name of the class to show me every place that class is used

bright fog
#

Might be things to be able to do that idk

bronze yoke
#

check your java extension for any settings with the term 'code lens'

#

that's usually what it's called

long grove
#

adding "Extension Pack for Java"

#

I want to check all the java source files in zombie\ai\ for where "ZombieGroup" shows up in the code

bright fog
#

You don't need no extension for that

long grove
#

that means I have to open them all and search each one individually?

bronze yoke
#

you can open entire folders in vscode

#

it should be in the dropdown when right clicking a folder in file explorer

bright fog
#

mb thought the way you asked your question that you had read the wiki page

bronze yoke
#

you can also do it from here

bright fog
#

Since you used the exact terms I used about searching in a folder

#

Check this

long grove
bronze yoke
#

ctrl-shift-f should search the entire workspace

bright fog
#

Usually the go-to is to open the entire decompiled java, then use the search function (loop on the left bar) and search in specific folders if needed

#

But that works too

#

Use the loop function on the left bar

#

Or what Albion said probably

long grove
#

I think this is what I want? I'll try what you said too Doggy

bright fog
#

Sounds good

long grove
#

Any advice on how to browse the code effectively to learn about zombie ai, grouping, and spawning? I have a general idea of how they are coded conceptually from this video:https://www.youtube.com/watch?v=hglrA6FrxOw&ab_channel=Retanaru

But I would like to start associating their behaviour with the code. Do I start from the bottom level or top level then down?

In this video I explain and show off the zombie migration mechanics. The sandbox mode lets us modify many of the main mechanics of the game and allows me to show off what does what. The redistribution hours and in game sound events are the primary movers of zombies while the rally group system and others help to smooth the rest out.

https://ko-...

โ–ถ Play video
bright fog
#

You're getting started with the java with quite a beast I think here

#

The way I'd do it is start from something I know about which is related to the spawning of zombies

#

Notably the sandbox options

long grove
#

well you know, low level where all the base things are defined and the top level where they are used to build things out of

#

yeah its a beast to learn but I just wanted to start with some browsing to get an idea of how things are structured. I'm used to really low level stuff, not how to relate large seperate files of code relate to each other

bright fog
#

That's fine, like I said the way I'd do it is start from something I know

#

You know like finding an item script, I'd start with its name

bronze yoke
#

this is likely one of the most complex things you can start with

bright fog
#

I think the issue you might encounter is that it probably is spread out a lot ?

#

But I don't know how it's defined in the java so hard to say

#

But it does feel like a complex system

long grove
#

so start with something simpler like doggy suggested? How the sandbox settings affect the population in code?

bright fog
#

It's not like there's a big sign saying SPAWNING SYSTEM IS DEFINED HERE, COME OVER

#

You got to know where to look for

#

And I don't know if ZombieGroup is it

#

So the way I'd find it is by starting from the sandbox options

#

And from here, go up until I find what I was looking for

long grove
#

Ok thanks. And the best way is to search up functions or variables and see where they are used/defined?

bright fog
#

In the case of sandbox options, I'd search from the sandbox option ID but I just realized they are not defined classically for the vanilla options

#

Still worth starting there I'd say

bronze yoke
#

i'd recommend trying to get code lens to work since that'd make finding usages of things massively easier especially if they have kind of generic names

#

usually not class names but function names and field names can be really generic and hard to search for by text

muted garnet
#

is it possible to get the exact degree of the angle where the character is looking? And is it possible to turn the character exactly by a degree during timedaction?

bright fog
#

Yes !

#

I did exactly something like that with a timed action

#

I made the character aim at a direction

#

However, it required aiming in my case

bronze yoke
long grove
bright fog
#

Has nothing to do with what albion described I think ? ๐Ÿ˜ญ

#
-- get job delta
local delta = 1 - self.action:getJobDelta()

-- get coordinates
local character = self.character
local p_x,p_y = character:getX(),character:getY()
local squareTarget = self.squareTarget

-- get vector
local vector = self.vector
vector:setLength(self.distanceToStartPoint * delta)

local x_target = squareTarget:getX() + vector:getX()
local y_target = squareTarget:getY() + vector:getY()

local x,y = x_target - p_x,y_target - p_y

vector = Vector2.new(x,y)
self.character:setForwardDirection(vector)

self.vectorEnd = vector

That's how I was setting the player looking direction, but it was only working if I force the player to aim

bronze yoke
#

i don't have any experience using copilot but i'd expect it to be unreliable

bright fog
#

I use it and it does okay, but it will hallucinate some stuff as usual

#

Like any AI tool you need to stay critic of it

long grove
bright fog
bronze yoke
#

people post ai code here sometimes and it's always dreadful and 90% hallucinations

bright fog
#

For multiple reasons if I have to guess:

  • it won't have the entire game code in mind when answering questions or specific elements
  • it won't understand some principles of PZ API
muted garnet
# bright fog

Thank you very much! This is exactly what was missing

silent zealot
#

you could be optimistic and start withe the classes under the ai folder, like zombie/ai/zombieGroupManager

outer crypt
#

ran into a strange bug where TV presets disappear. I tried to force to add them back in with addPreset() and it doesn't stick even on the device as the preset list is pulled up. I can tell that all the channel info is there because if I force the channel it works just fine. self.deviceData:setChannel(222)
self.deviceData:getDevicePresets():addPreset("Monty Python TV 24/7", 222)

silent zealot
#

What makes the presets disappear?

#

Also are you adding a 24/7 Monthy python channel because that is a great idea.

outer crypt
#

That's the odd part, been using dynamic channels for a while with radio stations and its never been an issue, added one TV Channel and it makes other mod channels disappear in the presets. If I stop that one channel from loading it works fine. I also noticed it does that with Emergency TV Channel

#

So the Monty Python channel already exists. for some reason the TMRadio TM MTV channel makes the preset disappear on tv's.

#

but if I force the tv to 222 it works fine

silent zealot
#

Sounds like something is coded with "makes the preset the vanilla presets + my station" instead of "presets = current presets + my station"

outer crypt
#

If I have the code print out the presets it sees it does not see 222 anymore.

silent zealot
#

Or the gui can't handle that many presets... do they show if you access presets via lua?

#

nevermind, you just answered that one.

outer crypt
#

So I never added the presets with the TMRadio code, they get added to the list of channels in the game. On the save I can see the channels loaded. even if I edit the save and add the 222 channel it still does not appear in the preset.

#

Basically the TV Channels and Radio channels are handled the same in game just different frequencies. At the last leg the TV doesn't allow you to create presets, it loads them from self.deviceData:getDevicePresets():getPresets()

#

and the addPreset function exists and doesn't kick an error but doesn't work.

#

Not sure where the game pulls the preset list from.

#

going to check the max presets...

#

Wow! Good call! The max presets is set to 10, one more than the list in vanilla. So every time someone adds a station it kicks the last one off...

#

That's my theory anyways...

silent zealot
#

yay!

#

Now the real question is can you get past that max preset value, or is it hard-coded in the java?

outer crypt
#

there is a setMaxPreset

#

about to find out...

silent zealot
#

At least it's not like the "9 projectiles max from a shotgun" limit where going higher crashes the game because it casually goes out of bounds on an array.

outer crypt
#

that also explains why my working method of adding channels would not add more than one...

#

that did it, bumped the preset limit and then it worked immediately...

#

so now I just need to find where that is set in the game to adjust all devices from the start if I can.

silent zealot
#

What object is the limit in? RadioData?

#

DvicePresets.java

outer crypt
#

zombie.radio.devices.DevicePresets

silent zealot
#

just call setMaxPresets before AddPreset

bronze yoke
#

why is this a thing

outer crypt
#

I know, right...

silent zealot
outer crypt
#

I could decorate the read presets function but I would love to have it do it upon creation of the tv.

silent zealot
#

But also... yeah, why is it a thing? Unless the GUI has a limit of 10? But it probably doesnt, the list is just a dropdown that can hold lots of entries.

outer crypt
#

yeah I just proved I can move it to 11...

#

which is just awesome, cause this one goes to 11...

outer crypt
#

But it is probably oversight as before 42 there were less channels.

silent zealot
#

But even so, why put a limit on? the presets go into a list so it's not like there is an array that cna only hold 10 elements

outer crypt
#

does seem suspicious...

silent zealot
#

A general "more presets" mod would be handy, I find myself having to delete radio presets when I have statiosn added

outer crypt
#

Which means this was not MontyPythonTV's issue or TMRadio's issue or Emergency TV Channel's issue, but a failure before us...

#

Well I think you might get your wish because I will build in a maxpreset setting into TMRadio that will work for TV's and Radios...

#

Sandbox it in case anyone is worried.

#

So I am still going to have to add the missing stations back in because by the time I get to add the max preset the damage is done. But I can handle that on a list if I need to.

silent zealot
#

you add your presets with addPreset(), correct?

#

why not just setMaxPresets(getMaxPresets()+1); addPreset()

#

Or do you put your station into a lua table and then the general radio code populates things?

bronze yoke
#

hook addPreset to do that even

silent zealot
#

Can you hook a lua call to a java function?

bronze yoke
#

yeah

#

if it's an instance method you have to go into the metatable to do it

silent zealot
#

The lua metatable of the thing calling the java function?

bronze yoke
#
local index = __classmetatables[DevicePresets.class].__index

local old_addPreset = index.addPreset
index.addPreset = function(self, ...)
    local maxPresets = self:getMaxPresets()
    if self:getPresets():size() >= maxPresets then
        self:setMaxPresets(maxPresets + 1)
    end
    old_addPreset(self, ...)
end
silent zealot
#

This is amazing

#

I have always assumed we couldn't hook those API calls

bronze yoke
#

bear in mind that java doesn't go through lua's metatables so it doesn't affect java-to-java calls

silent zealot
#

And I have also always put "learn metatables" lower on my priority list.

late thicket
#

When's a horse mod dropping

silent zealot
#

that's still immensely helpful, especially when a mod idea is really "change two java api calls, but they show up in 57 different places"

silent zealot
#

extend the range of dung already in the game.

late thicket
#

Well that'd be a start

bronze yoke
late thicket
bronze yoke
#

graphics are still WIP but we're doing a little better than that

late thicket
#

Best of luck y'all give it ur best

silent zealot
#

I assume the high level plan is add animations/behavior/make it ridable/add saddlebags

late thicket
#

Yep, I'm no modder but I'm pretty sure making it rideable is the hard part

silent zealot
#

all of which are potentailly very difficult.

late thicket
#

Hardest*

bronze yoke
#

we've got a proof of concept for riding, most of the rest is just a matter of time (we have a couple rough animations, but we need a *lot* for a functioning animal)

silent zealot
#

Then you need to add horse blinkers to reduce panic from zombies. And once you have the code to do that you'll have to extend it so the horse can wear hats.

late thicket
#

Can't the behavior be a duplicate of the cows or smthn

bronze yoke
#

a lot of the behaviour is primarily dictated by their animations, which we have to do from scratch since we have a completely different skeleton

silent zealot
#

So whenever a zombie is near the horse charges the closest part of your base to destroy it, even if that means running back from freedom towards the danger just to $^@# your base up?

silent zealot
late thicket
silent zealot
#

And also explains why things didn't make much sense when I looked ta code trying to work out why my bull wasn't getting my cows preganant

bronze yoke
late thicket
silent zealot
#

Ridable cows would be a fun mod while waiting for the full horse.

silent zealot
#

Bonus: create a summonable ridable cow skeleton.

#

There needs to be some purpose for all the animal blood we can colelct when killing them!

late thicket
#

Do sum black magic shit, create a start symbol frm the blood

#

Lolz

#

Star

#

Does pour something on the ground leave a trail?

#

Pouring*

#

It'd been a fun feature ngl, we could make trails of gasoline n set traps for the zed n stuff

outer crypt
outer crypt
silent zealot
#

No way to edit the max before presets are added then, because the java creates a new DevicePReset (with max of 10) and then puts in the TV stations before you have any chance to do something.

outer crypt
#

Thank you for checking that.

bronze yoke
outer crypt
#

Which makes my fix pretty clear, check on readpreset.

silent zealot
#

I poked RadioData a bunch for the Plug in Your Radio mod.

#

yeah, because you know the TV station list should have every station, unlike radios with their random stations.

outer crypt
#

yep

#

and it's okay if I need to update it manual tbh.

silent zealot
#

Anyone else remember twiddling little knobs to tune in their TV then having to adjust the vertical hold to stop the picture scrolling up and down endlessly?

outer crypt
#

so far there are only 3 mods with channels

#

I am a cable guy by trade... the knobs where easier than the veractor tuners

#

imagine tuning your tv with that...

silent zealot
#

those things can $#^@# off lol

outer crypt
#

lol

silent zealot
#

The knobs probably turned the same piece underneath, but they were a lot esier to use.

outer crypt
#

and that is how long I have been a cable guy...

#

basically, this big tuning system allowed each channel independant fine tuning so you could just puch a button later versus tuning the station each time with one big knob.

silent zealot
#

My TV as a kid was pretty much exactly this:

outer crypt
#

yup

silent zealot
#

there was a little knob for each channel (I think it had 6, which is all you ever needed in Australia - 5 free-to-air-station and an old top loading VCR)

outer crypt
#

two screws for a screw in antenna adapter for an atari, etc...

#

ah, here in the states we had one knob for UHF and one for VHF that had a setting that flipped to UHF.

spiral hearth
#

ok so im trying to make a compatability mod for an abandoned clothing mod (im not going to publish it as i merely want to learn how they work) how would one go about it?

#

compat might not be the best descriptor for it

spiral hearth
silent zealot
spiral hearth
#

ah thanks

silent zealot
#

If there are recipes you will need to redo them

spiral hearth
#

im not confident with the actual coding yet i just wanna get used to how the actual models work and form around the body

silent zealot
#

If there is an existing B41 mod that has already been done; that part of the game did not change in B42

spiral hearth
#

what do you mean with "that part of the game did not change in b42"?

spiral hearth
#

i was trying to see where i could find a resource on how to change the model to work with the vanilla model

silent zealot
spiral hearth
#

ahhh

#

thanks

silent zealot
#

If the clothes were not built for the default character model though, try #modeling channel if you need some help.

spiral hearth
#

ah thanks

silent zealot
#

And if you have not used Blender before, enjoy the initial learning curve. ๐Ÿ˜‚

spiral hearth
silent zealot
#

That's good, you at least know the basics of using the interface.

spiral hearth
#

the interface is hell ๐Ÿ˜ญ

#

not intuitive at all but i can sort of navigate it

late thicket
#

Can someone make a mod that adds corpses to some cars which we can drag out n stuff

#

As in the walking dead universe

icy night
#

Hi, does anyone know where I can find the file that defines the frequency of burnt houses/building stories

sly basalt
#

hello im new in this modding community i just wonder how was the folder structure in b42?

pine patio
silent zealot
tacit pebble
#

what, I am doing wrong D:

silent zealot
#

High chance it will be in the java, not the lua

icy night
#

Ah ok

silent zealot
tacit pebble
#

stressed ๐Ÿคฃ

silent zealot
#

So the code ignores the way every mod is <steam>/108600/12335452/mods

#

And that's why WorkshopID is blank here.

#

(I think... but that is definitely the bit that generates the errors, and it's because it's asking Steam "what is the workshop id of "mods"?" when it coudl just look at the name of the parent folder...

#

(OK ignore that second bit, the function throwing the error doesn't get used to populate that bit. Plus it does still return the list of workshop IDs. So maybe steam gives multiple entries, and some are to "mods" folder and teh rest to correct folder? Either way, the error spame is not caused by mod.infe but by the way steam hands over list of paths to installed mods.)

bronze yoke
#

the problem is that they check one folder too shallow

#

this code was written for the old mod structure where that would have been correct

#

i think they don't want to fix it yet because it'll break half of all mods and makes modding permanently more annoying

#

the supposed purpose isn't even relevant until multiplayer comes out so i suspect they'll fix it around then

grizzled fulcrum
#

I figure if they're going to do a breaking change, might as well do it in b42 considering it's a major update not a bugfix

bronze yoke
#

i sort of pray they leave it how it is forever or come up with a middle ground but idk

silent zealot
#

They could fix it easily, just rewrite getIDFromItemInstallFolder() with correct assumptiosn about the paths being given

#

or even... if string == "mods" return null

grizzled fulcrum
#

I mean they could just have a legacy mod loading system for still supporting old structure

bronze yoke
#

the main bullet points are:
- every mod with a dependency is broken by this change, because the dependency's id will change
- working on dependencies is permanently more annoying because your local copy has a different id from the live copy, you have to change require ids every single time to test

grizzled fulcrum
#

oof that would be annoying

#

why would they even change the mod structure in favour of that??