#mod_development

1 messages ยท Page 316 of 1

strong jasper
#

Hello, everyone. I'm trying to implement this idea. I want the player's body temperature to drop by 0.001 with each tick. I have a function that works every tick and in the middle of it I wrote this code snippet. The problem is that it subtracts the temperature only once, not every tick.

local bodyDamage = player:getBodyDamage()
local currentTemp = bodyDamage:getTemperature()
bodyDamage:setTemperature(currentTemp - 0.001)

queen oasis
#

still hoping there's a better way to get the current selected backpack on the player if anyone has a hint to give?

Events.OnRefreshInventoryWindowContainers.Add(function(page, why)
  if why == "end" and page.onCharacter then
    local bagType = page.backpacks[page:getCurrentBackpackIndex()].inventory:getType()
    ... set a variable to reference later
#

I'm trying to catch it during an OnFillWorldObjectContextMenu event

queen oasis
tacit pebble
#

i believe "Grab x" will transfer item into selected backpack from container

#

and getPlayerInventory(arg) function is from
lua\client\ISUI\PlayerData\ISPlayerData.lua
(not from java)

mossy steeple
#

hey, does anyone have/know where to find the list of these codes for changing moodles/skills when watching vhs tapes?

queen oasis
tacit pebble
broken kayak
#

Could you point to me where I'd find documentation for this function ?
I didn't find it in the Project Zomboid Javadoc nor do I find any mention of it in the game's lua scripts

tacit pebble
frank elbow
queen oasis
tacit pebble
broken kayak
#

Well container:hasTag is most likely what I was looking for !

tacit pebble
mossy steeple
mossy steeple
#

ah! nevermind, found it

broken kayak
bronze yoke
#

yes, this is for build 42

broken kayak
mossy steeple
#

so... question. i know these codes point towards parts of the Recorded_Media_EN file, and i've changed these to match my versions of these in the appropriate mod file- is there something i have to do to generate these codes? i admittedly assumed they just had to be a unique identifier and that was it

polar charm
#

Hello, it's my first time Modding, and I thought modifying the BTSE shop code would be a good start. I set up a store, and it looks nice, but I didnโ€™t like how it had 1,000 lines of basically the same function being copied over and over looked. So, I figured a better approach would be to export the content into a CSV file, loop through it, and add the items dynamically from the CSV. I tested this locally, and it reads the file and generates the content as expected. However, when I upload it to the Workshop, it fails at this line:
local file = io.open(filePath, "r")

I added an error log to Google Drive for reference https://drive.google.com/drive/folders/11gjHIpAAJYQ7x7JUd4IfEumittA0zwuK?usp=sharing.

My first assumption was that BTSE just takes a copy of the file, but then I realized I had successfully added more PNG files to the vehicle_shop. I even placed items.csv in vehicle_shop but got the same results.

For those with experience modifying BTSE, is what Iโ€™m trying to do even possible? Or does the code not allow it? Am I approaching local file = io.open(filePath, "r") incorrectly, or am I getting the class path completely wrong? Any insight would be appreciated.

bronze yoke
bronze yoke
mossy steeple
#

ah! maybe that's not the issue then? this is the error i got trying to load it; it wasn't quite comprehensible to me

bronze yoke
#

that just sounds like a missing bracket somewhere

polar charm
# bronze yoke are you sure it worked locally??? there is no `io` library in zomboid

PS C:\Users\Bryan\Desktop\btse\BTSE_Economy\media\lua\shared> lua .\ValuesAndPrices.lua
Error loading BTSE_Economy_Shared.lua: .\BTSE_Economy_Shared.lua:330: attempt to index global 'Events' (a nil value)
Loading items from CSV file: items.csv
File found: items.csv
Price type: number
Discount Price type: number
Description type: string
Amount type: number
ItemName
Price type: number
Discount Price type: number
Description type: string
Amount type: number
Base.BallPeenHammer
Price type: number
Discount Price type: number
Description type: string
Amount type: number
Base.ClubHammer
Price type: number
Discount Price type: number
Description type: string
Amount type: number
Base.HandScythe
PS C:\Users\Bryan\Desktop\btse\BTSE_Economy\media\lua\shared>

this the results I got I ran locally. If there is no io, then could it possible be I imported a library without know locally and obviously it not working in Workshop

bronze yoke
#

to read files you can use getFileReader (relative to Zomboid/Lua/, best for things you want users to configure) or getModFileReader (relative to mods/MyMod/, best for things that are part of the mod)

polar charm
bronze yoke
#

the path is based on the function you use, not relative to the file calling it

#

with getFileReader it'd look for Zomboid/Lua/items.csv, with getModFileReader it'd look for mods/MyMod/items.csv

polar charm
mossy steeple
#

one final question- if you add custom home vhs tapes, do they automatically get added to the once-per-save pool? or do i need to go manually change something for that to happen?

silent zealot
#

Including the "spin cart around like you're doing a coin trick" that happens on some transitions.

thin swan
#

Before I start digging, anyone happen to know if there's an easy way to increase the speed of a playerobject without messing with animations?

#

Oh wait I can just check how the fast movement in debug does it

#

Just tested to see if the animation would work while debug fast movement, and look at him go lmao

thin swan
#

Damn, that might be a no-go. seems it just takes player direction and then teleports the player, so it would cause issues with collisions for sure

thin swan
# slim swan Is this scooter a vehicle?

No it's an item that you equip in both hands. I'm contemplating making it a vehicle, but it will mess with my plans to make it possible to put it in your backpack

slim swan
#

I've always wanted to make a mod that can teleport vehicles, but I've failed every time.

#

When I set the vehicle's coordinates, it always teleports back to its original position.

ancient grail
thin swan
#

Let me see if it still works in b42

silent zealot
#

And involves transforms, which involve hypercomplex numbers. Which is not a term I made up, it's the result of a theoretical mathemtaician saying "complex numbers are not complex enough, lets add two more imaginary components!" and accidentally inventing a really good way to handle 3d object rotation... provided you don't need it to be human readable.

#

But in theory, BaseVehicle:setWorldTransform() will teleport vehicles.

slim swan
thin swan
silent zealot
#

Just like the Zuper cart video I posted earlier, a little bit of jank makes it fit in.

thin swan
#

Hahaha yeah exactly

silent zealot
#

But the important question is: Will I be able to use a katana while riding a scooter?

thin swan
#

I actually want to make the scooter a weapon lol, so you can jump off and swing it around. But considering how much issue I had just getting it to fucking move.... maybe not

silent zealot
#

You could probably do it with a different item - scooter can be in ride mode, compact transport mode or swing as a weapon mode.

thin swan
#

What's the protocol for porting something to b42? Because that tchernobil mod only works for b41, but it just needs to be put in a b42 folder to work.
Just contact them and ask?

silent zealot
#

Or... what type of item is the scooter at the moment? and is there any reason it can't be a weapon?

thin swan
#

You can push while on it lol, if you tap space he kinda lunges forward a bit

silent zealot
#

I'd ask first, then make a B42 port be very clear in the description you just ported it and will remove the port when there is an official update.

silent zealot
#

There are a lot of ports like that already, I don't think anyone will mind. (unless the original mod has a "you may not copy my code at all or repackage this" type message)

silent zealot
#

yeah, that means it's a no-go for porting without permission. Still worth asking.

#

Or you have to recreate the functionality you need - not copy/paste the existing code, just make your own version.

thin swan
#

Yeah that's what I was thinking too, but not sure if I can do it without looking at their mod as reference, and then it's likely just gonna end up being a copy anyways

silent zealot
#

IMO it's not copying if you have a look to see what functions you want to hook into/modify, then write your own version of the modifications.

#

It's not like you can reasonably claim to own the rights to "mod that controls speed by tweaking the functions that control speed"

#

I also add a -- thanks to <modder name> in the code even though what I end up with is 100% different to the original mod.

thin swan
#

I guess that's fair. I made a comment on the mod page, but I guess I'll have a go and see if I can make something similar

#

What a fucking champ, he already replied and said it's a part of TchernoLib b42. Get ready to scoot!

ancient grail
thin swan
#

Woohoo! Got it working decently, just gotta make a nicer turn animation and tweak the speed values a bit ๐Ÿ˜„

storm trench
storm trench
#

I do kind of want to learn animating and make an animation for that slide though. Kind of like the Flintstones, yknow??? Hahaa.

grand gazelle
#

where do i go to beg and plead to TIS gods to unhardcode barricades โ˜ ๏ธ

sour island
#

Forums I suppose

broken kayak
granite ginkgo
queen oasis
#

it was probably way harder to red that option out than it should have been (see: way harder than I made it)

#

for's and if's and far as the eye can see -- but no ipairs

local function canWeGrabThat(playerNum, context, worldObjects, test)
    local playerBagType = getPlayerInventory(playerNum).inventory:getType()

    if not (worldObjects[1] and worldObjects[1]:getSquare():getObjects()) then return end

    local overrideData = JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE[playerBagType]
    if not (playerBagType and overrideData) then return end

    local objs = worldObjects[1]:getSquare():getObjects()
    for i = 0, objs:size() - 1 do
        local obj = objs:get(i)
        if instanceof(obj, "IsoWorldInventoryObject") then
            local objType = obj:getItem():getType()
            if JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE[objType] then
                local grabOption = context:getOptionFromName(getText("ContextMenu_Grab"))
                local subMenuOption = context:getSubMenu(grabOption.subOption)

                for j = 1, #subMenuOption.options do
                    local param = subMenuOption.options[j].param1
                    for h = 1, #param do
                        local paramType = param[h]:getItem():getType()
                        if JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE[paramType] then
                            subMenuOption.options[j].notAvailable = true
                        end
                    end
                end
            end
        end
    end
end
#

I'm not sure how to handle when there's mixed bags grouped together in the grab option

tacit pebble
#

๐Ÿค”

queen oasis
#

probably copy it in to a new option

storm trench
storm trench
#

ZuperCarts I couldn't get that to work, but of course my "capacity fix" is actually just a bug fix of the weird bug it had.

storm trench
queen oasis
#

if your cart has a type, you could always use the patch

#
local JB_MaxCapacityOverride = require("JB_MaxCapacityOverride")

JB_MaxCapacityOverride.addContainer("zupercarttype", 150, true)

and everything else is taken care of for the most part

thin swan
#

It would make sense in like sports stores, schools and most places toys spawn right?

#

Oh wait shit I should probably see what happens if I run into a zombie

vast pier
cinder nebula
#

Hi all. Does anyone know the code that can refresh the MODs tab UI when I move a slider, or click on a button? For example, the attached image from my mod. Whenever I type in the text in the text boxes and hit Apply numbers, the numbers to the left of the sliders don't refresh/update - same thing when I hit reset to defaults.

thin swan
vast pier
thin swan
merry saffron
#

Is there a way to disable blood sprays only for zombies?

thin swan
bright fog
#

hell yea lol

pearl prism
thin swan
pearl prism
#

Anyway, nice mod

#

congratulations

thin swan
#

Thank you! ๐Ÿ™

#

Oh crap I forgot to add TchernoLib as a dependency

queen oasis
#

bro with the modpack and then uploading all those mods one by one, first doing it at all, but without changing the mod id. cmon

earnest remnant
#

Anyone know if you can create a moveable that is dynamic in the sense that if the player places one on a tile then another on the next tile they act as a single object? Or would that need to be something where each is their own item and if say, a signal were to go from A to B to C it would be handled through events somehow? The thought being that I'd want player to be able lay cable from point a to point b and send a signal across it like a network cable. (Similar to Redstone in Minecraft but I was hoping to include an internal psuedo "8 bit" structure using bools to essentially simulate an Ethernet cable)

queen oasis
#

I'm sitting here weighing how bad it might be to overwrite the entirety of ISWorldObjectContextMenu.handleGrabWorldItem for a single "if" just so I can move on

#

it's so easy just to overwrite it. otherwise I think I'd have to rip the grab / grab all, etc context menu apart and rebuild it

#

or I can ignore it. the world menu isn't so bad, it'll just chuck it into the main inventory. the inventory pane is a different story tho

#

blender gives me hives

cinder nebula
#

Has anyone had success with the color picker from mod options, allowing all the colors available in the color picker box to work properly? I can only get 8 to work for what I am doing with the mod I am working on, such as red, green, blue, black, white, yellow, pink, and cyan - mostly solid colors. It doesn't seem like the different shades of the solid colors works, for some reason.

queen oasis
#
if not getScriptManager():getItem(containerType) then
    print("ERROR - JB_MaxCapacityOverride: containerType is not a valid container")
end

idk why I thought this would work with like "militarycrate" or "crate"
I didn't put a return in it(yet) but someone's logs are filled with stupid coding error msgs

#

pulls his lips to his ears and whispers "git gud, son"

cinder nebula
#

Is the code for the HUD to Pick up stuff contained within the IsMoveable?

icy night
#
    if RainManager.isRaining() then```
#

Will this function check for rain constantly or do I need to add an event to check for rain every ten minutes or so?

silent zealot
#

Functions only do something when then are called

#

So if you make a new function, something has to call it or it will never get used.

#

For that function, attaching it to the every minute or every ten minutes event would make sense.

silent zealot
#

potential difficulty: you're using the object:funtion() syntax which is equivilent of object.function(self), but the event will not pass the "self" when it triggers.

#

So depending how you have things coded you may need to do a bit of rework to keep track of all the actuive campfires you care about then checkCampfireExtingish becomes:

if raining
for each campfire in listOfCampfires
if campfire is loaded (i,e,: in the active area around the player)
extinquish it
else
mark it to be extinguished later when it is loaded, or just ignore this since it won't come up that often.

icy night
#

This is what I got

#

local function EveryTenMinutes()
    SCampfireSystem:checkRain()
    if not RainManager.isRaining() then return end

    local instance = SCampfireSystem.instance
    if not instance then return end

    for i = 0, instance.system:getObjectCount() - 1 do
        local luaObject = instance.system:getObjectByIndex(i):getModData()
        if luaObject.exterior then
            local isoObject = luaObject:getIsoObject()
            if isoObject.isLit then
                luaObject:putOut()
            end
        end
    end
end

Events.EveryTenMinutes.Add(EveryTenMinutes)
#

But now its sending up errors for the rain manager. I got that from SCampfireSystem

#

said the event called nil

icy night
#

Dw I'll figure it out. I'm just stupid cuz I don't mess with Lua much haha

silent zealot
#

I would avoid naming your function EveryTenMinutes, even though it will work it's just confusing to use the same name as vanilla functions

#

And too easy to overwrite things by accident

silent zealot
#

As for the lua .instance stuff... no idea, I'm not sure if that is something from Zomboid code or part of Lua pretending to have objects when all it has is tables in fancy disguises.

bronze yoke
#

it's sort of neither

#

it's not a specific lua feature but it's far from unique to zomboid, it's just something you can do

silent zealot
#

What does it actually do? Like in this example the event fires and then with no context the code calls SCampfireSystem.instance:someFunction()

#

is it like faking a static function?

bronze yoke
#

it's an instance of the class, usually used for singletons

#

when we instantiate one we'll put it into instance for easy access

silent zealot
#

So SCampfireSystem.instance is just an instance of SCampfireSystem

#

How does that get created/initilized? I can't see it in SCampfireSystem or any of teh things it extends, but it could be in the weird metatable stuff

bronze yoke
#

i think it's probably created by the java side of the global object system

#

but you'll see a lot of ui code does the same thing on the lua side

silent zealot
bronze yoke
#

when you have that structure there's a strong implication that there is only supposed to be one instance and you shouldn't create a new one

#

basically it's an easy way to access objects that there's only meant to be one of

silent zealot
#

yeah, that makes sense and it's just a weird half-assesed hack job from lua where other languages can actually enforce a lot of this

bronze yoke
#

no actually: this is pretty typical for most languages

#

other languages have visibility models so they may be able to prevent constructing extra better (though you can do this with more annoyance in lua too) but storing an instance in a field called instance is common convention everywhere

silent zealot
#

Fair enough.

#

I've seen it done in C# with getInstance() as a static method.

bronze yoke
#

yeah, often something like that will be done to prevent the field from being messed with

#

but in lua you can't prevent anything from being messed with without going to a lot of annoyance so you usually just don't bother

silent zealot
#

And Zomboid is pretty bad at deciding what goes in java vs. what goes in lua.

#

Like the logic for a washing machine cleaning clothes doesn't need to be in java.

#

But it is, so I can't easily make a washing machine clean dirty rags.

candid egret
cinder nebula
# cinder nebula Hi all. Does anyone know the code that can refresh the MODs tab UI when I move a...

I finally did it! I finally got the code to refresh the UI when the sliders are modified pressing either the "Apply Numbers" button or "Reset to Defaults" button. WEEKS of on-and-off work and I finally got the mod to be working sufficiently. ๐Ÿ˜ญ The pain! Glad I finally got it working, though.

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

silent zealot
#

Nice mod!

thin swan
#

Anyone happen to know if there's an easy way to revalidate/calculate a square or the world inventory? I'm having a small issue where after I trigger the recipe to fold/unfold the scooter and it's in the world instead of inventory, then it still shows in the world inventory (can't be seen or interacted with though) until I move

thin swan
silent zealot
thin swan
silent zealot
#

Otherwise there is a refresh somewhere on the inventory code; it will be ISInventoryPage and/or ISInventoryPane

broken kayak
thin swan
thin swan
silent zealot
#

And makes it easier to place your gear in the world instead of in an inventory

broken kayak
#

Yeah the next stop for my modding journey is to drag an item out of the inventory to place it directly in the world.

broken kayak
thin swan
icy night
#

@silent zealot I got it to work ๐Ÿ™‚

#
--**                  B42+ RAIN KILLS FIRE                 **
--***********************************************************

if isClient() then return end

-- Method to detect the rain
function SCampfireSystem:ExtinguishCampfiresInRain()
    if not RainManager.isRaining() then return end

    -- Identify all campfire objects
    for i = 1, self:getLuaObjectCount() do
        local luaObject = self:getLuaObjectByIndex(i)
        local square = luaObject:getSquare()

        if square then
            luaObject.exterior = square:isOutside()
            if luaObject.exterior and luaObject.isLit then
                -- Extinguish fire
                luaObject:putOut()
            end
        end
    end
end

-- Function to run every ten minutes
local function EveryTenMinutes()
    SCampfireSystem.instance:ExtinguishCampfiresInRain()
end

-- Register the event
Events.EveryTenMinutes.Add(EveryTenMinutes)```
#

My problem was not checking the square, I think because its now more of a furniture item

thin swan
#

Goddamnit, why did they have to make the climbing over fence with E and climbing over fence when running into it completely separate ๐Ÿ˜ฉ I can access the climb over fence with E super easy, but the one where you run into it seems to be fully java

storm trench
#

Welp, hopefully the patch I just rolled out solved all the duplication issues.

I wanna play InZoi so bad lmaooo.

broken kayak
#

Now with wear a whole bunch of thingies at once

candid egret
storm trench
icy night
#

Do yall ever use timers to delay an event?

#

Like would timer:Simple(15, function() work

broken kayak
#

This is getting cluttered

bright fog
small osprey
#

Do you folks have a universial inspect/dump function you use to debug tables/objects you are handling?

bright fog
#

<@&671452400221159444>

#

Nop

bright fog
thin swan
#

Holy shit I just realized something, these were a huge thing in the 90s, and it could work with the same system as the scooter ๐Ÿ˜ฎ

zinc glacier
#

Was hacked am fixed

#

trying to go through and delete all links

queen oasis
queen oasis
#

ooh, look at that pretty face

queen oasis
#

I'm going to guess that "tiles" are not objects until they are placed/built? ie, the "militarycrate"

ancient grail
bright fog
craggy nacelle
#

Hi, in the distribution there is a command for procedural lists called: forceForZones= for example forceForZones="Rich", but im unable to find where these zones are defined. And when i try to go with getZones and use coordinates i can only find the zone type, but no zone name. Can anyone point me in the right direction pls?

cinder nebula
icy night
brave bone
#

question:

   ``` wheel RearLeft
    {
        front = false,
        offset = 0.3944 0.0000 -0.8222,
        radius = 0.17f,
        width = 0.4f,
    } ```

what does the "f" stands for? is it feet?

craggy nacelle
#

id say its float, but i dont think lua uses that one?

brave bone
#

it is on the vehicle script thingy

#

in the ATA_Bus mod, under scripts/vechicles/templates/ .

#

yeah. it seems like a float value/indicator ๐Ÿ™‚

craggy nacelle
#

i guess its like me in the beginning using ; to end out of habit ^^

#

but thats just me guessing, better wait for someone who knows better ^^

brave bone
#

thank you ๐Ÿ™‚

bronze yoke
#

that's correct, it means float

#

lua doesn't use it but scripts aren't lua

#

the version of lua the game uses actually accepts numbers with f at the end but it doesn't actually do anything different

spiral hearth
#

ok so if i want to add a heavy two handed weapon is there an easy way to do so? like im making this as a joke mod thats not meant to be a serious addition to the game (ie like the falling pipe jumpscare mod)

ancient grail
#

theres also forage zones
and vehicle zones

cinder nebula
craggy nacelle
# ancient grail checked server/Items/ Distributions.lua ProceduralDistrubutions.lua SuburbsDistr...

Yeah, its confusing, i even try to use the decompiled files, but i seem to not be able to find where the zones are defined. i found them used in objects.lua of maps for the zones, but i have yet to be able to access those zones too. ๐Ÿ˜•
So i run with two problems, i dont know where they are defined (i got the list in the net) and i have seen whre they are used, but both still put me before their own problems.
But thx for looking into it. Appreciate it a lot. ๐Ÿ™‚

ancient grail
craggy nacelle
broken kayak
craggy nacelle
#

I have no problem using the custom zones or the distribution table, but without being able to inject my own zones into the map the procedural distribution tables cant use the forceforzones command. ๐Ÿ˜ฆ

ancient grail
ancient grail
#

i think what youre trying to do is possible but the method of doing it is not feasible
you just need to think of another way
dont get stuck on one way of doing things

craggy nacelle
#

those are the zones:
{ name = "trafficjame", type = "ParkingStall", x = 444, y = 430, z = 0, width = 20, height = 3 },

but i dont know where trafficjame is defined nor how to access this table, but im trying. ^^

the forceforzones is for the distribution table to tell when a container uses a special proceduraldistribution talbe

ancient grail
craggy nacelle
#

yes!

ancient grail
#

ok so what does force for zone does?

craggy nacelle
#

take this for example:

{name="LockerClassy", min=0, max=99, forceForZones="Rich"},

it part of the distributions table, telling the container that if its in the 'Rich' zone, then the container schould switch to the locerclassy table in the proceduraldistributions table

#

So now i want to inject a custom zones so i can adapt the loot table

ancient grail
ancient grail
craggy nacelle
#

no, i dont do mapping myself. maybe in the future. it should be independent of maps i play in. i define the zones for sandbox (or quick and dirty atm in lua) and then let my mod adapt the loot tables in those zones. at least thats the idea

icy night
#

Does anyone know if fire spreads when it rains or if the rain puts it out?

craggy nacelle
# ancient grail these are found here shared\VehicleZoneDefinition.lua

Hm, no those are named the same, but it doesnt look its them because it doesnt hold all the zone definitions. Also i dont see how the Zombiezonedefiniton could make use of them too... No its just double usage of the same names? Damn its early in the morning so my mind doesnt really work that well. XD

craggy nacelle
# icy night Does anyone know if fire spreads when it rains or if the rain puts it out?

Sry, tryed to take a quick look but the only thing i found is that the camp fire seems to be influenced by rain, sry. But you could use a private server and use the admin command for rain (startrain Starts raining on the server. Use /startrain "intensity", optional intensity is from 1 to 100), then give yourself a molotov... nah, do first the molotov and then start raining. In that way you should see if you cant find the code for it?

icy night
#

Yeah, I'll test it tomorrow and if I can then maybe I'll make a seperate mod that makes rain put out spreading fire

#

In the meantime, I've make functional ear muffs lol

#

Game automatically added the hearing impairment line. Pretty neat

#

This is my script, if anyone cares to critique it:

#

Ear muffs reduce volume by aaround a fifth and protectors reduce it by an eighth

craggy nacelle
#

Nice. Will it help in solo to sleep for example on a roof while surrounded by zomboids? Never played with deaf, so i dont know if that would work.

icy night
#

Hmm. Idk how to add that effect but I'll check

#

its a good idea tho

ancient grail
distant inlet
#

is there any way to turn zombies from runners into shamblers during gameplay?

ancient grail
distant inlet
frail yarrow
#

How do you get the FluidContainer info for items that are not yet opened. I am having problems getting the TotalWeight. All weight properties only return the container weight.

granite ginkgo
#

added working sliding door

bright fog
#

@queen oasis ups lol

icy night
#

Where can I find the scripts for the desensitized trait?

#

or all the other traits

bright fog
#

Everywhere and nowhere

#

It's like they define for a script x y z things happening

#

They just check for the traits in the code at some places to change some behavior

magic eagle
#

Hey everyone, come check out the first AI-driven player demo in Project Zomboid!

Weโ€™re training The Walking Dead's Rick as an autonomous agent in the PZ world โ€” surviving, collaborating, and evolving his own story.

Feel free to discuss, share, and follow us for more dev updates!

https://theindiestone.com/forums/index.php?/topic/82547-check-out-the-first-ai-driven-player-demo-in-project-zomboid/

vast pier
#

๐Ÿ˜”

craggy nacelle
distant inlet
#

how do you generate a random number from 1-n? any game API?

distant inlet
#

this class isn't exposed to Lua, is it?

bright fog
#

That's what this wiki page is for

#

That's Lua code

#

This is Lua

distant inlet
#

d'oh

icy night
#

Anyone know where I can find the threshold that sets how much pain, stress, panic, etc. a player be in to prevent sleeping?

bright fog
#

Possibly the wiki listed all that already

#

Nvm they didn't state any detail

icy night
#

Yeah, just the sleep duration

bright fog
#

My guess would be checking the context menu option for sleeping

icy night
#

I'm trying to figure out how to set a lower the threshold when wearing ear muffs to sleeo

#

Now how do I find the document that this is used in lol ```ContextMenu_PanicNoSleep = "Too panicked to sleep.",

frank elbow
#

Search for PanicNoSleep and, failing that, the full string ID

frank elbow
#

Assuming you've decompiled the Java (it may be in the Lua too, so perhaps unnecessary)

bright fog
distant inlet
#

is there any way to get a particualr zombie's ZombieID or does it have another usable ID?

bright fog
#

Depends if you need to identify that zombie later after it got unloaded then reloaded in

distant inlet
bright fog
#

:)

#

You're fucked

distant inlet
#

well shit

bright fog
#

Read that wiki page section

#

It should explain the problem

#

Secondly, you're fine

#

Because in the case of zombie stats, they get reset anytime the zombie gets loaded in

#

One problem: in Build 42 that's easy to handle, in B41 ... that's another story

#

Are you doing that for B41 or B42 ?

distant inlet
#

b41 for now

bright fog
#

You're fucked

#

Tho not entirely

#

Bcs you can check if the speed of the zombie is the right one

#

Let's just pray you don't need to do that for every available stats

#

Bcs you can't check all of em aPES3_CursedDemon

distant inlet
#

I guess I'll just drop the performance-intended cache for now

bright fog
#

You need to check the zombie stats every time and verify they are the right one, but that's only doable for stats you can in fact check

#

What's your goal exactly ?

distant inlet
#

i want to update speeds when zombies catch fire, but without constantly attempting to update the speed of every zombie that's on fire (caching its nonexistent persistent ID)

#

for now I'll constantly attempt I guess

bright fog
#

Ok that's easy to do

#

And not that costly

#

The main problem you might encounter is getting the zombie to use its precedent speed but you should be fine

distant inlet
#

yeah, that's something that I'm deleting right now lol

#

but you say in b42 it's doable?

bright fog
#

You can do it in B41 too

#

Your thing doesn't require specifically to update when a zombie loads in

#
  1. check the zombie is onfire
    2.1. if on fire, check the speed of the zombie, verify it's the right one
    2.2. if not on fire, verify if the zombie has mod data with a precedent speed value

3.1.1. if uses wrong speed, set the speed to zombie on fire, note the precedent speed in mod data of IsoZombie
3.1.2. don't do anything
3.2. verify the precedent speed == current speed

4.2.1. if speed is precedent speed, delete the precedent speed entry in mod data
4.2.2 if not speed is precedent speed, set current speed

distant inlet
bright fog
#

You got something like that

bright fog
#

If a zombie is on fire, it will die one day or another

#

If it gets unloaded or reloaded, you don't really give a shit tbf

distant inlet
#

what about if in an MP world a plyer logs out then in? I don't want an ever-growing cache

bright fog
distant inlet
#

yeah that's roughly it

bright fog
#

And the rare cache you keep track of will get deleted or replaced eventually

distant inlet
#

this is server (media/lua/server) lua file btw

#

when would it get deleted/replaced for server?

bright fog
#

You update the zombie server side ?

bright fog
#

Wait the algo can be even easier

#

Nvm no

#

Bcs some zombies can stop being on fire if unloaded I believe ?

distant inlet
#

i don't want clients updating zeds. I guess modData is client-side

bright fog
#

No it's both

#

I mean

#

It's not shared

#

But it can be used both sided

bright fog
#

And you use mod data of the ZOMBIE

#

not global mod data

#

Bcs you don't care if the mod data gets losts to a random other zombie I'd say

#

If you manage that well, you don't need to do much

#

In fact, you could just check if the zombie is on fire and change its speed that way, that's it

#

Because when the zombie gets unloaded I believe they lose their fire

#

And so their speed will get reset anyway when they reload in

#

If they die, it gets losts

#

No need to store any mod data

#

You just need to verify the zombie is on fire and has the fire speed

#

That's it

distant inlet
#

yeah but consider: zombie on fire, zombie has new speed, client logout, zombie unloads, client login, zombie reloads not aflame still w/ new speed

bright fog
#

No it won't

#

If you do it client side

#

Clients update the zombie speed

#

Server side idk, it could be weird and idk how zombie unload reload works server side

#

But client side, each clients verify zombie is on fire and has correct speed

#

That's it

#

Zombie unloads bcs you leave area or log out ? Zombie will get reset anyway

#

It won't be on fire and its speed will be reset to sandbox settings

distant inlet
#

ok I should verify that or probably "ah fuck it" approach

bright fog
#

Just test it

#

Test it in solo first

#

Then test in MP

distant inlet
#

speeds do get reset in solo

bright fog
#

Yes

#

I think in MP too tbf

distant inlet
#

gotta run for now - thanks for the help

bright fog
#

๐Ÿ‘Œ

icy night
#

Gonna keep working on the future benefits of wearing ear muffs

bright fog
#

That's cool, what did you use to reduce the volume ? You modified the options of the game ?

icy night
#
local earMuffVolumeAdjustments = {
    SoundVolume = 0.15,
    MusicVolume = 0.07,
    AmbientVolume = 0.15,
    VehicleEngineVolume = 0.1
}

-- Ear Protectors Volume
local earProtectorVolumeAdjustments = {
    SoundVolume = 0.1,
    MusicVolume = 0.045,
    AmbientVolume = 0.1,
    VehicleEngineVolume = 0.06
}

-- Ties sound to either Muffs or Protectors
local function getVolumeAdjustments(equippedItem)
    if equippedItem == "Hat_EarMuffs" then
        return earMuffVolumeAdjustments
    elseif equippedItem == "Hat_EarMuff_Protectors" then
        return earProtectorVolumeAdjustments
    else
    -- Default Volume Levels
        return {
            SoundVolume = 0.8,
            MusicVolume = 0.36,
            AmbientVolume = 0.8,
            VehicleEngineVolume = 0.5
        }
    end
end```
#

I found the default sound levels and then I added lessened volumes when ear muffs/potectors are worn

#

The difficulty I had was that the game kept tying it to all hats, but I eventually figured out how to restrict it to just my two items

icy night
#

I tied it to the the sound manager, thereby replacing the default values

#

this is my script

bright fog
#

The first require is completely useless and in fact will throw a warn in the console I believe because you're trying to require a file which doesn't exist

#

Also you change the volume of the soundManager, but that changes the game settings ? But not everyone uses the same default settings

icy night
#

Ah I see. No, I did it myself by just looking at other mods that do similar things

bright fog
#

The if statement for player is useless too, player should never be nil if I'm not mistaken

#

If it was, whole game would break earlier than the event trigger

#

most likely

icy night
#

lol, ok. I'll enact the fixes

bright fog
#

Change your sound settings a bit

#

Then test your mod

#

And see if it comes back to the default settings

#

I'm unsure how the soundManager works but if that's the game options that's problematic and you might actually make some people completely deaf by forcing their game volume to specific values LMAO

craggy nacelle
#

Ok so im still running into walls and start to think that im fundamentally misunderstand something. So can anyone tell me how zones work? Ive only started and not created any maps.

I tryed to somehow get access to them to let the loot distribution act on zones i create outside of already existing maps.

Now i even went as far as creating my own object.lua with coordinates and a zoone description for distribution and procedural distribution, but when using the chunk debugger, i dont see those zones at all.

Any advise?

storm trench
craggy nacelle
#

But i dont map XD

bright fog
#

At least from my understanding of what you're asking

#

Ah

#

Then I didn't understand what you're trying to do

craggy nacelle
#

I mod, and try to use code to do so ^^

bright fog
#

But what are you trying to mod exactly. Tho note I'm not familiar with zones related to maps

craggy nacelle
#

So ok, you know how in the distribution table there is a force command to direct containers to specific ProceduralDistribution tables? In essence, thats what i want to do too, just that i want to use a mod where i can insert some coordinates to define a zone. And inside that zone, the table should be altered. Does that makes more sense? Sry my english isnt great. ๐Ÿ˜•

bright fog
#

Can you even do that ?

craggy nacelle
#

Altering the distribution? Yes

bright fog
#

No

#

Not that

storm trench
#

@thin swan Caused by: java.io.FileNotFoundException: X:\Steam\steamapps\workshop\content\108600\3453879909\mods\KickScooter\42\media\AnimSets\player\movement\sneakWalkLow.xml (The system cannot find the file specified) at PZXmlUtil.parseXml(PZXmlUtil.java:53).

Also on sneakIdleLow and walkbagright

(Scooter mod)

bright fog
#

Not really

#

Loot generation is java sided

#

You can modify what type of containers spawn in which type of rooms and shit

#

But with coordinates ?

#

I don't remember something like that

#

You could link to the event which generates loot, wipe the loot in containers at the coordinates and then use your own loot generation system

#

But that doesn't sound great as you'd have to reimplement loot generation Lua side

thin swan
# storm trench I just wanted to say thanks for mentioning this yesterday. It hit me when coding...

Oh nice, glad it helped! ๐Ÿ˜„ And yeah those stack traces are annoying, I think it's because of that bug that requires you to put your animsets in both folders for b42. I think because I'm overriding a bunch of vanilla stuff, it's trying to find the vanilla file in my b42 folder, but it can't so it throws that error.

The kicker is, it doesn't seem to actually affect anything, and the only way I've found to fix it is by literally copy-pasting every single vanilla animset into my mod folder, which just feels super wrong lol

bright fog
storm trench
bright fog
#

Also you're overriding vanilla animsets ... ?

thin swan
# bright fog You need animsets to be in both B42 and B41 folders

Yeah I have the ones that I actually want to override in both, but those are also referencing some that I don't want to override, but it looks for them in my b42 folder, but when it fails it seems to find them in the vanilla, because the animation it's saying it can't find is still triggered properly

thin swan
# bright fog Also you're overriding vanilla animsets ... ?

Oh yeah, the scooter mod is super dirty. I couldn't figure out how to get it to move unless I override the defaultWalk and put in so it's only active when I'm not on the scooter, and when I'm on the scooter my custom one kicks in, but then I also need to make it so that other animations are not triggered when I'm on the scooter. And then I had an issue with some animations breaking because I just didn't put my own variable in that it should check for.
Seems like the whole animation system is very fragile, so I had to kind of brute force my way to a solution.

I'm working on untangling the whole thing though, I have some ideas to try

bright fog
craggy nacelle
#

Ah, no.

so for example:

{name="LockerArmyBedroom", min=0, max=99, forceForZones="Army"},
name="LockerArmyBedroom", min=0, max=99, forceForItems="furniture_bedding_01_56;furniture_bedding_01_57;furniture_bedding_01_58;furniture_bedding_01_59"},

this is the distribution table example. the force command tells where to use the special distribution. First line is for Zones. Thats what i want to use, but i cant figure out the zones.

storm trench
#

Try using <m_ConditionPriority>10</m_ConditionPriority> on the anims you need to execute above all else.

thin swan
storm trench
#

Might work, might not work. Didn't work for ZuperCarts, but worth a shot.

thin swan
storm trench
thin swan
#

But I've made some changes since then, so it might work if I play around more with it

bright fog
#

Worst case just extend an AnimSets, don't overwrite it, I think that should do the trick

bronze yoke
#

that's not what extend does

bright fog
bronze yoke
#

all it really does is essentially copy paste the file into yours

bright fog
#

Wouldn't that be enough ?

storm trench
bronze yoke
#

these seem like two separate things?

#

also i just remembered mods can't even extend from vanilla files

bronze yoke
#

the extend path is relative to the file and does not use any virtual filesystem bullshit so you can only reliably extend from other files in your own mod

bright fog
#

Yikes

thin swan
#

Basically what I'm doing is I have my customWalk.xml which is a copy of defaultWalk.xml but the speedscale is set to 0.2 and it has a condition to check if ScooterActive is true.

The defaultWalk.xml is also in my folder so it overrides the vanilla one, and I have added my ScooterActive false condition to it.

I thought that would be enough, but without also adding the ScooterActive false condition to a bunch of other animsets, it broke a lot of stuff, on and off the scooter. For example without also adding the ScooterActive condition and overriding the vanilla walkhandgun.xml, the gun would be upside down, even though I never reference or touched it in my custom animsets.

I'm gonna have to fully dive into the animsets to see how they all transition into each other and figure out which ones are crucial and which ones can be gutted.

icy night
#

@bright fog Was this the part that you said was incorrect regarding the player: function updateEarmuffsVolume(player) if not player then return end

frail yarrow
#

I am having so many problems with this function

    if not container then return false end

    local key = tostring(container)
    local required = 0
    local comp = nil

    if item and item.getFullType then
        local fullType = item:getFullType()
        local scriptItem = ScriptManager.instance:FindItem(fullType)

        if scriptItem and type(scriptItem.getModData) == "function" then
            local modData = scriptItem:getModData()
            if modData and modData["Component"] and modData["Component"]["FluidContainer"] then
                local ok, result = pcall(function() return item:getComponent("FluidContainer") end)
                if ok then comp = result end
            end
        end
    end

    if comp then
        local baseWeight = item:getWeight()
        local amount = comp.getAmount and comp:getAmount() or 0
        local fluidMult = 1.0 -- default multiplier
        local fluidWeight = amount * fluidMult
        required = baseWeight + fluidWeight
        debugPrint("Item:", item:getFullType(), "Base:", baseWeight, "Amount:", amount, "Fluid Weight:", fluidWeight, "Total:", required)
    else
        required = (item.getWeight and item:getWeight()) or 0
        debugPrint("Item:", item:getFullType(), "Total:", required)
    end

    local capacity = container:getEffectiveCapacity(playerObj)
    local used = container:getContentsWeight()
    local pending = stackAllMemo[key] or 0

    return (capacity - used - pending) >= required
end

The problem is that I cannot get (Sealed Fluidcontainers) to give me the Correct weight, from all the getWeight properties it only shows the weight of the container, but it should be (Weight + (FluidContainer Capacity * Fluid Weight per Unit) So example a diet cola should be (0.3 + (0.3 * 1.0) which shows as 0.6 in the tooltip.

Trying to access the properties via the script, or with pcalls like to crash so much.

craggy nacelle
# bright fog https://pzwiki.net/wiki/Room_definitions_and_item_spawns

Sadly no. I can already manipulated the item spawn in the distribution tables just fine for existing zones, tiles and rooms. Now i want to add my own zones to the map per code and use said zones to change the tables the containers there are using. Hate my lack of english to explain it better. ๐Ÿ˜ฆ

bronze yoke
#

that's what people were doing before i found that property

thin swan
#

I gotta play around with it again because I remember Chris mentioned that property to me when I was playing around before and I tried but it wasn't working

#

But the whole thing is a mess tbh, so I'll dive back in at some point and see if I can clean it up significantly

bright fog
bright fog
#

I don't think the zones can be modified through the Lua API

craggy nacelle
# bright fog The zones require mapping I think

Yeah, i fear the same, put an object file with zone coordinates in an empty map folder hoping it would be added to the map because worst case i can just alter that one, but again, no dice.

#

And the onzoneload doesnt give zones so... eh. shrug

bronze yoke
#

have you tried```lua
getWorld():getMetaGrid():registerZone(name, type, x, y, z, w, h)

bright fog
#

๐Ÿ‘€

craggy nacelle
craggy nacelle
#

My hero! Now it still doesnt work as intended but the zone is there which is the important step i was banging my head against since yesterday. XD

bright fog
#

Ah yea you'd have to set the zone before loot generation

#

You can regenerate loot in a zone in the worst case I guess

craggy nacelle
queen oasis
bright fog
#

mb ๐Ÿ™„

queen oasis
#

I was thinking about this the other day and that shooting a firearm without ear protection will debuff your hearing for a period and cause ringing in your ears.

frail yarrow
queen oasis
#

the GOG PZ would be on the same version as Steam PZ, correct?

craggy nacelle
bronze yoke
storm trench
#

Of course fixing the duplication breaks the hotbar fix again... wbangrycrab

livid stratus
#

hello everybody. I am trying to create a mod for Zomboid b42 but even with the correct file structure, It doesnt show up in my list. Is there something special I need to do to make it appears ?

queen oasis
craggy nacelle
livid stratus
#

didn't tried workshop.

craggy nacelle
#

Workshop is for when your structure is for release, mod is when you run it local (i think, at least i use it for that... ^^)

storm trench
#

I always just use Workshop. If you're only working on one thing at a time there hasn't been any issues with that for me.

queen oasis
#

I've got mods, mod-backup, workshop and workshop-uploaded and a folder hiding idk where with code I didn't use but wanted to save for later.
I work out of the workshop folder if I plan to upload it. Otherwise, test code stays in the mod folder.

bright fog
#

Just dev from workshop

#

Bcs if you need to upload, you'll make a copy of your mod

#

Which will clash with the one in mods

#

Never dev from mods it's just a waste of time and a pain to manage

livid stratus
#

my mod.info :

name=Kodiak's Off Grid Plumbing Mod id=KodiakOGPlumbingMod description=Allows players to connect pipes from a lake or river to their home with an electric pump. poster=poster.png

Does the ' can cause a issue?

queen oasis
bright fog
#

Where did you place it

#

And which version of the game are you on ?

livid stratus
#

And this is my file structure planning

PlumbingMod/ โ”œโ”€โ”€ Contents/ โ”‚ โ”œโ”€โ”€ mods/ โ”‚ โ”‚ โ”œโ”€โ”€ PlumbingMod/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ media/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ lua/ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ client/ (For UI & player-side scripts) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ server/ (For world mechanics) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ shared/ (For shared data) โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ scripts/ (For defining new items & objects) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ mod.info (Mod metadata) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ poster.png (Optional mod image) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ mod.template (Optional template file) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ workshop.txt (If publishing to Steam)

#

minds the notes, I try to set my mind with modding for this game

bright fog
#

what version are you on ?

bronze yoke
#

this is the b41 modding structure

livid stratus
#

0.42.6

bronze yoke
#

read the linked wiki page

bright fog
#

Yeah that's wrong then

#

That's for B41

livid stratus
#

thanks ๐Ÿ˜„

broken kayak
#

Is it common for mods to have more subscribers than visitors ? Are people just subscribing from the main workshop page without going to see the page ? ๐Ÿค”

bronze yoke
#

if it's a build 41 mod this mostly happens because of servers

#

but yeah, very normal

bright fog
#

If it's a mod that's mostly used on servers yes

broken kayak
#

Mod's for B42 and has been up for only two days, most likely not servers

bright fog
#

If the mod reaches the front page, that's unlikely to happen

#

And if the mod is an API or lib that's normal too

bright fog
broken kayak
#

It's the click to wear thingy

bronze yoke
#

can be collections too i guess

broken kayak
#

I'm wondering if people are just subscribing when coming accross the gif on the main workshop page

bright fog
#

That's actually what i did lol

#

Because I had seen you discuss your mod here

#

So I knew what it was already

icy night
#

Same

icy night
#

Reuploaded with fix

#

Now lets see if I can make players suffer hearing damage for not wearing the ear muffs when shooting lol

bright fog
icy night
#

Yes, I removed the part that manually sets the volume to the exact numbers and changed it to capture whatever the player has set the volume at before they put on the ear muffs

#

If anyone tries in, let me know how it works for you

bright fog
#

I think the system might be very intrusive tho

#

Because that means players can't even modify their sound options when they modify them ?

#

Since they get directly overwritten by the mod

icy night
#

It only overrides the volume when theyre wearing the ear muffs. If you normally play with audio quieter than 12% of the normal volume then I dont think youll be using this mod anyways

#

But still, its not common practice to alter audio so thats why I'm asking people to test it and see how it works with their settings

bright fog
#

True, but that doesn't mean that can't cause any issues

icy night
#

def

#

hopefully not but we'll see

bright fog
#

Just throwing potential issues here that come to my mind

#

How do you set the volume back to the default value ?

#

Also players could counter act the ear muffs by increasing their game sound so when they wear them the sound is the same ?

icy night
#

Yes, after taking off the ear muffs I applied a different volume and when I put them on/took them off again, it set it to that volume

#

I've been working on this for the past 6 hours today and 7 hours yesterday so I'm gonna take a break now lol

bright fog
#

Sounds fair

bronze yoke
bright fog
#

True

bronze yoke
#

here i don't think it really matters, it seems more like an immersion feature

bright fog
#

Tho there's methods to make darkness truly dark

bright fog
bronze yoke
#

i don't think there's really any possible way to do this that the player can't work around

bright fog
#

You could lock the sound options, so players need to go to the main menu to update sound

#

That's not going to stop it from happening

#

But that's going to make their life miserable if they try to cheat

#

Especially for these heavy modded saves drunk

#

Since load time would take ages

bronze yoke
#

a low pass filter would be good but not possible for us

bright fog
#

Yea

bronze yoke
#

back when it was good i played a lot of hunt showdown and there were so many people cheating with reshade/nvidia settings for night vision, it was kind of miserable

bright fog
#

Wait you modify every sound options volume right ? @icy night
Isn't there just a general volume you can change ?

bright fog
#

Was the same when I played Unturned back then, nights would be hella bright thanks to monitor brightness. Then the dev added dark zones where it's pitch black and even monitor brightness wouldn't help

bronze yoke
#

they ended up using their super aggressive anticheat to just ban people for using reshade and those nvidia settings

#

i bet people still have ways to do it but i don't play anymore

bright fog
#

damn

grand gazelle
#

hunt showdown always felt like a walking sim lol

#

spend 15 minutes making a loadout to get in and walk for 20 minutes to die to someone u cant even see

#

then extract

bright fog
#

Squad

icy night
bright fog
bronze yoke
#

i was really really into it, it's the only shooter that i've genuinely loved for the gameplay, but they made too many changes i don't agree with over the last couple years, i just don't really care for it anymore

icy night
#

oof, well

storm trench
#

Shooters?!? Pah!!! :p

strong otter
#

whats the best way for testing mods? currently i change some code, start the game up in SP and spawn and test everything, is there like any hot reload or something else ? or is that "the way to go"?

bright fog
#

Apparently scripts can be reloaded in B42 now

#

If you change a model it will usually reload

#

Texture I don't think so

strong otter
#

and b41?

bright fog
#

Animation it does

#

B41 no reload for scripts, that's the only diff

#

Lua can be reloaded

#

From F11 menu but I suggest using the community debug tools to reload easier

#

Has a neat menu to reload the multiple files at once, without searching for them in the F11 menu

bronze yoke
#

bear in mind lua reload can cause bugs in a lot of situations

bright fog
#

But note that the code might need to be written in a specific way to be able to do that

bronze yoke
#

b42 has better handling for reloads so it's less common

strong otter
#

okay i will give it a try an see if it works for me

#

thank you

bright fog
#

Also

#

For scripts

#

You can simply reload lua in the main menu

viral spire
#

How doable is it to make a mod that slows walking/jogging/sprinting speeds to realistic speeds? It'd be interesting to see players and NPCs walking at the speeds you'd see IRL, casual strolls or taking sweet time to get anywhere like you'd expect in the real world.

bright fog
#

Doesn't it already take fucking ages to walk around lmao ?

#

You want it even slower lmao ?

#

๐Ÿ’€

#

Anyway I believe you can modify the player speed, tho if I remember right in B41 it's broken ? But there's a framework that exists to modify the player speed for B41 at least

bronze yoke
#

you just have to set an animation variable

#

but the framework will probably provide more compatibility

bright fog
#

Don't think you should fuck with animations directly, I think you should just change the player speed with the Lua APi directly, unless changing animation speed is your only solution

#

Probably better to use directly what the API gives

#

Especially in B42 as if I'm not mistaken you can correctly change player speed now ?

bronze yoke
#

i didn't think anything had changed there

#

it was more that people didn't really know how to do it than it was actually hard to do

#

anything to do with animations was pretty unknown for a long time

bright fog
#

When it should

#

Now I believe it actually does

bronze yoke
#

i don't think it does

bright fog
#

I've seen multiple convo about the new armors slowing you down

bronze yoke
#

i'll check but i'm 90% sure it's still disabled

bright fog
#

Still bugged ?

bronze yoke
#

it's not a bug, it's disabled on purpose

bright fog
#

wa

bronze yoke
#

yeah still looks disabled in b42

bright fog
#

Jeez I made so many mistakes in ISBaseTimedAction

#

I'm making that json file

bronze yoke
#

actually combat speed might have always been used

#

i think they were anyway

bright fog
#

Yea I think so

#

I remember something like that

bronze yoke
#

it's possible there's a different way armour does slow you down, i haven't checked thoroughly

#

but normal clothing speed modifiers still aren't used

fossil idol
#

So, I'm sure this isn't the right place to ask this, but...I'm honestly hoping someone here will have ran into a similar issue as I only have it with my PZ setup.

So...annotations seem broken, mainly due to types like "number" and "any" throwing a undefined-doc-name error. As well, trying to use built-in library functions like "type()" and "pairs()" throws an undefined-global error.

For reference, I've set Lua.runtime.version to 5.1, as well as both Lua.workspace.library and Lua.workspace.userThirdParty to the root path for Umbrella.

Does anyone have any experience with something like this? I'm sure I'm just missing something or being dumb...but I've looked through all the documentation I can find and tried googling every which way I can think of only to find a whole lot of nothing

craggy nacelle
#

Uh, i dont know honestly. But i read umbrella and problem and since i had to google to figure out that i need gid installed to use it, i give it shot into the blue and say: do you have git installed? ^^

fossil idol
#

Yep, I do

craggy nacelle
#

Was worth a shot, sorry i could help. ๐Ÿ™‚

bronze yoke
#

what extensions do you have enabled?

bright fog
#

Unless you meant something else

bronze yoke
#

you do need git installed to install umbrella through the lua addon manager

bright fog
#

Wait really ?

#

Zamn

craggy nacelle
bronze yoke
#

the addon manager is literally just git

fossil idol
#

You do, but I installed it manually 'cause Git wasn't working for me before

craggy nacelle
bright fog
#

Isn't git installed by default on a PC ?

bronze yoke
#

it clones the addons repository and then inits the addon submodule when you install

bronze yoke
#

i've had to walk people through installing it a lot of times, and i had to do it myself way back

bright fog
#

Damn

#

I don't remember ever needing to do that tho I installed Git Bash back then so that was probably how I installed it on my PC

fossil idol
#

^ Unless you use Linux, I doubt Git would be installed by default

bright fog
#

I'm not on Linux

fossil idol
#

But I digress... As for my extensions, I do have and am using Sumneko's Lua LSP. Anything else would just be Peacock, Prettier, and a variety of language support stuff like Markdown All In One

bronze yoke
#

hmmm, that's good - sometimes people install other lua language servers on top or this weird umbrella extension (entirely unrelated to our umbrella *addon*, it's something to do with dota as far as i could tell) and those mess with things

fossil idol
#

Ah, that's fair. Nah I don't enabled what I don't need. I do have other Lua extensions, but I disabled those globally so they're only enabled in whatever workspace needs them

#

Even so, none of that should affect annotations, or basic built-in functions... I mean, like I said, I'm sure I'm doing something wrong. That's almost always the issue when it comes to tech problems. I'm just lost as to what. I didn't even know it was possible to screw with the built-in annotations

bronze yoke
#

yeah, i'm really confused by that one, that's why i wanted to blame another language server ๐Ÿ˜…

fossil idol
#

I even checked Umbrella's config and...while it does disable some built-in libraries, none of what it disables has to do with something like "pairs()"

#

I'm sorry, I tend to run into the weirdest of errors. lmao

bronze yoke
#

yeah, i just had it disable stuff that isn't in zomboid

#

does basic lua stuff work if you just make a new workspace without trying to add umbrella?

fossil idol
#

Hmm, let me see

fossil idol
#

Alright, that's weird... It does not work as it should in a new workspace

craggy nacelle
#

If i understand right (sorry for interrupting) class.new(argument) should allow me to make a new well, what ever the word, right? Or are there cases where i cant create a new instance with that one?

bronze yoke
#

yes, if it's a lua class you usually need to call class:new() instead though

bronze yoke
fossil idol
#

Well, the directory it's in, not the actual exe, sorry

bronze yoke
#

that could affect it...? i don't really know

#

i would've thought it's just the path of the workspace itself but i think when you do that it causes a very similar issue

fossil idol
#

If it means anything, the workspace is on an entirely different drive with no symlinks

small osprey
#

Warming this oldie up. Running into the same behavior of IsoDoor getKeyId() returning -1.

At the same time in AdminContextMenu.lua "Set Door Key ID (%d)", obj:getKeyId()" (and hence door object debug menue) the correct key ID of the door shows up.

Any idea?

Edit: Nervermind, it works. Was in the wrong gridSquare

livid stratus
#

Is there a site or a way to see what WorldStaticModel are available ?

craggy nacelle
# bronze yoke yes, if it's a lua class you usually need to call `class:new()` instead though

Hm, i really tryed all kinds of ways to write it, but Zone:new("", "", 1, 1, 0, 50, 50) simply doesnt like to be made. I just dont want to make the zones i register again and again. Guess i could go with a file and just say: you did it already, but thats kinda.. meh, so i try to figure out a way to either remove the zones or at least figure out a way if its there already. Tryed first to use the constructor for ItemPicerJava so i could get to the squareHasZone method, but i run into the same problem where .new just didnt work?

bronze yoke
#

it should just be .new for that since it's a java class

craggy nacelle
#

you mean Zone.new("", "", 1, 1, 0, 50, 50) didnt work either. Kinda stuck.

#

No idea what im doing wrong, but thats nothing new either. XD

bronze yoke
#

are you getting an error?

craggy nacelle
bronze yoke
#

there should be a stack trace ingame and in the log

craggy nacelle
#

Most likely, but i cant read it. I mean i can read it, but i cant interpret it?

bronze yoke
#

if you post it i can probably tell you what it means

craggy nacelle
#

ok, ill try ๐Ÿ™‚

#

Do you mean that one?

bronze yoke
#

huh, that implies Zone.new doesn't exist

craggy nacelle
#

Strange i just go by documentation since im rather new to both pz modding and lua.

bronze yoke
#

i can't see why it doesn't myself

craggy nacelle
#

Ah, that... you know what? That kinda makes me happy, even if it shouldnt since it means there is no solution, but at least its for once not my fault. XD

icy night
#

How can I keep track of something. Would Events.OnSave.Add(OnSave) work to keep track of whatever Im counting, before the player exits the game?

thin swan
#

I'm trying to wrap my head around how this works. If I want to disable the Bob_IdleTurn180L (turn_idle_180L.xml) from triggering while my <m_Conditions> <m_Name>ScooterActive</m_Name> <m_Type>BOOL</m_Type> <m_Value>true</m_Value> </m_Conditions> is met, what is the best way?

I tried making a custom turn_idle_180L_test.xml with my ScooterActive condition and condition priority set to 10, and then I changed the AnimName to reference my own animation. But it's not playing the animation that I set, it doesn't seem to use my custom file.

Is it because it extends a vanilla file?
I also tried taking the vanilla base file that it extends and make a custom version of that, but it's still not picking up on it.

I made sure my animsets are in b42/media/AnimSets/player and in just ./media/AnimSets/player

bronze yoke
thin swan
small osprey
#

TIL about the usage of "square:getBuilding()":

  1. Exterior door squares are often not inside the building
  2. Trailers are not buildings ๐Ÿ˜ฌ
icy night
#

To induce hard hearing trait

bronze yoke
#

so that might be part of why it wasn't working, that animation node probably doesn't work at all if it's relying on an extend

bronze yoke
icy night
#

Ok

thin swan
bronze yoke
#

e.g. player:getModData().myModShotsFired = 1

thin swan
# bronze yoke it should yeah

Okay now it does, I must have missed a file before because I tried doing exactly that and it wasn't working, but I tried again now and it works

#

That is great news, will be able to clean up the mod quite a bit and make it more compatible

#

Thanks for the help! โค๏ธ

queen oasis
wary lintel
#

How do I mod zomboid? I wanna know incase I try making some mods

wary lintel
#

Thank you

icy night
#

Is this a functional counter to track how many times the player has fired a gun throughout their save: ```local shotCount = 0
local hit = false

local function loadShotCount()
local player = getPlayer()
local playerData = player:getModData()

if playerData.shotCount == nil then
    playerData.shotCount = 0
end

shotCount = playerData.shotCount

end

local function saveShotCount()
local player = getPlayer()
local playerData = player:getModData()

playerData.shotCount = shotCount

end

local function countShots(character, weapon)
if weapon and weapon:isRanged() and weapon:getCurrentAmmoCount() > 0 then
shotCount = shotCount + 1
saveShotCount()
end
end```

#

Kinda going off of how the mod "All Shots Fired Add XP" tracks both hits and misses. But I dont know how to verify if the counter works

#

I saw how "Earn Desensitized" works so I'm trying to add their method of keeping track of it through player data

silent zealot
# icy night track shots fired

Track the volume of the shots too (weapon's soundRadius) since there is a huge difference in noise poutput between a shotgun and M36 pistol.

solemn thunder
#

wha

silent zealot
#

I can't remmeber the name, something like "onweaponswing"

icy night
#

OnWeaponHitCharacter

#

?

silent zealot
#

I think that is when a wepon hits something

#

OnWeaponSwing

bronze yoke
#

i think this is really overcomplicated

silent zealot
#

Since you care about number of shots, not number of hits

icy night
#

You think that will count guns?

bronze yoke
#

just use the player's mod data directly, instead of storing it locally *and* mod data

silent zealot
icy night
silent zealot
#

Also, use a more unique name for anything your put in modData.

#

BubbsShotCount instead of shotCount, or make a subtable for your mode.

icy night
#

Yeah, ok

silent zealot
#

Just add that to a total in addition to number of shots fire, I wouldn't normalize it or anything... just straight up track the total of noiseRange and then figure out thresholds from there.

icy night
#

Alrighty. Much appreciated man

silent zealot
#

That will also automatically track silencer use since they override a weapons noiseRange

icy night
#

Are there silencers in vanilla? Or would I have to make that for gun mods

silent zealot
#

also: player:getWornItemsHearingModifier()

#

Not sure what the scale is for that, but calling that will let the player use earmuffs etc without you needing to write code to handle that.

icy night
#

Ah ok

silent zealot
#

(as in, you don;t need code to work out how hearing is modified... you just grab the already existing final value)

icy night
#

Do many items alter hearing?

silent zealot
#

...welcome to Scope Creep-ville. Population: almost every mod in existence. ๐Ÿ˜›

icy night
#

Frankly I thought it didnt exist until I saw the game already recognized my hearing impairment of the ear muffs

silent zealot
#

I'm not sure, but if I had a mod that was going to damage my eardrums I'd find out.

icy night
#

lmao

silent zealot
#

Quick search for "HearingMod" coems up with ~ 20 items:

#

...I did not realize zombies could be missing ears.

icy night
#

I'm glad I could teach you something drunk

silent zealot
#

I'm amazed this stray quote doesn't completely and utterly break the game, given how the parser likes to behave.

bronze yoke
#

well the reason for that is that it doesn't expect quotes at all anyway

icy night
#

How do you search within documents so quickly? Do you use a tool

#

Because searching for one phrase takes my laptop's file manager forever

silent zealot
#

I use VSCode

bronze yoke
#

if you have the folder open in vscode you can use ctrl-shift-f to search all files

icy night
#

Lemme see

bronze yoke
#

there's also standalone utilities like grep but i just use my ide

silent zealot
#

VSCODE + Umbrella == huge help for writing mods

#

Then I open a vscode instance, point it at the media folder and use that to search for text in lua/scripts

#

And another vscode open and pointed to a decompiled version of the game's java code

icy night
#

Should I still expand the hearing protection to all items with hearing modifier or should I stick with my two ear muffs

#

nvm, I'm not even at that point

silent zealot
#

just use player:getWornItemsHearingModifier()

icy night
#

alr

silent zealot
#

Then it's not your problem to decide what protects hearing, the game will give you a result.

icy night
#

should make my job a lot easier

silent zealot
#

And you're covered if someone releases Vanilla Hearing Protection Expanded

icy night
#

Lol, as if

outer crypt
#

is there a version of square:getZombie() for getting an animal?

icy night
#

All I found related to hearing was the hearing aids mod

silent zealot
#

It's not a big deal for vanilla, but if I was going to add a mod to implement hearing damage from gunfire I'd want to be able to wear earmuffs/stuff cotton wool in my ears/etc

#

Plus, winter fashion:

silent zealot
#

Just found some hearing protection in preparation for modded ear damage.

icy night
#

hehe

#

Should I do Deaf trait or just Hard of Hearing?

#

I was gonna have it level up from hoh to deaf

silent zealot
#

HArd of hearing IMO

#

Deaf is a massive drawback in this game.

icy night
#

Ive never tried it

silent zealot
#

Reduced rear awareness, no sounds for zombies approaching... without those zombie moans as they apprach I would die so often

#

Partly because I instinctively rely on them after 1500 hours of Zomboid

wary lintel
#

How do I create custom traits?

tacit pebble
distant inlet
ancient grail
bronze yoke
#

they're not making changes

silent zealot
#

That function is called from the player object and looks at the equipped items to determine the total hearing modifier, changing item parameters is seperate to that

ancient grail
#

ah right

ancient grail
#

not sure if vehicle counts as moving objects

queen oasis
bronze yoke
outer crypt
tardy condor
#

hello all

#

I try to make a mod and I put a system to have it in several languages, but it does not work. I don't understand. That's what it looks like

#
my file NR_Achievement\media\lua\client\NR_AchievementsList.lua

NR_AchievementsList.categories = {
    ["survival"] = {
        name = getText("UI_Category_survival"),
        description = getText("UI_CategoryDesc_survival"),
        icon = "category_survival.png"
    },
    ["combat"] = {
        name = getText("UI_Category_combat"),
        description = getText("UI_CategoryDesc_combat"),
        icon = "category_combat.png"
    },
    ["exploration"] = {
        name = getText("UI_Category_exploration"),
        description = getText("UI_CategoryDesc_exploration"),
        icon = "category_exploration.png"
    },
    ["skills"] = {
        name = getText("UI_Category_skills"),
        description = getText("UI_CategoryDesc_skills"),
        icon = "category_skills.png"
    }
}

my file NR_Achievement\media\lua\shared\Translate\FR\NR_AchievementsList_FR.txt

NR_AchievementsList_FR = {
    -- Catรฉgories
    UI_Category_survival = "Survie",
    UI_CategoryDesc_survival = "Achievements liรฉs ร  votre temps de survie",
    UI_Category_combat = "Combat",
    UI_CategoryDesc_combat = "Achievements liรฉs au combat contre les zombies",
    UI_Category_exploration = "Exploration",
    UI_CategoryDesc_exploration = "Achievements liรฉs ร  l'exploration du monde",
    UI_Category_skills = "Compรฉtences",
    UI_CategoryDesc_skills = "Achievements liรฉs ร  vos compรฉtences",

tardy condor
#

is like it in game

silent zealot
bronze yoke
#

the file must be named UI_FR.txt

silent zealot
#

So try getText("Category_skills"), instead of getText("UI_Category_skills"),

bronze yoke
#

you can't add new translation file names, each file's name is hardcoded (they don't use overrides like other files do so this won't override anything)

silent zealot
#

Or I may be thinking of the sandobox settings

bronze yoke
#

yeah i don't think that's a thing ๐Ÿ˜…

silent zealot
#

or it may be different everywhere, because why should it be consistent?

bronze yoke
#

i think sandbox options do something like that but getText itself doesn't

silent zealot
#

Possibly other scripts too,

tardy condor
silent zealot
#

Item display names do...

#

I think Albion is correct here and I'm mixing things up.

#

Any translation from a script or thing that is really a script and not actually lua even if it looks liek it will prepend something, but getText() does not.

tardy condor
bronze yoke
#

internally the game stores translation strings from each file name separately and uses the prefix in the string to know which file to search, so the filenames are completely hardcoded because of that

#

it probably makes the lookups faster

silent zealot
tardy condor
#

ok i try first UI_FR 2 min I restart the game

#

@bronze yokeis work ^^' ๐Ÿ˜ small encoding problem but it works

#

@silent zealotthank you too for taking time for me

silent zealot
#

My theory is the translation system was meant to just be a lua table, but someone named the files .txt instead of .lua by accident so they didn't load and the tranlation didn't work at all so a java dev said "screw it" and coded up a custom java translation function for the misnamed files and then that just stuck around.

bronze yoke
#

i theorise they just were lua in an earlier build

#

the most fun oddity with them is that you literally don't have to make it look like a lua table

silent zealot
#

Could have also been a more sensible reason like bad performance, but I'd have though reading the files in via lua then shoving them into java woudl fix that and be more extensible

bronze yoke
#

the format isn't checked or anything, it literally just skips the first line

#

i think some of the newer vanilla ones don't even bother with it

steep isle
#

Are there any tutorial guides that can help me get started with character animation?

silent zealot
#

B41 or B42?

steep isle
#

B42

silent zealot
#

In B42 you need to stock up on your alcohol of choice so you have a way to soothe the pain that is dealing broken AnimSets.

steep isle
#

So is it very difficult to create a new character animation?

#

My job is in animation, but I don't know much about coding.

bronze yoke
#

the actual animating aside, integrating it into the game is not too bad but there's a lot to get your head around

silent zealot
#

People are managing to do it, but at a minimum it requires you to copy files into two places... I've been staying away from it thinking I'll revisit mod ideas that require it once the animation jank is fixed (which I thought would have happened by now)

bronze yoke
#

yeah i know i was originally recommending everyone stay away from it but i'm losing hope now given that that was three months ago ๐Ÿ˜…

#

it doesn't restrict what you can do at all, it's just really annoying

silent zealot
#

Also the last time I animated something was nearly 20 years ago because I got sick of a friend on SecondLife complaining about a particular NFSW animation ont being available anywhere so I made a custom animation set for her.

#

Not exactly something I'd put on my modding resume ๐Ÿ˜›

steep isle
#

Sorry, I haven't made a mod before, so I'm dont know what could be annoying. Does that mean the animation mods being made now will be broken by future updates?

silent zealot
#

They might keep working (with extra files that are no longer needed) or they might break, but "might break" is true for anything right now.

bronze yoke
#

if they break, it'll be entirely unrelated to this bug

#

in build 42 they changed the modding structure slightly, and for some reason animation files still need to be put in the old structure as well as the new one to work

silent zealot
#

The actual animations I expect will still work fine, but the mods will likely need a bit of a tweak... that's me guessing on likely changes though

#

I wouldn't let that hold you back at this point.

bronze yoke
#

animation mods largely didn't break between b41 and b42 (a lot of them that used certain conditions needed a single extra parameter added) - you're always gambling with a game in active development, especially while it's in unstable, but there's not any specific reason to think animations are going to break

#

and if they do the work to fix them probably won't be that much, it's likely to be more about configuration than actual animation

silent zealot
#

I'd go as far as saying the core design of the animation system won't get changed because that would be too much work and is not on the roadmap.

steep isle
#

I noticed that mods for carts or scooters on the Workshop have added new animations, and I'm wondering if I could create a mod for various convenient transportation tools, such as skateboards or rollerblades, or even rolling actions for the character.

bronze yoke
#

also, the animation system is *new*, it's not due a rework

silent zealot
#

Functions getting extra parameters or syntax changes in scripts, maybe. But those are quick to deal with when they happen.

ancient grail
bronze yoke
#

the animation node files need to be in the b41 and b42 locations for the game to actually load them

#

this is because the code that scans for node files wasn't updated to check the right folder, but the code that actually loads them was

#

so you need both

tardy condor
#

is work

ancient grail
fringe torrent
#

Please dont kill me for posting here: You guys can anyone please help, i have the simplest problem. I'm running an old build solely singleplayer with some old mods and the load order keeps setting one of the required mods for one of my others all the way on the bottom of the load order, I just need to put it on top (truemusic prequisite) and I've been looking for like 8 hours with no solution, please help me obi wan Kenobi, your my only hope

frank elbow
fringe torrent
broken kayak
#

Is there a mod to fix the pesky crash when trying to modify the load order on a save with a missing mod on B42 ?

broken kayak
vast pier
#

Anyone know why as of 42.6 the code I have to trigger a ripping sound is repeating the sound forever?
owner:playSoundLocal("ClothesRipping");

thin swan
#

Jesus christ I hate working with animations lol, but the kick scooter refactoring is done so it's not replacing any vanilla files now.
I need to decompile the java and take a closer look at how the animations works one day soon

tranquil kindle
#

Oh no...

sour island
craggy nacelle
#

I know zombie id's arent persistent, but is there a way to create... i dont know... a bot with zombie behavior where you could use a object id for example? Question is about creating some kind of boss (havnt yet started, just doing some research in its possibility and looking at other mods). But you dont really want a boss to fall under the same rules then regular zombies, so im a bit troubled about that issue.

bronze yoke
#

zombies have a 'persistent outift id' which is more or less persistent

craggy nacelle
#

Hm, so i could use that id to link to remaining hp? But what about movement. For example if you want the boss to wander on a certain route and when it gets into client reach it loads its stats and remaining health, can you use that id for that?

#

When i think of 'boss' i go quite away from normal zomboid and more to ohter games npc behavior for a boss encounters, so partly scripted stuff, like being active in a certain area and reacting to players that come in range. I dont think i can modify zombies enough for that? Thats why i was asking about an id that is persistent and can be linked to a... well i dont know, bot? Flying scripted block of undefined propotions since i suck at modeling? XD

#

Meh, its as i said, just trying to figure stuff out atm to see where it could end before i start.

queen oasis
distant inlet
bright fog
#

It's non-unique

bright fog
#

The issue is its non-unique

#

There's different methods you could use

#

One could be limited your boss to a specific area, and then having the boss load in that area

#

You could also just straight up despawn the boss and respawn it again

#

If it's a unique boss that can work

#

Respawn it with the stats it had before

#

Or don't even give a shit and just don't even set the stats to what they were

#

Keeping track of zombie health is kind of a pain

craggy nacelle
#

Thanks, as i said, its a bit of a brain storming thing atm. Was also looking in your zombie forge for inspiration too by the way. Thanks for the comments, makes it a nice learning material. ๐Ÿ™‚

bright fog
#

Np lol

#

Modders that don't comment their shit are mad tbf

#

Tho my comments are not perfect of course

#

I think in the case of a zombie boss you can use different tricks

craggy nacelle
#

Yeah, i think there are quite a lot of approaches possible. Also i think it might a bit more then i can handle for now, since i only stared out.

#

There is also the problem that the api isnt really that great at documentation, so there is a lot of 'seeking blindly' invovled. Using the search function in this channel is honestly the biggest help i found to this point. XD

bright fog
craggy nacelle
icy night
distant inlet
#

is there a way to play a sound that's audible to players from within 30 tiles?

#

i've seen this https://pzwiki.net/wiki/Sound_(scripts), but not sure if a sound defined in that way should be used in getSoundManager():PlayWorldSound("<defined_sound>", ..)
edit: nvm it works perfectly now ๐Ÿ˜…

bright fog
#

@storm trench

#

Let's continue here

#

Wdym

#

The new required mods ?

storm trench
#

If I update an already existing mod with new dependencies, how does that work for the users already subbed?

bright fog
#

They need to download it yes

#

You prefer to keep the java patch ????

#

@queen oasis

storm trench
#

I haven't made a java patch.

bright fog
#

Then what's the problem ?

storm trench
#

Oh my dear goodness. Nevermind then.

queen oasis
#

I have covid brain so I was confused

bright fog
#

I mean it's quite confusing. Yes of course it's going to cause issues to add a new dependency

#

But if you need to add it, do it now rather than when your mod got a million sub

#

If you want to use it for your cart mod, add it NOW, not in 6 months if more people end up using your mod

storm trench
#

I dunno what I'll do yet. Thanks.

queen oasis
#

idk how the game handles it, but worst case you can throw a context option in the menu to let people know to unsubscribe and resubscribe

bright fog
#

They won't need to resub

craggy nacelle
#

I try to learn from the zomboid forge project and wanted to see how to put functions in a table? (Maybe i missinterpret the whole thing?) But i dont quite understand how this works or how to call said functions when using them in a nother file, Any advise?

    ZombieData = {
        ["outfit"] = {
            current = function(zombie)
                return zombie:getOutfitName()
            end,
            apply = function(zombie,choice)
                zombie:dressInNamedOutfit(choice)
                zombie:reloadOutfit()
            end,
        },

This is a part of the code of the ZomboidForge_module.lua

Tryed to do something similiar, but as said before, dont quite understand what im doing there, so there isnt much suprise when i get a null pointer while trying to call it from a nother file. XD

storm trench
storm trench
#

Okie dokie, that'll work.

#

Thank youuu!

bright fog
craggy nacelle
#

still 41, only tryed 42 while playing

bright fog
#

I don't remember exactly lol

craggy nacelle
#

Is not just that i dont get a pointer, but i also dont quite understand the part where you write:

        ["outfit"] = {
            current = function(zombie)

So i guess its technically 2 questions in one ^^

bright fog
#

I don't even remember tbf

#

Also bcs I reworked the framework in a major way

#

Tbf I need to write a documentation but I've been burnt out from this mod overall

craggy nacelle
#

Ah, ok makes sense, so that isnt quite the normal writing style in lua? ^^ Thought that was what is considered 'clean programming'

bright fog
#

idk tbf

#

I experimented with some shit, but the way I wrote stuff in B41 was a mess

#

I deserved a major rewrite

open drum
#

hello fellow modders

storm trench
#

Well, I guess this is a sign from the mod gods for me to work on that now instead of playing a bit. Just loaded my save and my character was replaced with a blank one. Lmao. Fine. I won't procrastinate anymore... sighhh.

open drum
#

Could anyone help me to understand why this thumpable is not hitable??

#
    local sq = getCell():getGridSquare(getPlayer():getX(), getPlayer():getY(), 0);
    local shelf = IsoThumpable.new(getCell(), sq, "carpentry_01_16", false, ISSimpleFurniture:new("shelves", "carpentry_01_16", "carpentry_01_16"));
    shelf:setIsContainer(true);
    shelf:getContainer():setType("shelves");
    shelf:getContainer():AddItems("Base.Crowbar", 10);
    shelf:setHealth(1000)
    shelf:setIsThumpable(true)
    sq:AddTileObject(shelf);
#

the "shelf" spawns with crowbars as expected

#

but it's not "thumpable" even if i swing axe on it

bright fog
open drum
#

yea

#

but!

craggy nacelle
#

Ok, i figured out the pointer part, that was just stupid since i made a mistake in the requirements... XD
Will try and figure out more about the writing style. ๐Ÿ™‚
Also your programming still looks better then my experimental spaghetti code (which is why i wanted to clena up my writing a bit too ^^).

open drum
#

01-16 is actually a box

#

crate

#

it's naed shelf cuz it was a snippet from vanilla that i copied

icy night
#

For my "shooting without ear protection damages hearing" script... at what point should the player get the hard of hearing trait. After maybe 1000 shots? Should I set a clear threshold or should I base it on chance? Like 1 in 10,000 chance per shot or whatever

#

Just looking for suggestions

bright fog
#

lol

silent zealot
#

Then you just need some OK defaults, and people can customize it.

queen oasis
icy night
#

I was thinking the player could set the threshold in sandbox settings by selecting their play style (I Use Guns A Lot, I Use It Sometimes, I Rarely Use Guns)

storm trench
icy night
#

setting an exact number could be confusing, since it'll be using the stacked total of the Sound Radius

silent zealot
#

I like to use numeric values and not constrain the range, because zomboid varies so much based on mods/options/playstyles.

icy night
#

yea, for sure

open drum
silent zealot
#

Just put in the tooltip comment "based on total value of sound radiuus of fired guns"

#

Does the mod allow for some recovery "i.e.: instead of "after X total you suffer hearing loss" it's "too much shooting with no recovery time"?

open drum
silent zealot
#

If so it will be nearly impossoble to choose named defaults for every server since the "tempo" of gameplay maters

craggy nacelle
silent zealot
#

But numeric trhesholds are still fine.

icy night
silent zealot
#

If you havn't done that yet leave it as a feature for a future update, "points healed per day"

open drum
#

hmm nope

#
    local sq = getCell():getGridSquare(getPlayer():getX(), getPlayer():getY(), 0);
    local shelf = IsoThumpable.new(getCell(), sq, "carpentry_01_16", false, ISSimpleFurniture:new("Normal", "carpentry_01_16", "carpentry_01_16"));
    shelf:setIsContainer(true);
    shelf:getContainer():setType("Normal");
    shelf:getContainer():AddItems("Base.Crowbar", 10);
    shelf:setHealth(1000)
    shelf:setIsThumpable(true)
    shelf:setMovedThumpable(true)
    sq:AddTileObject(shelf);
silent zealot
#

...actualy when I say it that way it's super easy to do, add a function to the oncePerDay event that removes DailyHEaringRecovery from the value.

craggy nacelle
#

ah i remember i think, try to add RecalcProperties() at the end. ๐Ÿ™‚

#

with square

#

sq:RecalcProperties()

icy night
#

Yeah, I think I know how to do it that way

craggy nacelle
open drum
#

didn't work ๐Ÿ˜ฆ

#

dunno what's causing the problem