#mod_development

1 messages Β· Page 270 of 1

zenith glacier
#

AH , that's why.. is there another event i could use ?

#

Maybe, OnRefreshInventoryWindowContainers ?

bronze yoke
#

if you want to catch players moving items it's best to hook the inventory transfer action, there isn't really an event for it

zenith glacier
#

Okay , thank you so much , ill find another way to do it with the inventory transer action MeruLuv

red tiger
#

@digital sail I hate seeing that you had to backport bitwise ops support yourself. Wish I could've told you I did this too.

#

I wrote one that searches the game's API for exposure to bit32 bitwise ops on the Java side to make them faster.

#

Been a bit pushy for the past couple of years to get Build 42 or a future build to expose some math tools like this.

digital sail
red tiger
#

I ended up writing my own as a result to work with a optional Java patch. =)

#

Been building a commons-like library for these sorts of tools over the past months to help others find it if they need it.

digital sail
#

I had to admit I did not benchmark it at all. You think the Lua implementation is slow?

red tiger
#

I don't know if yours is but mine is yeah. Adding Java into the interops calls speeds mine up by ~ 5x

#

I'll link mine. I put it in a gist too.

digital sail
#

I don't want to edit the Java code though. I would if it was supported by Steam workshop. As it is it would be detrimental to the mod to ask people to move a file manually.

red tiger
#

It's optional, not mandatory.

#

The code asks if that class is present and if so then set the function to call the Java API else run the pure Lua alternative.

digital sail
#

I see.

red tiger
#

Reading numberlua rn

#

Trying to see how they did it.

digital sail
#

I'll keep that in mind after benchmarking the mod if I need to optimise the code then. I could add some info on the mod page on how to install it.

red tiger
#

I emulate bitwise ops over strings based off an earlier example I saw. I wonder if this one does something much faster.

#

Yours looks faster. I'll play with that and see how it fares against mine.

#

Right now I'm packaging up a 2-month project but this is interesting enough to look at. Thanks for posting it in your credits.

digital sail
#

You're welcomed

red tiger
#

I needed mine for an AES encryption library I modified to work in the PZ Lua environment

digital sail
#

I really needed that CRC32 library as I did not want to implement it myself, because I'm lazy :D

red tiger
#

It ended up being so slow I moved to a simple key-expanded char-code modifier encryption solution for now.

digital sail
#

Why do you need AES?

red tiger
#

Encrypted LuaNet packets.

#

I wanted true encryption but had to settle for less since Kahlua is so dramatically slow and ill-equipped for tools from the JVM that aren't exposed.

#

This was my console last night:

digital sail
#

haha

#

you are brave for trying to make sense of the mess that is PZ code
I just try to encapsulate whatever works :'D

red tiger
#

I think the funniest thing about this project is that I worked on it a couple times over the past year. I had brain surgery between those two points.

frank anvil
digital sail
#

I was a little surprised when I realised Khalua does not implement next (table [, index])

red tiger
#

I wrote a primitive integer library before I got that rock out of my skull. xD

frank anvil
#

I'm working on a silly little thing with my silly little program

digital sail
#

hahaha, what the hell

#

you need to find a game with C programming or something low level like that

red tiger
#

I think like a C programmer. Thanks for realizing that. Yes I am a little odd...

#

hahah

digital sail
#

We make mods for Project Zomboid, we are all odd here. No worry.

red tiger
#

10 years of it will bake yer brain. You'll become one of them..

#

So this is all for an anti-cheat, btw.

digital sail
#

makes sense

red tiger
#

It's to securely package and send over a payload of code to the client that then checks for game mods and kicks them.

#

The keys are cycled every x seconds.

digital sail
#

Are there a lot of cheaters in PZ?

red tiger
#

It's all handled by bootloader code on the workshop.

red tiger
digital sail
#

😬

red tiger
#

It's really funny.

#

But now I have a way to check client-side with obstacles in the way from compromised clients duping the anti-cheat so now the real fun begins.

#

One could write a true build 41 anti-item-dupe check.

#

And because of the nature of serving the anti-cheat code from the server's machine through the workshop bootloader, a server could modify their copy to be stronger / resistant to otherwise template copies.

viral spire
#

Are there any mods out there that gradually decrease zombie populations to simulate them dying of starvation AKA 28 Days Later, or is this already doable in the advanced zombie settings?

I don't think I ever got an answer for this in the past, but this is the one thing I'd love to do in order to simulate a Rage Virus run, in order for me to actually outlast the Infected.

half arrow
viral spire
queen oasis
#

I still have this issue when I'm highlighting squares. The starting position moves even though it is only set once and doesn't change. Does anyone know why this is happening?

-- set startX, startY from OnMouseDown function
startX, startY = ISCoordConversion.ToWorld(getMouseXScaled(), getMouseYScaled(), getPlayer():getZ())

-- set endX, endY from OnMouseMove function
endX, endY = ISCoordConversion.ToWorld(getMouseXScaled(), getMouseYScaled(), getPlayer():getZ())
local x1, x2 = math.min(startX, endX), math.max(startX, endX)
local y1, y2 = math.min(startY, endY), math.max(startY, endY)
-- standard for loop to getSquares and highlight floor
red tiger
#

I'm not too sure but that's my first thought.

#

I usually see glitches like this from floating values as inputs not being sanitized.

queen oasis
#

I'll check. I was under the impression that ISCoordConversion.ToWorld returned a floored number but maybe not

red tiger
#

I'm speaking purely from a first-glance observation.

queen oasis
#

that's a lot of decimal

red tiger
#

pcall strikes again. .__.

#

This whole custom pcall business PZ does is really a sore thumb.

#

Libraries use pcall(require) to check if libraries are present and carries on if not. PZ literally forces me to modify source code of imported libraries to fix this from causing complete failures.

queen oasis
#

thanks Jab, idk why I didn't check that. it's fixed

red tiger
#

Working on retro-fitting a MD5 library in pure Lua 5.1 to work inside of Project Zomboid.

#

It'll be useful for verifying string payloads transmitted through server-files to client for additional security options for people who use my code-loading framework. =)

frank anvil
#

Am I working hard or hardly working?

frank anvil
maiden stump
#

A question that you folks might be able to help me with:

Open wardrobes function as intended and display clothes when they're placed at map creation, but they stop displaying anything once moved. Is there anything that can be tweaked, either in debug mode or with a simple mod, that would fix that issue?

I tried using the brush tool in debug mode, but that wardrobe also failed to display anything.

red tiger
#

Documentation isn't ready yet however I'm happy to have all this code up on the workshop and on GitHub:

#

Basically, EtherHammerX is the content mod and ModLoader / Asledgehammer Utilities are the libraries that power it.

#

EtherHammerX is a mod that securely checks the client-side for mods that enable hacks & cheating on multiplayer and zapps it. Even if the client is compromised to check for my anti-cheat somehow the server will have ways to figure that out and handle them.

#

ModLoader serves the contents of the anti-cheat and allows for servers to add additional checks of their own and diverisfy their security so that it makes it harder for cheats to combat the anti-cheat. =)

#

Open-Source + Security-hat gang. <3

#

It's probably going to be around 8 - 10 hours of documentation for this but hopefully this'll help the multiplayer community combat the more recent cheats out there on the marketplace.

fallow mauve
#

hi im fairly new to zomboid mapping however i got a quick question

if i creating an area in a vanilla tile and i leave a tile blank, will the vanilla tile be overwritten?

gilded yoke
#

I'm building an access manager. Whats an easy way to wipe player logins not just the whitelist

#

players.db?

#

or perhaps the whitelist is the login...

teal nacelle
#

the game crashes whenever i try to load in with the mod I've been tryna make

#

here's the code, mostly made with the help of folks on here lol:

-- if you want an icon for this trait, put an 18x18px PNG
-- named trait_Autism.png into media/ui/Traits

local Autism = {} -- don't pollute, keep it local

Autism.doTraits = function()

local addTrait = TraitFactory.addTrait("Autism",
      getText("Autism"),
      -1,
      getText("A mental disability. This trait is not a 1-1 recreation of the real experience, nor is there only one unified experience for everyone with ASD. This is simply based on my own."),
      false,
      false)

TraitFactory.sortList()

local traitList = TraitFactory.getTraits()
for i = 1, traitList:size() do
    local trait = traitList:get(i - 1)
    BaseGameCharacterDetails.SetTraitDescription(trait)
end

end

Events.OnGameBoot.Add(Autism.doTraits)

Events.OnWorldSound.Add(function(x,y,z,radius,volume,source)
print(volume)
if volume > 3 and getPlayer():HasTrait("Autism") then
getPlayer():getStats():setPanic(25)
end
end)

queen oasis
#

Seems to work ok

queen oasis
# teal nacelle here's the code, mostly made with the help of folks on here lol: -- if you want...

name the file yourtrait.lua or something, just make sure it's .lua extension
make sure to save the file is in C:\Users\yourusername\Zomboid\mods\whatevermodname\media\lua\client\

local Autism = {} -- don't pollute, keep it local

Autism.doTraits = function()

    -- this initializes the trait and adds it to the trait list
    local addTrait = TraitFactory.addTrait("Autism",
          getText("Autism"),
          -1,
          getText("A mental disability. This trait is not a 1-1 recreation of the real experience, nor is there only one unified experience for everyone with ASD. This is simply based on my own."),
          false,
          false)

    -- sort all traits
    TraitFactory.sortList()

    -- idk if this needs done, but it was in the guide you were using so I kept it
    local traitList = TraitFactory.getTraits()
    for i = 1, traitList:size() do
        local trait = traitList:get(i - 1)
        BaseGameCharacterDetails.SetTraitDescription(trait)
    end
end

-- add the trait when the game boots
Events.OnGameBoot.Add(Autism.doTraits)

-- when there is a world sound, do this
Events.OnWorldSound.Add(function(x,y,z,radius,volume,source)
    local player = getPlayer() -- the player object
    local stats = player:getStats() -- the stats of the player
    local panic = stats:getPanic() -- the current panic of the player
    if volume > 3 and getPlayer():HasTrait("Autism") then
        player:Say("It's loud")  -- visual indicator for testing
        stats:setPanic(panic + 25)  -- add 25 to the current panic level
    end
end)
teal nacelle
#

Do I do the same thing as panic for stress too, or is it different?

drifting ore
#

Is it technically difficult to make a mod where the donor part, for example, the door retained its original color?

bronze yoke
#

it is impossible

#

vehicle parts can't have a unique colour from the vehicle

#

you can have different pre-set colours using part models with different textures but it couldn't match the original vehicle's colour as they are randomised tints and there's likely millions of possibilities

frank anvil
fallow mauve
fallow mauve
frank anvil
#

Prolly both, I dunno lmao

#

The void is more likely though

#

I doubt that the PZ engine automatically overwrites stuff

fallow mauve
#

Gonna have to test it out then

#

Thanks for your time

frank anvil
#

np

runic fossil
#

Good morning, I'm trying to make my first mod, it's a very simple mod but I still can't get it to work. What would be the correct way to test it?

indigo copper
#

global function AddWorldSound(player, radius, volume)
radius is sound range
what is volume ??

#

i'm checked test of same radius a dffren volume 10~100
result is all same

bright fog
#

It's how fast the sound volume lowers based on distance

ancient grail
#

ive tried to set coordinates for a zed(teleport)
and what happened was it just teleports back

question if anyone knows if this will work if its send to server and back
or is it just another limitation

analog pagoda
#

Hello people. Is it possible to create the following crafting dropdown menu flow? I see most people have tons of recipes in their mods for repeat actions and I'd very much like to create a more compact set of recipes
Right click wooden spear > Bind > Leather, Cloth, or Tape > Fork, Knife, Machete, Letter Opener, etc.

#

By compact I mean on the UI end

lunar portal
#

Is there anyway to address the parked vehicles in project zomboid?

I'm trying to figure out how the game knows where to spawn cars, the rotation of the car and other data.

livid badger
#

Good evening. Can anyone tell me how I can add an item to a selected area of ​​the floor?

#

i think that i can use this method

sq:transmitAddObjectToSquare(objNew, index);

maybe anyone know better way??

teal nacelle
#

Does anyone know what volume most gunshots are in code? I can't decide on what volume to make the character panic and get stressed from

#

The original 3 value i put makes the character panic from opening a door lmao

frank anvil
#

I put all my map stuff into the correct folders (as per a tutorial I found), uploaded em to the workshop, subscribed to and enabled it, started a new save, went to the location I edited, and there's no change

#

I really need some help rn, this has been the project of the last three days

#

and I don't want all of this to be for nothing

robust locust
ancient grail
ancient grail
frank anvil
ancient grail
bronze yoke
lunar portal
ancient grail
lunar portal
#

But I don't know how to identify the event of vehicles spawning.

ancient grail
#

should probably refer to worst vehicle mod

cuz it has something to do fetching the vehicles

#

you can then just despawn it and replace it from your list

teal nacelle
#

So, the next feature I'mma try to add for this mod is gonna be meltdowns

The idea is that once stress reaches the maximum, the character just freaks out

Once their panic goes away, they get tired and sad. Any idea how to do this without always making them tired/sad every time they panic?

frank anvil
teal nacelle
#

I think I have an idea on how to make them panic when the stress is too much, at least

#

Honestly, Lua is surprisingly similar to Godot's scripting lol

#

Quite a bit more complicated but it hasn't been too rough switching over

runic fossil
teal nacelle
teal nacelle
#

idk why this keeps happening, but the trait has stopped appearing lmao

here's all the code:

local Autism = {} -- don't pollute, keep it local

Autism.doTraits = function()

-- this initializes the trait and adds it to the trait list
local addTrait = TraitFactory.addTrait("Autism",
      getText("Autism"),
      -1,
      getText("A mental disability. This trait is not a 1-1 recreation of the real experience, nor is there only one unified experience for everyone with ASD. This is simply based on my own."),
      false,
      false)

-- sort all traits
TraitFactory.sortList()

-- idk if this needs done, but it was in the guide you were using so I kept it
local traitList = TraitFactory.getTraits()
for i = 1, traitList:size() do
    local trait = traitList:get(i - 1)
    BaseGameCharacterDetails.SetTraitDescription(trait)
end

end

-- add the trait when the game boots
Events.OnGameBoot.Add(Autism.doTraits)

-- when there is a world sound, do this
Events.OnWorldSound.Add(function(x,y,z,radius,volume,source)
local player = getPlayer() -- the player object
local stats = player:getStats() -- the stats of the player
local panic = stats:getPanic() -- the current panic of the player
local stress = stats:getStress() -- the current stress of the player
if volume > 50 and getPlayer():HasTrait("Autism") then
player:Say("TOO LOUD!") -- visual indicator for testing
stats:setPanic(panic + 10) -- add 10 to the current panic level
stats:setStress(stress + 0.1)
if stress == 1 and getPlayer():HasTrait("Autism") then
player:Say("OH GOD!")
stats:setStress(0)
stats:setPanic(100)

end

end)

ancient grail
#

``

--code

``

ancient grail
teal nacelle
#

Make the character panic and gain stress from loud noises, then if the stress gets too high they completely freak out

ancient grail
teal nacelle
#

That was working before, it only started bugging out once I added the high stress thing

bronze yoke
#

the usage here is weird but getText never causes errors

ancient grail
#

but theres nothing else i can see that could cause issue

#

stress is stats right and not body damage?

teal nacelle
#

Yeah, it's stats

ancient grail
#

why not just trigger based on distance instead of volume?

teal nacelle
#

Distance as in the radius of the sound?

#

I could try that, but I have no clue about the radius

ancient grail
#

yeah like if its 3 squares away then causepanic
or something

bronze yoke
#

but then quiet sounds would cause panic

teal nacelle
#

I don't want it to be any nearby sound

#

Just especially loud ones

#

Like, for example, gunshots

ancient grail
#

i see ok then

bronze yoke
teal nacelle
#

I'm trying to base it on how sensory overload is for me, and it's usually sudden loud noises that cause trouble

ancient grail
teal nacelle
#

I was thinking of having shouting cause it too, but I don't really ever freak out from my own yelling so that wouldn't make much sense

bronze yoke
#

your file fails to compile because you have an unclosed scope

teal nacelle
#

Ah

bronze yoke
#

add an end here

teal nacelle
#

So, 3 ends?

ancient grail
#

seems like the volume is always 20

#

you really should use distance now

teal nacelle
#

I have it at 50 volume, which makes it only react to gunshots

ancient grail
#

i see

teal nacelle
#

Idk what volume bombs are but I want them to react to bombs too

ancient grail
#

i guess youre right

bronze yoke
# ancient grail

the same sounds will always be the same volume, that isn't unexpected

grizzled fulcrum
#

does the sound not get louder or quieter in game the further the gunshot or event is away?

teal nacelle
#

Bombs don't make the character freak out

#

For some reason my game won't let me go debug

#

I've put it in my launch settings

bronze yoke
#

world sounds are an ai thing (primarily) that lines up with audio to simulate hearing, they aren't audio themselves

#

'volume' doesn't really mean anything in particular, it's just a tiebreaker for zombie attraction

livid badger
ancient grail
#

none
i just wrote the code and pasted on debug

#

didnt saveit

#

but is basically a halo and print based on the params from the world sound event

#

i just added the direction from my other mods function but it seems inaccurate

grizzled fulcrum
teal nacelle
#

Just wondering

How could I make the character gain unhappiness and tiredness after calming down from the panic caused by meltdowns?

#

okay so it seems like the meltdowns don't work

#

here's the code for that:

    if stress == 1 and getPlayer():HasTrait("Autism") then
        player:Say("OH GOD!")
        stats:setStress(0.1)
        stats:setPanic(100)
    end
teal nacelle
#

Okay, I changed the stress check and it works now

teal nacelle
terse sage
#

Regarding creating weapons, specifically on magazines, does the GunType have to match with the gun its intended to be used in? and as a follow-up, can that field take multiple entries?

lime zealot
#

Does anyone know where traits' effect strength is defined? I'm specifically trying to change the amount of the Organized trait, but can't find anything when decompiling and reading through the .class files I'd think would have it (files with "character" or "trait" in their name 😢). I'm pretty novice at modding and java, so I'm not really sure exactly what I'm looking for

bronze yoke
#

generally the game doesn't really define the effects of traits as attributes of the trait, it just hardcodes checks for specific traits in the parts of the code where they would be needed

ancient grail
#

ooops i might be wring
stress is 0 to 1?

#

but still
its better to use

=
<=

than use
~=

for anything with numbers

drifting ore
#

Hello. I'm interested in a couple of things about the server. My players are complaining that loot appears poorly or does not appear at all in some places on the map. Please tell me, does the second setting in my screenshot require the game or real time to be specified?

ancient grail
#

i think thats game time but not sure

fallow mauve
#

best trait in the game

fleet bridge
#

so if its 2 hr days, basically loot respawns every 2 days

drifting ore
ancient grail
teal nacelle
#

How do I check the distance from a sound? The character is having constant meltdowns from a house alarm across the city lmao

queen oasis
green spear
#

i wanna get in texturing so i could make some wwe attires in the game

#

if someone could tell me

#

where to start

#

i would really appreciate it

#

but i'm afraid it would need 3d modelling knowledge?

topaz tangle
#

anyone know any weird or wacky cars?

true nova
# green spear i wanna get in texturing so i could make some wwe attires in the game

It depends if vanilla models are fine for you, you can even do modded ones i suppose. the texture is just a .png, you can open the vanilla clothing texture files and edit them in an image editor, assuming you can make it out well enough and draw your own design on it. sometimes the texture is too stretched and hard to make out though. you'd have to grab the model that goes with it also so it all lines up right. of course doing this all in blender would likely give you better results

errant cypress
#

How should I start modding?

topaz tangle
#

Make something cool

true nova
errant cypress
indigo copper
#

local InfoMessage = {
isServerAlert = function(self) return self.isServerAlert end,
getText = function(self) return self.text end,
getTextWithPrefix = function(self)
-- you may want to transform text here to match usual server messages
return self.text
end,
new = function(self, text, isServerAlert)
return setmetatable({
text = tostring(text),
isServerAlert = isServerAlert
}, self)
end,
isShowAuthor = function ()
return false;
end
}
InfoMessage.__index = InfoMessage

-- to add a server message:
function servermsg(msg)
ISChat.addLineInChat(InfoMessage:new(msg), ISChat.instance.currentTabID - 1)
end

servermsg('This is ServerMessage send for All Player!!!!')

Thank you guys, thanks to you I found a way to replace /servermsg

stark tusk
#

Hey guys, I have a question, what determines if an object is Thumpable or not? I have a set of tiles that are supposed to be thumpable but when placed, become IsoObjects instead of IsoThumpables

bright fog
#

I don't remember exactly, but there's a different between player built tiles/walls etc and world stuff

stark tusk
#

hmm, somehow furniture end up becoming IsoObjects despite being player-placed

#

Ah, I think I know whats causing it

#

Ill keep checking but Im hoping theres an easier way to differentiate between thumpable and not thumpable 😦

stark tusk
#

thats what im doing actually

#

but i need specific tiles to be thumpable and the other tiles not thumpable

stark tusk
stark tusk
# stark tusk

interesting how this causes the tile to be IsoObject instead of Thumpable

teal nacelle
queen oasis
queen oasis
queen oasis
teal nacelle
#

Once

queen oasis
#

I think you would have an easier time modding if you got that to work.
And I'm sure you did this but: open steam, right click on Project Zomboid, click properties and type -debug in the launch options under General. Close the properties window and start the game.

alpine zenith
#

Hello,
i would like to start making zomboid mods and as an first project i would like to make an map mod. idk yet if i want to add it to the main map or create a new one. i basicly want to create my school for an game day we have at school.
Does anybody have some good up to date tutorials to reccomend to me?
(pls ping me)

true nova
queen oasis
# teal nacelle Yep, I did that

You might try disabling all mods then trying again. If that doesn't work, you can verify game files and hope that resolves it.
If none of that works, you might want to head to pz_techsupport with your log files.

teal nacelle
#

I have so many mods that it'd probably take hours to reenable the ones I want to enable πŸ’€

untold turtle
#

Haio, currently making some clothing. I am currently trying to find a BodyLocation that occupies pants/jacket but allows a vest and such unlike "FullSuit" and things

queen oasis
stark tusk
teal nacelle
#

That could be why

true nova
#

IsoObject:getThumpableFor(IsoGameCharacter) this returns a thumpable

ancient grail
ancient grail
ancient grail
true nova
#

yeah thats what it says it does lol idk if it works though

ancient grail
potent walrus
#

Anyone ever run JDecompiler on the server? Where is the bloomin Jar file?

#

oh, looks like JD-Gui is no more

#

what Java Decompilers are people using?

true nova
untold turtle
grizzled fulcrum
#

there is no JAR file, it's only class files in server/zombie

left needle
#

Hello Rokem where can i find the Buildings ID?

ancient grail
bright fog
bright fog
bright fog
drifting ore
#

Like imagine one place is a red zone with only sprinters

#

Than a green zone is shamblers

#

Yellow fast shamblers

#

Like it detects when you enter the cell

#

And it changes the zombie ai depending on the cell

bronze yoke
#

i think chuck already has a mod for that

drifting ore
#

o

ancient grail
ancient grail
# bright fog Nice, what do you plan to do with that ?

probably use to trigger functions that has something to do with getzombielist
since thats cell based right?
so basically reinitiate the table
and set the needed properties to those zed maybe

but im not 100% sure if its worth doing since i didnt need this before

how do you guys check for memory usage ?
to determine which method is better interms of memory

bright fog
#

It's impossible to detect a zed being loaded in

#

It's loaded in when in the player cell

#

Not when the world cell is loaded

#

In the 75 tiles radius or so I don't remember the exact value

ancient grail
#

Yes this event is based on player cell?

i used
getPlayer():getCell

then / 300
the x and y

i messed up?

bright fog
#

That's why I asked what you'd use it for

#

Bcs world cells are loaded way further than current player pos

#
  • sometimes some further are loaded I believe
#

But these do not load zombies

ancient grail
#

i see

bright fog
#

I believe they load world zombies

#

Which aren't active for zombie list or zombie update so you can't do anything on them

ancient grail
#

i remember testing out chunk range with pao
we determined it was around 1k square

bright fog
ancient grail
#

what we did was we send fire command like far away then teleport if theres no fire then it wasnt loaded

we gradlually decreased it
i think he was triggering the fire command and i was the one teleporting to check
iirc

#

1k fire shows up
but + 1 more square didnt

#

weird huh?

#

now that i think about it
we could have just made function count instead

something like this maybe
(untested)

function countLoadedSqDistance()
    local player = getPlayer() 
    if not player then return 0 end

    local startX = math.floor(player:getX()) 
    local y = math.floor(player:getY())     
    local z = math.floor(player:getZ())     

    local count = 0
    local x = startX

    while true do
        local square = getCell():getGridSquare(x, y, z)
        if not square then break end 
        count = count + 1
        x = x + 1
    end

    return count
end
ancient grail
ancient grail
bright fog
#

Pretty cool !

#

I'm curious on a few things. How do you manage the movement of the zombie ?

digital sail
#

I remember I managed to do it with one callback but there were significant issue so I gave up

ancient grail
#

not sure what youre refering to

ancient grail
digital sail
#

the markers

#

the white circles

ancient grail
#

those are just world markers

digital sail
#

oh, right, it's a function you can call, meant for debugging, but you cannot use the texture you want, right?

ancient grail
#

you can add custom pngs if you want
ive done that

ancient grail
# digital sail oh, right, it's a function you can call, meant for debugging, but you cannot use...

like this

i added the destination marker png
and used it instead of vanilla circle
https://youtu.be/XtEcwiMLsfE?si=sQ4rMdkIthumvaG-

Dungeon Maker Mod:

Allows Server Admins to Setup Dungeon Challenges

Keys = Entrance
Chest = Exit (you may also exit anytime via right click context option)

Keys and Chest Colors are related to their Level
| LEVEL | COLOR |
| 1 | White |
| 2 | Blue |
| 3 | Red |
| 4 | Gold |

Teleport:
Entering / exiting will je done v...

β–Ά Play video
digital sail
#

Can I have a look at the code to see what API function you're calling?

ancient grail
#

sure check out
dungeon maker mod

sturdy salmon
#

Hello good evening. Is it possible to create a log on a server running Ubuntu? For protection reasons, there is no access to relative or absolute routes (I don't remember which one, I think it's the absolute one). On the client, it was difficult, but I was able to generate general logs, however, the logs in this case have to be generated by the server. Specifically, I wanted to generate records with 2 events, with onEnterVehicle and onExitVehicle. I try in several ways, but I can't do it. If there is any tutorial or step to follow, I will appreciate it.

#

I was even looking at a mod that generates logs on the safehouses, but it says that it generates them in the Zomboid/Lua route and on the server, I don't have that route. I have not been able to generate the logs on the server. In the client yes. But in this case, I need them on the server.

#
local function OnEnterVehicle(character)
    local log = getModFileWriter("patagonia", "media/lua/logs/" .. os.date('%Y_%m_%d') .. "_on_enter_vehicle_log.txt", true, true)
    local vehicle = character:getVehicle() -- BaseVehicle
    local vehicleScript = character:getVehicle():getScript()
    log:write(string.format("JUGADOR: %s. TP: /teleportto %d,%d,%d. VEHICULO: %s. ID(): %d. CALIDAD DE MOTOR: %d.\n", character:getUsername(), vehicle:getX(), vehicle:getY(), vehicle:getZ(), vehicleScript:getFullName(), vehicle:getID(), vehicle:getEngineQuality()))
    log:close()
end
#

This on the client was working fine for me, until I realized that I didn't need the log on the client, but on the server. Although doing that also cost me a little time.

#
local function OnEnterVehicle(character)
    local vehicle = character:getVehicle() -- BaseVehicle
    local vehicleScript = character:getVehicle():getScript() -- VehicleScript
    local text = string.format("JUGADOR: %s. TP: /teleportto %d,%d,%d. VEHICULO: %s. ID(): %d. CALIDAD DE MOTOR: %d.\n", character:getUsername(), vehicle:getX(), vehicle:getY(), vehicle:getZ(), vehicleScript:getFullName(), vehicle:getID(), vehicle:getEngineQuality())
    sendClientCommand("PatagoniaLog", "writeOnEnterVehicleEvent", { text })
end
#

Currently, I am trying to do that, based on another mod, but I cannot generate the log.

bronze yoke
#

you can write files to the server exactly the same way you write them to the client, if they're not showing up you should add prints to check if your code is actually running

sturdy salmon
bronze yoke
#

i wouldn't generate files inside the mod folder (or at least not the lua folder) as this can cause checksum issues

#

you can use getFileWriter to get a file writer inside the Zomboid/Lua/ directory

sturdy salmon
#

They were generated within media/lua/logs if I remember correctly (on the client). But on the server, it couldn't do it.

sturdy salmon
#

I have that structure on the server.

bronze yoke
#

where is the save file stored then?

sturdy salmon
#

It doesn't get stored anywhere, that's the problem.

bronze yoke
#

this is the game install location but there should also be a cache location where things like server settings, save files, etc are stored

sturdy salmon
#

That's right, the cache folder contains everything except the Zomboid folder. And no matter how much I generate it manually, the file does not appear.

#

Now I show you what the cache folder has.

#

Even if you generate the folder manually, the log is not generated.

#

Obviously, I must be doing something wrong.

#

What if I give you the github repository? Can you review it?

bronze yoke
#

so to be clear you've tried creating .cache/Lua/? here .cache is what would normally be called Zomboid

sturdy salmon
#

I try it.

#

Thanks.

#

We will see if the log is generated.

bronze yoke
#

looks correct, i hope that fixes your issue

sturdy salmon
#

πŸ™‚

#

🀝

#

I'll check it later.

#

Thanks for the clarification. Zomboid = .cache

#

🀣

heavy swift
#

how do you open these files? the direct X texture tool keeps saying that theres been an error

terse sage
#

Of note, and more strangely, the icon works but the mesh does not.

ancient grail
ancient grail
devout torrent
#

not really a mod but hey!

bright fog
devout torrent
#

95% chatgpt

#

ive been trying my best to learn python for over a year but i swear nearly nothing is sticking with mer

#

so chat gpt is my friend

runic fossil
devout torrent
devout torrent
#

i even got it to tell me how to make bombs and drugs ect

runic fossil
#

You need to try it

devout torrent
winter ferry
#

wheres the folder for containers? im trying to change the capacity of some, but cant seem to find the folder

round notch
#

Yeah Claude 3.5 is da shit πŸ’ͺ🏼

scenic cradle
#

Is there a way to make vehicle part installs/uninstalls recognize a modded tool (screwdriver/wrench) as a viable option for the action?

#

I tried adding it to the parts' required items, but then it just requires the vanilla tool and the modded tool simultaneously.

red tiger
#

Worked on a more comprehensive anti-cheat delivery framework this past month. Will write out stuff for announcements however it's already out for use & testing.

ancient grail
winter ferry
#

Specially the metal two tile shelves

fleet bridge
#

It's a property of the tile iirc

ancient grail
ancient grail
#

yep i set it to 1k but i think it can go further than that just didnt test cuz 1k was already alot

fleet bridge
#

Might be cancerous since most people would tend to store it with 20000 ripped sheets and then corrupt the chunk or something

ancient grail
ancient grail
fleet bridge
#

Ah

ancient grail
terse sage
#

Is it possible to make a gun always spawn with a certain attachment equipped? and if so how is that done?

ancient grail
terse sage
#

hm, interesting.

#

Trying to get around the fact that this pistol has its grip as a separate attachment, but I dont want separate grips, just one set

bronze yoke
#

you can, just use an OnCreate function

#

in your script add OnCreate = OnCreate_MyWeapon,
in a lua file (untested):```lua
OnCreate_MyWeapon = function(item)
item:attachWeaponPart(InventoryItemFactory.CreateItem("Module.MyAttachment"))
end

terse sage
#

so something like

#

OnCreate_MyWeapon = function(CZ75)
item:attachWeaponPart(InventoryItemFactory.CreateItem("TBS.CZWoodGrip"))
end

bronze yoke
#
OnCreate_CZ75 = function(item)
    item:attachWeaponPart(InventoryItemFactory.CreateItem("TBS.CZWoodGrip"))
end
terse sage
#

oh shoot okay

#

and then I'd just need to define the grip slot on the weapon

terse sage
devout torrent
#

i think ill make a post on the reddit

stark tusk
#

Hey guys, are there any resources on getting started with UI editing? I'm trying to add a new UI to the Client menu but Im not sure where to begin since the modding resources doesnt seem to have much in the way of UI resources

dull moss
#

UI MichaelDespair

ancient grail
dry chasm
# stark tusk Hey guys, are there any resources on getting started with UI editing? I'm trying...

I think the easiest way would probably (currently) be to just work off of an existing UI.
For example if there's one that already does most of what you need, to just work off of that one and modify whatever you need (inheriting from that one, not just editing the original)
Otherwise it can be quite confusing and annoying to get into, depending on your plans.
After that, you probably figured most of the stuff out and can start on a completely custom one, or just modify the other as desired still.
Regardless, good luck and remember to take your time and enjoy it!

half arrow
#

Hi, does anyone know how to stop an animation from playing, either before it starts or while in progress? Particularly the hitreaction animations. I've already tried playerObj:setHitReaction(""); and playerObj:changeState(IdleState:instance()) (among a few other things), which does stop the animation from playing sometimes, but once the animation loop starts I can't stop it (when you are getting hit by multiple zombies for example).

vast flint
#

Is it true that I can learn LUA in 24 hours ? Does that include sleep and meals and breaks? Cuz I feel like knowing C++ prevent me from learning LUA. Too corrupted by type checking on compilation and static typing.

#

Feel like Im too old to learn another language too

bronze yoke
#

i think lua is a pretty simple language to learn, especially for people who already know another language - it's intentionally very minimal so there isn't that much to learn

vast flint
#

Im so confused by the arrays and classes though. And by interoperability... like there are those lua gui library why cant they work in an embedded lua scenario like zomboid ?

bronze yoke
#

lua doesn't have any kind of native rendering library so it's always going to be dependent on some external api

#

if you want type checking the most popular lua addons for most ides will support some variant of luacats type annotations, i personally make as much use of type annotations as possible

#

they aren't checked at run or compile time (they're just comments) but the ide will show warnings/errors for them

vast flint
#

I wish that intellij had some sort of plugin for the game specific lua and a live debugger. Feels like im coding blind otherwise

#

normally when I code in C++ I have intellisense running and my first line is debugging so I can inspect all the vars content and all the available obhect to learn whatever API Im using but cant do that here 😦

bronze yoke
vast flint
#

oh nice! I'll try that at least I'll be less blind. At this point I was gonna changing the game code with java and doing like the fps mod and releasing a dll as a mod but I know that's not really a mod nor easily to share and really really conflict prone cuz at least in java I could attach intellij debugger and code anything and see all the variables

#

fun fact: I hate visual studio code for a long time until I was hospitalized for 4 weeks (car accident) and all I had to pass time was ubuntu with vscodium/vs code and made a little pygame roeguelike to pass time

bronze yoke
#

i prefer jetbrains ides myself but unfortunately they're undeniably inferior when it comes to lua

vast flint
#

Only had 4 gb of ram, tried to use it but the laptop would lock up. It's a 2009 laptop

vast flint
#

so could I asks about a piece of game code that has me very confused even thoughj I tried to learn lua a bit ? Like I dont understand where some of the variables it's using come from even if I grepped the whole codebase

frank elbow
#

The type stubs that albion sent include these, but for details of the implementation you'll need to decompile the .class files

#

But you don't really need that just to start modding, just if you need details on how stuff is being handled Java-side

vast flint
#

oh for my first code modification I wanted to make debug available in normal mode but some stuff like right-click an item to get a menu I cant figure out how to do. The game code seems to use a giant method for it testing every possible type of item and it's really not obvious to me what handle items in inventory right-click vs item on the ground because it seems to check the type of an item but the way it check if it's inventory or not is really unclear to me

#

2nd mod would be modifying basements so they never run out of electricity/water but charge money from another mod for it so Im going to need to have them as requirements

#

not suree if here is the right place to asks about lua game code since you cant make a mod out of it

bronze yoke
#

the way mods add context menus isn't the same as how the game does it

#

for mods you listen to the OnFillInventoryObjectContextMenu/OnFillWorldObjectContextMenu events and add your options to the context menu they pass

vast flint
#

I see that's where I was wrong I guess. Wanted to give items on the ground the edit item right-click thing so I though I had to modify the existing one in the lua game code

true nova
#

anyone know why if an item works fine otherwise but i try to spawn it with square:AddWorldInventoryItem() it spawns but without a model

random ginkgo
#

Does anyone know what I'm doing wrong trying to edit the Tiles2x files for Grass etc. but when I repack it and put it in the mod folder and load it nothing changes still default textures in game are you supposed to have a script or something to go along with changing pack files?

ancient grail
#

whats the difference ?

OnReceiveGlobalModData (Triggered when the game client is receiving GlobalModData from the server.)

SendCustomModData (Triggered when the game server is sending custom ModData to the client.)

true nova
ancient grail
#

well thats true

true nova
#

i guess with these separate events you can catch mod data and modify before it goes to the client, outside this doesn't probably matter

true nova
ancient grail
#

this is weird i assume that onrecieve moddata is sent back to all clients from the server
but it seems that the sender wont receive it(which is good but i assumed wrong)

#

ah i messed up nvm
i got that backwards

random ginkgo
fleet bridge
bronze yoke
#

it should be noted that the game does not automatically respond to mod data requests, the event is where you are expected to send it

ancient grail
#

this is confusing
i thought that onrecieve dont trigger unless you request

but thats sendcustom ?

bronze yoke
#

yeah, it's a little confusing - on receive just fires when receiving mod data, whether it was requested or not is irrelevant (ModData.transmit doesn't even know if it was), i guess send is called that because that's what you're supposed to do with it

ancient grail
#

imanage to make it work without using send custom
even ny older mods

bronze yoke
#

i don't personally make any use of the mod data networking, i don't find it to have any practical benefits over commands

#

imo storing anything synchronised as mod data on the client is poor design (even if it is mod data on the server, which there are good reasons for)

main pasture
#

anyone know how to get the shader class of a VehiclePart? (or set alpha value of a vehicle part)

sand dagger
#

hi there,

Little Question which is the best event for player is ready and spawned on the map on client to trigger a server command once ?

vast flint
#

how do I find out the name of this item so I can adress it in lua, like making it dismantlable. I know it's a generator but the question is generic. I dont know which debug tool to use to click/right-click on it and see the dev string for it :

main pasture
# vast flint how do I find out the name of this item so I can adress it in lua, like making i...
local function AddToContextMenu(playerIndex, context, worldItems, test)
    local player = getSpecificPlayer(playerIndex)

    if worldItems[1] ~= nil then
        local square = worldItems[1]:getSquare()

        local objects = square:getObjects()
        for i = 0, objects:size() - 1 do
            local obj = objects:get(i)
            local properties = obj:getProperties()
            if properties:Is("CustomName") and properties:Is("GroupName") then
                print("CustomName: ", properties:Val("CustomName"))
                print("GroupName: ", properties:Val("GroupName"))
            end
        end
    end
end

Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)
#

this prints the custom and group name of the tile, and you can then use them with similar script to add context menu item to do what you want

vast flint
#

I can add that to the in-game lua editor right ? Or I have to make a full blown mod with it with the startup method etc ?

main pasture
#

I'm not sure. haven't really used that. should work if you add it to any lua file

vast flint
#

in which of the 4 logs does print goes ?

main pasture
#

I think general

#

but you can also just check it from the console

vast flint
#

seems to works with container but the generator in the screenshot or pile of tire gets this: function: prerender -- file: ISTilesPickerDebugUI.lua line # 173 | Vanilla.
[23-11-24 11:36:45.818] ERROR: General , 1732379805818> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: missing argument #2 to 'format' at KahluaUtil.getArg line:380.. (etc) can pastebin it if needed

#

so it seems for static items Id need some other code

#

where for a container I get 23-11-24 11:33:25.277] LOG : General , 1732379605277> DEBUG:Counter Steel.
[23-11-24 11:33:25.277] LOG : General , 1732379605277> DEBUG:None None.
[23-11-24 11:33:25.277] LOG : General , 1732379605277> DEBUG:Counter Steel.
[23-11-24 11:33:25.439] LOG : General , 1732379605439> CustomName: Counter.
[23-11-24 11:33:25.439] LOG : General , 1732379605439> GroupName: Steel.

#

either the above or that error too: attempted index: item of non-table: null. Maybe istilespickerdebugui.lua is unrelated and because I insist on having debug features in normal mode

frank elbow
#

OnTick is triggered after a function that sets the flag is called (see IngameState.java), so it should be good-to-go for sending events at that point

#

That said, I'm unsure whether there's a better way. I'd defer to albion since I know she's looked closely at the various events

sand dagger
#

okay i did now OnPlayerMoved and set a Init var on true that it only get trigget on first move

bronze yoke
#

yeah no those two methods are the best i've found, it's a little ugly but overall fine

vast flint
#

meh even with for key, value in pairs(properties) do
print(key .. ": " .. tostring(value))
end It seems they have no properties at all 😦

#

M07DEBUGTRACE.
[23-11-24 11:46:50.423] ERROR: General , 1732380410423> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Expected a table at KahluaUtil.fail line:82.

bronze yoke
#

you can only loop over tables with pairs, not objects

main pasture
#

it is a PropertyContainer

vast flint
#

what should I do? Trying to find out on my own by enumerating all possible properties of my static objects since they dont seem to have a CustomName or GroupName

bronze yoke
#

you can loop over its metatable with pairs but that would just tell you about methods (which you can just see in much better detail on the javadocs anyway)

#

i tend to identify objects by object:getSprite():getName()

vast flint
#

I mean since they aren't container they are entity/tiles in the javadoc right ?

bronze yoke
#

a lot of objects that can't be moved or dismantled might not have specific names set, this just gets the sprite's name in the sheet

main pasture
#

my bad. I used that code because movable objects don't seem to have proper sprite names

bronze yoke
#

you may need to nil check getSprite() if you're using this on unknown objects

vast flint
#

Im trying to make them dismantled like the old mod I once used made them but I dont remember the name of that mod

#

so the only solution at this point is for me to make a mod to make them dismantlable

#

but for this I need some sort of id/name for them

#

And also yeah: getSprite of non-table: null at KahluaThread.tableget line:1689.. on the car lift, tire piles, generators etc

bronze yoke
#

that sounds like you're doing something else wrong

#

this error means your object is nil

#

which is to say you do not have an object to check the sprite of to begin with

#

i think dismantling is configured in the tiledefs, i think you can decompile vanilla's and build a new one with just those sprites to override them with new properties

vast flint
#

I right-clicked the pile like this: . That is how Id expect it to tell me what it is

#

right to the left of "building menu" in the tire texture

bronze yoke
#

i don't see how your code could ever get nil in place of an object so i would look for typos

#

the object list you're looping over can't contain nil

vast flint
#
    local player = getSpecificPlayer(playerIndex)

    if worldItems[1] ~= nil then
        local square = worldItems[1]:getSquare()

        local objects = square:getObjects()
        for i = 0, objects:size() - 1 do
            local obj = objects:get(i)
            local properties = obj:getProperties()
            print("M07DEBUGTRACE")
            print("Name: ",object:getSprite():getName())
            if properties:Is("CustomName") and properties:Is("GroupName") then
                print("CustomName: ", properties:Val("CustomName"))
                print("GroupName: ", properties:Val("GroupName"))
            end
        end
    end
end

Events.OnFillWorldObjectContextMenu.Add(AddToContextMenu)``` that is the current code
#

anyway trying to find out how to pick a tile for the tile picker, maybe that will tell me what the tile is 😦

main pasture
#

maybe add this after the "if properties"

#
else
   print(obj:getSprite():getName())
end
#

then it prints the sprite name if it has no custom/group name

vast flint
#

finally it was in the brush manager dev option all along:

main pasture
#

is it possible to create new shaders with a lua mod? you can edit the existing .frag files with mods, but copying one with a different name and trying to use it doesn't seem to work

bronze yoke
#

you can, make sure to copy the vert and static frag shader too

#

you can't do anything fancy like passing new uniforms or anything though so the usage is fairly limited

neat coral
#

How difficult is it to retexture an existing vehicle? Is there any existing guide about this topic?

main pasture
main pasture
random ginkgo
vast flint
#

ok so still trying to figure how to add a dismantlable item in the world. Like I found examples like function DAMN.OnCreate.DismantleWoodenArmor(items, result, player, selectedItem) but those are for crafting recipes. Tried to grep microwave in the game code since it's allegedly a dismantlable world item but I can't find any .java or .lua that seems to handle that

bronze yoke
#

it's not lua or java, it's baked into the tiledefs

vast flint
#

I know I need a bunch of player:getInventory():AddItem("") aftre that in the method but I still dont know how to hook dismantling up . Oh can't I change the tiledefs by code ?

bronze yoke
#

not sure, never tried

#

if you download Project Zomboid Modding Tools on steam, one of the tools in there is for editing tiledefs

fallow mauve
#

I am abit confused on what is happening here

round notch
#

Looks like the beach to me ⛱️

coarse sinew
# vast flint ok so still trying to figure how to add a dismantlable item in the world. Like I...

When implementing custom dismantling properties for sprites, you don’t need to hook into dismantling functions. Instead, assign the appropriate properties directly to the sprite definitions using the OnLoadedTileDefinitions event. See this snippet #mod_development message
These properties allow you to define dismantling behavior, including materials yielded, tools are assigned automatically based on the mats outputted.
For example, the relevant properties for defining dismantling behavior include:
CanScrap: Enables dismantling.
CanBreak: Allows the object to be broken apart.
Material: Defines the primary material yielded (e.g., MetalPlates, SmallMetalPlates, MetalScrap), for a full list see ProjectZomboid\media\lua\client\Moveables\ISMoveableDefinitions.lua L327-L433 in the games files.
Additional materials can be specified with Material2, Material3, etc., for yielding multiple outputs.

Here's how the code should look:

Events.OnLoadedTileDefinitions.Add(function(manager)
    local sprites = {
        "industry_02_64", "industry_02_65", "industry_02_66", "industry_02_67",
        "industry_02_68", "industry_02_69", "industry_02_70", "industry_02_71"
    }

    for _, sprite in ipairs(sprites) do
        local props = manager:getSprite(sprite):getProperties()
        props:Set("CanScrap", "", false)
        props:Set("CanBreak", "", false)
        props:Set("Material", "MetalPlates", false)
        props:Set("Material2", "SmallMetalPlates", false)
        props:Set("Material3", "MetalScrap", false)
        props:CreateKeySet()  -- finalize property definition
    end
end)
#

To see the name of the object sprite you can use debug, press F2 and then select the tile and the sprite name will appear where I have underlined in red.

vast flint
# coarse sinew When implementing custom dismantling properties for sprites, you don’t need to h...

Very good info thanks a lot! What if I want it to drop 5 metalplates ? Do I need to repeat material, metalplates five time or there is a parameter for that ? I think both dismantlable and CanScrap need to be set according to latest update patch note : "Added functionallity for any object existing as Iso and Inventory (such as radios) to be dismantable/scapable in their IsoObject form by looking up the inventory item dismantle recipe. For this to work the spriteproperties must be set to 'CanScrap' AND have at least one dummy material defined for the scrapcode to recognize it as valid scrapable, the actual materials returned will be from the recipe". Maybe Im confused between scraping and dismantling though

ancient grail
#

i suggest doing it via lua and just use setSprite()

ancient grail
#

apply to thump objects

if not obj:isDismantable() then
    obj:setIsDismantable(true)
end
ancient grail
vast flint
#

what is a thumpable ? 😦 googled but I found the programming docs but I dont know what a thumpable is.

nimble badger
#

How can I implement a custom animation for holding a weapon? and what mod example is there?

true nova
digital sail
#

Is there a known bug where the sandbox vars edited with the UI would not be saved after restarting the server?

bronze yoke
#

if your server uses udderly up to date your sandbox vars are permanently fucked and will never change unless you mess with your save file

#

that's the most common cause of issues like that

digital sail
#

😩

#

Thank you so much

#

As per popular request I worked on making my chat mod compatible with Udderly Up To Date

#

so I had the mod enabled...

#

it's a very short and simple mod, it should not be too hard to fix

#

but the mod is not open source and the author does not seem to be working on PZ anymore
it looks like most donations on their Ko-fi comes from Rimworld, I don't blame them

#

You would not happen to know why some people receive discord messages with a getText() returning : @discord-bot-id message (like @90702379879878 message) and some others just message?

bronze yoke
#

to my knowledge the problem simply is not fixable

#

it's been investigated before

#

the function they call to save the world just does that

#

the issue is that it creates map_sand.bin which is not supposed to exist in multiplayer saves and freezes the sandbox options

digital sail
#

it needs a java server side mod

digital sail
grizzled fulcrum
grizzled fulcrum
digital sail
#

By the way, is it me or the community feel little entitled?

grizzled fulcrum
#

def not just u

#

when you make something, some people will always ask 'but when will you add more'

digital sail
#

Yes, and that's the nicer ones

#

In the meantime the contribution are very scarce.

#

I had people add me on discord to tell me I needed to implement additional feature for my mod to be used on their "professional" server

true nova
grizzled fulcrum
#

πŸ˜‚ true

digital sail
#

I told them how they could contribute

grizzled fulcrum
#

when I dont have time to add something or dont want to personally, I just say "the github's there and I will merge your PRs when you add them" and they never say anything back usually

digital sail
#

I'm not doing this for money, I would never get enough from PZ mod to just... stay alive, I am just happy to give something for people to enjoy
at this point I'm using my ko-fi to make it clear this is actual work

digital sail
true nova
#

thats fair. i just think if someone is demanding that 'I' do this in a dm then they better already have a plan to make it worth my time

#

otherwise if its just a suggestion I have an open mod page

digital sail
#

I never had this experience before, or not to that level

true nova
#

my neither thats weird

#

but i dont really make any clear connection between this and my steam and i dont add anyone on there so im all locked down on getting random dms for that

digital sail
#

I'm definitely not adding anyone else out of the blue like that :D

#

to nuance what I said, there are also nice people writing Github tickets, making small donations or just being nice without ulterior motives

ancient grail
ancient grail
grizzled fulcrum
#

It was most likely said sarcastically, like sometimes after you make a small mod they say "now make build 42"

silk pike
#

hello everyone
I would like to create an item that is a copy of the mannequin object but weighs very little. Unfortunately I can't find the mannequin item among the various scripts
Can someone help me???

vast flint
#

you guys got any trick if a modded game dont load and seemingly with no lua errors ? cuz 1 mod and this happens so Im pretty discouraged and about to never play the game again. It froze at click to start game then I clicked. Does the same even if I remove my mod

#

otherwise dont see the point of modding a game that wont even tell me why it cant load a save

mellow frigate
vast flint
#

Im asking if there is a lua command I can type in debug mode or something I can do to make it load anyway, pretty generic question

#

there is no errors so mod support cant do anything for me. Like maybe I can get into the lua debugger thing and run something or something...?

#

with all the debug tools in the game maybe there is something I dont know that could help that was the point of the question

true nova
frank elbow
ancient grail
silk pike
ancient grail
#

you can just convert the weight as it enters the inventory

rapid coral
#

Can the desync while driving in a car with others be fixed by modding?

tranquil kindle
#

They're adressing it in b42, though it was said that initial release will not have MP

rapid coral
#

Like the parent car tracks location of the passengers and the person driving is the one loading chunks. The passengers are childed to the car/driver and cannot leave the car in case of desync. The rest load at their own pace and when the cars come to a stop they can get out.
Maybe this is dumb. I am dumb. I know nothing of modding or anything

rapid coral
#

I know combat might involve zombie code, but cmon, the car? Don't know why they didn't fix that

devout torrent
#

does this setting only allow for placed items and items in containers to be taken, or does it also allow for people to unbarricade/dissasemble your base?

#

I want to make a mod which would require safehouses to be entered/lootable but also be so you cant dissasemble anything or unbarricade.

#

would having safehouseallowtrespass and safehouseallowlooting both be on allow people to enter/take items from ground / placed / containers while also not being able to open windows, unbarricade windows and dissasemble/move stuff?

ancient grail
#

in guessing the barricade thing isnt related to that

devout torrent
#

doesnt matter i tested it ingame

ancient grail
#

its connected to the allow trespass itself

#

so basically you cant disable it when you allow trespas
thats where you should add your mod

devout torrent
#

the mod isnt even working lol

ancient grail
ancient grail
devout torrent
#

i dont know lua so im guessing

ancient grail
#

it cant be done without lua

devout torrent
#

ik

#

lemme find the error

#

do i use Events.OnPlayerLoad, Events.OnCreatePlayer, or Events.OnPlayerUpdate to trigger code on players spawn?

ancient grail
#

you have to have 3 functions

1 checker function to detect if youre in a safehouse that is not yours
2 hook to disable disassemble action
3 hook to disable sledgehammer

#

probably disable pickup moveables too

devout torrent
ancient grail
#

find what exactly

devout torrent
#

i found 3 things that do the same thing? but they just give me back an error

Events.OnCreatePlayer.Add(function(playerIndex)

#

error:

attempted index: Add of non-table: null

#

i know its something thats probably obvious but idk

ancient grail
#

is that your whole code?

devout torrent
#

-- Key Assignment on Spawn
function givePlayerKey(player)
if not player then
print("Error: Player is nil!")
return
end

local username = player:getUsername()
local lifeCount = (player.getLifeCount and player:getLifeCount()) or 1
local keyName = username .. "'s Key #" .. tostring(lifeCount)

local keyItem = InventoryItemFactory.CreateItem("SMPL.Key")
if not keyItem then
    print("Error: Failed to create key item!")
    return
end

keyItem:setName(keyName)
player:getInventory():AddItem(keyItem)
print("Key added to inventory: " .. keyName)

end

-- Use OnCreatePlayer for assigning keys
Events.OnCreatePlayer.Add(function(playerIndex)
local player = getSpecificPlayer(playerIndex)
if player then
givePlayerKey(player)
else
print("Error: Player is nil in OnCreatePlayer event.")
end
end)

-- Crafting Keys
function canCraftKey(player)
if not player then return false end

local scrapMetal = player:getInventory():getItemFromType("Base.ScrapMetal")
local keyItem = player:getInventory():getItemFromType("Base.Key")
return scrapMetal and keyItem

end

function craftKey(player)
if canCraftKey(player) then
local scrapMetal = player:getInventory():getItemFromType("Base.ScrapMetal")
player:getInventory():Remove(scrapMetal)

    local keyItem = player:getInventory():getItemFromType("Base.Key")
    local newKey = InventoryItemFactory.CreateItem("Base.Key")
    newKey:setName(keyItem:getName())
    player:getInventory():AddItem(newKey)
    player:Say("You have crafted a new key!")
else
    player:Say("You need a scrap metal and an existing key to craft a new one.")
end

end

-- Door/Window Interactions
function onInteractWithDoor(player, door)
local keyItem = player:getInventory():getItemFromType("Base.Key")
if keyItem then
door:setLocked(false)
player:Say("Door unlocked!")
else
player:Say("You don't have the correct key!")
end
end

Events.OnFillWorldObjectContextMenu.Add(function(player, context, worldObjects)
for _, object in ipairs(worldObjects) do
if instanceof(object, "IsoDoor") or instanceof(object, "IsoWindow") then
context:addOption("Unlock with Key", object, function(door)
onInteractWithDoor(player, door)
end)
end
end
end)

-- Lock Containers
function lockContainer(player, container)
local keyItem = player:getInventory():getItemFromType("Base.Key")
if keyItem then
container:setLocked(true)
player:Say("Container locked!")
else
player:Say("You don't have the correct key.")
end
end

Events.OnFillWorldObjectContextMenu.Add(function(player, context, worldObjects)
for _, object in ipairs(worldObjects) do
if object:getContainer() then
context:addOption("Lock Container", object, function(container)
lockContainer(player, container:getContainer())
end)
end
end
end)

#

/////////

well im not getting an error anymore but the key isnt being added to inventory still

fleet bridge
#

use OnPlayerUpdate

#

player object probably isn't available to receive the item

#
function yourFunction(player)
  player:getInventory():AddItem("your key")
  Events.OnPlayerUpdate.Remove(yourFunction)
end
Events.OnPlayerUpdate.Add(yourFunction)
devout torrent
#

my items.txt didnt look like other mods so i just copied their structure but now my game crashes when loading scripts?

#

****module SMPL

{
imports
{
Base
}

   item SMPL_Key
{
    Weight    =    0.05,
    Type    =    Normal,
    DisplayName    =    SMPL Custom Key,
    Icon    =    Item_Gray_key_icon_48x48,
}****
fleet bridge
#

Missing a closing curly bracket

devout torrent
#

oh yeah

#

i only copied the start

#

syntax error ofc

#

πŸ€¦β€β™‚οΈ

#

so obvious

devout torrent
#

the code doesnt have any errors, but its till not making the item |:

-- Create the custom universal key (this won't conflict with vanilla items)
local customKey = InventoryItemFactory.CreateItem("SMPL_Key")
if not customKey then
print("Error: Failed to create custom key item!")
return
end\

LOG:
[SimpleMultiplayerLocking] Error: Failed to create custom key item!.

#

.
im trying to search the doc but even puting in something like OnPlayerUpdate just says no results found

bright fog
bright fog
devout torrent
#

for example my mod would crash the game because my textures didnt have Item_ at the front

#

how was i supposed to know that

#

|:

#

ive been doing a python masterclass for ages and its so hard, its supposed to be a 2-3 month course

#

im not very good at this

#

im pretty sure ive completed the course 4-5 times now

#

and i still have no idea how to program

#

i feel like nothing sticks with me?

#

well anyway, theres not much documentation. i often ask chatgpt for help but he knows just as much as i do reffering to pz.

bright fog
#

Don't go too deep tho as the lua version we have is 5.1 and some stuff we don't have access to

devout torrent
#

yeah i know chatgpt wont know much about pz doc, but the documentation doesnt have any mentions of things like onplayerupdate

#

is it outdated?

devout torrent
small topaz
devout torrent
#

thx

small topaz
devout torrent
#

ive been looking at a similar repo

#

chatgpt is actually pretty capable at writing code but many times it says that X is the error and then gives me code with the error lol

#

the best i can do is for my code not to remove the vanilla key

bright fog
bright fog
#

I don't have time to help in detail rn sadly

devout torrent
#

i searched for OnPlayerUpdate and theres no results?

devout torrent
#

how is this giving me errors

fleet bridge
#

would be helpful if you knew what the error was

#

you can look here for events

ancient grail
sturdy salmon
hazy shuttle
#

Been scratching my head with this. Its probably something simple but I can't figure it out. I want to achieve activating the mouse and keyboard and deactivating the joypad on a onPress keybind. And then on releasing that keybind it activates the joystick and deactivates keyboard and mouse. Id like to aim with the mouse. I'm playing on the steam deck so I can map the keys I need and use the gyro as a mouse. I found a mod that does this in a sense where it switches to keyboard and mouse fluidly but when it gets to reactivating the joypad it goes through a menu to select the player or make a new player. I just want it to reactivate the joypad. Heres the code in the mod maybe its just as simple as adding something basic

#

local function disbleJoypadKey(key)
if key == getCore():getKey('Aim') then
local joypadData = JoypadState.players[1]
if joypadData then
JoypadState.useKeyboardMouse();
local playerData = getPlayerData(0);
if playerData then
playerData:revertToKeyboardAndMouse();
end
end
end
end
Events.OnKeyPressed.Add(disbleJoypadKey)

round notch
#
    -- Store the original joypad data when we switch to keyboard/mouse
    local savedJoypadData = nil

    -- Function to handle key press (switching to keyboard/mouse)
    local function disableJoypadKey(key)
        if key == getCore():getKey('Aim') then
            local joypadData = JoypadState.players[1]
            if joypadData then
                -- Save the current joypad state before switching
                savedJoypadData = joypadData
                -- Switch to keyboard/mouse
                JoypadState.useKeyboardMouse()
                local playerData = getPlayerData(0)
                if playerData then
                    playerData:revertToKeyboardAndMouse()
                end
            end
        end
    end

    -- Function to handle key release (switching back to joypad)
    local function enableJoypadKey(key)
        if key == getCore():getKey('Aim') then
            if savedJoypadData then
                -- Restore the saved joypad state
                JoypadState.players[1] = savedJoypadData
                local playerData = getPlayerData(0)
                if playerData then
                    playerData:setJoypadIgnoreAimUntilCentered(true)
                    playerData:setAuthorizeMoveReset(true)
                    playerData:setJoypadBind(1)
                end
                savedJoypadData = nil
            end
        end
    end

    -- Register both event handlers
    Events.OnKeyPressed.Add(disableJoypadKey)
    Events.OnKeyReleased.Add(enableJoypadKey)

Something like this?

#

Don't know if it works lol

hazy shuttle
round notch
hazy shuttle
round notch
#

I don't own a joypad else I'd try and help πŸ˜‚ difficult for me to test haha

marble folio
#

Hey folks, does anyone have a tip to help make freaking arts for crops?
I wanna make a mod that adds crops to all the plants n herbs found on the vanilla game (plus a few other others maybe) and GAH, I'm having a extremely tough time drawing the crops, couldn't make any usable thing yet

devout torrent
devout torrent
#

-- This function is called when the player spawns in the game
function giveKeyOnSpawn(player)
-- Add the key item directly to the player's inventory
player:getInventory():AddItem("SMPL.SMPL_Key")
end

-- Register the function to be triggered when the player spawns
Events.OnPlayerSpawn.Add(giveKeyOnSpawn)

.I dont want other people to code for me, but ive been trying for hours i have no idea

bronze yoke
#

OnPlayerSpawn doesn't exist, you're thinking of OnCreatePlayer

#

that passes the player as the second argument so you'd have to change your function signature to e.g. function giveKeyOnSpawn(_, player)

devout torrent
#

thx

ebon dagger
#

Does anyone know if there is a way to edit the existing skill categories?

Quick example of what I am seeking to do:
I wrote a driving skill mod a few years ago, and I want to make a category (ie: parent) of "Vehicle Skills" and move Driving and Mechanics into it. Been searching for the last day and a half and havent found anything.

devout torrent
#

i have this in media/shared and the module is SMPL and the item is SMPL_Key:

-- This function is called when the player spawns in the game
function giveKeyOnSpawn(_, player)
-- Add the key item directly to the player's inventory
player:getInventory():AddItem("SMPL.SMPL_Key")
end

-- Register the function to be triggered when the player is created
Events.OnCreatePlayer.Add(giveKeyOnSpawn)

why wouldnt it work?

bronze yoke
#

does the item work? you can spawn it from the debug list normally?

ebon dagger
#

Do you have reference to "player" in your code already?

function giveKeyOnSpawn() local player = getPlayer() player:getInventory():AddItem("SMPL.SMPL_Key") end

bronze yoke
#

the event passes one

ebon dagger
#

Oh derp, yeah.

ancient grail
devout torrent
#

yeah

#

i dont know lua

#

ive been trying for a long time to learn but i think its to difficult for me currently

ancient grail
# round notch And..?

and nothing im not against ai being used as a tool
its up to the modder how to use them tho

directly having it write entire code isnt something its capable to do not unless you feed it syntax or your own code

i often use it for math formulas

round notch
#

Just thought your comment was a pretty weird contribution to my attempt at helping someone that's all. Pointing out the fact I used an ai to assist, like ok... You could've suggested an improvement where the code was going wrong.. that would've been helpful..

devout torrent
# ancient grail and nothing im not against ai being used as a tool its up to the modder how to u...

The newer models deffinitelly can, used it to write this. Didnt write a single line of code.
https://github.com/Roadbobek/Project-Zomboid-Mod-Manager-X-Mod-Manager-Server-Mod-List-Transfer-Tool

GitHub

Tool for Project Zomboid mod management. Allows you to use Mod Manager mod lists in Mod Manager: Server, and Mod Manager: Server mod lists in Mod Manager. A simple tool to transfer a mod list betwe...

#

Even the older gpt models before chatgpt, when u had to go to an unlisted link to use it could, not aswell but they could.

#

the only problems i had with it was misunderstanding what i wanted it to do, but the code didnt have any errors.

ancient grail
ancient grail
devout torrent
#

it can search the web well, but often you have to ask it to

#

and if you try feeding it a lot of data it just says the message is to long

#

it doesnt work very well with something like pz, because it doesnt know the doc

#

and i cant just send it a file that long

ancient grail
devout torrent
#

i find it hard to learn stuff when i can barely understand the documentation, so i really like using chatgpt to explain things to me

#

i want to be able to write my own code

#

also bugfixing, good for that

ancient grail
#

thats also a good use for it actually

#

what exactly are you learning rn?

sour island
#

Using ChatGPT to rubber duck / review is mostly fine if you give it good enough instructions / limit scope.

But you should probably disclose that you used it when giving out snippets that may or may not work.

#

I would recommend anyone using it to learn to avoid being swept up with the results, maybe try to read along the code to figure out what it's doing- ask it to make changes, see what it changed. Read the little blurbs it adds at the bottom explaining changes.

#

Source: I've used it before for some PZ mods, and currently using it to learn GameMaker (Studio 2) and often times the model goes haywire and just gets confused if you keep the session going.

grizzled fulcrum
#

Not to mention the only little amount of training data for PZ over Python which OpenAI probably datafarm so much Python code

round notch
#

Didn't even use chatgpt used Claude πŸ˜‚

grizzled fulcrum
#

tbf claude is much better than chatgpt imo for most langs

#

but the thing about AIs not knowing much about kahlua still exists

round notch
#

Yeah I get you. I did say it probably won't work after I posted it

#

I usually test it vigorously but the issue I was addressing relating to a gamepad which I had no way of

#

Tried to be helpful at the very least ☹️

grizzled fulcrum
#

I feel like the AI is more useful to ask for ideas on how to layout the code yourself more than writing the code straight up

queen oasis
#

I've used copilot for help with logic before. I never asked for code. Just asked for a "class derived from ISBaseTimedAction for selecting an area with the mouse in Project Zomboid" and it spit out some almost usable code.

grizzled fulcrum
#

ask the AI to decide on certain systems of your mod

round notch
#

I think it's good for blocking code logic out. Even if it makes non existent functions out of thin air if you manage to systematically go through it and check I find it very powerful

queen oasis
#

anywho, does update function of a timed action run per tick or?

queen oasis
grizzled fulcrum
#

for example. the progress bar uses the underlying update function (after the timed action's update func is called)

queen oasis
#

apparently, the last time I touched this code I had decided to rewrite it using ISBaseTimedAction but didn't comment anything so I got myself all kinds of lost.

#

some nice looking functions in there though. Inebriated me writes ok code.

true nova
#

Inebriated is the best way to code

queen oasis
#

well, I mean, I don't really remember starting to rewrite this module and there's zero comments. makes it interesting.

#

I think I was trying to get away from using Events for the mouse

round notch
true nova
#

My favorite is uploading an update and waking up to complaints that it's breaking games and trying to remember what you did

versed seal
#

guys is there a mod that increases loot chances at night? I'm playing on a "everything insanely rare" hardcore world with runners at night and I wanted to incentivise nightly escapades (since regular looting literally yields barely anything useful at all) so I wanted to switch all rarities to "rare" or vanilla default at night

scenic cradle
#

Why are the world 3D models so difficult to get working? I have tried every combination of things I can think of. I want to use a vanilla mesh with a custom texture but when it's placed on the ground, it shows the old 2D icon style item

grizzled fulcrum
#

Check your script where you define and use the model.

sour island
#

His model script might also be goofed- logs will say if something isn't able to load.

scenic cradle
#

Nothing showing in the debug console.I think I'm getting in a loop of fixing one thing but breaking another between the scripts

sour island
#

Show your scripts here, could be something obvious

scenic cradle
#

I don't have access to them at the moment, but can I reply to your comment later on with them?

ornate cloak
#

I'm looking to get a recipe item query to be a little more advanced, but my brain is not. I'm trying to look for all empty water bottles, of those all the ones that have an AttachmentType, but exclude certain specific items from the returned list. How is that done? Or am I overreaching here?

scenic cradle
grizzled fulcrum
ornate cloak
versed seal
#

I want to make a mod that increases loot rarity at night, but I've never modded and idk where to even begin. I understand I just need to find which functions handle loot rarity and checks if it's night or not and make a single if statement, but idk what they're called, where to look etc. Any help would be appreciated!

tranquil kindle
# versed seal I want to make a mod that increases loot rarity at night, but I've never modded ...

I don't think it would be that easy. AS far as i know, loot is generated around player, i think its alot tiles, but don't know exact numbers, so if you for example visit area by day, it would spawn said loot. If you were to visit that area later by night, it would be already generated, unless you made so it changes/respawns? But then this opens doors for alot of exploit by looting at day, then again by night and once again by day.

versed seal
# tranquil kindle I don't think it would be that easy. AS far as i know, loot is generated around ...

I imagined it would work something like that with loot spawning, the question is how big the spawn radius is. I wouldn't want to do the second option you mentioned because of the exploit possibilities, but if the spawn radius is for example 5 tiles (by tiles I understand it refers to roughly the size of for example a carpentey wall being placed which equals to 1 tile?) I think it would work well with the first option cuz then the player could simply avoid certain POIs during the day and raid them at night for the bonus but if the tile radius is like dozens of tiles then it would make it really problematic for the player lol

queen oasis
#

"this should work. why doesn't this work?"
whispers: because you named two functions the same name, like a genius
continues whispering: and if you paid attention to the error highlights, you would have known that 10 minutes ago...

true nova
queen oasis
#

I'm lost again. I'm getting a nil error but everything looks good to me.

I'm calling ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, item:getContainer(), stageSquare, 150))

I get the error: function: new -- file: ISInventoryTransferAction.lua line # 700 | Vanilla / Object tried to call nil in new.

Line 700 is: o.stopOnWalk = not o.destContainer:isInCharacterInventory(o.character) or (not o.srcContainer:isInCharacterInventory(o.character))

destContainer is an IsoGridSquare

#

player walks all the way to the square and then it errors

queen oasis
#

item is a ComboItem... bet that's my answer

bronze yoke
#

that's normal

#

your error is because destContainer is a square, not a container

queen oasis
#

I tried floor and got the same thing. I'm playing with ISDropItemAction again and I think my problem is I'm loading up the ISTimedActionQueue. Lemme post some code.

#
local wobs = square:getWorldObjects()
if wobs then blah blah let's find logs
    local dropLogs = ISWalkToTimedAction:new(playerObj, stagingSquare)
    dropLogs:setOnComplete(Forestry.dropLogs, o:getItem(), playerObj)
    ISTimedActionQueue.add(dropLogs)

and then

Forestry.dropLogs = function(item, playerObj)
    ISTimedActionQueue.add(ISDropItemAction:new(playerObj, item, 150))
end

This causes the player to get the specified amount, walk to the "stagingSquare" and think for a second, and drop nothing. Sometimes the player goes back for more, sometimes the action bugs.

bronze yoke
#

bear in mind that it's a timed action *queue* for a reason, you don't need to do weird stuff with on completes, you can just queue both actions

queen oasis
#

I was trying to defer checking the players inventory until they got to the drop off square. I could have been doing it wrong, but using luautils.walkAdj it would run the function to check the player inventory immediately.

versed seal
# true nova so you would want to add to an event. i would use LoadGridSquare. this event pas...

from my research it would seem the loot spawns upon world generation or at least in a massive area when the player first walks into it so it complicates things a lot lol. I'll try to maybe change the loot generation system in general instead of adding on top of it cuz i dont want to spawn new loot to already looted/opened containers.
Also thanks for the suggestion, I'll try to make use of this event!

split furnace
#

How does the game knows that those new body locations correspond to "lower legs" etc. in the base game?

group:getOrCreateLocation("KATTAJ1UpperLegs")
group:getOrCreateLocation("KATTAJ1LowerLegs")
group:getOrCreateLocation("KATTAJ1UpperArms")
group:getOrCreateLocation("KATTAJ1LowerArms")

And then in the scripts:

BodyLocation = KATTAJ1LowerArms,
mellow frigate
split furnace
bronze yoke
#

it doesn't really know at all

#

body locations basically just represent item 'slots', items with the same body location/incompatible body locations can't be equipped together

#

for stuff like protection, insulation, etc, it's the blood location that's used, which maps directly to areas of the body

split furnace
#

Uh, so blood location IS the thing that hooks everything together, thanks, I had a suspicion that it was the case but it sounded a bit weird

queen oasis
queen oasis
#

my head is almost on straight but idk what I'm doing wrong here. getItemsFromFullType("") returns an array.

local logitems = playerObj:getInventory():getItemsFromFullType("Base.Log")
for i=1,logitems:size() do
    local log = logitems:get(i)
    ISTimedActionQueue.add(ISDropItemAction:new(playerObj, log, 150))
end

That gives me an InvocationTargetException error when I try to set log
I also tried local log = logitems:get(i):getItem() but that gave me an getType of non-table: null

bronze yoke
#

for i=0, logitems:size()-1 do

queen oasis
#

I tried that, and also going backwards. I still get nil for the first iteration, and a comboitem for the second

#

lemme double check

#

well ok then, maybe I didn't try that

ebon dagger
#

Anyone have any idea on what setting I need to muck with to prevent a custom context menu from duplicated on stacked items?

ebon dagger
#

Figured it out. For anyone in the future with this issue, you need to add a boolean check to the function you add the context item with.

Example:
`function ResearchContextMenuEntry(player, context, items)
local needsContext = false;
local items = ISInventoryPane.getActualItems(items)
for _, item in ipairs(items) do
if not instanceof(item, "InventoryItem") then
item = item.items[1]
end
if item:getFullType() == 'YourMod.YourItem' then
needsContext = true;

    end
end
if needsContext then
    local character = getPlayer()
    context:addOption(getText('IGUI_YourString'), items, YourCallback, player)
end

end`

celest crane
#

I tried making a clothing mod. I have a prototype (let's call this Shirt A) that basically functions, so I used it as a base for the other shirts
The original prototype works and shows up in the game, can be selected during character creation and appears
The other ones, they show up in character creation, but when I choose them the game forcibly unequips the clothing
What I did was:
replicate the files in media/clothing/clothingItems one for each piece, with unique GUID
add the items to media/scripts/clothing text file that contains Shirt A (which, again, works)
add the unique GUID to fileGuidTable

Is there a step I'm missing?

#

The thing is, since the shirts are basically just the same texture with different color, if I set them as alternate textures with mBaseTexture they work

#

it's just that, the separate item entries do not work

#

Holy crap I'm dumb, the file names in clothingItems have a single teensy small whitespace in it lmao

torn igloo
#

Anyone manage to decompile and recompile LootRespawn.class successfully? Or anyone has made a patch for LootRespawn.class to fix the empty loot respawn?

vast light
#

I feel this is probably pretty easy, or impossible, idk lol. Can I rename the output item from a crafting recipe? And since it's a sheet of paper, can I also write on it? Like have it craft already written on?

#

This is my first attempt at modding

fleet bridge
#

Yes, you can do it using OnCreate

ancient grail
queen oasis
#

Is there a limit to the amount of actions you can add to the ISTimedActionQueue before it bugs?

drifting ore
#

Hello everyone. The game has a java module (I assume it is java), which is responsible for displaying a message on the server "The player died" in the chat. I want to change this output phrase a bit. Do you have a suggestion, which module is responsible for this?

#

Or perhaps you know how this can be changed without having to decompile Java files?

grizzled fulcrum
#

The first place id look is translation files.

#

In media/lua/shared/translate/en for example

#

If its not there, and its not in the lua somewhere (not likely) then its probably hardcoded in Java and that's gonna be an endeavour.

drifting ore
grizzled fulcrum
#

Oh yeah, then you might be out of luck

#

I don't know much about chat system, but tbh it sounds like that element would be hsrdcoded

#

If no one else can help you, the idea might have to be put on temporary hold

queen oasis
vast light
queen oasis
#

I supposed you could turn off death announcement and make your own

drifting ore
queen oasis
#

line 1349 in IsoGameCharacter.class

drifting ore
#

thanks, I'll try to decompile this and create something like a dictionary there and randomly write one of the phrases to a variable, and then substitute it into a function. theoretically, this should work

queen oasis
#

I would turn off the death announcement sandbox option and hook the OnCharacterDeath event to send a message to chat.

queen oasis
mellow frigate
#

When I start reading, item in hands are hidden. If I override the hand item after starting the read animation, the holding hand is not animated. Do you know how I can keep the visual StaticModel in hand during the animation ? ```lua
self:setAnimVariable("ReadType", "newspaper")
self:setActionAnim(CharacterActionAnims.Read);
self.character:reportEvent("EventRead");
--if self.item then
-- self:setOverrideHandModels(self.item, nil);--does not work. forcing the item inhibit hand animation
--end

bright fog
#

There's options to have an item equiped during the timed action I believe

ebon dagger
mellow frigate
#

I probably should not override primaryAnimMask and secondaryAnimMask which I did but not write here that I did stressed

bronze yoke
#

for what it's worth, one of my timed actions which does no such thing also hides items when performing it

mellow frigate
#

By removing primaryAnimMask and secondaryAnimMask the hand override finally works. thanx you three.

split furnace
#

What causes Could not find bone index errors?

#

I'm creating new body locations, it's probably related

grizzled fulcrum
#

and this skips all of the other bone stuff like pos, rotation, scale

split furnace
#

Well it looks like the error solved itself somehow, I love when they do that

versed saddle
#

i have a β€œspecial” infected mod idea i’d like to share with someone who might be mod capable in that regard

#

dm me if you are a modder and want to hear the idea i wanna see if it’s doable

dry chasm
versed saddle
dry chasm
versed saddle
#

i too dumb

#

brain capacity not big

dry chasm
#

Just takes time to learn and get used to it

versed saddle
#

yeah

dry chasm
#

And community is nice if you ever stumble somewhere and need some help

bright fog
versed saddle
#

i’ll try to summarize, but it’s based off a dream i just woke up from a few hours ago

versed saddle
# bright fog What's your idea ? I won't do it, but I can give some thoughts on if it's possib...

-# a viral outbreak had occurred in a fictionalized version of my apartment complex. the behavior of the afflicted was very strange and could be divided into three subtypes of infected

The Dormant
The Far Gone
The Vampires

-# The Dormant do not have much physical aspects that let others know they’re dangerous, it’s in their behavior that lets you know to steer close from them. The Dormant tend to act in strange ways, such as standing and staring at nothing, doing random acts around the area despite the threats around, etc. If the Dormant happen to be children, the Dormant will not often attack unless they feel threatened, utilizing methods of grouping or swarming to spread the disease faster. The same cannot be said for adult Dormants though, as an adult Dormant will at some point try to grab you or attack you. Dormants primarily spread the infection through airborne means, having a sort of β€œaura” of the virus around them that puts people at immediate risk. Paired with their risks, the behavior of a Dormant can be easily mistaken for a normal human if you’re not observing their behavior enough, as Dormants tend to utilize the ability to knock on doors to try and draw out unsuspecting individuals.

-# The Far Gone are somewhat easier to notice, as their physical appearances alter slightly with appearances of blood, dirt, or torn clothing, and are more feral in how they act. Just like Dormants, they are attracted to slight changes in the area such as a shift in sound or a visual shift, like lights turning on or off in an apartment, and unlike Dormants, will try harder in their attempts to get to wherever it is they want to, going so far as to bang on doors like zombies. Their ferality is more evident than that of a Dormant, making them a bit easier to spot from the rest.

-# The Vampire is where things took a turn in my dream. A strange man with a strange appearance had caught my eye in the beginning of the dream and later appeared again. Almost as though he was observing the chaos, this β€œVampire” had been outside for a good amount of time. His presence paired with a few teenager Dormants had made me briefly think I was delusional regarding a zombie attack, but when I asked the Vampire, who was outside on the pavement and I on a fire escape stairwell, if he was a zombie, he gave me a sinister chuckle that all but confirmed my suspicions.

-# Vampires are highly dangerous and assumed to be rare (I didn’t dream long enough to study them further). Their tendencies are far more dangerous, having little signs to indicate that they are infected, other than an β€œobservationist” or β€œstalkish” behavior that of which is peeled away whenever a Vampire feels that the time to strike is now. When a Vampire is ready, a slight mutation process will occur where the Vampire will let the full effects of the virus overtake them (possibly temporarily if not for an extended period of time), gaining far more strength, speed, and ferality at the cost of the more human benefits it once had. They give a terrifying scream when transforming.
-# A Vampire’s mutation doesn’t entail too much change, sporting a more malnourished physicality, a sunken face, and a pale skin pigmentation. Alongside this, are enhancements to their speed, strength and ferality.

#

here’s the dream too

#

it began at my apartments

-# i felt something strange and began to saw people outside chasing each other weirdly and banging on other people’s doors but their behavior wasn’t entirely feral, like they had some sort of control left but only sometimes

-# anyways, as it began to start i realized what was going on rather fast and began to call everyone i could to warn them about what was going on, i called my mom and damn near hyperventilated trying to tell her the zombie apocalypse was happening now, i tried to call my buddy and warn him, it was fucking terrifying. then, i began to lock down the entire apartment and barricade it, using whatever furniture i could to block off doorways, windows, stairways, etc

-# there was one specific figure who caught my attention during all this, a very very strange man with an even stranger demeanor, and i somewhat knew or felt that he was one of them, but the way he acted was more intelligent. i wasn’t the only survivor in this apartment complex, i had to deal with a young Japanese guy who the language barrier was very evident with, but we managed to communicate with each other about what we needed to do to feel safe.

-# me and him turned off all the lights in our apartment, started to crawl around, and began to watch the behavior and the method of operation for the β€œzombies”, which was quite scary given i found out that the β€œzombies” were attracted to movement and light, and there seemed to be at first two types; the dormant and the far gone.

-# The dormant ones were like you and me, relatively normal looking in physical appearance, but acting out in strange ways. For example, at some point, me and the Japanese guy caught sight of someone working out in the track field next to the apartment, just straight up doing pushups. We could somewhat tell that they were infected though due to the way they jogged, which was a sort of a stiff, feral limp. Then we saw a couple other kids doing the same stuff, and got the idea to try and get their attention to see if we were exaggerating or if there really was a problem.

-# I made a light whistle towards them in the dark of the apartment, and the two-three we were originally watching multiplied into about 5 or so kids from out of nowhere. It was like we woke them up from a trance. Admittedly we asked them if there was any zombies, one of them replying no despite the obvious answer being YES. They then immediately began to swarm up together and knock on doors like it was Halloween. They were the dormant.

#

-# The far gone were those affected by it long enough to have their mind almost entirely lost. Almost entirely feral, these were the ones who were banging on doors and trying to break them down. When I was barricading the bottom floor, one managed to break in and I had to dodge it and run away since I was unarmed. Something we observed was that if the Far Gone weren’t attracted by anything, they would enter a state of focus in order to look for something, anything, to set them off and give them a reason to move. When we shut the lights off and began the observation process, we saw this occur with a slightly buff looking lady who was in this state of focus. Had we not had our lights off I do believe she would’ve gone to seek us out.

-# I mentioned that there seemed to be two types. The man with the exceptionally strange demeanor I mentioned earlier. When I looked out from a fire escape window on the second or third floor of the apartments, he was less than maybe 30 feet from me on the ground. Looking at me, watching me. And I asked him, β€œare you a zombie? are you one of them?” and he just chuckled. He just fucking chuckled. And it wasn’t a lighthearted chuckle, it was a sinister β€˜oh, you poor, unaware fool’ chuckle. Then he said β€œNo”.

-# Out of nowhere a third survivor who looked like he was ready to kill LITERAL vampires with his fucking Bloodborne getup climbs up my fire escape, goes β€œDon’t listen to him, he’s one of them” and proceeds to help me board up the fire escape window. I thank him and go β€œalright here’s the deal we have a safe house upstairs fully boarded off.” Just as we’re starting to climb the stairs we hear a horrifying roar. A transformation roar. My fight or flight kicked in, and me and the new survivor sprinted up the stairs as quietly as we could. I looked down the stairwell because it was one of those stairwell’s you could kind of peek.

-# I saw that same strange man sprint up the stairs in a far more physically chaotic way than the others carried themselves. This was a ferality comparable to a vampire. And considering his appearance and demeanor, assuming others were like this too, I’m calling this third type the Vampire. A third stage that was either a sign of the normalities to come, or a sign of rare mutations that were to be seen occasionally around.

-# The vampire had luckily not seen us, but at that point that fucker was already in the apartment. It was terrifying.

bright fog
#

Definitely doable

grizzled fulcrum
#

holy essay! no offense lol, just was surprised)

bright fog
#

Yea lol

grizzled fulcrum
#

an interesting idea for zomboid would be turning off name tags if you cant already

#

in a multiplayer environment, and with zombies that can look similar to players, that would be really terrifying

versed saddle
#

same for whoever else might want to

#

just credit me for coming up with the idea lol

bright fog
#

server settings

#

also from lua I believe you can

ancient grail
versed saddle
ancient grail
drifting ore
queen oasis
#

something like SendCommandToServer("/servermsg someone ded")
I guess I don't know how that would render. I can look into it later though.

#

because I think a servermsg pops up on the screen too?

drifting ore
#
local function sendMessageToServerChat(messageText)
    local chatServer = ChatServer.getInstance()

    chatServer:sendMessageToServerChat(messageText)
end

local function OnPlayerDeath(player)
    local username = player:getUsername()
    local deathMessage = string.format("%s test!", username)

    sendMessageToServerChat(deathMessage)
end

Events.OnPlayerDeath.Add(OnPlayerDeath)

I tried this but ended up still getting an error:

STACK TRACE
-----------------------------------------
function: sendMessageToServerChat -- file: death.lua line # 4 | MOD: death
function: OnPlayerDeath -- file: death.lua line # 17 | MOD: death.
[30-11-24 02:18:31.371] ERROR: General     , 1732907911371> 19 228 483> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getInstance of non-table: null at KahluaThread.tableget line:1689..
[30-11-24 02:18:31.371] ERROR: General     , 1732907911371> 19 228 483> DebugLogStream.printException> Stack trace:.
[30-11-24 02:18:31.373] LOG  : General     , 1732907911373> 19 228 486> -----------------------------------------
STACK TRACE
-----------------------------------------
function: sendMessageToServerChat -- file: death.lua line # 4 | MOD: death
function: OnPlayerDeath -- file: death.lua line # 17 | MOD: death.

And this is what I found in the documentation:

  1. https://pzwiki.net/wiki/OnPlayerDeath
  2. https://projectzomboid.com/modding/zombie/chat/ChatMessage.html#getAuthor()
  3. https://projectzomboid.com/modding/zombie/network/chat/ChatServer.html
#

Don't judge strictly, I practically don't remember this documentation... It's alien to me. And I'm not a lua programmer

drifting ore
vagrant rapids
#

any mods that changes the hud/UI appearance?

drifting ore
#

I have one server, but it won’t change anything regarding the chat. There is only extra. command /suicide

#

However, the absence of this mod did not affect anything

drifting ore
queen oasis
#

quick test and I don't think ChatServer is exposed in lua

drifting ore
#

Then could there be any analogue?

jolly goblet
#

Is anyone creating a mod that can integrate AI like CHATGPT into NPC interaction with the player?

queen oasis
frank elbow
queen oasis
queen oasis
grizzled fulcrum
#

yeah, if you want a proper integration without having to run like a listener service or something alongside the game, you probably want a Java mod

queen oasis
#

wonder if one can fake an OnAddMessage event... it still wants a ChatMessage, nvm

#

thought I broke the inventory panels(again) but nope, they were just closed for whatever reason.

jolly goblet
#

Hi, your project looks very interesting. I'm creating an NPC mod and I wanted to include AI.

maiden arrow
#

What is the 2nd argument for context:addOption() supposed to be? I see the player being passed on some examples and on others not.

#
context:addOption(actionName, nil, callbackFunc)
bronze yoke
#

the first argument to pass to the function

#

it's dumb but basically addOption(name, arg1, callbackFunc, arg2) calls callbackFunc(arg1, arg2)

maiden arrow
#

Yeah that is kinda dumb, thank you for clarification

vagrant rapids
#

okay, i know this is hard to explain but im gonna go and try to share my idea and see if someone is able to help me out on this one.
so if you guys have played the Day One mod by Slayer (wich btw its amazing and i love it) youll know theres this little feature that basically throws a nuke at you. so im trying to do this kind of cinematic end to one of my worlds in wich i want it to begone with one of these nukes, iΒ΄d like it to be activated via a button either made in the game or one similar to this debug tool from their mod itself (pic1) and when it being pressed and advertisement similar to this one (from cod mw2019 pic2) thus making the player die instantly alongside the world itself, do you guys think something like this could be possible? does someone know where to start?

maiden arrow
#

You can create an option when right clicking anywhere in the world

vagrant rapids
#

i understand

maiden arrow
#
local handleOptionClicked = function()
    --Stuff happens here when you press the button
end


local function OnFillWorldObjectContextMenu(playerIndex, context, worldObjects)
    context:addOption("Option Name", nil, handleOptionClicked)
end


Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)
#

my syntax is disgusting rn hope you dont mind

vagrant rapids
#

sincerely, my "programming experience" its about 1 day old so i surely dont mind since i dont even know how to code that myself

vagrant rapids
#

XD

maiden arrow
#

You have no experience in lua?

vagrant rapids
#

uhhh

vagrant rapids
maiden arrow
#

Basically none lol it's fine

vagrant rapids
maiden arrow
#

right click anywhere in the world it should show up as an option

vagrant rapids
#

okay im going to test it rn

maiden arrow
#

I added one myself called "trigger timed action"

#

I am trying to set up timed actions and I noticed the require method and it seems like it doesn't throw an error, even if the path is invalid so how can I be sure if it has required anything

vagrant rapids
#

scrap it im gonna start at the beginning, i tried to implement the trigger timed action on the mod i was trying to do but i think its best if i just start all over

maiden arrow
#

oh rip

#

I am trying to learn how to make timed actions myself but nothing is happening

#

Maybe it will help you

vagrant rapids
#

apparently with this you can trigger any event just like the mod but im not pretty sure how to link that to the event itself

maiden arrow
#

It's still not working for me under the path media > lua > client > TimedActions

require "TimedActions/ISBaseTimedAction"

MyTimedAction = ISBaseTimedAction:derive("MyTimedAction");


function MyTimedAction:new(character) -- What to call in you code
    local o = {};
    setmetatable(o, self);
    self.__index = self;
    o.character = character;
    o.maxTime = 30; -- Time take by the action
    if o.character:isTimedActionInstant() then o.maxTime = 1; end
    return o;
end


local handleOptionClicked = function(player)
    local plrString = "Timed action has been pressed"
    getPlayer():Say(plrString) --Make player say something for debug purposes

    MyTimedAction:new(player) --Nothing is happening
end


local OnFillWorldObjectContextMenu = function(playerIndex, context, worldObjects)
    local player = getSpecificPlayer(playerIndex)
    context:addOption("Timed Action", player, handleOptionClicked)
end


Events.OnFillWorldObjectContextMenu.Add(OnFillWorldObjectContextMenu)

lmk if you figure it out

vagrant rapids
ancient grail
#

@bronze yoke
youve always mentioned that the load order doesnt work like how most people think of(based on whats written first from the modlist)

https://youtube.com/shorts/ubleyA7WnZE?si=cJ5Zd9KYf7-nS4-x

i saw this and wondered why tis would make something that has a load order control?

In this video, we take a look at the mod management menu mentioned in a previous Thursdoid post by the developers of Project Zomboid.

Enjoy!

------------------------------------- Important Links -----------------------------------------

Patreon & Server Whitelists: https://www.patreon.com/mratomicduck

My Discord: https://discord.gg/EwyjPw4HY...

β–Ά Play video
#

also someone showed me this

#

but i know what youre saying is in regards of lua tho but id like to ask you what your take on this matter

#

thnx in advance

bronze yoke
#

i don't know why they would do that, but load order does matter in very specific circumstances (but well written mods rarely rely on these factors because they are avoidable and you should never rely on the user to do your work for you)

#

load order affects the order in which mods 'load' but that's mostly meaningless as most types of files that are run during the main 'mod loading' phase do not really care what order they run in

#

it doesn't affect things like the order in which script and lua files run, which is the main thing people seem to think load order does

#

the only real effect it has on scripts and lua is if multiple mods have the same file (a 'file override') the one from the mod latest in the load order is prioritised

#

aside from that, load order rarely matters (map load order can matter of course but this is technically a separate system entirely - don't think the order in which you load the actual mods affects anything there)

#

i've also heard that incorrect order of tile mods can cause some kind of corruption, but i haven't looked into why that might happen (so may or may not be another superstition)

#

but when you hear things like 'load library mods first' this is mostly nonsense and doesn't affect anything whatsoever

#

if a mod overrides a file from another mod, then it will require it, which in singleplayer forces the game to put it later in the load order anyway, so it's not a big deal there (though i will always argue that file overrides are unnecessary and just add a new avenue of failure)

#

so overall the only time you really need to change the load order is if two mods override the same vanilla file - but in most cases this just means they won't be compatible no matter what you do with the load order, so it also doesn't matter much there lol

worthy zenith
#

Hi

#

i would like to start learning how to make mods for this game, where could i start?

maiden arrow
#

There is no good answer for that question

worthy zenith
maiden arrow
#

well no but

#

Figure out what mods you want to do and try to make them

worthy zenith
#

Okay

maiden arrow
#

Good suggestion

ebon dagger
#

This will give you basic concepts and help you get the file structure and such.

#

Its how I learned, I started by making a cooking mod, which is mostly just items and stuff (its called Rugged Recipes feel free to tear into the code)

Once you get into it, I find just looking at what other people did and looking at the base files for PZ is the Best source.

ebon dagger
#

WILD ASK, but has anyone ever successfully removed a base game skill?

Working on an overhaul and I would love to combine sneaking and lightfooted into one skill.

Is there anyway I can remove Nimble from the Perks object?

if not, would creating my own custom skills overlay that just so happens to forcibly ignore it work?

bronze yoke
#

probably not wise to actually remove it if possible as there'll be java-side queries for it you can't prevent

#

probably better as you suggest to just get the ui to hide it

ebon dagger
#

I didn't even think of the Java side calls. Thanks for reminding me. Lol. I've been wanting to learn to make the UI windows for a while anyway. Good reason to do it.

maiden arrow
ebon dagger
#

When you say "nothing happens"

Are you doing this with a context menu? Does the context menu show?

maiden arrow
#

Yeah context menu shows

ebon dagger
#

Ok, when you click it, does it Error out, or just do nothing?

maiden arrow
#

Nothing

#

I will double check though

ebon dagger
#

Ok, with the code you posted there, is that the WHOLE code?

Timed actions need a bunch of different entries. I found a blank in a mod, lemme grab it.

maiden arrow
#

Yes it's the whole code

ebon dagger
#

Ok, I found this "BlankAction" in Better Lockpicking by Aiteron

require "TimedActions/ISBaseTimedAction"

EmptyAction = ISBaseTimedAction:derive("EmptyAction")

function EmptyAction:isValid()
    return true
end

function EmptyAction:update()
end

function EmptyAction:start()
end

function EmptyAction:stop()
    ISBaseTimedAction.stop(self)
end

function EmptyAction:perform()
    self.func(self.arg1, self.arg2, self.arg3, self.arg4)
    ISBaseTimedAction.perform(self)
end

function EmptyAction:new(character, func, arg1, arg2, arg3, arg4)
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.character = character
    o.maxTime = 1
    
    o.func = func
    o.arg1 = arg1
    o.arg2 = arg2
    o.arg3 = arg3
    o.arg4 = arg4
    
    return o
end```
maiden arrow
#

This might help @ebon dagger

#

add lua on top for the colors

maiden arrow
#

\media\lua\client?

ebon dagger
#

media\lua\Client\TimedActions

#

But the MEAT of your code should be in :perform()

That is what is called when the action actually DOES something

maiden arrow
#

How do I call it tho? with :new()?

#
local handleOptionClicked = function(player)
    MyTimedAction:new(player)
end
ebon dagger
#

ISTimedActionQueue.add(YourAction:new(varb, varb))

#

That adds a timed action to the Queue

maiden arrow
#

In my case I assume

 ISTimedActionQueue.add(MyTimedAction:new(player))
ebon dagger
#

Yep!

maiden arrow
#

It errors

ebon dagger
#

did you add definitions for :start, :perform, etc?

maiden arrow
#

yup

#

Same code just replaced the line

#

oh wait I believe I know now

#

One second

#

Great it works. The progress bar appears now

#

Thank you so much

ebon dagger
#

No problem! I just got through learning most of that this last few days.

past ridge
#

can anyone give me a quick crash course on how to make a new item that is a reskinned canned food?

#

ive created some textures

#

and im using the canned beans code as a base

#

how do i make it use my own custom texture?

#

these are the textures ive made

#

i just need to know how do i like give them to a item

ancient grail
#

i dont really get why it matters to them ill ask people

past ridge