#mod_development

1 messages · Page 76 of 1

agile vigil
#

Is all good 🙂

#

I appreciate the help, this is my first attempt at classes in Lua, and my setup was getting a bit hard to read without it.

#

It'd be really awesome if I could autobox some of these laugh

golden sparrow
#

Hello everyone, I'm new to modding and I can't find a way to ID zombie, I tried ZombieID, getOnlineID() and getkeyID() so far but everything either return nil or -1 am I doing something wrong ?

ancient grail
#

Search the lua files for movingobject

#

Or something like that. Im afk i cant check

#

What ks it youre tring to achieve

golden sparrow
#

Oh yeah there's a getID method i'm gonna check that

#

Ty

ancient grail
#

🫡

drifting ore
#

how would i safely remove one of the vanilla professions from the game

neat hedge
#

you could study what some of the rebalancing mods do there since those affect the starting traits

#

if there winds up being no easy way to remove it you could do something like set all its values to nothing to effectively remove it, or make it too expensive to ever pick

plucky oxide
#

Hi 👋 I have created a new mug item which is a duplication of the basic mug, without any particular addition except the texture.

How can I get this new mug to have the basic mug recipes? Making coffee, all different types of hot/cold drinks ?

#

I have added a new evolvedrecipe, I have the recipe in game which takes my new mug but I can't do anything with it. I also tried to change the evolvedrecipe list of the coffee item without success. Any ideas?

thick karma
#

@neat hedge At a glance, only IsoGameCharacter (the object of players / zombies) has a "setVariable" function, so I'm not sure about triggering animation events on a vehicle. You may have to work out a pretty original solution there.

#

And IAnimationVariableMap and AnimationVariableSource

neat hedge
#

that might not be too hard to work with, provided I can still find a way to give things hurtboxes

thick karma
#

But idk how those could tie back to vehicles if vehicles don't have anim variables.

neat hedge
#

if I can make footfalls have a frame on stepdown where they do absurd damage wherever they step we could probably get cars all squished, but then there's the clipping issues to consider

thick karma
#

Again, adding footfalls to a car's motion would require some pretty creative programming, but I suppose you could periodically trigger some sort of event like that as you walked.

neat hedge
#

what could be done is utilizing both character objects and cars. the car is made invisible and a playermodel rendered over it in its place to handle the actual animations and whatnot, but that's preeeeetty jank

#

I'm PRETTY sure cars have actual hitboxes since they're able to spaz out like they do sometimes when they clip into certain things so there could be ways to exploit that

thick karma
#

Well the player object is used to set and track animations, not the model assigned to the object, so I don't know that finding some janky way to stick a player model on a car would help you use the built-in animation system any better.

#

Also unsure game would let you

thick karma
ancient grail
#

@neat hedge
Wait for anonymous or albion they should know about cars

agile vigil
#

I seem to have some trouble with confirming a player's identity.

So I have character Alice, belonging to player Bob logged in as username Charlie, let's say.

When Alice dies and Bob makes a new character, Eve, then I need to confirm that it is still Bob playing Eve, preferably via the username Charlie.

My issue is that player:getUsername() just returns the name Alice and Eve in singleplayer, so it breaks there.

ancient grail
#

Singleplayer shouldnt have usernames

#

Ifaik cuz three no need for client nor server related stuff and username is only need for that

#

Maybe displayname would be more appropriate

agile vigil
#

Wouldn't people be able to just select a displayname to match someone else?

ancient grail
#

Singleplayer is single player why would there be someone else?

#

Create a loca host to solve your issue i think

#

Local*

agile vigil
#

I'd prefer having a one-solution-fits-all rather than having to find selection criteria for whether or not the player is in a single-player, split-screen, or multiplayer game right now.

pulsar heath
#

hi there, anyone available to respond to a dumb question thats been making me pull my hairs out?

astral dune
#

Cars do have hitboxes, just a single simple rectangular cuboid. Interacting with the actual physics engine is difficult to impossible though. Not even the vanilla code really touches the physics engine much. For example when you collide with something in a vehicle, the java just notices that your velocity changed rapidly, and searches in a radius for what might have been the cause, pretty jank tbh

#

as for vehicle animations, I don't know if this is what you're actually looking for, but obviously any mod that adds moving doors, hoods etc work with the animation system that vehicles have, good place to look

nimble spoke
sour island
#

Hopefully the new update to liquids open up recipes and fluid containers to be a bit less rigid

#

Let me make a gallon of coffee in my bleach bottle drunk

minor yew
#

Is there a good amputation mod?

plucky oxide
neat hedge
solid dawn
#

Does someone here has experience with the professions framework? I'm trying to add a profession that automatically adds two traits instead of one.

I tried traits = {"Burglar", "Scavenger"} but that crashes my game and traits = {"Burglar"}, {"Scavenger"} doesn't work

astral dune
#

Having a look at the documentation, none of the examples have more than one trait, but the fact that its a table implies you should be able to have more than one

#

what error do you get?

pulsar heath
#

stupid question of the day: is there any way to init the rcon on single player mode?

solid dawn
#

For some omnious reason it worked now. What I did was renaming the trait to Scavenger2 and change the line exclude = { "Claustophobic" } to exclude = { "Claustophobic2" }.

I think it was the second one because the professions framework replaces the vanilla skills and prefixes them with a 2

astral dune
#

Does it really do that? Sounds like that would break everything

#

but I haven't worked with it so its just a knee jerk reaction

#

Also, is there really a typo in the trait and they didn't fix it for the 2 version? lol

quasi geode
#

it doesnt replace the vanilla ones. the ones with the 2 suffix are 'profession versions' of the vanilla traits (cost no points, cant be manually selected)

#

shouldnt need to really exclude any of them (like Claustophobic2) since these traits cant be selected anyways and must be manually assigned to professions

pseudo ermine
#

how do you edit mod options / settings

#

for specific mods

quasi kernel
#

Mod Options can generally be found via an appropriately named mod called Mod Options- however sandbox settings can be viewed for specific mods if those mods are enabled when you're viewing said settings on world creation. I believe there's also other mods to edit sandbox settings while a world has already been made, so that's that.

dim hill
fast galleon
#

@pseudo ermine
make a patch mod

fast galleon
pseudo ermine
lyric mesa
#

Not really sure where im supposed to ask this but I guess ill ask it here,
Ive seen other servers make it so that you dont get the "Workshop item version is different than the servers" whenever their is a mod update but how?

astral dune
#

I assume they make their own modpack

lyric mesa
astral dune
#

Its frowned upon generally

lyric mesa
left walrus
#

Hey guys I’ve recently started playing PZ and haven’t been able to get a definitive answer I’ve searched online as well but Does anyone know of the most up to date and playable NPC mod, I’m running superb survivors but I keep seeing 2 in 1 and superior Survivors I check the links and they bring me too superb ALSO are there any know GOOD compatible mods that are beginner friendly to run along

astral dune
lyric mesa
#

damn

pulsar heath
#

anyone knows what lua libraries can be used in the mods?

#

does it have all the libs that "regular" lua has or is it limited ?

astral dune
#

its more or less standard lua 5.1. "Regular" lua comes with no libraries, so I'm not really sure what you're referring to there

#

well, I suppose you could consider table , string and math as libraries, they're in there

pulsar heath
#

what i mean is... by default my lua install has the sockets lib

astral dune
#

no, nothing non-standard like that

#

you can fire up the game in debug mode and run something like for n in pairs(_G) do print(n) end if you want to see what's available out of the box

pulsar heath
#

and can i require my own lib placed inside the mod folder? A small lua script to make my life easier with some functions that i use regularly?

astral dune
#

yes, for sure. All lua files are loaded by default, and require works as normal

pulsar heath
#

any place in particular in the mod folder structure to place the lib?

#

or i can just throw it in with the rest of the lua files?

astral dune
#

if its stuff you're gonna use all over the place I'd say put it in the shared folder, otherwise you may have access issues

pulsar heath
#

ok, thanks for the info... will give it a try. I have the app working but i dont want to use keypresses so trying to figure out another way to make it work, and i thought about simple tcp/ip comms to send small strings that the mod reacts to

astral dune
#

I'm not aware of PZ's lua having any access to the network stack. What are you trying to do?

pulsar heath
#

i made a mod that integrates with twitch... it used keypresses to trigger events in the game. But its very limited, in mp its easier since i use rcon to do whatever i need to and not keypresses since the events are triggered from the server... in single player i dont have that option... at least that i know i cant use rcon in single player

#

didnt had the time to work on the mod, but now im on vacation so... plenty of time... trying to improve on it and make it more user friendly

astral dune
#

hmm, well then you already know more than me, I have no idea how you'd do twitch integration

pulsar heath
#

its quite simple... i made a lib for c# that uses the pubsub endpoint

#

the lib does all the hard work, the mod only reacts to what the app tells him to do... like send zombies, etc

#

so the easy part was doing the lib, the hard part is making the mod work the way i want.

#

the way the mod is right now you need to use a third party app for it to work to send the keypresses

#

the way i want it to work, you only need the mod and my app to do everything from setting the events on twitch, and serve as middleman between the game and twitch api

astral dune
#

so you currently have certain keys mapped to trigger events?

sour island
# lyric mesa damn

You can leave the pack as unlisted - won't show up unless you link it. And can still be downloaded through the game.

pulsar heath
#

but that means the user has to setup the keys in the game, plus the rewards on twitch, plus the third party app to send the keystrokes that has a limit since the free version of the app doesnt allow more than 10 different "buttons" that trigger the keystroke

#

so its kind of boring, repetive and not easy to set up

astral dune
#

may be able to flange up something with file i/o

pulsar heath
#

when it was for my own use... it was fine... but i was dumb enough to put it on the workshop

#

i thought about the file thingie... but that opens another big can of worms

#

i do have a version of it that works that way... but its... not very viable...

#

also made a version that uses memory, but that can be sometimes detected as cheating... so to future proof it and avoid false cheating flags when the game implements an anti cheat, im trying to figure another way to do it

astral dune
#

how did you do it with memory?

pulsar heath
#

it kinda works...

#

i tried a method using pipes

astral dune
#

it will take some digging in the Java, but I imagine it may be possible to send server command or client command packets. Not sure if there is any encryption involved

pulsar heath
#

well the rcon init is public but i have no way how to make it work

#

i digged a bit through the java but found nothing that could help me

#

but im even worse at java that i am with lua 🙂

drifting stump
#

if you have it working for multiplayer then why not just run a server for singleplayer

pulsar heath
#

thats an option for me, but not for everyone

#

worst case scenario ill have to keep using the keystrokes and make my own thing in c#

#

but that means i will have to bang my head to send the correct codes since it uses glfw if im not mistaken

drifting stump
#

it absolutely is just click host on the main

pulsar heath
#

you have to think that not everyone that streams has the cpu power to host the game and run everything else, hosting a game needs more resources and some machines cant handle hosting, streaming and everything else or whatever else the streamer needs

drifting stump
#

it really doesnt most games just run an offline server for singleplayer

#

zomboid hasnt gone this route yet but i expect it to eventually

pulsar heath
#

run it in sp check the task manager, then do the same with a host and check it again

humble oriole
#

I would just run the hosted server if I was playing solo, far easier to manage

pulsar heath
#

youll see it eats up more resources

#

and anyway, im a stuborn dude... i want it to work my way 😄

neon bronze
#

can anyone help me with ui stuff? trying to add Scrollbars but :addScrollBars() doesnt do anything

humble oriole
#

Speaking of stubborn, I'm really struggling with a mod I'm working on. I'm placing down a moveable and it initiates the object on the client side, but doesn't ever do it on the server side. I've looked at plenty of examples, but I just don't understand it well enough to spot the actual reason why it doesn't. Is anyone familiar enough with the IsoObject system to give me a hand?

drifting stump
drifting stump
humble oriole
drifting stump
#

?

humble oriole
#

Well, when I was looking at some of the vanilla code, it's made up of an Object/System pair on both the client/server side and a map object, right?

    self:initNew()
    if SBioGasSystem.isValidModData(isoObject:getModData()) then
        self:noise("Valid Data")
        self:fromModData(isoObject:getModData())
    end
    self:saveData(true)
end```

function SBioGas:stateToIsoObject(isoObject)
self:toModData(isoObject:getModData())
isoObject:transmitModData()
end```

    local isoObject = self:getIsoObject()
    if not isoObject then return end
    self:toModData(isoObject:getModData())
    if transmit then
        isoObject:transmitModData()
    end
end```
fast galleon
#

nevermind, I'm on mobile

#

I get confused when I read

drifting stump
#

you transmit modData but you never transmit the object anywhere

#

now i dont know if this is the code to place it down but when you create the object it needs to be transmitted to the server

humble oriole
drifting stump
#

where do you create the object

fast galleon
#

If you have a global object, pretty sure server got the isoObject

humble oriole
#

Creating the object is done in this style, right?
local javaObject = IsoThumpable.new(cell, sq, spriteName, north, modData)

drifting stump
#

yes

iron wagon
#

Is there a good intro to nodding anywhere?

drifting stump
iron wagon
astral dune
#

IsoObject.transmitCompleteItemToServer() has to be related, right?

drifting stump
#

indeed

#

dont forget to add the object to the square too

humble oriole
drifting stump
#

but seeing as you already have it locally you should be doing that already

pulsar heath
#

i think im gonna go the easy way and use files... maybe make the mod check for file changes and use it to trigger the mod events...

humble oriole
# drifting stump dont forget to add the object to the square too

The Indie Stone has this in the code for traps.

    if SBioGasSystem.isValidModData(square:getModData()) then
        self:noise('moving square modData to object')
        self:fromModData(square:getModData())
        self:reinitModData(square)
        self:toModData(isoObject:getModData())
    end```
#

the comment leads me to believe they don't do it that way anymore

astral dune
#

I think they're referring to modData there, not the object itself

humble oriole
#

ah, ok

drifting stump
#

indeed refering to modData only

fast galleon
#

how do you know server has problem

humble oriole
#

because if it's initiated on the server it shows up under GlobalObject ModData

fast galleon
#

If it wasn't on server, you would have no global object?

#

Are you testing on MP?

humble oriole
#

yes

#

I don't understand then why it's not staying loaded when I port away.

fast galleon
#

the isoObject?

#

Anyway, to debug properly you need to have access to logs and print everywhere you are not sure.

fast galleon
humble oriole
#

man, I thought I was getting a handle on this, but I guess not :/

fast galleon
#

So I try to update the battery degrade function and I ended up with this (condition is integer)

            degradeVal = degradeVal > 1 and 1 + math.floor(ZombRand(degradeVal * 100) / 100) or math.floor(ZombRand(100 / degradeVal) / 100 ) == 0 and 1 or 0

which is much better than what it used to be and keeps the values from original

#

-- average of 1M rolls / 10: 5.5 / 3: 2 / 1.6: 1.37364 / 0.9: 0.90082 / 0.033: 0.03280

#

can I modify it so that when degradeVal is above 1 it averages to that value? I've tried a bunch of alteration but they don't scale well

#

I get close but with weird results

astral dune
#

averages to what value?

drifting ore
#

please can someone help me with something fairly basic lol. i've tested a million different variations

this function is being called just fine, but the way i've written this. somehow it seems like it never checks again after the original call to check timestamp vs server startup timestamp which is defined as serverStarted. as it's written i just wanted it to restart every minute for testing

    function restartsixhr()
            print("[Nipdate] Setting Auto Restart...")
                local currentTimestamp = getTimestamp()
                if currentTimestamp - serverStarted >= 60000 then
                    restartTime()
                end
            end
#

every other part of the block functions, and everything is working. except this portion is just never actually calling restartTime()

#

and yes i'm incredibly new so i'm probably missing something straightforward.. but hoping this helps push me into new territory of understanding 🙂

pulsar heath
#

missing a loop?

#

how do you call the function?

drifting ore
#

just return?

#
function Nipdate.pollWorkshop()
    local fakeTable = {}
    
    if pendingReboot then return end

    print("[Nipdate] Checking for outdated workshop items...")

    querySteamWorkshopItemDetails(getSteamWorkshopItemIDs(), function(_, status, info)
        if status ~= "Completed" then return end
        for i = 0, info:size() - 1 do
            local details = info:get(i)
            local updated = details:getTimeUpdated()
            local haveUpdate = false
            if updated >= serverStarted then
                haveUpdate = true
                local modLine = "Mod \""..details:getTitle().."\" ("..details:getID()..") has an update!"
                print("[Nipdate] "..modLine)
            end
            if haveUpdate then
                workshopOutdated()
            end
        end
        -- call the Nipdate.restartsixhr function before checking for updates
        restartsixhr()
    end, fakeTable)
end
if (SandboxVars.Nipdate.RestartDelayMinutes or 5) == 0 then --Only do this if we're in the mode where we only reboot with no users online. Will require a restart of server to initialize this mode. 
    Events.OnDisconnect.Add(function() Nipdate.pollWorkshop() end)
end
#

near the bottom there

#

im super unfamiliar with how to call things properly

pulsar heath
#

gimme a second to read it... was deep in visual studio so my brain is a bit slow right now

drifting ore
#

no problem at all. thanks for even taking a sec. i'm essentially adding the function to add restarts into an workshop updating script now

#

it runs perfectly. even my function i'm calling works just fine (not pretty but works) but it's never making it to call the restartTime()

#

if i remove the math check, it will instantly restart over and over

#

so i know it works

#

well it doesnt restart.. i have that built into a loop on my server.bat

astral dune
#

getTimestamp() is in seconds, isn't it?

drifting ore
#

is it?!

#

i swear was ms but my brain was so slow that i might have just told myself that

pulsar heath
#

yeah i dont see anything wrong

drifting ore
#

after knowing it was seconds

#

maybe it was seconds and i been doing other things that made me forget

astral dune
#

there is a getTimestampMs or getTimestampMillis or something

pulsar heath
#

is it in s?

#

the loop is correct so might be the condition

#

i dont know how the server timestamp works

#

if its ms or s

drifting ore
#

i swear was MS but i'm going to test with anon input

#

thank you for now i shall see. hopefully this will create a one stop shop for mod updates and server auto restarts without needing any scheduler outside of pz

drifting ore
pulsar heath
#

its possible that there is a problem with the conditions that determine whether or not the Nipdate.pollWorkshop function should be called.

drifting ore
#

it's normally called via the math at the bottom

#

sec

#
local nextPoll
Events.OnTickEvenPaused.Add(function()
    if not restartingNow and restartingAt then
        if isServerEmpty() then
            print("[Nipdate] Restarting the server now! (Outdated workshop items were detected and server is empty)")
            Nipdate.rebootServer()
        elseif restartingAt - getTimestamp() <= 0 then
            print("[Nipdate] Restarting the server now! (Outdated workshop items were detected)")
            Nipdate.rebootServer()
        end
        return
    end

    if pendingReboot then return end

    -- Don't bother checking for outdated Workshop items if there's no restart delay and the server has players on it
    if (SandboxVars.Nipdate.RestartDelayMinutes or 5) == 0 and not isServerEmpty() then
        return 
    end
    
    local timestamp = getTimestamp()
    if not nextPoll or timestamp >= nextPoll then
        nextPoll = timestamp + ((SandboxVars.Nipdate.WorkshopPollingIntervalMinutes or 1) * 60)
        return Nipdate.pollWorkshop()
    end
end)
#

sorry

#

it does use sandbox vars to change the value but i have it set for both functions

pulsar heath
#

at first glance... i think you have the condition wrong... dunno but i get the idea that for example, if the RestartDelayMinutes variable is not set to 0 and the event listener is not added, the Nipdate.pollWorkshop function will not be called when a player disconnects.

drifting ore
#

it's set to restart automatically if no players detected, and to initiate a another function if it does detect

#

i do think you are right. i just can't work out how to get it to check that data on a regular basis without checking it a bajillion times

pulsar heath
#

in not very good with lua but from what i can see you prolly got the condition wrong

drifting ore
#

gonna run this and see

function restartsixhr()
    print("[Nipdate] Setting Auto Restart...")
    local currentTimestamp = getTimestamp()
    print("Current timestamp: ", currentTimestamp)
    print("Server started timestamp: ", serverStarted)
    if currentTimestamp - serverStarted >= 60000 then
        restartTime()
    end
end
pulsar heath
#

it appears to rely on the workshopOutdated and restartsixhr functions to handle initiating a reboot. It is possible that these functions are not behaving as expected, or that there is a problem with the conditions that determine whether or not a reboot should be initiated. But thats as far as i can go atm... my brain is kinda overworked today...

drifting ore
#

no worries

pulsar heath
#

go with baby steps

drifting ore
#

they work fine atm

#

only seems to have an issue when i call this

pulsar heath
#

1st try just the reboot in case of an update

drifting ore
#
LOG  : General     , 1672782439894> 51,853,937> RCON: listening on port 27015
LOG  : General     , 1672782440780> 51,854,825> [Nipdate] Checking for outdated workshop items...
LOG  : General     , 1672782440882> 51,854,926> [Nipdate] Setting Auto Restart...
LOG  : General     , 1672782440882> 51,854,926> Current timestamp:      1672782440
LOG  : General     , 1672782440882> 51,854,927> Server started timestamp:       1672782437```
pulsar heath
#

if that works, then add the check for players online

drifting ore
#

have it

#

ill send you dm of code quick

small fog
#

I noticed that the Storm Project is no longer being maintained. Is it compatible with the current PZ version>?

drifting ore
#

omg i think it is seconds

fast galleon
humble oriole
#

to print lines from server lua to the log I just need to do noise("some text")

#

right?

fast galleon
#

noise prints in debug

drifting ore
drifting stump
#

@drifting ore how are you shutting down the server?

#

and OnDisconnect doesnt trigger on servers

drifting ore
#

haha sec

dull moss
#

bruh got timedout cuz i wanted to ping 7 ppl

#

@bronze yoke @sour island @astral dune y'all da real MVPs for encouraging modding and answering questions, cheers to ya

#

@jagged ingot @fast galleon @agile vigil @drifting stump y'all too ❤️

drifting ore
#

nice job

#

also my mod is working! almost exactly how it should just need to fix when it's called. but just watched my first auto restart happen using only in game mod 🙂

#

well and a loop on the .bat file still of course

#

no more schedulers controlling my life! lol

pulsar heath
#

nice, how did you fixed it?

drifting ore
#

lol it wasn't broke

#

ever

#

it uses seconds

#

i had 60000

pulsar heath
#

looool

drifting ore
#

so i tjust never waited long enough

pulsar heath
#

so it is seconds...

drifting ore
#

yes

#

when i changed to 60 boom

#

that print told me everything

#

when i saw the number only go up by like 100 after a few mins

pulsar heath
#

like i said... i didnt see anything wrong with your code... so it could only be one of the conditions...

#

baby steps helps 🙂

drifting ore
#

haha so true. sometimes i get so caught up in so many things at once

#

i just want to remove the call from workshop poll now and set it to call itself i thin

#

it feels to janky just adding it into another function

pulsar heath
#

better janky and working than pretty and not working

drifting ore
#

not wrong LOL

#

maybe i should leave well enough along

drifting ore
pulsar heath
#

youre gonna upload that into the workshop? thats a useful tool to have

drifting ore
#

yes

pulsar heath
#

i can stop relying on the cron jobs...

drifting ore
#

let me just clean it up. it's already on workshop just not updated with this

#

i want to add the sandboxvar

#

to change the time

drifting stump
drifting ore
#

just using the start loop in bat file

drifting stump
#

it causes data loss

drifting ore
#

but this is better than issue rcon commands thru windows scheduler

drifting stump
#

it doesnt save when you run that

drifting ore
#

because it kicks everyone

#

it does

#

it has more logic

#

i just havent shared it all tbh. i tried to keep it simple

#

i can share if you want

drifting stump
#

im talking about getCore():quit()

#

not a scheduler

drifting ore
#

no it does more than that

#

its just how i actually just it down in the end

#

shut it

#

the prints and debug

#
LOG  : General     , 1672788398169> 57,812,213> RCON: listening on port 27015
LOG  : General     , 1672788399385> 57,813,428> [Nipdate] Checking for outdated workshop items...
LOG  : General     , 1672788399581> 57,813,625> [Nipdate] Setting Auto Restart...
LOG  : General     , 1672789299081> 58,713,124> [Nipdate] Checking for outdated workshop items...
LOG  : General     , 1672789299284> 58,713,328> [Nipdate] Setting Auto Restart...
LOG  : General     , 1672789299284> 58,713,329> [Nipdate] Restarting the server (Server empty and 6 hour restart time.)..
LOG  : General     , 1672789299285> 58,713,329> [Nipdate] Saving...
LOG  : General     , 1672789299344> 58,713,388> reanimate: saved 0 zombies
LOG  : General     , 1672789299354> 58,713,399> Saving GlobalModData
LOG  : General     , 1672789299381> 58,713,424> [Nipdate] Quitting in 15 seconds!
LOG  : General     , 1672789300083> 58,714,127> [Nipdate] Quitting in 14 seconds!
LOG  : General     , 1672789301083> 58,715,127> [Nipdate] Quitting in 13 seconds!
LOG  : General     , 1672789302083> 58,716,126> [Nipdate] Quitting in 12 seconds!
LOG  : General     , 1672789303085> 58,717,129> [Nipdate] Quitting in 11 seconds!
LOG  : General     , 1672789304082> 58,718,126> [Nipdate] Quitting in 10 seconds!
LOG  : General     , 1672789305083> 58,719,127> [Nipdate] Quitting in 9 seconds!
LOG  : General     , 1672789306083> 58,720,127> [Nipdate] Quitting in 8 seconds!
LOG  : General     , 1672789307081> 58,721,125> [Nipdate] Quitting in 7 seconds!
LOG  : General     , 1672789308083> 58,722,127> [Nipdate] Quitting in 6 seconds!
LOG  : General     , 1672789309082> 58,723,126> [Nipdate] Quitting in 5 seconds!
LOG  : General     , 1672789310082> 58,724,126> [Nipdate] Quitting in 4 seconds!
LOG  : General     , 1672789311081> 58,725,125> [Nipdate] Quitting in 3 seconds!
LOG  : General     , 1672789312082> 58,726,126> [Nipdate] Quitting in 2 seconds!
LOG  : General     , 1672789313083> 58,727,126> [Nipdate] Quitting in 1 seconds!
LOG  : General     , 1672789314082> 58,728,126> [Nipdate] Quitting...
LOG  : General     , 1672789314082> 58,728,126> EXITDEBUG: Core.quit 1
LOG  : General     , 1672789314082> 58,728,126> EXITDEBUG: Core.quit 3
LOG  : General     , 1672789314083> 58,728,127> EXITDEBUG: Core.quit 4
pulsar heath
#

6 hours restart time?

#

🙂

drifting ore
#

lol when im not testing yes

cinder shadow
#

hey guys i just asked chatgpt to make a project zomboid mod for me. Im curious if it got it right.

#

though i guess it forgot about the model and stuff

#

still neat

pulsar heath
#

if it works ill stop banging my head and ask the bot for the solution lol

drifting ore
#

i dont think it will work out of the box like this lol

#

does object freeze even work

pulsar heath
#

the bot lies a lot, i've asked him for some tips in music production... and he appears to be right, to know what hes talking about, but theres a lot stupid things in the middle

drifting ore
#

yep thats same for me

#

also reiterates alot of the same sometimes

pulsar heath
#

it can give you a blueprint though... but you still need to go through all of it and change like 98% of what the replies

#

simples questions like... how does this function work ... yeah... but the full code... i doubt it

drifting ore
#

also it only has potential info from old api functions if i recall

#

w;hatever was scraped from 2 years ago

pulsar heath
#

the data is from 2021 yes

cinder shadow
#

yeah

pulsar heath
#

i think december or something like that

astral dune
#

chatGPT doesn't understand pass-by-reference so its pretty useless making lua code, lmao

drifting ore
#

yea i'll agree i've gotten way further just asking questions and examining working logic in action lol

pulsar heath
#

well like i said, at least it can give you a few bullet points on what you need to do

#

how to do it... thats another thing

drifting ore
#

i will say, using another model, feeding it all the require dataset up front and going over a few examples

#

it can 100% write a mod just by asking

pulsar heath
#

if its a specialized model it prolly will

#

a multi purpose one... i doubt that very much

#

i imagine the stupid things it has on his dataset since they opened it to the public

#

since its supposed to learn with you as well and "evolve"

drifting ore
#

this beautiful group of people will get you further than any chat bot lol

pulsar heath
#

but now im curious... gonna sign up and ask him a few things

cinder shadow
astral dune
#

I asked chatGPT if it used any of the conversations people have with it as part of its dataset, and its said no. I wonder if it was lying to me

pulsar heath
#

google and facebok also say they dont use user data

#

and like i say... if the product youre getting is free... that means YOU are the product

#

hmm it start by saying what i have to do... but then i ask him for the full code and puff...

#

but its totally wrong though

drifting ore
#

not technically a lie then!

pulsar heath
astral dune
#

I pointed out incorrect code to it once, it said "oh ya that's wrong" and explained properly why it was wrong. Then said "try this instead" and gave me the exact same code

pulsar heath
#

not tottaly wrong though

pulsar heath
#

the base logic is right... but... lua uses imports?

#

i think not good sir...

astral dune
#

thats java code

pulsar heath
#

i requested in lua

#

he spat this out

drifting ore
#

the only real decent chat bot is one that has tha randomizer set to 0

#

it will repeat itself often but rarely give out there answerrs

pulsar heath
#

ok.. very simple its not gonna work on zomboi, but it will run

#

damn

drifting ore
#

at least after halfway decent training

pulsar heath
#

it will work... i think

#

not in zomboid but...

#

it does appear to be the right code for a simples tcp/ip listener

#

i asked him to improve the code and optimize it also display the data received...

#

-- Load the socket library
local socket = require("socket")

-- Create a TCP server
local server = assert(socket.bind("*", 8080))
local ip, port = server:getsockname()
print("Server listening at " .. ip .. ":" .. port)

-- Accept connections and receive data in a loop
while true do
local client = server:accept()
print("New connection from " .. client:getpeername())
local data, err = client:receive("*a")
if not err then
-- Display the received data
print("Received: " .. data)
else
-- An error occurred while receiving data
print("Error receiving data: " .. err)
end
client:close()
end

#

this looks like it will work

astral dune
#

just need the mystical socket library he made up

pulsar heath
#

and now its repeating himself...

#

it works on my ide

#

😄

#

it works ... ok... im gonna dump one of my scripts and see if he fixes it ahahahha

astral dune
#

my favourite convo with it so far went something like

Can you create an object in java without using its constructor?
No you cannot create an object in java without using its constructor, Java objects use constructors to blablabla
Do you know about the java library Objenesis?
Objenesis is a java library that allows you to create java objects without a constructor
Why didn't you mention it before
uh well you see...

pulsar heath
#

and the socket lib is part of the distro i have of lua 5.4

neon bronze
#

I wish coding would be that easy when i could use magical libraries outta nowhere

pulsar heath
#

magical? This lib is old or the bot wouldnt have it in the dataset... ate least 2 or 3 years old

#

but even if i ask him to do it without the lib

#

he keeps using it...

#

when i asked him why is he using the lib when i asked him not to he simply replies: ok, here is the lua script without using blablabla

#

and just repeats the same code over and over again no matter how i ask him not to use it

humble oriole
#

I have the noise line in my functions and I've tried it with or without local function noise(message) SBioGasSystem.instance:noise(message) end in the code and none of my server side luas are printing to debug.

#

am I doing something wrong?

astral dune
#

I just use print and look in the server logs tbh

pulsar heath
#

same... never used noise

humble oriole
#

is it just print("string here")

pulsar heath
#

yup

#

or print("String", var)

#

normal combos apply

#

im lazy to the point when im modding something thats not server sided i just make the char say when jumping inside the code

rancid tendon
#

i have a question:

#

does anyone know of like, a testing map for loot distributions?

winter thunder
#
rancid tendon
#

i feel like a useful thing to have would be a map with just a bunch of every class of container close together and organized so that you can generate worlds and see loot patterns

winter thunder
#

There are some links for the distro stuff here

#

Under the indie stone forum part

rancid tendon
#

hmm, none of those are quite what i'm looking for

winter thunder
#

And you can dig in the LUA, but otherwise- I dont think there is anything like what you are asking. It probably wouldnt be terribly hard to make

#

ooh also- I got axe? 👁️ 👁️

#

But while I am here, if I want to add/remove events to the lua event manager, do I need to require any specific files? Or am I just good to put the Events.OnCreatePlayer.Add(exampleFunction); at the end of my code

winter thunder
dull moss
rancid tendon
#

amazing work musicmaniac! that's a hell of a lot of work to be proud of on display

crystal summit
#

I have a question for modders, no one have made a WWI mod what adds Clothing and guns?

dull moss
#

took 3 weeks EZ

winter thunder
dull moss
#

no now i want to play Imperator Rome 😄

#

maybe a bit later xd

#

i could do ur drugs logic actually

crystal summit
dull moss
sour island
#

Nice job you maniac

drifting stump
#

there was already a mod doing what you did and it had those issues

dull moss
#

it's honestly so good

drifting stump
#

congrats on workshop mod

dull moss
drifting ore
sour island
#

I don't think my new journal method works 😦

#

Doesn't seem to catch addXP decoration if addXP is called in Java - which it is in some cases

#

hmmm

#

Might have to use the hook which I was avoiding

sour island
#

I wonder if there's a way to identify java origin'd hook calls 🤔

jaunty marten
#

@willow estuary what do u think about to create #waywo channel? there're #old_showcase for in-game moments and #creativity for arts and etc but no channel for modding things. ppl sends their works in this channel but want to check exactly smth mods showcase instead 95% discussing

#

🥺

astral dune
#

if anything, please change the name of this channel to #mod_development 😩

dull moss
#

Speaking the truth

sour island
#

that keeps the m m m m

#

My idea was mrogramming

sour island
#

calls from Lua throws the player object in a list

#

event calls checks, clears, and returns if the player is on the list

#

chances are they aren't gaining multiple sources of XP in the same frame

#

maybe I should throw in the perktype just in case

#

the hookcall also uses the boostmap multiplier as a numerator if ignore boostXP is on

ancient grail
sour island
#

🧠

dull moss
#

I use mods I'm very clearly a modder

ancient grail
sour island
#

so we need
mod_support
mod_development
mod_enduserhell

humble oriole
young grotto
#

hello gents, I'm trying to make the lua recognize different broken glasses for more builds mod

#
  MoreBuild.neededMaterials = {
    {
      Material = 'Base.Plank',
      Amount = 6
    },
    {
      Material = 'Base.Screws',
      Amount = 4
    },
    {
      Material = 'Moveables.brokenglass_1_0' or 'Moveables.brokenglass_1_1' or 'Moveables.brokenglass_1_2' or 'Moveables.brokenglass_1_3',
      Amount = 1
    }
  }
#

but this doesn't seem to work

#

it only recognize Moveables.brokenglass_1_0 as the materials

#

and not for the rest of the broken glass

#

how do I write the function to make it recognize multiple broken glass as materials?

jaunty marten
young grotto
#

alright, thank you for the info

humble oriole
#

man, I just can't get this, sorry for asking you guys over and over about this. I'm working with IsoObjects and my client log shows:

and the server log shows:

LOG  : General     , 1672810619416> 45,294,966> HomeBioGas: #objects=1

It's like they're not linked but I don't understand why.

pulsar heath
#

i wish i could help you, but i dont know enough to do so, plus... 6am here... damn... the codes eats away the time and i dont even noticed it...

#

but it finnaly works... only need to finish the gui... good luck bet time for me 🙂

#

bed...

#

cant even type anymore...

#

Twitch api done... mod... 80% done...

ancient grail
fast galleon
humble oriole
#

Why wouldn't any of the prints I have be running in the functions be returning anything?

#
function SBioGasSystem:updateBioGas()
    print("Starting biogas update.")
    for i=1,self.system:getObjectCount() do
        local hbg = self.system:getObjectByIndex(i-1):getModData()```
fast galleon
#

like nothing prints?

humble oriole
#

Yea, I'm not getting anything from any functions in the console

#

Also, other objects like the rainbarrel and farming in the logs show found isoObject with a luaObject instead of found isoObject without a luaObject

#

so, that's why I was assuming I was doing something wrong

fast galleon
humble oriole
fast galleon
humble oriole
#

Events.EveryHours.Add(function()SBioGasSystem.instance:updateBioGas() end)

#

I just don't want to assume it's working

fast galleon
#

you should get the top print, otherwise something is obviously wrong

#

You probably checked already, but are there no stack trace or severe logs on server?

humble oriole
#

There's one for that function, but this one isn't throwing an error.

    print("loading the biogas object")
    if not instanceof(isoObject, "IsoThumpable") then
      isoObject = newBioGas(isoObject)
    end
    SBioGasSystem.instance:loadIsoObject(isoObject)
end```
#

oh cool, that one is working

#

I really wish sitting in debug wouldn't kick you from the server

#

Why would the mod I'm referencing have the values under both the GlobalObject Modata and the IsoObject ModData?

agile vigil
#

What debug mod are you using here? laugh

fast galleon
fast galleon
#

the global object puts / retrieves that data

agile vigil
humble oriole
humble oriole
fast galleon
#

client global object will have no data until you call updateFromIsoObject

fast galleon
humble oriole
#

yourSystem.instance:getLuaObjectByIndex(1?)
C or S forsystem?

fast galleon
#

c, for client

humble oriole
#

no change

fast galleon
#

is that the number 1 object?

humble oriole
#

yes, that's the only object

#

I get a table if I print it

fast galleon
#

ah by index doesn't call the update, only the getAt does.

#

try calling the update on the luaObject

humble oriole
#

I'm not sure how to do that 😦

fast galleon
#

what you did before + :updateFromIsoObject()

humble oriole
#

LOG  : General     , 1672824170943> 58,846,489> Object tried to call nil in console
ERROR: General     , 1672824191476> 58,867,022> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in console at KahluaUtil.fail line:82.
fast galleon
#

probably typo or something, break it into steps

myGloblaObject = CBioGasSystem.instance:getLuaObjectAt(x,y,z)
#

now you can call anything on that object

#

this command has update included

humble oriole
#

awesome

#

not sure why only have the values are coming through, but that's progress at least

fast galleon
humble oriole
#
    self.methane = modData["methane"]
    self.biowaste = modData["biowaste"]
    self.fertilizer = modData["fertilizer"]
    self.maxFertilizer = modData["maxFertilizer"]
    self.maxBiowaste = modData["maxBiowaste"]
    self.maxMethane = modData["maxMethane"]
    self.lastHour = modData["lastHour"]
end```
#

looks fine

fast galleon
#

ah, they were not on the isoObject

humble oriole
#

I'm not sure why, they're initialized on the javaObject and the Sobject

fast galleon
#

I'd check the reverse on server (toModData and maybe your setObjModDataKeys on initSystem)

humble oriole
humble oriole
#

aight, I have to call it, it's 3am haha. Thanks for your help

#

I really appreciate it!

drifting ore
#

nevermind - got it working. switched to using the pop bottle as a base instead of the water bottle, and it worked just fine.

thick karma
#

Anyone have an opinion to share regarding the most well developed and bug free shop mod?

graceful tulip
#

How can I find out which mod is giving me errors?

#

There are too many on my list to try disabling each one by hand

sour island
#

immersive

thick karma
#

Bahaha right on. Well I am humoring the idea of adding gamepad support to the one I decide I like the best. Kinda wanna investigate cool shop mods but virtually none seem to have gamepad support

sour island
#

I forget gamepad is a thing tbh

#

Doesn't seem easy to support(?)

thick karma
#

Advantage of adding it to yours would be at least you linger here often bahaha

#

It's not trivially easy but it's not the hardest thing I've ever had to figure out... But it's a bit time-consuming. Links have to be considered manually and focus passed carefully.

#

And often

sour island
#

My shop code is on my GitHub if you want to collaborate - I can add you as an author on the mod

#

I also have a unreleased faction banking mod on the GitHub too

#

It's a companion mod to the shops

thick karma
#

I will likely wait for you to get your most recent bug fixed and subscribe to the workshop version to work from there on something that will hopefully change more slowly.

#

I already have a lot of the code for going from context menu to popups and back to gameplay from my Jumper mod so hopefully that'll help

#

But yeah definitely nontrivial hence my desire to pick the shop mod carefully first lol probably not gonna do this for any other shop mods

thick karma
dull moss
sour island
#

Well if I can self promote, my shop features are more developed than the others afaik.

You can have more than 1 type of shop, and the shops are tabled in globalModata so you can create connected locations anywhere using any object.

All from in-game UI - eventually I want to make it so anyone (given the right conditions) can make their own shop.

neat umbra
#

Hey, so is zombies reanimating a mod or is it an optional game rule? Because I had an Idea for a mod that someone else could use, as I have no clue if it's already a mod, and if it's not, Idk how to make mods

neat umbra
#

Oh sweet, makes my idea better then

#

The idea is that if you have a bladed weapon, you can cut the limbs and other parts off of zombies -eg, cutting off the arms and mouth like they do in the walking dead, or slicing off all limbs so that, when the zombies DO reanimate, they can only sit there and do nothing

#

Obviously, it would take time depending on the weapon - machetes and axes would be faster than a knife, for example. But it could also scale with your weapons skill level too

#

Once again, this may already exist, but if not, then you can just have this idea

#

I don't know how to mod for shit lol

wooden bluff
#

was this game written in lua?

neat umbra
#

I think so? I just googled it and it came up with a bunch of PZ related articles with titles like "Intro to Lua"

jaunty marten
jaunty marten
wooden bluff
#

oh

sour island
#

Lua is a scripting language, not to get too focused on the technicals.

#

PZ uses a version of Kahlua which is like a middleman between java and lua

#

Much of modding is figuring out where it is best to pin your code to. Lua otherwise is very easy.

robust jetty
#

Any idea why this won't work?

local private = {}
private.refreshContainer = ISInventoryPane.refreshContainer

function ISInventoryPane:refreshContainer()
    private.refreshContainer(self)
    function hiddeEquippedItems(tecla)
        if tecla == 41 then
            for k, v in ipairs(self.itemslist) do
                if v ~= nil and v.equipped then
                    self.itemslist[k] = nil
                end
            end
        end
    end
end

Events.OnKeyPressed.Add(hiddeEquippedItems)
frank elbow
#

What you're doing here is declaring a global function (hiddeEquippedItems) within a function (refreshContainer). This means that the function will not exist in the global scope until refreshContainer is called, which means when you try to add it to the OnKeyPressed event, it will not yet exist.

I'm not familiar with the usual conventions for declaring a hotkey, but in general you would be better off separating out the OnKeyPressed event handler

#

What exactly are you trying to do? I'm assuming you want to trigger the code in the function when refreshContainer is called, but toggle the behavior with a hotkey? If you're trying to track state, you will need a variable to do so

ruby urchin
#

hiddeEquippedItems will never be called because they are in different blocks of code

frank elbow
#

Since it's global, it could theoretically be called if you called the function that declares it first. That's not a very pleasant pattern, though

ruby urchin
#

should be self.hiddeEquippedItems to call him, so you can do Events.OnKeyPressed.Add(ISInventoryPane.hiddeEquippedItems)

frank elbow
#

That won't work, since it's not a member of that table (scoping does not work like that in Lua)

ruby urchin
#

that's why you need add self.

frank elbow
#

That won't work either

#

Oh, I see what you're saying. Declaring the function on self

#

That still wouldn't work though, since you'd have to call it manually first

agile vigil
#

I've seen a few people write in here (this Discord) when trying to commission mods, models, or otherwise. Is there a better place to do that?

I'm thinking of something like the RimWorld Mod Market Discord, where commissioners and modders all meet up to trade money for work.

ruby urchin
agile vigil
plucky oxide
#

Hi everyone, I'm still learning, I'm trying to add a new tee shirt with a logo (just the textures). I managed to get the new tee shirt with my logo on it but I have a problem, I seem to be overwriting a tee shirt in game, I'm not sure.

Do you have a mod to recommend that adds new clothes that use clothingsDecals?

robust jetty
vague raven
#

Was the SMUI stutter fix broken or something? @craggy furnace

robust jetty
#

If i do this it works

local private = {}
private.refreshContainer = ISInventoryPane.refreshContainer

function ISInventoryPane:refreshContainer()
    private.refreshContainer(self)
    for k, v in ipairs(self.itemslist) do
        if v ~= nil and v.equipped  then
            self.itemslist[k] = nil
        end
    end
end

But don't know hot to add a key to trigger it

#

Now it works, nice

#

Now i have to find a way to undo it

#

xd

fast galleon
#

@robust jetty
if private.isPrivate then ... end
OnKeyPressed:
private.isPrivate = not private.isPrivate

fast galleon
robust jetty
#

i don't understand 😅
i was thinking on create a copy of the items and then restore it, but seems more fast yours, if i understand it

fast galleon
#

What I mean is: on key press change the value of isPrivate and check that in the other function

robust jetty
#

U mean restore the default values ?

fast galleon
#

It looked like you wanted two separate functions if you can manage it with one then this not necessary.

vague raven
#

ah ok thanks

astral dune
fast galleon
astral dune
#

actually shit, I just noticed the colon, no it won't work 🤦‍♂️ my bad

fast galleon
#

😦

#

@robust jetty
to add the items back you can call refreshContainers and not remove the items? 🤔

robust jetty
#

I guess so, because they are not deleted, they just don't show up

humble oriole
robust jetty
#

Like this guide says i store the original to call it if a don't need a custom code, but how do i call it to restore default values?

humble oriole
#

@fast galleon where are you looking to see what those functions you were showing me last night do?

jaunty marten
#

cos if use way from screenshot then after reload the file it will override ur overrided func instead real original func

humble oriole
#

Yea… that makes sense

fast galleon
#

there's also the system and the server files, if you haven't looked at them

humble oriole
#

Yea, I typically have the media folder open in vs code and a tab open with the Java.

#

Just wish someone had a diagram somewhere of the relationships between the Server/Client LuaObject and the JavaObject

fast galleon
#

ah, java has similar named files but most times you don't need them for this system

robust jetty
#

You mean something like this

ISInventoryPane.refreshContainer = ISInventoryPane.refreshContainer or refreshContainer
local original_refreshContainer = ISInventoryPane.refreshContainer

function ISInventoryPane:refreshContainer()
    original_refreshContainer(self)
    function hiddeEquippeditems(keypressed)
        if keypressed == 41 then
            for k, v in ipairs(self.itemslist) do
                if v ~= nil and v.equipped  then
                    self.itemslist[k] = nil
                end
            end
        end
    end
    Events.OnKeyPressed.Add(hiddeEquippeditems)
end
#

how do u make it have colors?

#

😅

humble oriole
humble oriole
#

#findinfiles is a lifesaver

jaunty marten
#

there's no good plugin to look jar files in vs code

#

sad

jaunty marten
jaunty marten
#
TABLE.ISInventoryPane_refreshContainer = TABLE.ISInventoryPane_refreshContainer or ISInventoryPane.refreshContainer
local original_refreshContainer = TABLE.ISInventoryPane_refreshContainer

function ISInventoryPane:refreshContainer()
    original_refreshContainer(self)
    function hiddeEquippeditems(keypressed)
        if keypressed == 41 then
            for k, v in ipairs(self.itemslist) do
                if v ~= nil and v.equipped  then
                    self.itemslist[k] = nil
                end
            end
        end
    end
    Events.OnKeyPressed.Add(hiddeEquippeditems)
end
#

@robust jetty

robust jetty
#

I think I understand, this is the part that is hard for me to understand about all this.

pulsar heath
#

im messing around with the mod since i got the api app done ( apart from the gui ) and trying to figure out how the heck this works on zomboid... after reading a while i think i kinda get how to make it... but still.. trying to create a resizable window to display some text but with a imagem before the text.

local window = ISUI.CreateWindow(100, 100, 300, 300)
window:SetTitle("Minha Janela")
local row1 = window:AddRow()
local image1 = row1:AddImage(32, 32)
image1:SetTexture("image1.png")
row1:AddText("sometext bla bla bla")
window:Show()

is it something like this or not really?

solid dawn
#

I am having a problem with the mod I'm currently working on. It's a profession mod and I'm utilizing the profession framework.

The console is giving me this error, which is preventing the game from starting properly:

attempted index: getLabel of non-table: null

LOG  : General     , 1672855775093> -----------------------------------------
STACK TRACE
-----------------------------------------
function: SetProfessionDescription -- file: MainCreationMethods.lua line # 639 | Vanilla
function: doProfessions -- file: 2ProfessionFramework.lua line # 413 | MOD: Profession Framework

ERROR: General     , 1672855775094> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getLabel of non-table: null at KahluaThread.tableget line:1689.
ERROR: General     , 1672855775094> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: getLabel of non-table: null
    at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812)
    at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
    at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
    at zombie.Lua.Event.trigger(Event.java:64)
    at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65)
    at zombie.GameWindow.enter(GameWindow.java:753)
    at zombie.GameWindow.mainThread(GameWindow.java:491)
    at java.base/java.lang.Thread.run(Unknown Source)
LOG  : General     , 1672855775094> -----------------------------------------
STACK TRACE
-----------------------------------------
function: SetProfessionDescription -- file: MainCreationMethods.lua line # 639 | Vanilla
function: doProfessions -- file: 2ProfessionFramework.lua line # 413 | MOD: Profession Framework

LOG  : General     , 1672855775094> 
LOG  : General     , 1672855775172> creating new sourcewindow: C:/Program Files (x86)/Steam/steamapps/common/ProjectZomboid/media/lua/shared/NPCs/MainCreationMethods.lua```

It says something about the ProfessionDescription but everything seems right to me? I have already created some traits and there were no such problems. Maybe there is a typo which I just can't see... but I doubt it.
#

Thats how the profession looks like:

    name = "UI_prof_buildercarp",
    icon = "prof_buildercarp",
    cost = -6,
    xp = {
        [Perks.Woodwork] = 3,
        [Perks.Maintenance] = 1,
    },
    clothing = {
        Eyes = {"Base.Glasses_SafetyGoggles"},
        Hat = {"Base.Hat_HardHat"},
        Shirt = {"Base.Shirt_Workman"},
        TorsoExtra = {"Base.Vest_HighVis"},
        Hands = {"Base.Gloves_LeatherGloves", "Base.Gloves_LeatherGlovesBlack"},
        FullSuit = {"Base.Boilersuit", "Base.Boilersuit_BlueRed"},
    },
    traits = {"Buildercarp"},
})```

And thats the corresponding entry in the translation file:

```UI_prof_buildercarp = "Builder",
UI_profdesc_buildercarp = "",```
#

can someone make sense of the error message?

polar prairie
#

does anybody know how to get a simplified uv-map in blender? i always end up with a messy unsorted texture with thousands of individuel parts.

bronze yoke
#

it wants to add the name of the trait to the profession description

old ginkgo
#

Quick question;

I've managed to make a chat stream that needs to be used in a separate tabID than '1' (the default general tab) in the ISChat.lua, but I can't figure out how to populate/generate a second tabID on chat creation, I know it's possible since admin's have the 'admin chat'. Is it possible for a regular non-admin client to have more than one or even two chat tabs?

elder zephyr
#

Does anyone know how to activate mods just from a collection in project zomboid? Example: I have 500+ mods downloaded but only want to use 40 of them which I’m currently subscribed to and are in a collection. When I go to make a new world, it still shows the 500+ mods downloaded but I want to use just my 40 that I want.

solid dawn
#

classic

old ginkgo
elder zephyr
astral dune
#

did you download the mods manually? If you want to use the subscription feature then you can only use the subscription feature, once you manually drop mods in they're there until you manually remove them

solid dawn
#

Question here. Is it possible to override specific vanilla functions without overriding the whole file itself? If yes how do I do so and which one would I have to overwrite to half the amount of propane used when deconstructing metal items and car wrecks (I want it to only be half when a certain trait is selected)?

#

I was thinking the function in question might be ISMultiStageBuild:consumeMaterial() in ISMultiStageBuild.lua or it is this one: function buildUtil.useDrainable(item, uses) local count = math.min(uses, item:getDrainableUsesInt()) for i=1,count do item:Use() end return count end

bronze yoke
#

as long as the function is global, you can just rewrite it in your own file:

function sameFunctionName(arguments)
    --etc etc
end
#

in most situations i would find a way to not override the entire function, like this:

local old_function = functionName

function functionName(arguments)
    -- run code before
    old_function(arguments)
    -- run code after
end
#

in this case, halving the uses before passing it to the old function might be appropriate

sour island
#

I love it when functions return what they produce

#

Makes overwriting that much easier

#

I feel dirty jumping in after fillContext menu to remove options

#

Although I guess/hope it's a list pre-render

humble oriole
#

biowastecontainer:addItem(item:getReplaceOnUse())
Trying to add an item to a container and it's just throwing an object error? Is it because I'm adding it to the variable instead of the object?

astral dune
#

if the variable isn't the object, what is it?

humble oriole
#

it is, I got it

#

biowastecontainer:AddItem("Bowl")

#

was using the wrong addItem

astral dune
#

lmao, having different methods that vary by a single capital letter is pure cancer

humble oriole
#

Now I just need to figure out why half my variables aren't initializing

#

This is really annoying, I wrote out the logic to do the work in like 2 hours and there's only minor syntax errors.

#

I have spent hours trying to figure out this stupid object system, haha

pulsar heath
# elder zephyr I tried doing that but it still shows the 500 mods whenever I go to add mods but...

dont remember the exact file but if you create a new game and select only those 40 mods in the save folder that file called mod something you have the list of the mods ( ids i think ) that the save loads, you can use that to make the collection... did something similar about a year ago dont remember why, with a little bit of python and the steam api everything is possible using the info on that file

#

or was it a mod i had that created that file? dont remember very well...

#

its mods.txt stored in the save folder

#

that should have the list of the mods that every save loads, use that as base to make the collection

#

for example %userprofile%\Zomboid\saves\sandbox\nameofthesave\mods.txt

solid dawn
# bronze yoke in most situations i would find a way to not override the entire function, like ...

sooo something like that I guess? Sorry I have absolutely no experience with lua or PZ modding. This is the first time I'm trying to get into it

local old_function = buildUtil.useDrainable

function buildUtil.useDrainable_NWO(item, uses)
    local count = math.min(uses, item:getDrainableUsesInt())
    
    if (item = "Base.BlowTorch" or item = "Base.WeldingRods") and player:HasTrait("Blacksmithmetal") then
        local count = math.min(uses, item:getDrainableUsesInt() * 2)
        local count_eff = math.ceil(count / 2)
    else
        local count = math.min(uses, item:getDrainableUsesInt())
        local count_eff = count
    end
    
    for i=1,count do
        item:Use()
    end
    return count 
    old_function(count)
end
drifting ore
#

bro I feel so bad asking questions here I feel like I'm annoying yall 💀
is there a guide on how to save information from mods input? like if I assign a player a local value of 5 and I want to make it persistent every time he joins?

#

I'm looking at LUA codes in the folder but I cannot find anything relevant

#

to saving data, that is

dull moss
#

does moddata stay even if mod is disabled? aka if i enable mod with moddata, run it for a while, disable it, play without it, and then enable it again. Will moddata stay?

pulsar heath
#

save it to a file ?

#

at least thats what i've been doing...

drifting ore
#

Basically yeah, save the information to a file on the servers' database

#

So it's a lua thing to learn to save files right?

#

I don't have to google it specifically tied to PZ?

pulsar heath
#

you can use the filewriter

#

i think thats whats its called

drifting ore
#

Gotcha, thank you man I appreciate you a lot! 🙂

#

I'll take the steps from here 😂

pulsar heath
#

keep in mind it only can write to the mod folder

#

or was it somehwere else? lemme check

#

i think you can specify where to write the file but by default it writes the file @ %userpfoeil%\Zomboid\Lua

#

never bothered to much since i only use it for temporary information

#

@ %userprofile%\Zomboid\Lua

#

damn my keyboard is drunk today

bronze yoke
#

if it's specific to a player, use (player object):getModData().key = value

bronze yoke
dull moss
#

nice

#

cheers

molten cobalt
#

@dull moss @finite owl @winter thunder - Just an FYI I've published the WIP Vampire Mod to the workshop, just thought I'd let you know and thank you for your help (a lot of help!), its very much appreciated - and that goes for everyone on here too, its a great community 🙂 - I'm sure I'll be back soon when I come to the next stage with it haha

dull moss
#

where link

molten cobalt
#

Didn't know if this was the place to post the link but if its ok I can

molten cobalt
#

There you go

molten cobalt
#

Very WIP and all the image are just placeholder, but I thought I'd get it out there to get some feedback/suggestions etc

drifting ore
#

nice job dude

dull moss
#

ez rate up

molten cobalt
#

Thank you, honestly the people here deserve a lot of credit, wouldn't have been able to do it without you

drifting ore
#

i think almost everyone in here feels that way at some point lol

neon bronze
#

Hey how do you remove items from players inventory? For some reason when i add bullets instead of getting one i get six bullets

solid dawn
# solid dawn sooo something like that I guess? Sorry I have absolutely no experience with lua...

Hm okey this is the error I get.

LOG  : Lua         , 1672868748239> Loading: C:/Users/xxx/Zomboid/mods/NewWorldProfessions/media/lua/server/BuildingObjects/ISBuildUtil_NWO.lua
Jan. 04, 2023 10:45:48 PM zombie.Lua.LuaManager RunLuaInternal
SCHWERWIEGEND: Error found in LUA file: C:/Users/xxx/Zomboid/mods/NewWorldProfessions/media/lua/server/BuildingObjects/ISBuildUtil_NWO.lua
ERROR: General     , 1672868748246> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: ISBuildUtil_NWO.lua:7: ')' expected near `=` at LexState.lexerror line:278.
ERROR: General     , 1672868748246> DebugLogStream.printException> Stack trace:
se.krka.kahlua.vm.KahluaException: ISBuildUtil_NWO.lua:7: ')' expected near `=`
    at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:278)
    at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:289)
    at org.luaj.kahluafork.compiler.LexState.error_expected(LexState.java:683)
    at org.luaj.kahluafork.compiler.LexState.check_match(LexState.java:713)
    at org.luaj.kahluafork.compiler.LexState.prefixexp(LexState.java:1108)
    at org.luaj.kahluafork.compiler.LexState.primaryexp(LexState.java:1130)
    at org.luaj.kahluafork.compiler.LexState.simpleexp(LexState.java:1211)
    at org.luaj.kahluafork.compiler.LexState.subexpr(LexState.java:1303)
    at org.luaj.kahluafork.compiler.LexState.expr(LexState.java:1321)
    at org.luaj.kahluafork.compiler.LexState.cond(LexState.java:1424)
    at org.luaj.kahluafork.compiler.LexState.test_then_block(LexState.java:1597)
    at org.luaj.kahluafork.compiler.LexState.ifstat(LexState.java:1610)
    at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1736)
    at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
    at org.luaj.kahluafork.compiler.LexState.body(LexState.java:1026)
    at org.luaj.kahluafork.compiler.LexState.funcstat(LexState.java:1681)
    at org.luaj.kahluafork.compiler.LexState.statement(LexState.java:1758)
    at org.luaj.kahluafork.compiler.LexState.chunk(LexState.java:1790)
    at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:198)
    at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:132)
    at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:124)
    at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:546)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:510)
    at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:342)
    at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:264)
    at zombie.gameStates.GameLoadingState.enter(GameLoadingState.java:97)
    at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
    at zombie.GameWindow.logic(GameWindow.java:298)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:765)
    at zombie.GameWindow.run_ez(GameWindow.java:681)
    at zombie.GameWindow.mainThread(GameWindow.java:495)
    at java.base/java.lang.Thread.run(Unknown Source)
astral dune
# solid dawn sooo something like that I guess? Sorry I have absolutely no experience with lua...

I don't think this will work. The first issue is nothing after a return statement will ever get run, so the old function doesn't happen. If you put it before the return, its going to drain it the normal amount, so you'll end up draining extra. You're either going to have to not call the old function at all, or cache the fuel amount before, call the old function, then change the result after

uncut meteor
#

what is the type for negative numbers

dull moss
#

it's still integer, no?

uncut meteor
dull moss
#

cuz you set minimum to 0

#

0 is not lower than -255 my man

astral dune
uncut meteor
#

oh i'm stupid

dull moss
#

happens

solid dawn
astral dune
#

which means it will never get called

solid dawn
#

ah k got it

fast galleon
#

inventory:AddItem(InventoryItemFactory.CreateItem("base.item"))

neon bronze
bronze yoke
# solid dawn hm no new function has _NWO at the end

let me explain this a bit better:
we use this

local old_function = functionName
```to save the original vanilla function into a variable, we do this so that if multiple mods overwrite the same function they'll call each other's code in a chain - otherwise we'd all overwrite each other, and only one mod would have its code run
we replace the original function by using the same name, with one that calls the saved copy we made:
```lua
local old_function = functionName
function functionName(args)
    old_function(args)
end
```when we do this, we can mess around with the arguments going into the original function
```lua
local old_function = functionName
function functionName(number)
    number = number + 5
    old_function(number)
end
```when the original function has a return value, we need to return it as well:
```lua
local old_function = functionName
function functionName(number)
    number = number + 5

    -- if you don't need to run any code after the original function, just return it:
    return old_function(number)

    -- otherwise, save it into a variable, mess with it, then return it
    local returnValue = old_function(number)
    returnValue = returnValue / 2
    return returnValue
end
#

of course, you don't strictly have to mess with the arguments/return value of a function: you can run any code you want in your overwritten function

fast galleon
#

I like doing it like this lately:
ISReadABook.new = myPatch(ISReadABook.new)

humble oriole
#

Also, doesn't derive do the same thing, or am I misunderstanding what that does.

#

CBioGasSystem = CGlobalObjectSystem:derive("CBioGasSystem")

bronze yoke
#

derive is for classes, or pseudoclasses or whatever you want to call them

humble oriole
#

that should seriously be pinned though

bronze yoke
#

i don't think we do pins here, but i appreciate that 😇

humble oriole
#

we wouldn't have to worry so much about load order of mods if they all followed that

drifting ore
#

yea this clears up some things for me big time also

#

thank you

dull moss
#

@molten cobalt
"- Making the time the damage is dealt between dynamic, so it is correct as of dawn and dusk in each season."

#

instead of dealing damage only between specific times of day, do it always but multiply damage by 1 - getClimateManager():getNightStrength()

polar prairie
#

does anyone had the issue that the texture for a model is working. but in another savegame it is not? kind of weird. the model is working fine for both tho.

plucky oxide
#

table.insert(ProceduralDistributions.list["X"].items, Y)

Hi ! What is the max value of Y? 100? Is it the percentage chance of spawning?

winter thunder
humble oriole
#

When I'm setting up an object, where's the most appropriate place to assign a sandbox variable to a modData variable?

#

Would I do it under initNew? I feel like that wouldn't update existing objects.

bronze yoke
#

you want it to update existing objects? then i'd ask why it needs to be moddata

humble oriole
timid gull
#

does anyone know how to control the radiation in the stalker mod?

molten cobalt
#
local function TraitSunlightSensitive()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        local allBodyParts = player:getBodyDamage():getBodyParts()
        local bodyPart = allBodyParts:get(ZombRand(allBodyParts:size()))
        bodyPart:AddDamage(5)


        

    end
end
Events.EveryOneMinute.Add(TraitSunlightSensitive)

local function TraitMinorSunlightSensitivity()
    local player = getPlayer();
    local timeOfDay = getGameTime():getTimeOfDay();
    if timeOfDay > 9 and timeOfDay < 20 and player:isOutside() then
        local allBodyParts = player:getBodyDamage():getBodyParts()
        local bodyPart = allBodyParts:get(ZombRand(allBodyParts:size()))
        bodyPart:AddDamage(2.5)


        

    end
end
Events.EveryOneMinute.Add(TraitMinorSunlightSensitivity)
bronze yoke
#

yep

#

can the traits be earned during gameplay? if not, i would use something like

local function AddTraitEffects(_index, player)
    Events.EveryOneMinute.Remove(TraitSunlightSensitive)
    Events.EveryOneMinute.Remove(TraitMinorSunlightSensitivity)
    -- the above cleans up the events, in case the player had the trait, died, and made a new character

    if player:HasTrait('Trait1') then
        Events.EveryOneMinute.Add(TraitSunlightSensitive)
    end
    if player:HasTrait('Trait2') then
        Events.EveryOneMinute.Add(TraitMinorSunlightSensitivity)
    end
end
Events.OnCreatePlayer.Add(AddTraitEffects)
```otherwise, rewriting your events like this:
```lua
local function TraitMinorSunlightSensitivity()
    local player = getPlayer();
    if not player:HasTrait('TraitName') then return end
    -- etc
end
```would be the simplest way of doing this
molten cobalt
#

No you can't earn them doing gameplay no, thank you for this, I'll see if that works now

humble oriole
#

can you call server side functions like you can with client side ones, the output just shows up on the server log?

astral dune
#

I like musicmaniac's idea to use nightstrength though, means you'd take different amounts of damage depending how high the sun is in the sky. Could also take other weather into effect

astral dune
molten cobalt
#

I'll add it to the suggestions 🙂

humble oriole
#

I have to use rcon don't I

astral dune
#

not if you use the host button on the main screen, but if you set up a local server I'm sure it must have some way to enter commands for server maintenance

#

whether or not it lets you run lua code I don't know, I just use host for testing

#

Personally I have a custom Client command that I use to tell the server to run code I want to test , but its a bit of a lift to set that up

bronze yoke
#

i don't think you can run lua commands from the server console

#

i was about to suggest what anonymous just mentioned

astral dune
#

can servers not be run in a debug mode like that? its a shame

molten cobalt
#

Do I include the " "? or just the name straight up?

astral dune
#

as for using RCON, I thought that was impossible but I've been told otherwise, I'll have to look into that

bronze yoke
#

it needs to be in quotations

molten cobalt
#
local function AddTraitEffects(_index, player)
    Events.EveryOneMinute.Remove(TraitSunlightSensitive)
    Events.EveryOneMinute.Remove(TraitMinorSunlightSensitivity)
    Events.EveryOneMinute.Remove(TraitExtremeSunlightSensitivity)

    if player:HasTrait('sunlightsensitive') then
        Events.EveryOneMinute.Add(SunlightSensitive)
    end

    if player:HasTrait('minorsunlightsensitivity') then
        Events.EveryOneMinute.Add(MinorSunlightSensitivity)
    end

    if player:HasTrait('sunlightsensitive') then
        Events.EveryOneMinute.Add(ExtremeSunlightSensitivity)
    end
end
Events.OnCreatePlayer.Add(AddTraitEffects)
#

Is what I have, but doesn't seem to do the damage at all now, does that look right? - I've got to head off now but I'll look at this again in the morning ty for your help

astral dune
#

you'll have to call that AddTraitEffects function in some event

bronze yoke
#

it's added to OnCreatePlayer at the end

astral dune
#

ah

bronze yoke
#

i noticed you're using different names when you're removing them than when you're adding them, i think you're likely adding the wrong names and that's why nothing is happening

astral dune
#

does that event fire when you make a new character after death? handy

bronze yoke
#

it's fired when an IsoPlayer object is created

astral dune
#

ahh ya TraitSunlightSensitive vs SunlightSensitive

pulsar heath
#
filewriter("eventdata.txt", "r")
-- read the contents of the file into a string
local fileContents = filewriter("eventdata.txt", "r", "*all")
-- check if the file is empty
if fileContents ~= "" then
    -- split the string on newline characters
    local lines = fileContents:split("\n")
    -- create an empty dictionary
    local eventData = {}
    -- iterate over the lines
    for _, line in pairs(lines) do
        -- split the line on the ":" character
        local key, value = line:split(":")
        -- add the key-value pair to the dictionary
        eventData[key] = value
    end
    -- delete the contents
-- delete the contents of the file
filewriter("eventdata.txt", "")
#

this is to read a json string and get the values...

#

anything that looks wrong?

#

wanted to test it but dont have pz installed on this pc

#

...

drifting ore
molten cobalt
#

@bronze yoke , so the trait name in the "" needs to be same as the name used in the local function, that starts with Trait? Or the name used when creating the trait, like

SunlightSensitive = TraitFactory.addTrait("sunlightsensitive")

bronze yoke
#

it needs to be that one - i meant the names of the functions

#

Events.EveryOneMinute.Remove(TraitSunlightSensitive) vs Events.EveryOneMinute.Add(SunlightSensitive)

bronze yoke
dull moss
#

isn't it created on new character freshly anyway?

#

oh

#

nvm

#

makes sense

drifting ore
#

sorry for imposing but im learning something i need to use for auto restart mod im working on.
Events.EveryOneMinute.Add(function)
would i keep that indefinetly?

OR
else Events.EveryOneMinute.Remove
or is there a reason you'd need to remove after?

#

or even have it in the first place

#

or only if there is a condition that would need to remove

bronze yoke
#

it depends on the exact situation

drifting ore
#

for me it's checking for gettimestamp vs timestamp of server start

#

i want to do that regularly

bronze yoke
#

if the code to add it can run more than once, you probably want to remove it first otherwise the function will run multiple times every minute

drifting ore
#

oh. so else remove would only run it once per min?

#

i'm trying to add a sandbox var for it so if i can figure this out then i can use that arg instead of a set number

#

dont need help with that part but understanding the event that makes sense for detecting gettimestamp vs server started timestamp so i can have a variable timing on server restart. and yes im an absolute noob but this mod is almost done 🙂

molten cobalt
#

Sorry, so the local function name or the traitfactory one?

bronze yoke
#

the traitfactory one is the one you need in the if, but that's not why your code isn't working

#

when you add the event, you're calling Events.EveryOneMinute.Add(SunlightSensitive), but from what i can tell your function is called TraitSunlightSensitive

molten cobalt
#

Ah ok cool, so it needs to be TraitSunlightSensitive

astral dune
#

Event.Add really should throw an error when it gets nil, lol

uncut meteor
#

is this safe?
Folder placed in /shared/
Original mod used number instead of sandboxvars and he placed the .lua in client and server

bronze yoke
#

shared should be fine

#

if they added the exact same file to client and server, that's pretty silly - the client runs files in the server folder anyway

uncut meteor
molten cobalt
#

@bronze yoke I'll check it with the same names tomorrow and check, thanks for your help

sour island
plucky oxide
#

A Necro forge user to help me? In the tab to get the list of all modded items, my items are duplicated, do you know why?

bleak prairie
#

how would i go about making a command?

astral dune
#

what kind of command?

bleak prairie
#

also when it comes to the actual chatbox itself, when im adding stuff to it does the image have to be from the game or can i add it with the mod.
like this: self.visibleButton:setImage(getTexture("media/ui/Panel_Icon_Gear.png"));

#

where the image is, can i add that to the mod folder

astral dune
#

Thats actually a good question, I'm not sure how to add admin style commands

bleak prairie
bronze yoke
#

they can be from your mod

bleak prairie
#

saund, thanks for the help, ill see if i can figure out that command thing.

drifting ore
#

good example of usage is in udderly up to date i believe

#

in the client commands file

bleak prairie
#

ill have to check it out

#

thanks

drifting ore
#

yes its exactly what you want to know

#

np

left walrus
#

can anyone halp me
im new too modding in PZ im not sure if i have my mods in the right load order
i can send a screenshot of my mods if that helps

#

idk how to tell if 1 a mod i added is working and 2 if i have them in the right load order true actions for example isnt letting me read while walking, as well as sit down n the chairs superb survivors is at the top of my mod list, i added a lot of good popular mods from the work shop QOL mods, britas guns, some vehicle mods, bunker mods for the paramilitary start mod etc

#

that last one is working, britas is working, npc mod check. but as far as the others idk

red rapids
#

Cant find the ID of paw low loot in the workshop folder any idea where it is?

drifting ore
humble oriole
#

are map objects just lua defined items?

humble oriole
#

I'm also noticing that if the object isn't loaded when I start the server, the server can't interact with it?

ruby urchin
#

What the dog doing

brisk badger
#

Who the dog doin

winter thunder
winter thunder
lament canopy
#

where can i find the stuff that makes obese give bonus fall damage and stuff

#

like the extra trait code

vast nacelle
lament canopy
#

can i find examples in the files

vast nacelle
#

A lot of trait related effects are on the Java side so you'd need to decompile the java files to see what they are doing.
If you just want a general usage of traits in the lua-code, searching inside files for "HasTrait" will bring up a bunch of trait-related code.
For example in media\lua\client\TimedActions\InventoryTransferAction.lua, this is where Dextrous/Allthumbs affect transfer times.

  o.maxTime = o.maxTime * 0.5
end
 if character:HasTrait("AllThumbs") then
   o.maxTime = o.maxTime * 4.0
 end```
lament canopy
#

where could i find the one for fitness/weight related ones

young grotto
#

just wondering, where can I get the list of the Moveable. items?

#

I'm trying to find moveable big blue dumpster

#

moveables.txt and newMoveables.txt doesnt have it

bronze yoke
#

i think most of them are generated at startup

young grotto
#

oh aight, thanks

bronze yoke
#

if you want the type or something it would be easier to just pick one up and grab it from the console

young grotto
#

okies

vast nacelle
#

Yeah, they are of type "Moveables.Moveable"

#

So a generic placeholder item that the game dynamically fills with the correct data when one is needed.

bronze yoke
#

oh yeah i remember this now, i helped someone work out how to spawn them - you had to call a function on the placeholder that fills the data

young grotto
#

I see

#

hmm i think scripting works too

#

since popsicle fridge doesnt have specific moveable

#

so I just do Result:Moveables.appliances_refrigeration_01_21

humble oriole
#

don't most moveables get their properties from the tile definitions?

#

I pull moveables from tiles all the time to give players items that may be more rare to buy on our shop. And I'm using them as my sprites for the Biofuels mod I'm making. the object sprite below is a placeholder

{
  Type                = Moveable,
  Icon              = default,
  DisplayName          = Moveable,
  DisplayCategory     = Carpentry,
  WorldObjectSprite   = DylansRandomFurniture01_13,
}```
humble oriole
#

I'm still having trouble with my objects. When I load into the server, it doesn't initiate the server side object and I'm not sure why 😦

humble oriole
#

I was wrong

fast galleon
#

btw, you can send commands to server to debug it, just make a custom debug command that calls functions on server.

humble oriole
#

Just so I can wrap my head around this. The luaobject is a temporary object that is initiated by the server on startup. And it's built off an isoObject which is the "long term" storage that is saved to the server, is that roughly correct?

#

So you interact with the luaobject and then push it to the isoobject for storage, right?

fast galleon
#

yeah, that how most vanilla works

humble oriole
#

seems really messy

fast galleon
#

remember the data keys I mentioned before? those are saved on the server on the global object even when the isoObject isn't loaded.

#

luaObjects always get their data from another object, they all have a java globalObject. To get the luaobject, you basically do globalObject:getModData(). But those objects only save things you tell them to save.

Most systems now, work around an isoObject and put / transmit the data that way.

humble oriole
#

it's just like I'm pretty sure I understand what this code is doing, but it's awful that it has to be done this way.

#
        local isohbg = hbg:getIsoObject()
        if isohbg then
            hbg:fromModData(isohbg:getModData())```
#

but if I want to update every one of my objects on the server, I just have to iterate through them all and do this. it's just really messy

fast galleon
humble oriole
#

yea, that's old code I haven't tested yet, in my client function I'm not doing it that way.

#

and then after I do the work on the lua object I transmit the whole thing back to the isoObject

#

just seems like there an extra step in here for w/e reason

fast galleon
#

you only to call fromModData on clients btw, server shouldn't need it. Not sure how you imagine updating all objects without iterating.

humble oriole
#

and now it's not allowing me to get any luaObjectsbyindex.
if I do self.system:getObjectCount() it shows 1

#
self.system:getLuaObjectByIndex(1)
self.system:getLuaObjectByIndex(2)```
#

these all return nil

fast galleon
#

self is the instance right, you call lua functions on that directly. Not to mention Lua objects use Lua system (start from 1)

humble oriole
#

Yea, I know that. I tried 2 because the function returns (index-1)

    return self.system:getObjectByIndex(index-1):getModData()
end```
#

that's how I'm calling it, so self should be correct

#

you're saying instead of self.system just use self?

fast galleon
#

no you use getLua above on the java system

humble oriole
fast galleon
#

either call getObjectByIndex on system, or getLuaObjectByIndex on instance, don't mix things up

#

there's also getLuaObjectCount or something you can use on instance

humble oriole
#

I'm sorry if this is a really stupid question, but what's the difference.

fast galleon
#

just print them to see if they are same obj and if they have same functions

bronze yoke
#

self.system is a java object

humble oriole
#

this is what happens when you go to college for programming and then become a linux system admin xD

bronze yoke
#

i'm honestly not that sure what it's for but that's why there's some redundancy

humble oriole
fast galleon
#

excuse the coder of this for any mistakes 😅

#

system getIbject gives you the global object
getModData then gives you the luaObject

humble oriole
#

ah, I didn't realize you wrote ISA!

fast galleon
#

just the parts after April, like this system

humble oriole
#

lol

#

and

#
    return self.system:getObjectByIndex(index-1):getModData()
end```
fast galleon
#

yeah, this system has a lot of parts like that

humble oriole
#

this is so painful, it's just interfacing on top of it

#

what's to stop us from just doing everything on the IsoObject?

#

since, the lua object modifiers just interface the IsoObject anyway

fast galleon
#

You can overwrite everything for your system, even make a different one.

fast galleon
#

At first I thought it would give me the isoObject whenever I wanted, like you did.

#

You can replicate everything with a global ModData table.

humble oriole
#

I expect there to be about 60-80 of these on a server and any particular time. Likely a significant % will be doing nothing but existing.

#

a modData table would be thicccc

#

I have 2 more questions.

  1. Why is it when I change the contents of a container with lua and restart the server, it reverts the contents to before I did the lua work.
  2. Are sandboxvars available to the entire lua stack?
young grotto
#

guys, how do I use setCanPerform(String functionName)

#

I'm trying to remove a recipe

#

what should I put in the string and function name?

humble oriole
#

getScriptManager():getRecipe('Gather Gunpowder'):setIsHidden(true)
getScriptManager():getRecipe('Gather Gunpowder'):setLuaTest('Recipe.OnTest.AlwaysFalse')```
#

that's how I'm doing it, I think albion helped me with that

young grotto
#

hmmm

humble oriole
#

setIsHidden won't work if you're using ReduceLagofCraftingMenu

#

So I just have that line commented out.

#

Naturally you'd want to change Gather Gunpowder to your recipe name

fast galleon
#

@humble oriole
I've been renaming a lot of things and making them like modules instead of adding everything to global space here.
https://github.com/Poltergeistzx/ImmersiveSolarArrays
I don't suggest you do the same while debugging but it's something to consider. If you plan ahead, it will be easier to make everything local later.

GitHub

ImmersiveSolarArrays for Project Zomboid. Contribute to Poltergeistzx/ImmersiveSolarArrays development by creating an account on GitHub.

humble oriole
#

is this code what's live on the mod now?

fast galleon
humble oriole
#

it is not, I'll take a look at it. I referenced the live code on the workshop a lot for what I've written

fast galleon
humble oriole
#

ok, I'll keep an eye on it. My mod is significantly more simple than yours, so it may not be worth it.

#

Do I have to do anything special to do math things in lua?
output["BioGas"] = (MethaneDailyRate / 24) * 1 * (biowaste / MaxBiowaste)
this is throwing some very odd errors

fast galleon
humble oriole
#

__div not defined for operands in

#

time to print

humble oriole
raw canopy
#

Hi guys! Can anyone explain to me, why client-side part of the mod is allowed to give a character XP?

I recently read code for the mod Skill Recovery Journal, and I was shocked when I found out that thole whole mod is client-side! And the strangest part was that I saw a call to a function player:getXp():addXp(...) in a client script.

Does this mean I can just fix any lua script on my computer to give myself max xp for all traits, and this will act like a cheat for MP? Shouldn't giving out XP be a server's prerogative?

I'm confused, please explain it to me, anyone?

#

Oh! @sour island You're the creator, right? Could you help with the message above? :)

frigid gate
#

I see that a lot of people are discussing issues right now, so I hope I don't interrupt anything! I've been wanting to create clothing mods for Zomboid for quite some time, and finally got around to doing it. I'm just having issues with it once I get to the whole process of having it show up in game. It does show up, but when spawned in debug mode I get 57 lua errors that I don't have the vocabulary to decipher, and when I right click on it to open the context menu my game brings up all of the debug info. Please forgive me if my descriptions of the issue are terrible, I only have experience on the visual art side of modding.
For some more context, the item is a blindfold, and should be set up right. I set the clothing location as a hat, and I haven't bothered to do any uv mapping or texturing since I'm basically just figuring out how the heck to do the whole process of modding. If anyone has any ideas or needs more info, please let me know!

polar prairie
#

does anybody has a link to a blender-addon which can export .x files?

drifting stump
#

Anyway if you want to cheat that much you can edit the java part

ancient grail
raw canopy
ancient grail
#

Does anyone have a code that lets me determine the angle
For a turret mod
Like where the player is

hollow sand
#

Looking for a modder that would be willing to work on an idea I had for multiplayer.

Willing to pay.

Essentially the mod idea is that instead of dying, a character goes into a DBNO (down but not out) state.
Upon hitting a certain HP threshold, your movement is heavily restricted, you’re essentially crawling, and require medical aid to get back up.

Otherwise it could be as simple as if you go down you have a countdown until another player can revive you.

frigid gate
odd notch
#

how expensive are sendclientcommand/sendservercommands?

#

could they run ontick?

#

say, a sendclientcommand that tells the server to give clients near the source client the value of a variable

ancient grail
#

i dont think they are but when placed ontick im not sure

#

shouldnt u be using global moddata in such cases?

odd notch
#

i didnt even consider that, thank you

fast galleon
#

send command is supposed to limit traffic, not the opposite

fast galleon
#

if "source" can have modData then you can just check that modData. e.g. isoObject type
and regularly have the server send the data if the obj is loaded.

#

It's what the global object system like traps/farm do.

odd notch
#

or must server moddata be the middleman

fast galleon
#

depends where you change the values, but server is always in the middle obviously

calm depot
#

AFAIR, when you call transmitModData() everyone else's "truth" becomes whatever the instance sent

#

regardless of whether the instance is a client or a server

fast galleon
#

depends what you mean, global modData specifically says it will not send to clients unless instructed to.

odd notch
#

i’m looking to add typing indicators to roleplaychat and want to do so without bricking peoples servers

#

so when a player starts typing, they send logic to nearby players that they’ve done so- and as i type this i realize i can probably do this without moddata altogether

#

wish me luck, tysm

fast galleon
#

Olipro is there a way to set an exact float (java) from lua? It usually loses precision e.g 2 becomes 2.00000008

calm depot
#

lol, I don't think you really mean 2 in your example, do you?

fast galleon
calm depot
#

welcome to the world of IEEE-754 floating point values

#

what you want is unfortunately impossible

drifting stump
#

The solution is to not print unformatted floats

#

The innacuracy is intrinsic to floats

calm depot
#

I don't think he's bothered about the print statement

drifting stump
#

He only saw the inaccuracy with a print

#

¯_(ツ)_/¯

fast galleon
#

well no I noticed that a > b is not accurate

calm depot
#

herein lies a key issue, you almost never want to use == with a float comparison

fast galleon
#

which is why I printed it, to better show my problem

calm depot
#

what you actually want to do is validate that x > Y > z, where Y is your float

calm depot
#

what was the exact conditional statement

fast galleon
#

the float can be higher than was I set

calm depot
#

the other caveat you have to contend with is that when you hardcode a float in your program, that also will end up as whatever the closest representation is

fast galleon
#

I was comparing the possible maximum multiplier you can get from a book with the current multiplier of a player.
Only difference from vanilla, maximum can be multiplied by a float.

calm depot
#

well, again, what was the comparison statement?

fast galleon
#

it was the float a which I set > the float b which the player has. Sometimes it was true, sometimes not. Which is why I added the extra y: a + y > b
I've changed this a few times but the principle is something like that.

sour island
#

Would math.max() work better here?

ancient grail
#

will this work if i type this on a live server

#
Events.OnWeaponHitCharacter.Add(function() 
    function isntaKill(wielder, character, handWeapon, damage)
        local godWeapon = 'Base.DoubleBarrelShotgun'
        if  wielder == 'Glytch3r' then 
            if handWeapon == godWeapon then
            character:getBodyDamage():setOverallBodyHealth(0)
            print(character)
            end
        end
    end
end)
calm depot
#

no

ancient grail
#

ow why

#

so it has to be part of a mod?

calm depot
#

if by "will this work" you mean "will isntaKill be in scope when I do the remove"

ancient grail
#

na forget the remove i just wanted to remove it so that when i reinitiate anychanges it removes the first version

#

there removed the remove

calm depot
#

OK, so isntaKill is already defined?

#

in Lua, a global is really just a key in the _G table

ancient grail
#

no its not on any mod i just want to set it via debug

calm depot
#

then just declare it

ancient grail
#

ye but it doesnt 1 shot the player i tried it

fast galleon
#

I think he just wants to run the logic inside

calm depot
#

what are you talking about?

#

your snippet registers a function for an event that does nothing other than replace _G.isntaKill

ancient grail
#

im not sure if im not explaining it correctly basically once i run the command using debug im able to 1 shot a player

#

is there such instaKill? i just named it

#

if i cahange the name will it matter

calm depot
#

🤦‍♂️

#

why couldn't you simply have said "I want to inject a function that results in a 1-hit kill if I use a particular shotgun"

ancient grail
#

sorry bout that

#

so will it be possible? what things do i need to modify for this to work

calm depot
#

the enclosing function that you pass to Events.OnWeaponHitCharacter.Add takes no arguments and it simply declares a global function

#

what it sounds like you want to do is first declare your global function and then pass its name to Events.OnWeaponHitCharacter.Add

#

although you could just do it inline, but it appears you want to also be able to easily remove it from the debug prompt

#

whether or not it will actually work, I don't know. I haven't looked to see whether a client can arbitrarily tell other clients they've been shot and killed

ancient grail
#

yep

#

it wont work i think

#
getPlayer():getPrimaryHandItem():setMinDamage(99999999);
getPlayer():getPrimaryHandItem():setMaxDamage(99999999);
#

also did this

#

didnt work too

calm depot
#

mmm, you would more than likely need to do it on the server

ancient grail
#

Ok il try

agile vigil
#

@sour island There was some scare earlier about whether your addXp decoration via reflection was safe / worked with anti-cheat and without debug mode.

I wasn't really paying attention at the time, but could you clarify if the solution was problematic to use, or if the anti-cheat flare-up was unrelated to the decoration? 🙂

finite owl
#

Apologies if I'm teaching you to suck eggs 🙂