#mod_development

1 messages · Page 546 of 1

cosmic condor
#

put this .txt file in the scripts folder and put your sound in the sound folder

chilly beacon
#

interesting sound clip...

ruby reef
#

you sure there is a sound called ZombieSurprisedPlayer?

#

nothing pops up for me

cosmic condor
#

The sound is in .bank file, you don't need to mess with it.

#

Just create your own mod and the scripts will replace the sound for you.

ruby reef
#

sure

#

file = media/sound/sexygirlmoaning.ogg, so i replace the sexygirlmoaning ogg?

cosmic condor
#

yep

ruby reef
#

with the name of my file?

cosmic condor
#

ofcourse

ruby reef
#

alright and what should i name this txt file?

#

never modded sounds before i just did items

cosmic condor
#

same as your mod's name

ruby reef
#

alright

#

thanks

#

so the current file structure should be?

media/sound/filename.txt
cosmic condor
#

Workshop\yourmod\Contents\mods\yourmod\media\scripts\yourmod.txt Workshop\yourmod\Contents\mods\yourmod\media\sound\yoursound.ogg

ruby reef
#

i see tysm man!

cosmic condor
#

audacity > mp3 > then converter to ogg

ruby reef
#

damn man you gave me everything lol

#

tyyy

ruby reef
cosmic condor
#

how?

ruby reef
#

it didnt convert

#

it did but its not the audio i inputed

cosmic condor
#

first you need to select the format you want then drag and drop on the program and wait

ruby reef
#

yep i did

cosmic condor
#

can you record what you did?

#

I'm using it on a daily basis. No problem at all.

ruby reef
#

nvm found another program

#

and i cant record it it'll take a lot of time to upload

#

and is there anyway to trigger the jumpscare effect?

cosmic condor
#

teleport your character in a room

#

or just use stash map debug

cosmic condor
#

cool

#

but the volume might be too high, should tune it down a bit

#

I'd suggest 85

wooden falcon
#

I want to use the Mod Options mod with my mod so that users can tweak my mod's functionality within their in-game settings.

Mod Options: https://steamcommunity.com/workshop/filedetails/?id=2169435993

There doesn't seem to be much documentation / explanation on this mod's page and I have a few questions:

  1. Can these options be seen by .txt files in the media/scripts folder or only the .lua files in the media/lua folder?

  2. The mod's page shows the options table being defined as a local variable. If I want them to be accessible from outside of the file they are being defined in, do I remove the local keyword (and change the variable's name to something unique that won't clash)?

Thanks!

serene cypress
#

what are the parameters for player:getXp:AddXP()

violet shell
#

Is this helps : player:getXp():AddXP(Perks.Doctor, 1)

serene cypress
#

Ive been looking into the source code of other mods to try and learn and I saw some mods have 2 or 3 additional boolean paramaters after those ones

violet shell
violet shell
#

any hints ?

serene cypress
violet shell
#

Sorry, I don't understand what those booleans are for...

lucid spindle
#

Anyone know if we can get/set/reload SandboxOptions.Distribution in lua? I see Distribution in the API ref but having trouble actually getting to it.

pulsar rock
#

Hey all, anyone figure out how to fully decode player data from the players.db?

#

I'm currently stuck with the following result; Which isn't exactly useful.

#

That's after converting the original data to a hex string, and decoding using latin-1

#

(Please toss me a ping if you've got an answer)

midnight mica
#

anyone know how to get the proper count of the result, for example i getas result 2x of thesame item but result:getCount() only displays 1

drifting stump
#

its an sql databse

pulsar rock
#

Not the rows themselves

drifting stump
#

ah its likely a java object converted into a byte array

pulsar rock
#

How would that even work? hmm

lucid spindle
lucid spindle
#

When your temporary text file has somehow picked up a non-displaying character that makes the debugger reject what you are typing 🤦
So this appears to work as expected...
getSandboxOptions():set("Distribution", 2)
print(getSandboxOptions():getOption("Distribution"):getValue())

lucid spindle
#

Sadly this doesn't seem to actually have any effect on Zed distribution. Any thoughts??

timber moat
#

progress on my tainted sink/tub/toilet water mod >:3

#

randomized water levels too

timber moat
#

so stoked to get this working, i was worried i would have to delete the old objects and create new ones but i managed to just modify the tiles directly and i feel so cool about it lol

azure rivet
#

Hi, I created a mod for a profession but when I die and create a new character I don't get the profession to grab it again, how do I solve this?

cosmic condor
#

Many mods break after your character dies.

azure rivet
jaunty marten
#

there's a lot of them in workshop

lucid spindle
#

How are folks doing their soft settings/config for their mods? A link to an example or tute would be great.

signal frost
#

How does the RV Interior mod work? Does it teleport you to a separate zone somewhere?

limber ridge
#

Yeah

#

That’s how it works for the one I have

#

It’s an armoured rv

signal frost
limber ridge
#

Yeah

violet shell
#

Hi, I'm a former b40 modder and I started to play & mod in b41. I have a first question : is there any change in recipes ? For instance, is there some kind of hardcoded function that you can call to check proximity when you craft : something like a "isNear:" ? If not, I'll have to rely on including in "onTest:" some old functions I got. Thanks.

summer acorn
#

how can i add a brake light to a car texture?

violet shell
#

Thanks. I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?

#

In m'y b40 mod i uses to check for textures with a dedicated function that was called by a onTest function.

violet shell
undone crescent
#

anybody an idea how to make a noisemake reset itself?

small topaz
#

hi! i am currently working on a clothing mod and while play testing, the console.txt sometimes contains this: AnimatedModel$AnimatedModelInstanceRenderData.init> skinningData is null, matrixPalette may be invalid

#

my mod works fine so far (no red error boxes and it behaves as intended). however, i am curious what the console output means and whether this could lead to problems... any ideas?

cinder kindle
#

Hello, do you where I cand find the moodles files ? Specially the hunger moodle ?

undone crag
#

I think Java unfortunately.

lucid spindle
#

"How are folks doing their soft settings/config for their mods? A link to an example or tute would be great."

hot pagoda
#

A suggestion: When you wreck a vehicle or have been attacked and killed by zombies while in a vehicle ur corpse is automatically applied to the inventory of that seat of the vehicle. This would be an even better dev update but im sure someone out there can figure a mod to do it. Anyway would love to see this!

shrewd gyro
#

Hi guys, I'm trying to make a vehicle mod and then I found a 2018 tutorial on "theindestone.com", while following the steps I stopped and thought "is this tutorial good for creating mods nowadays?" I went into the PZ mods folder and took a look at the vehicle mods I downloaded, and they all seem to have this folder called ISUI, what is it and how to use it? (sorry if it's not understandable, i'm using google translate)

sinful vessel
void folio
#

Anyone savvy know how to get IsoRegions to render the walls so that I can debug a build issue? It just shows shaded blue volumes currently with no distinction as to walls.

Fixed: Build at least 1 wall frame outside and IsoRegion should snap into wall render mode.

topaz violet
#

anyone know the name of the black and white mod?

#

i cant find it on steam workshop

shrewd gyro
#

How do modders discover the game's source code? I was exploring the code of some mods I downloaded and they "Pull" things out of the game like variables etc. like, a code representing a location that such items will spawn, etc. I remember that a long time ago I used dnspy ​​to do this with the worldbox, but apparently it doesn't work here, could someone clear this doubt for me?

lucid spindle
shadow geyser
gleaming inlet
#

found something interested while messing with my player.db file

#

agony

heady crystal
#

Thought I'd give modding a try but I am a bit confused right off the bat. What file extension do I use for scripts inside the media\scripts folder and is there any naming scheme I should follow?

#

The PZ modding repo mentions the game makes use of Java and Lua but doesn't exactly specify. I am assuming it's Lua?

mint sphinx
#

hmm i have a weird question here hmm.. im kind of lazy when i making sprites and cought my self to just re use some of the some of the same texture in multiple rows in the mytexture,pack my question is does the pack self runs a dedup it self when you make it as a pack or do you need to delete the dublicates your self ?

dont really know where to place this question

wooden falcon
#

I'd like to make a mod that adds a "Place in oven" button here whenever an oven is in range. Does anyone know of an addon that adds buttons to existing menus so that I can see how they're doing it?

jaunty marten
jaunty marten
#

@wooden falcon btw I think it will fast your work

local player_num
Events.OnCreatePlayer.Add(function(_player_num)
    player_num = _player_num

    local crafting_panel = getPlayerCraftingUI(player_num)

    local text_width = getTextManager():MeasureStringX(UIFont.Small, getText("UI_blablabla"))

    local new_button = ISButton:new(
        crafting_panel.addIngredientButton:getRight() + 5,
        1,
        text_width,
        25,
        getText("UI_blablabla"),
        crafting_panel,
        callback_func
    )
)
mint sphinx
#

where does the server check if all client is sleeping check ?

jaunty marten
#

IsoPlayer.allPlayersAsleep

mint sphinx
# jaunty marten java func

just found it as well hmm was hoping for it had another call hmm byt thx

do you have knowlagde about the tree growth tick also have problems with finding when that happen lol

jaunty marten
#

Not in pz rn but u can try to check square after cut tree by square:getTree
There's :HasTree and :getTree but maybe in :HasTree checks :getTree and tree health (as I got health it's for chopping progress but I'm not sure) then maybe there's some way to get grow time

keen cape
#

I gotta admit, taking on the older 2 in 1 npc mod, has been quite the task aniblobsweat

violet shell
#

About NearItem :
I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?
In my b40 mod i used to check for textures with a dedicated function that was called by a "onTest" function.

jaunty marten
#

pz modding moment

mint sphinx
gleaming inlet
#

cant beat em?, join em

jaunty marten
#

it's fine

small topaz
#

hi! have a question concerning those GUID strings which are for example used for identification of clothing items. example is such a thing: 20830c4a-bc1e-4b57-ad50-9521916ba9d0. can I use any string in the format 8-4-4-4-12 where the blocks are composed of random integers (between 0 and 9) and random lower case letters (from a to z)?

tawdry moss
#

How do you overwrite a vanilla item with a mod? I’m trying to make a trait mod for food allergies, but overwriting the vanilla items to add an “on_eat” function is not working.

jaunty marten
#

check the code, there are 20-30 lines of one, usually modders literally copy this into their mod and change name of file to don't create extra dependency

wanton axle
small topaz
wanton axle
#

Definitey didn’t follow that format you mentioned

#

Yep

small topaz
#

in my case, i am working on a mod which might have a lot of clothing items and therefore i decided to write a little program which automatically generates the fileGuidTable and the respective .xml files to save work. one part of the program consists in generating enough of those GUID strings. therefore my question...

frosty falcon
#

you can also get guid generators it’s quite a common use for unique ids, wiki actually says a lot about guid generation iirc

slow graniteBOT
#
terminalchillness#3527 has been warned

Reason: Bad word usage

inner blade
midnight mica
#

is it possible to make a character equip the welding mask to do a recipe?

#

keep only requires it, i'd like it to require being equipped

lucid spindle
#

Any tips on doing a "silent noise event" to attract zeds to a given location. I know I've seen it in a mod but I cannot remember which one.

oak rover
#

looking for someone to commission a pretty easy mod if you'd like

wooden falcon
#
    fixing Fix Rolling Pin
    {
       Require : RollingPin,

       Fixer : Woodglue; Woodwork=1,
       Fixer : DuctTape,
       Fixer : Glue=2,
       Fixer : Scotchtape=3,
    }

Is it possible to set the "Potentially repairs #%" amount? I have a custom weapon in my mod with 4 different ways to repair them. One of them has a 20% repair, one has a 50%, and the other two have 10%. But I have no idea how those numbers were set because I didn't do them myself.

wheat warren
#

could someone help me with adding a new spawn region for players to pick from (area on vanilla map near bases etc)

#

im talking specifically the spawn regions you can pick, i have a spawn point set currently and would like more options, thanks if you can help

cosmic condor
wheat warren
#

dont know why i didnt think of that thanks 🙂

#

hopefully now it works 😄

wheat warren
#

i did it right a while ago and wasnt putting them in the server files 😄 figured it out

radiant venture
#

I want to make a "clothing" item aka a hilt for the katana but don't want to put it as a "tail" item or smth like that. So how would i make a new section so it doesn't impare the ability to wear any other clothes

#

Also is there an easier way to do distribution than going through 9k lines of code-

candid tapir
#

Can someone help me with this problem I have (see photo) the gunfighter in sandbox is squished.

#

Would appreciate if someone has answers, been at this for 2days now

cloud crow
#

why is "Piercing=TRUE," not working on some guns?

#

some changes just won't really apply for some reason

cloud crow
#

even if I change the swing time, the attack speed of the melee doesnt change

small topaz
manic harbor
#

Is it possible to create a custom radio station and play custom music ? If it is, do you have some docmentation to give me ?
Thank you in advance

radiant venture
small topaz
#

its sth like group:getOrCeateLocation("myNewLocation")

radiant venture
#

Thanks for the help man. I'll look into it once i'm done grilling

undone crag
wintry stag
#

Chainsaw retexture for the people that doesn't like the orange one. To replace it, download the texture, go to ProjectZomboid > Media > Textures, then do copypaste and replace it.

#

Here's a picture of how the chainsaw model looks with the new texture

violet shell
# jaunty gate "NearItem" should do it.

About NearItem :
I Guess it's in recipe definition :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of a 3D object like a oven what should I use ?
In my b40 mod i used to check for textures with a dedicated function that was called by a "onTest" function.

cloud crow
unique sinew
#

is workshop bugged rn? cant see my posted items etc like the panel is missing on the right

#

nevermind its working now just a min later

shrewd gyro
#

I put my mod in the mods folder and they didn't appear in the PZ mods menu, does anyone know how to solve it?

cloud crow
#

Now this time, for some stupid reasons with guns, I set the recoilDelay=0, then added FireMode = Auto,
The gun fuggging shoots like it has 100 RecoilDelay.

#

While another gun has exactly the same variables, and it works, it shoots full auto. What the F?

timid saffron
undone crag
#

Swing speed is the same hmm I lack answers :|

cloud crow
#

so no matter I change swingtime, it doesnt matter?

undone crag
#

If an item has a reach of 1 and your character has one, and you change its speed in the txt tile to 2 and reload your save, then that item's instance's reach is still 1, but if you add a second one of the same sort of item to your character then that has a reach of 2. Oh swingtime maybe that does not do anything anymore and it uses a different thing now. There are items with numbers that affect their swing speed.

shrewd gyro
#

Now it worked! I had put it in the wrong folder

misty lake
#

hey ppl been without my pc for 8 months now, just got a new gpu for playing today, so... i had a lot of mods before when i was playing on build 51

#

Should i just delete everything and do it from the start?

#

I immagine too much has changed to break everything right?

devout galleon
#

I would go with a clean install @misty lake

misty lake
#

I'll probably just do that

odd merlin
#

Sir is there anyone who can help how can I install map mod like Raven Creek to the server with server hosting site -https://games.agilahost.com/

devout galleon
#

Prolly the easiest way

odd merlin
#

its there already but map wont load

#

@devout galleon thats what i got after

vestal sparrow
#

is that mchost

odd merlin
#

agila hosting

odd merlin
calm depot
distant yoke
#

is there a way to see the files that are downloaded when you download someone's mod? i am trying to work out the coordinates/tiles of someone's map

midnight mica
#

is there anything in the base lua files that handles zombie respawns? i'd like to make a mod that adds respawns/total population in certain cells, but i can't find anything to go on

hybrid idol
#

I have a question that I'm sure has been asked a million times, but I haven't been able to find an answer to my particular idea. I'm making a mod for a .357 magnum revolver, but I'd like for it to be able to switch between .38 special and .357 magnum, and have different range and damage. Is there a fairly simple way to implement that? I don't want to add to much more to the game. I was just thinking of changing it in the inventory to have a drop down menu with an empty gun to switch between the two. I think I understand the basics of how to make a new gun and ammo type work, I was just wondering about that specific function.

violet shell
hybrid idol
#

That's true!

old blade
#

you know what i would really like to see

#

im not sure if its actually planned

#

but

#

id really like to see tracers

#

or some kind of visual representation of bullets being fired

#

other then like, a light up around you

slow graniteBOT
#
Hugh#4016 has been warned

Reason: Bad word usage

keen cape
slow graniteBOT
#
A2 - Sgt. Sage#5474 has been warned

Reason: Bad word usage

dusk saddle
#

I've got some questions regarding clothing moddin'
I've been following that one clothing tutorial that's on both Github and Steam, though I've done it all in 2.79. Would that impact rigging at all? As in-game my jacket is a mangled mess!

thorn cipher
#

Hmmm

willow estuary
thorn cipher
#

Did you use a zomboid clothing model as the base?

thorn cipher
willow estuary
dusk saddle
#

Yeah, I used a base model. The base jacket

thorn cipher
#

So this is just a retexture right?

dusk saddle
#

Let me try exporting the FBX with what I use to export my Ravenfield content - maybe that'll resolve the issue

#

Sort of, though the model has been altered as well

thorn cipher
#

Ah right

#

Ok, if it was just a retexture you could just point your lua at the vanilla mode lol

#

Model*

dusk saddle
#

Darn, well unfortunately that didn't work. Though I guess those export settings I use are for Unity 2020 anyways lol so it was a long shot that they'd work here

chrome egret
chrome egret
midnight mica
#

does it even matter if you put a lua file in the correct folder? i made something that i thought was being handled server side, so put it in the server folder, but it seems it works only trough the player client

thorn cipher
# dusk saddle

@winter bolt what do you think has happened here? 😅

#

It must be a rigging bug right?

midnight mica
# late hound yes it does matter

hm, i'm very confused now. made a mod that sends out a servermsg at certain intervals to warn that the server is going down, but it seems to no longer work when i add if isClient() then return end at the top

frosty falcon
#

isClient()
This returns true if you are the client in a multiplayer game, but false in a local game or if you are the server

isServer()
This returns true if you are the server in a multiplayer game, but false if you are client or local game

getWorld():getGameMode() == "Multiplayer"
This returns true if you are in MP

midnight mica
#

any chance SendCommandToServer() does not work from the server side?

frosty falcon
#

why don't you just use rcon

#

making it a mod means everybody downloads it which leads to your issue here right

#

personally I have a cron job to restart server every 2 hours at X, and another cron job that runs RCON commands to send the server messages before X time

#

but to answer your question, I am not sure

midnight mica
#

because i haven't found clear instructions on how to set it up, so this seemed easier for me as its a server mod

frosty falcon
midnight mica
#

this works on dedicated server and doesn't require your own pc to be on?

frosty falcon
#

exactly

#

set up the 2 cron jobs on the server itself if you can

#

if you are using a host then you would have a web panel that you can schedule server restarts in

#

and then just use rcon on your own pc or another one to send the commands

#

(if you don't have a VPS, its controlled by someone else)

midnight mica
#

i'll read that post, thanks

dreamy granite
dusk saddle
#

heh

violet shell
remote elk
#

Hi, I'm wondering how zomboid calculates interior temperatures for rooms/houses and such?

strange sequoia
dusk saddle
#

No idea

remote elk
#

Does anyone have a guide for adding things to the right click build menu?

#

(And world-object modding in general)

#

I've tried to reverse-engineer it from PZ's files but its a bit vague

late hound
# dusk saddle No idea

feel free to zip up your project and send it over, I can take a look at what is going on

winter bolt
dusk saddle
#

I've exported it as an FBX, though the mod itself is part of a much bigger project so I'm not sure how well to go about it

#

I've also tried exporting it as a Direct X thingy, but that just makes it vanish entirely

frosty falcon
violet shell
#

Thanks. I can choose partially the daily reboot hour, but I cannot choose the frequency of it sadly.

frosty falcon
#

:/ If you are fairly competent with computers and can follow step by step guides you could look into a simple Ubuntu VPS with a steamcmd zomboid server install guide, but Linux can be confusing to at first to learn for just a game server I guess
(VPS for <32 ppl, dedicated or something bare metal for above perhaps)
Sorry I don’t really know any good hosts..

meager atlas
#

Trying to join a modded game

#

keep getting this error

shadow geyser
low dew
#

Is there any effective way to make the shelves on the left to block vision like the one on the right? I'm quite technologically inept and cannot figure out for myself unfortunately

drowsy tusk
#

Anybody have a clue as to how I can move the Scrap Bench from the Scrap Mechanic mods?

valid spindle
wet sandal
#

Anyone know how to check in lua how many local players are currently playing?

#

Currently looking at using getSpecificPlayer() 0-3 in a loop

#

IsoPlayer.getPlayers()

#

Aw, its not working as expected. It still has multiple players in it after a reload despite only a single player being active.

#

Oh, its always length 4

small topaz
#

in a vanilla lua, there is a function call where is function is called drawText, applied to self (i.e. self:drawText). now, the lua i am working in doesn't define that function and i also didn't find anything about drawText in the the javadoc (i.e. here: https://zomboid-javadoc.com/41.65/). anyone an idea where this "drawText" function is coming from? the lua where it is called is ISCharacterScreen.lua in client/XpSystem/ISUI.

ruby reef
#

how do i add custom animations to the game?

brave violet
#

is Shark's (and Peach's) Military Uniform Improvements broken rn?

brave violet
#

oh I'm not asking for support I'm just curious if its the same for everyone, thank you though!

ruby reef
#

np

brave violet
#

ah alright it might be the load order, the shemaugh keeps disappearing

ruby reef
#

does anyone know how can i port a mod from build 40 to build 41

drifting stump
small topaz
drifting stump
#

its just a call to drawText on the UIElement java object anyway

ruby reef
#

what do you mean any recommendations?

#

what do you want to work on?

#

oh guys for fuck sake this is for developing mods

#

like that helped

cloud crow
#

Is there a mod that prevents the Alt+F4 thing or similar for servers? So that players can't just cheat their way out from death?

jaunty marten
#

I think you're looking for this

small topaz
jaunty marten
#

media/lua/client/ISUI/ISUIElement.lua

#

👌

jaunty marten
#

someone know way to get rotation of world item placed by player?
I tried: getWorldZRotation, worldZRotation, rotation, angles, getAngles, getAngleX, getAngleY, getAngleZ, getDirectionAngle, direction
no variables or functions
In base code I found nothing but setWorldZRotation bored

tidal kayak
#

I'm not a modder but I wanted to ask something:

Is there any way to simulate a push-start car in project zomboid? From what I know every car in the game has to have a key, but some of the vehicles you can mod into the game like humvees/military trucks are mostly push start and don't need a key. Any way to make it so in game? Only one I can think of is to have them spawn in hotwired, but I'm not sure if that's possible

#

Wait not push start as in you push the car but like you press a switch or smth

drifting ore
#

Whoever made the trolly mod needs to be sent a fruit bouquet

jaunty marten
#

tried too and always gets N
same value in methods toAngle, ToVector

cloud crow
#

Is there a mod that allows createhorde command in console to specify a location instead of slamming a horde in a player's face?

sage rock
#

the game updated and now the AIZ map pack is obsolete, I want to play again with a new map pack, any recomendations that are not buggy and lore friendly?

craggy furnace
torpid kestrel
#

Allright guys, I dont know if this is the right place to ask this, but anyone has an idea of what mod breaks placing campfire? Thanks in advance

dusk saddle
olive estuary
#

So I just noticed with True Music it has a bug with the boombox on the ground anyone got a fix for this?

#

I'm also creating a music pack for True Music. Wondering how I put my tapes into the loot tables

remote elk
#

Does anyone know how PZ calculates indoors temperatures? I'm trying to make a propane space heater with similar functionality to the antique oven when power goes out.

mint sphinx
#

-.- you have to love this game so much lol
i made weapon called "rubber axe" and i made a Categories called fakeAxe and becuase it contains Axe it work as a normal axe in the game on trees damn lovely contain they do xD lol

hybrid idol
#

How do I set how many bullets a box of bullets contains?

#

I've tried looking on google and youtube but all I found was stuff on how to install ammo mods, not make them.

grim rose
#
inventoryfemale = {
            rolls = 1,
            items = {
"items", 1,
            }
        },```
#

hello i have question

#

is this container treated as zombie corpse

#

or i am modyfing item pool of "already dead poeple"

#

?

fast galleon
grim rose
#

so for these you meet in events and such?

fast galleon
#

This is for when you kill a zombie.

Not sure, but events usually have specific items they add to corpses.

grim rose
#

Sorry to bother

#

how can i check if distribution works?

#

and second

#

do i need new world for that?

jaunty marten
jaunty marten
grim rose
#

okay thanks

sour island
#

I figured out a way to consistently change items on load - tie a function into the lua function that calls on inventory drawing

grim rose
#

can anyone help me on doing distributions?

midnight mica
#

does anyone know when a cell actually loads on the server and when it unloads? i'm working on a mod that lets you add zombies to a certain location, but so far it only seems to work when im in that cell, so i'm curious when neighbour cells are being loaded and if its possible to load a cell through the server lua while noone is actually present there yet?

slender totem
#

Random heads up. If you install Steam on Ubuntu using flatpak (because Steam from the official repository is a mess), the mods folder is in ~/.var/app/com.valvesoftware.Steam/Zomboid/mods/, not in ~/Zomboid/mods like the in-game message hint says in the mods screen.

sour island
#

Just don't put any print message in loading squares cause it will crash your game unless you put a delay/spam control to it

midnight mica
cosmic pawn
#

Any mod that adjusts when dirt appears on the character? Kinda finding it silly that your char gets massive blotches of dirt when you have a total of "2" dirt.

lucid spindle
#

Anyone have any ideas how to tell if a given tile is in/near an "urban" area? Or know of a mod that does this?

sour island
midnight mica
azure rivet
#

Hello, I want the character to attack with a knife with the left hand, how can I invert the animation or something?

slow graniteBOT
#
Shawn#1175 has been warned

Reason: Bad word usage

small topaz
#

I am using the lua event "OnNewGame" to add stuff to the player's inventory. Is it save to put the respective .lua file to the shared folder? or does it belongs to client?

small topaz
wooden falcon
#

I'm interested in making a mod that adds a (moveable) button to the UI. Clicking this button will bring up a context menu with specific options (based on what items you have). (For example, "Smoke a cigarette", "Take a painkiller", etc.)

I have no idea where to begin though. Does anybody know of any mods that add a button to the UI, or add a button / hotkey for actions like those?

hot patrol
sour island
# hot patrol Would you be able to give me an exple on how this would be done? I plan to add m...

I edited it without testing but this should work:

local ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
function ISInventoryPane:refreshContainer()
    ISInventoryPane_refreshContainer(self)
    
    local it = self.inventory:getItems()
    for i = 0, it:size()-1 do
        ---@type InventoryItem
        local item = it:get(i)
        if item:getFullType()=="Base.Book" then
            print("--debug-- item found")
        end
    end
end
#

I would be very careful with the if statement tho

#

make sure the item is only set once

#
local ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
function ISInventoryPane:refreshContainer()
    ISInventoryPane_refreshContainer(self)

    local it = self.inventory:getItems()
    for i = 0, it:size()-1 do
        ---@type InventoryItem
        local item = it:get(i)
        if item:getFullType()=="Base.Book" then
            print("--debug-- item found")
            namedLit.applyTitle(item)
        end
    end
end
#
namedLit.setBooks = {}
---@param book HandWeapon | InventoryItem | IsoObject
function namedLit.applyTitle(book)
    if not book then return end
    --do stuff
    namedLit.setBooks[book] = true
end
#

note: namedLit.setBooks usage

#

The item would have to be reset once a game session due to how items are loaded - but you can store your values in a modata

#

Like this:

namedLit.setBooks = {}
---@param book HandWeapon | InventoryItem | IsoObject
function namedLit.applyTitle(book)
    if not book then return end

    local title, author, year
    local bookNameLitInfo = book:getModData()["namedLit"]
    if not bookNameLitInfo then
        book:getModData()["namedLit"] = {}
        bookNameLitInfo = book:getModData()["namedLit"]

        title, author, year = namedLit.getTitleAuthor()
        if title then bookNameLitInfo["title"] = title end
        if author then bookNameLitInfo["author"] =  author end
        if year then bookNameLitInfo["year"] =  year end
    end

    if bookNameLitInfo then
        title = bookNameLitInfo["title"]
        book:setName(title)
        local colorForTitle = namedLit.TITLES_color[title]
        if colorForTitle then
            book:setColor(Color.new(colorForTitle[1],colorForTitle[2],colorForTitle[3],1))
        end
    end
    namedLit.setBooks[book] = true
end
#

Storing the values would avoid them being shuffled everytime

#

somethings don't need to be redone tho - afaik item names remain

#

condition might as well

hot patrol
#

Now my item won't be the vanilla book. My manga will be an entirely new item with separate model and everything. If I am understanding right I would just have to change if item:getFullyType()=="Base.Book" to Base.Manga

#

Dammit the code block didn't work on mobile

jaunty marten
#

works
just not ' but `

hot patrol
#

Yea, thanks

#

Lol

jaunty marten
#

👍

plucky junco
#

Hi, I'm trying to make a mod for use the boxing gloves as weapon, I would like to use the vanilla one (Gloves_BoxingRed), is it possible to create a new item that when is equiped it show you wearing the boxing gloves? thx

sour island
#

I actually use a table of types as keys with values as true for quick checks - but if you're only dealing with 1 type it's ok to use what I pasted

sour island
#

Anyone familiar with setting colors onto items? I am setting it but the icon doesn't seem to change

plucky junco
#

which icon you want to change the color? the item icon? you mean the texture?

sour island
#

trying to use setColor() to tint an item on the fly

#

doesn't seem to work

plucky junco
#

which color you want?

sour island
#

It's random

plucky junco
#

as I tought i'm too noob

#

maybe here you can get info

#

sorry

sour island
#

no worries

plucky junco
#

@sour island sorry if I ask to you, but is it possible to make the player wear a clothing item when you are equipping a weapon? as I said before i'm trying to make an invisible weapon that when is equipped also make you wear the vanilla boxing gloves. the only way to do it is to make a new 3d model for the weapon? and there is any way to make the 3d model fit on both hand even if i'm using only one hand to fight?

sour island
#

Couldn't you just assign the weapon the clothing's model?

clear geode
#

guys im not sure if i did this file correctly.. its for my gun mod

#

do i need to add the "imports" line ?? xD

plucky junco
#

or point me where i can get the info, thx

sour island
#

try using a weapon script and giving it the boxing glove's models

#

taken from the boxing gloves scripts

plucky junco
#

M_BoxingGloves.X

#

found

#

WorldStaticModel = M_BoxingGloves.X like this?

sour island
#

no clue

plucky junco
#

ok

#

thank you! ☺️

vapid wind
#

anyone know what mod adds the ability to claim vehicles like a safehouse??

vapid wind
#

you are the best

#

thank u ❤️

tender meteor
#

hello everyone. Im having issues with britas. i need help configuring the loot for a dedicated server. and the ingame admin settings cutoff halfway.

anyone know how to find or configure the files that could help me? possibly in voice if able to make teaching/communication better

im also using G-portal.com to host my server if that helps

vapid wind
raw vault
#

there’s intuitions on the gun fighter page

tender meteor
tidal kayak
#

so i had an idea for a mod that makes listening to music (specifically CDs) decrease not just boredom but also your stress and unhappiness. any idea where i could start?

wooden falcon
# plucky junco Hi, I'm trying to make a mod for use the boxing gloves as weapon, I would like t...

https://steamcommunity.com/sharedfiles/filedetails/?id=2823438384 I wanted the same thing as you so I tried to make it. I couldn't get the existing Boxing Glove clothing item to work as a weapon, but I was able to modify the mesh of it (made it just the right-hand glove) and use that as a weapon skin. It works decently well except that the way weapons "sit" in your hand doesnt' work particularly well with something that should go on your hand (like a glove). So I had to make the glove comically big (otherwise the glove either looked wrong while in idle position or while in aiming position; also if it wasn't big, the hand would phase through the glove).

I'm quite new to modding and this was my first mod ever for pz. I'm sure someone could have done a much better job. But feel free to take the existing code and modify it however you want.

plucky junco
wooden falcon
#

Yeah, I don't know enough about textures / meshes / animations to have done a good job of it. The comically large glove was the best I could do. But I did add some custom sounds to the swing + hit animations for it that, imo, sound really good. And the baseball bat swing animation actually works decently well for a "punch".

plucky junco
wooden falcon
#

If I want to "extend" an existing mod, what do I need to do to ensure that my extension mod loads after the existing mod? I think I read in the past that it is based on alphabetical order. If that's the case, which name specifically controls this?

plucky junco
#

i saw private lime did it but was a glitch

wooden falcon
rose trail
#

Which mod would you recommend for stability, vainilla weapons expansion or britas weapon pack?

wooden falcon
#

Are you trying to upload the mod for the first time or are you trying to update one you've already uploaded?

wooden falcon
#
player:getInventory():getFirstTypeRecurse("item_name")

will give me the first item of that name in my inventory. How can I get a full list of all the items of that name in my inventory instead of just the first one?

Edit: getAllTypeRecurse() seems to be what I needed.

raw vault
wooden falcon
# plucky junco https://www.youtube.com/watch?v=loCgEDso5B8

Thinking about it again, you could probably implement some logic in your code where whenever you equip your "invisible glove" weapon, it spawns and equips the boxing gloves to your character. And then whenever you unequip the item, it deletes the boxing gloves from your character. This wouldn't allow you to wear other gloves in the game, but it would explicitly tie the weapon to the skin.

wooden falcon
#

If I have a clothing item as item that I have already confirmed is in my inventory, what function do I use to equip it? I found ISInventoryPaneContextMenu.equipWeapon(...), but my item isn't a weapon.

glacial flicker
#

Do you need to know Java to make mods? or is Lua enough?

#

probably a dumb question from me

wooden falcon
glacial flicker
#

Oh amazing, thank you!

open niche
#

is there a mod that lets you wear clothing over the prisoner jumpsuit?

hybrid idol
#

Just a quick question because I don't know how to word it for a proper search. I want to make a gun that can be crafted between two ammo types. I'll assume I have to make a second file for the gun for the second caliber, but will condition be shared between the two? Or is that another thing I have to figure out how to set up?

vapid wind
#

i need to help my guy out, he has like 20 errors when loading into his server and im trying to figure out how to read errors to help fix it....how do you get to the errors?

small topaz
#

[SOLVED] anyone an idea where this problem comes from: i made a new body location which i put before all the vanilla body locations. however, rendering order is not correct. here is an example with a green skin i made:

#

the green skin intentional. T-shirt for example is not shown and instead is hidden under the green skin. the skirt is also not displayed correctly. as i said, i put the new body location (called "Skin") before all the vanilla locations.

#

seems to be the case that all clothing items which don't have a 3d model and are just textures are hidden under the skin but why?

#

[EDIT:] already solved (forgot to clear the vanilla body locations before i added a new one). anyway thanks! 😉 XDXD

midnight mica
#

anyone know if the Event OnTick runs 40x per second for all clients, or does that depend on the client's processor?

hasty ravine
#

When adding a new map area, do I have to include them in the server mods? For example, the one in the photo below

lucid spindle
#

Anyone know how to send messages like the "Server shutting down in..." message using LUA?

#

i.e., the big message in the middle of the screen

small topaz
lucid spindle
#

Ok maybe an easier question then... How do we get fields from objects in PZ lua?
For example, an IsoPlayer object has a float field called "runningTime". How do we get this value?

#

Also, how do we access packages (e.g., zombie.chat) in LUA?

plucky junco
#

if i'm not wrong you already can with admin powers, just press "add safehouse" in the admin panel

plucky junco
lucid spindle
wooden falcon
# small topaz

Appreciate it. This ended up working for me

ISInventoryPaneContextMenu.wearItem(item, player:getPlayerNum())
true vault
#

Quick Question...
How do you go about listing a mod as a dependency of another?

The scenario; I wish to package a base mod, and two optional "extensions" together. The base mod is done, the two extensions each add a recipe(s); both require the base mod active for their result/base to exist.

Additionally, would listing the base mod as a dependency ensure that they load after the base mod?

wooden falcon
true vault
#

Awesome, I'll check that out. Thank you :3

true vault
clear geode
#

hello. How do i make a custom gun repairable like vanilla ones??

wooden falcon
manic harbor
#

Is it possible to play global sounds on certain conditions (Player holding a radio) ?

kind fossil
#

Hello everyone! I am looking for a model viewer for Project Zomboid to take pictures/record animations of 3D characters

#

I don't know if it is possible

drifting ore
#

Can I add clothes to random zombies?

timid saffron
#

Hey I have a gtx gaming server that I modded and now I get no sound from firearms. I deleted all the mods and there is still no sound

#

Does anyone have experience with gtx servers who might be able to help?

#

I figure I have to repair the game files but there doesn’t seem to be an obvious way to accomplish this

sour island
#

Anyone familiar with custom sandbox options know if there's a possibility to categorize options so that some are required for others / faded out when false, etc?

plucky junco
#

yes

#

sorry

#

you have to put the name of the player on the top part

#

must be the correct nickname

#

here you have to put the player nickname

#

on the owner section

#

you are welcome

dawn shuttle
#

I'm trying to find a function that returns all the player indexes on a server. I've tried IsoPlayer.getPlayers() but that only returns local players.

#

Or if there's a way to acquire the server object as a client. As I know there's a getPlayers function for it as well

drifting ore
#

Hello, how do I change death sound effect?

#

I wish to change it like this.

dawn shuttle
# drifting ore I wish to change it like this.

You should try to find the .wave or .ogg file in the game's directory under /media/sound and in your mod folder, have a .wav or .ogg file of the sound you want with the same name and same folder structure.

#

Essentially overwriting the vanilla death sound

drifting ore
#

Uhm, can I have the full explanation?

dawn shuttle
#

This is the whole task

#

What are you missing?

drifting ore
#

The find the wave or ogg thing.

#

I would appreciate directions.

dawn shuttle
#

Ok so you need to know how to mod first is what you're telling me

drifting ore
#

Any chance it has to be done in workshop?

dawn shuttle
#

the mod doesn't need to be done for the workshop, but PZ has steam workshop integrated with their game so it's strongly advised

plucky junco
#

also i'm not sure you can change the death sound with a mod

plucky junco
#

this is where is the sound file

drifting ore
#

isn't that the sound when you have died?

#

what I meant was the sound whenever you kill a zombie.

#

the blood splatter one

jaunty marten
#

try setZombieHitSound

#

but it'shave to be applied to each item separately as I got

drifting ore
#

it's not in sound.

jaunty marten
#

ah death sound

#

or wdym

drifting ore
#

the sound whenever you kill a zombie..

#

uhm, how do I put it, the sound you heard after you stomp one of them to death.

#

you hear the splatter

jaunty marten
unborn citrus
#

This is just an idea, but custom fight music you can import

#

Like the new chase music for The Legion in Dead by Daylight could fit well imo

frosty falcon
#

fuming frank tape combo 👌

#

and tbh just any dbd killer track since they all evolve, especially the gunslinger dudes track :D

unborn citrus
#

Sounds like a dream

wanton axle
#

Does anyone know where the vanilla professions icons are stored?

hybrid idol
#

So I finally finished a mod, and I think I did all the structures right, but I can't get it to show up in game under the mods to even test it. Does anyone have any idea why that would be? I looked up every conceivable way to do it but I'm stumped.

azure rivet
#

Hello, can you tell me how the "Attachment Type" affects a weapon?

azure rivet
hybrid idol
#

Thanks. I managed to figure it out after a moment. Hopefully that's the last assistance I need for a while. Or at least a minute. XD

dusk saddle
#

Aloha and salutations, I've still had a strange issue regarding my jacket and its rigging being all sorts of wack-a-doodle! I exported it as an FBX instead of an X, X just makes it transparent. Looking at the rigging, it all seems all right? It's just a modified version of the default jacket which then I transferred weights back to just to make sure. Attached is a blend file for anybody who might want to mess around with it, saved in Blender 2.79.

#

Jacket itself is a recreation of the 1895 waffenrock pertaining to IR. 22, I'm wanting to expand into 19th century uniforms and stuff, as well as weapons. Civil War, Indian Wars, etc. though want to mess around with this first. Possibly up to WWII, no idea though

hybrid idol
#

Okay, so I got it to show up in the mods screen in game, but I can't spawn any of it to check how it looks. Can someone with experience dm me and take a look at it sometime to see if I did most things right, or if I bungled the entire thing. Either I did one thing wrong, or everything is wrong. I'm sure there's no in between. XD Also sorry if a request like this isn't allowed.

serene sluice
#

I'm trying to edit one of the texture from the base game, changing the image worked but I really don't want to reopen the game each time to check the effect. Can anyone give a hint about how to load the 3d model and paint on them?

dusk saddle
thorny garnet
#

Dumb question, where in the debug menu can I find coordinates like this?

#

Particularly for modded maps

#

I get posX,posY,posZ but where does worldX/worldY come from?

serene sluice
dusk saddle
#

Do you know what the texture is called or what it's for?

#

I can look around and see if maybe I can find it, and if it's a .x I'll convert it to FBX for you

serene sluice
#

for example Shirt_Denim

dusk saddle
#

Hmm, that might be an actual texture overlay on the base character, but I'm not sure. Let me looksie

serene sluice
#

It actually seem so, because last time I forgot to turn off background and made it all white, which immediately covered the entire character

dusk saddle
#

Unfortunately I've been having issues with my own jacket not being weighed properly and can't figure out what's wrong

serene sluice
#

thanks

#

I was searching on google and every link on the wiki is broken

dusk saddle
#

Heh, yeah no worries

lucid spindle
#

Anyone know how do we get fields from objects in PZ lua?
For example, an IsoPlayer object has a float field called "runningTime". How do we get this value?

serene sluice
dusk saddle
serene sluice
#

looks a lot worse in blender, maybe I should improve my drawing

wooden falcon
strange sequoia
#

Yaay my mod is almost done after a month of work :DD

Is "Makeshift" a good word for clothes that you can craft out of things that you can find laying around like curtains, sheets, trashbags etc... ? I couldn't find a better word for it and English is not my first language

#

I found "Make-Do" but "MakeShift" sounded better 🤔

placid tiger
#

Poggers

lucid spindle
dusk saddle
strange sequoia
#

Thanks for the answer ❤️

upper junco
#

Can anyone give me some advice, Im trying to get the the HandTorch to be able to attach to a backpack using Noirs Attachments and also still be able to attach one to a belt using the better belts mod. So I created a new item called HandTorchBelt with the following recipe.

recipe Open Belt Clip
{
destroy HandTorch,

 Result:HandTorchBelt,
 Time:30,
 OnTest:Recipe.OnTest.TorchBatteryRemoval,
 OnCreate:Recipe.OnCreate.CST_OpenClip,
 StopOnWalk:false,

}

Then I found some code from another mod and edited it some to try to keep the same battery life from item to item when crafted.

function Recipe.OnCreate.CST_OpenClip(items, result, player)
for i=1,items:size() do
local item = items:get(i-1)
if item:getType() == "HandTorch" then
if item:getUsedDelta() > 0 then
local HandTorchBelt = player:getInventory():AddItem("Base.HandTorchBelt")
if HandTorchBelt then
HandTorchBelt:setUsedDelta(item:getUsedDelta())
end
end
break
end
end
end

It is actually working but the problem I am having is that its creating 2 of the new flashlights one at the same Battery life as the original HandTorch and one at full battery life. Much appreciated if someone could help me out been trying for awhile now to get rid of the extra item.

true vault
#

I'm baaaaaaaack lolz
Another quick question, hopefully...

Is there a way to specify in a single recipe, that it can use one of an array of items, and only require one?
As an example, say that I want to replicate the ability to disassemble radios. Must I specify a recipe for every type of radio, or can I specify an array of all of them, and a single recipe with that array?

#

Alternatively...
If I must make a recipe for each, is there a way to write a Lua script instead, that generates each based on an array of the item names? Mainly to help me future-proof the mod aha
(I know I can use Lua to insert into loot tables programmatically, but I don't have any idea how to do the same for recipes)

true vault
strange sequoia
#

If not then during the week

wooden falcon
#
  1. Does anyone know anything about the code that causes an item / container in the world to be highlighted?
  2. Does anyone know anything about how you get the information of which item you are currently mousing over in the inventory ui?
  3. If I want to change an existing mod slightly (without explicitly changing the mod's code), can I just have my mod define an identical function with the same signature and then have my differences within that function?

Edit: For 1, maybe IsoObject:setHighlighted(bool,bool); (haven't tested it tho). Not sure what the second bool is for, but it seems to be optional. Still not sure about question 2 or 3.

jaunty marten
#

and anyone who will download ur addon have to do same thing

#

for 1 u found function and didn't test but still sending this message I think almost 3 time.. just test it and check what will happen?

#

lul

#

for 3 I think should be somewhere in ISInventoryPage or ISInventoryPane

wooden falcon
#

i want to write a mod that provides a hotkey for transferring whatever item you're currently mousing over from the container it's currently in to the one one that's open in the other pane. (for example, pressing T moves the whole stack and ctrl+T moves one of the items in the stack). need to get the info of what item is currently being moused over though. haven't been able to find something like that digging through the lua yet. will check the files you listed.

wooden falcon
#

this looks really promising thank you very much

jaunty marten
#

👍

wooden falcon
#

is it possible to overwrite this function, but still call the original function after my code runs? i would think no because by overwriting the function, trying to call the original function would just call my new function?

jaunty marten
#
MyNewActions = MyNewActions or {}

MyNewActions.OldFunc = MyNewActions.OldFunc or Func
function Func(...)
  MyNewActions.OldFunc(...)
  ...
end
#

there's more than single way cos func can be method or procedure

#
--#1
test = {}
--Original func
function test:Func()

end
--Override
MyNewActions = MyNewActions or {}
MyNewActions.OldFunc = MyNewActions.OldFunc or test.Func
function test:Func(...)
MyNewActions.OldFunc(self, ...)
--...
end

--#2
test = {}
--Original func
function test.Func()

end
--Override
MyNewActions = MyNewActions or {}
MyNewActions.OldFunc = MyNewActions.OldFunc or test.Func
function test.Func(...)
MyNewActions.OldFunc(...)
--...
end
plucky junco
#

I'm having a problem with my mod. I created a book that give 100 xp on the skill that you choose from the opening menu when it's read. the book works, but when I right click on it it gives me this error. is it enough to understand whats the problem?

wooden falcon
jaunty marten
#

seems in ur recipe

#

if u even used it

plucky junco
#

ok, i'll check again the items names

#

thx

jaunty marten
#

yup

jaunty marten
plucky junco
#

item 100XPTraining {
Weight = 0.30,
Type = Normal,
DisplayCategory = Literature,
DisplayName = Training Book,
Icon = 100XP,
WorldStaticModel = 100XP,
Tooltip = Tooltip_item_100XPTraining

jaunty marten
#

but mb just I could be wrong xp

plucky junco
#

ok

#

thx

formal oar
#

britas weapon and armour not workin for me in server please help, im playing in ingame server host

sinful relic
#

is it possible to make a moodles icon change depending on its stage?

atomic stream
#

Is there anyone who I can ask a few questions in private about clothing modding?

plucky junco
#

thx for the hellp

#

here is the result

#

it's quite basic 😁 but I needed it for my server

#

but still need some testing

midnight mica
#

does anyone know in which files i can find this UI? been looking everywhere but can't seem to pinpoint it

plucky junco
#

ProjectZomboid\media\ui\ClockAssets here?

midnight mica
#

im looking for the lua file, so i can change its position

cosmic condor
#

I wonder why there is no clock mod?

sour island
#

This is a shot in the dark but is it possible to add textures onto item's icons? Like decals on the item icon

#

Just occurred to me equipping adds one... I'll look there

upper junco
#

Is it possible to create a recipe with no result? Or to just destroy an item without creating another?

sour island
#

"RemoveResultItem"

#

"RemoveResultItem:true,"

plucky junco
#

check also, there is a mod that make the rubbish bin working, so you can delete the content

upper junco
#

recipe Open Belt Clip
{
destroy HandTorch,

 Result:HandTorchBelt,
 Time:30,
 OnTest:Recipe.OnTest.TorchBatteryRemoval,
 OnCreate:Recipe.OnCreate.CST_OpenClip,
 StopOnWalk:false,

RemoveResultItem:true
}

So like this?

#

Or does it need to be directly under the result: line

#

And thank you Chuck and kratos for your replies

sour island
#

I don't think the order matters

jaunty marten
jaunty marten
jaunty marten
#

need to try

eager pollen
#

what is that and how do I fix it

viral notch
#

small question:
How to block mod to be used while is other mod activate ?
i know there is option require but that is if mod need other mod to be activated but how about to pretend mod to not be activated when is other mod active ?

strange sequoia
eager pollen
#

alright, good to know

viral notch
frosty falcon
viral notch
frosty falcon
#

I see, not sure but authentic z has that kind of thing going on with its extra backpack module that should be off when enabling the main one

#

see if they did it?

#

I am just guessing tho someone else might know the answer

viral notch
hybrid idol
#

So I got my mod to show up under the mod menu, but when I load in with debug mode to check it I get an error thing saying something along the lines of (my mods name) '=' is expected near base

#

I've referenced it against other similar mods and everything seems to be in order. So I'm super confused.

viral notch
#

there are none

#

of any other tags than name,descryption,id and poster

#

for others mods by that autor also doesn't have others tags...

#

so idk

eager pollen
#

how do you go about adding 'hood up/hood down' kinda functions to a piece of clothing where it can have two state you can toggle between?

dusk saddle
#

Would OnCreate not work regarding rotten food? For instance, I'm making some knockoff Lunchables for my mod and an issue I've encountered with my other food items is that, even if the package reads rotten, you open them up and the food's still fresh

jaunty marten
jaunty marten
#

:setRotten is just placeholder

#

I don't remember real function name

dusk saddle
#

Hmm, I could browse the PZ files to find a function like that maybe. Any idea where something like that would be kept?

jaunty marten
#

no idea

dusk saddle
#

Ah darn

viral notch
#

i can try to create custom function but idk if engine will accept it....

jaunty marten
viral notch
#

function withone will detect if is assigned mod ID= id1,id2,id3... and will force stop script with print on console (and logs) WARING YOU USE MORE THAN ONE VERSION OF SAME MOD!

#

and or it will spam error in console

#

or will crash game

#

not sure yet

midnight mica
#

i did a little test with the OnTick event and im counting about 39-40 ticks per seconds, does anyone know if thats thesame for everyone or does it depend on the players processor?

jaunty marten
#

mod manager even updates now? author is alive? xp

#

I think better to ask to add ur feature

viral notch
jaunty marten
#

if u do it by urself and send to author will have more chances

viral notch
#

it works

#

o.o

#

but not really as should

jaunty marten
viral notch
#

it block mod and pretend from load ... mess in console but game load without that and those in typed ID's ... problem is ... after back to menu mod also disappear from Mod list... and need to restart game to be able use it again ...

jaunty marten
viral notch
#

image to have intel i9 duo core 8GHz

jaunty marten
#

xp

violet shell
# thorny garnet I get posX,posY,posZ but where does worldX/worldY come from?

I think worldX/worldY is the cell coordinates ? In one of my functions I used this to locate the player coordinates :
local x, y, z = player:getX(), player:getY(), player:getZ()
And then use my 3 variables x, y or z to compare it to different values to check where is the player
I use this in an "onTest" function in a recipe to allow craft only at defined coordinates.

#

I am looking for help to understand how NearItem works (and if it works, actually). Here my questions :
NearItem:myargument
But what it expect ? A string ? A Base.Item ? If i want to check the presence of an IsoObject like a oven what should I use ?
In my b40 mod I used to check for textures with a dedicated function that was called by a "onTest" function.

thorny garnet
violet shell
#

I'm not sure you need WorldX/WorldY because I think that player:getX(), player:getY(), player:getZ() gives you unique coordinates on the whole map, not coordinates by map cell. If I remember well my testing sessions when I wrote that part of my code

hybrid idol
#

Can someone assist me with looking over my mod files to see what I'm doing wrong? The mod appears under the mod tab, but the only thing I can get to spawn is one part of it, and it doesn't use the icon I set for it. I can swear all the parts are there, it's just getting them to fall into place that's driving me insane.

silver yarrow
#

Hey folks, I was looking for a way to expand on the Clothing Degradation (sandbox option, making it more customizable like some mods that allow for numerical changes in rates, multipliers, etc). Or at least simply tweak its numbers, especially for dirtyness and when (in x/100) their decals start showing in clothes in a global sense not per script (and on body if possible too). I'm no coder, but have done some small changes to mods myself and would like directions to see how far above my head this is.. So I was trying to find where those values are, not even sure if in a .lua, .class (how we open those?) or if i need to decode java libs or if it is baked in some other game file. Would someone have an idea which type of file would have those metrics (rate of degradation and, more specifically, when in the x/100 scale the decals start showing on clothes/body)? Or if there is a mod out there to that effect? (I couldn't find any, aside from hand washing tweaks which is nice but not quite what I'd like to change or make more customizable).

TL;DR: where's the code for WHEN (%) dirty decals start appearing on clothes and body?
Cheers!

#

(because having a huge brown smear appearing on the character/clothes after a 10-step jog in a clean base due to a 2/100 dirtyness just rubs me the wrong way... I agree with the concept, but not with the scales/rates)

midnight mica
#

anyone have experience with worldsoundmanager? i'm trying to pull in zombies from large distances, over 100. but many are not even responding, even when i put the radius to 200+, when my character teleports near them, then they seem to hear the noise, so i'm guessing they are not fully loaded cause noone is near them? is it possible to load a chunk without any player being in it, i think that might fix the issue

fair frost
wooden falcon
#

About to do some digging myself, but does anyone know (or even just have a general idea) of some functions that get called whenever you equip a weapon? I want to add a weapon that executes a custom function anytime the player equips it. (Maybe ISEquipWeaponAction. Maybe Events.OnEquipPrimary)
Edit: The Events one did the trick.

drifting ore
#

Hey, what would be the lua code to equip a player primary item to a gas can where gas can is

    local gascans = inventory:getAllEvalRecurse(function(item, player)
        return item:getType() == 'PetrolCan'
    end, ArrayList.new())

?

wooden falcon
wooden lodge
#

Hello there, could someone please tell me what the correct class name to call for First Aid skill is?
This one doesn't work and I can't find anything anywhere;
SkillRequired:FirstAid=10,

Please @ me or DM me, it's 6.30 AM and I'm heading to bed.

shadow geyser
hallow girder
#

yo, anyone know how to make use of the NATO ammo from the brita's modpack??

#

like, can i just use 7.62x39 nato in an ak47??

hallow girder
#

o shit i guess that's 7.62x51 nato

hallow girder
#

also i can't figure out ammo crafting in the brita's pack :U i have the t-mag reloading press, some 12g hulls, some 00buckshot, some shotgun primers, some gunpowder, and i can't figure it out

#

i'm losing my mind lol

wooden falcon
#

Does anyone know if it's possible to have custom animations on weapon swings? All the custom animations I can find in other mods are for actions that aren't a weapon swing. The only weapon swing animation choices I can find that are used in the vanilla code (SwingAnim) are Bat, Spear, Heavy, and Stab. I can find animation files and references in those files that use keywords like Bob_AttackBat01_CritHit and Bob_AttackBat01_Hit etc. but I can't find anywhere in the lua where those animation files actually get tied to the Bat keyword that is used when declaring a weapon's SwingAnim. So I don't know what I'd need to do in order to introduce an additional option for SwingAnim.

hallow girder
#

i dont see why you wouldn't be able to @wooden falcon , like.. there's already animation mods n' stuff, but idk... also... nice Vincent Adultman pfp.

wooden falcon
#

agreed on thinking it'd be possible. my lack of success isn't indicative of it being impossible, but the fact that no other mods that I can find do it makes me skeptical. if it was possible, you'd think people would have done quite a bit with that by now =/

hallow girder
#

Yeah idk. i dont know anything about modding, i wasn't even sure if this was the right spot to ask my own questions 😆

#

i still laugh that my first experience with adding a mod to the game was "i wonder if there's a mod to add pot to the game" XD i always have jigga's mod installed now

dense vale
#

Howdy howdy there all;

I’m looking to commission a mod for project zomboid; it’s going to be used in a server/modpack though as a first warning.

I was looking at seeing if someone could possible make a mod that allows you to hook up a metal barrel to a generator to increase its fuel tank size; or a upgrade system for a generator to improve its fuel capacity/efficiency

Just send me a DM or ping me and we can talk prices

trim barn
#

there are any top/ranking mod for server? where can see top pvp killers or top time lived or zombies killed, anything?

alpine scroll
#

If I make a mod that the entire logic is server logic, do multiplayer clients have to download it?

late hound
wooden lodge
trim barn
#

okayy, thank you, ill try

wooden falcon
# late hound This is because weapon custom animations are convoluted to make currently. There...

Thanks for the response. The animation I’m trying to use is a punch which actually already exists in the game. You can see it in the animation viewer in debug mode (something like Bob_Attack1Punch). You can also find the .X files for them. However, there are no accompanying .xml files and I’m unable to decipher exactly how the system works for the existing ones (spear, bat, heavy, stab). I’m guessing there is something in the Java files that connects it all. Hopefully in a future update they make the system more accessible.

astral grail
#

Are there any basic QOL mods people would recommend?
I'm trying to have a slightly enhanced experience without adding a ton of new / crazy stuff.

midnight mica
#

does anyone know why the outer zombies are not being pulled in? i've tried both server and client wise to play a sound like this:
getWorldSoundManager():addSound(self.player, self.player:getX(), self.player:getY(), 0, 200, 200)

#

their distance from me is about 50 tiles

wooden falcon
# astral grail Are there any basic QOL mods people would recommend? I'm trying to have a slight...

Imo, checkout the following:

  • Eggon's Hotkeys & Hot Actions
  • Bzouk Hotbar Mod B41
  • Left Click Redux - Click To Act
  • Fast Keys
  • Unpack
  • Health Bars (for build 41)
  • Mod Options
  • Has Been Read
  • Minimal Display Bars # this one is similar to Health Bars, but gives more in depth information
  • Weapon Condition Indicator [41.60+]
  • Combat Text (B40+B41)
  • Better Sorting

For some of them, I needed to tweak their settings to get them how I want. Feel free to DM me if you need help with any of them.

small topaz
#

when working with lua events and the command Events.TheEvent.Add(function), what determines the order in which the added functions are executed? is there a way to manipulate the order manually, say having a specific function which should always be executed at last for example?

wooden falcon
#

my suggestion would be to do test where the first function you add takes a really long time (like a while loop that does nonsense for hundreds of thousands of iterations) before printing something. then the second function you add just prints something immediately. then see if the second function doesn't run until the first one finishes.

#

there might be some type of sleep / wait command you can use instead of the while loop. i dont think lua has one natively, but you might be able to use an OS specific option since it's just for testing purposes and not something you'll have other people downloading.

small topaz
wooden falcon
#

I don't remember specifically where I read it, but I definitely read somewhere that the lua files are loaded in alphabetical order. I believe this meant the names of the files themselves and has nothing to do with the directories they are stored in. The one exception to this is that all mod files are loaded AFTER all vanilla files.

wooden falcon
#

I actually had a file that needed to be loaded after an existing mod's file. Initially, I was getting errors. After I changed my file's name to start with the letter 'z', the error went away. It's a tiny sample size and doesn't prove anything concretely, but that's the logic that I am working with at this time.

small topaz
#

i'll try to work with your hypothesis and see what i get.

small topaz
#

many thanks for the ideas

spare void
#

Hello, i'm looking for a mod that would allow me to queue up actions, especially like deconstructing furnitures to level up carpentry or metal working, does that exist ? i can't find anything on the workshop

wooden falcon
#

In both my mod's workshop.txt and mod.info files, I have

require=eggonsHotkeys
require=Susceptible

But in-game, only Susceptible is required by my mod. Do I have the syntax wrong or is it not possible to require more than 1 mod? (Maybe I'm supposed to put them on one line with a comma or semi-colon between them? Will try that later when I can.)

willow swan
#

Hi, I’m quite new to Lua and hope this isn’t too big of a bother.

I was hoping to add a skill level requirement for a mod used by a server I play on. Specifically using an item such as a bandage. Is it possible to add skill requirements to item usage?

#

I've been able to add skill requirements to crafting thanks to the extensive documentation by the community but skills for item usage hasn't been documented and I haven't been able to get anything to work.

wooden falcon
#

For the 10 Years Later mod, I only have one choice when setting up a multiplayer server. For solo play, I can choose "no indoor, no roof, lower veg", but for multiplayer it seems like I only have the full vegetation option? Anybody know how to get the "no indoor, etc." option for multiplayer?

willow swan
eager pollen
#

is there a list of the different hatcategory?

small topaz
#

anyone knows whether the vanilla game also triggers lua events via its java code?

eager pollen
#

im looking for something that would mask the head entirely, not just nohairnobeard

eager pollen
#

also for some reason nohairnobeard doesn't seem to mask the beard.
checked with the vanilla balaclava and it also doesn't hide the beard :/
nohair and nobeard works separately tho.

lucid spindle
#

Is this kind of thing valid/going to work as expected?

local XX_modData = getGameTime():getModData()

function myFunc1()
XX_modData.someVal=1
end

function myFunc2()
if XX_modData.someVal == 1 then
-- Do stuff
end
end

...
myFunc1()
...
myFunc2()

chrome egret
chrome egret
willow swan
#

what would I use to check the skill levels of a player? getSkills () ?

lucid spindle
viral flame
#

I can't figure out how to delete bodies

#
local deferedDeadBodyChecks = {}

function HungryHordes.OnZombieKilled(zombie)
    deferedDeadBodyChecks[#deferedDeadBodyChecks+1] = {
        square = zombie:getCurrentSquare()
    }
end

function HungryHordes.OnTick(ticks)
    for i, posData in pairs(deferedDeadBodyChecks) do
        local square = posData.square
        local deadBodyList = square:getDeadBodys()
        
        if deadBodyList ~= nil and deadBodyList:size() > 0 then
            for i=0, deadBodyList:size() -1 do
                local body = deadBodyList:get(i)
                body:removeFromWorld()
                body:removeFromSquare()
            end
        end
    end
    deferedDeadBodyChecks = {}
end

Events.OnTick.Add(HungryHordes.OnTick)
Events.OnZombieDead.Add(HungryHordes.OnZombieKilled)

does not work

#

but

#
local deferedDeadBodyChecks = {}

function HungryHordes.OnZombieKilled(zombie)
    deferedDeadBodyChecks[#deferedDeadBodyChecks+1] = {
        square = zombie:getCurrentSquare()
    }
end

function HungryHordes.OnTick(ticks)
    for i, posData in pairs(deferedDeadBodyChecks) do
        local square = posData.square
        local deadBodyList = square:getDeadBodys()
        
        if deadBodyList ~= nil and deadBodyList:size() > 0 then
            for i=0, deadBodyList:size() -1 do
                local body = deadBodyList:get(i)
                body:reanimate()
            end
        end
    end
    deferedDeadBodyChecks = {}
end

Events.OnTick.Add(HungryHordes.OnTick)
Events.OnZombieDead.Add(HungryHordes.OnZombieKilled)
#

works great

#

Im going insane 🦀

#

only difference between the two snippets is reanimating the body instead of deleting it

willow swan
#

Looks like adding skill requirements to timed actions is a no go, but adding skill requirements to crafting recipes is easy. Might just have to go that route for now.

small topaz
willow swan
#

I'm close to throwing in the towel and asking someone to do it for twenty bucks at this rate

small topaz
#

ok... ui modding is quite hairy since it is difficult to understand the vanilla code but definitely possible and in my experience even possible without overwriting vanilla functions

small topaz
willow swan
#

Well, I would be working on a mod already made, not vanilla sadly

#

Though, I'd be willing to work on a vanilla action first, probably smarter anyways....in that case the suture action

small topaz
#

is that option only available in the health screen? by clicking some body part?

willow swan
#

Mhmm

#

From what I know at least, yes

small topaz
#

then i would have a look at the vanilla file lua/client/XpSystem/ISHealthPanel.lua

willow swan
#

Thank you

small topaz
#

i would then try to identify the function which generates your particular option for suture. the pz codes comes with some predefined java functions with which you can hide that option from the screen. very roughly speaking, it could be something like option.enable(false), option.setVisible(false) or panel.remove(option). I don't have the exact code in mind and don't know what exactly applies in your particular situation but that's the rough direction

willow swan
#

I imagine there's a compiled list somewhere, but my Google skills are lacking....I'm 22 going on 82 here

small topaz
willow swan
#

Amazing...

small topaz
#

problem is that the javadoc does not tell you what exactly the functions are doing but this can often be inferred from context and from the vanilla code

viral flame
#

only safe way to delete corpses from server I think?

#

Game handles them super specially apparently pain

viral flame
small topaz
#

at first i had also problems with the javadoc but now i am quite fine with it

#

a general question to the people here: i am working quite a lot with instances of objects which i create by sth like this: item=InventoryItemFactory.CreateItem("Base.MyItem"). the items can not directly be accessed by the players and are in a certain sense hidden from them. in case i don't need such an item anymore, is it necessary and is there an option to delete them somehow in the code? maybe some java method "item:deleteItem()"?

#

i am thinking about this since i don't know how and if the game/java/lua handles "stacks" somehow. saving all that stuff somewhere in the memory. now i am wondering whether the creation of those items could lead to performance/memory issues when done very often and not deleted properly.

upbeat latch
#

Hello! Im having an issue right now only happening to me, Im host a server for friends with mods but some tiles are bugged out for me also im having tearing for some weird reason idk how to fix it

#

Idk how to fix it

wooden falcon
#

Weapon stats are often (always?) defined in a .txt file within the media/scripts directory. Is it possible to have those stats modified by a .lua file in the media/lua directory? I'd like to use Mod Options with my mod to give the user control over the weapon stats, but I'm not sure how I would go about doing that (if it's even possible). For example, I'd like to be able to change fields such as:

ConditionMax
MaxRange
SwingAnim
CriticalChance
MinDamage
MaxDamage
BaseSpeed
shadow geyser
small topaz
wooden falcon
#

oooo that looks promising thanks a lot

small topaz
small topaz
small topaz
wooden falcon
#

oh ya true. i was about to test it anyway. will report back shortly.

shadow geyser
wooden falcon
shadow geyser
willow swan
wooden falcon
small topaz
#

ok! great!

shadow geyser
# wooden falcon this actually works 🥳 . funny enough, it works in the opposite way you were wor...

I had to do a similiar thing before. and to solve that, I just had an function in the OnEquipPrimary lua event, which would check what the weapon being equipt was, then would make the necessary modifications based on the mod option. this way they could modify existing items as well. technically, if you never unequipped the weapon, the mod option wouldn't apply, but I figured that would be a rare case.

wooden falcon
#

yeah definitely thats a good idea. i dont have any issue with it only affecting future items. your solution would be more complete though.

small topaz
willow swan
#

Making progress with help...wanted to ask what exactly PerkFactory.Perk is doing?

#

Is that necessary to have to get the level of a perk?

shadow geyser
# small topaz if i get things right and the only problem is that it doesn't affect the items i...

that would be a good solution that catches all cases. however you should also consider the performance, as if you dont find a nice trigger for when to check and filter what items to check, it can start to have a performance impact. because If you have no trigger for iterating the inv, you need to do it regularly, and with no filter on what items to check, you are checking them all. 1 function doing this won't kill your cpu, but if you continue that philosophy for how you check items, it starts to stack up. obvs you can do whatever you like, but that is part of the reasoning why I decided to just do the OnequipPrimary, because it catches practically all usecases except one unique case. and also its minimum performance impact, by only checking when a weapon is equipped rather than every tick/minute and only that one item rather than the entire inventory. you could actually make a check of all your inventory be triggered by the modification of the modoption which could be a nice compromise. that way it does the more intensive inventory check, but only once.

willow swan
#

if self.character:getPerkLevel(Perks.Doctor) > 1 then
return false

should that be

if self.character:getPerkLevel:PerkFactory.Perk Doctor > 1 then
return false

?

shadow geyser
#

I think perkfactory is for making custom perks. you dont need to use it in your case if you are just querying a existing perk from the player obj

willow swan
#

Hmmm weird, I was searching through the java doc and it was associated with Doctor, Blacksmith, etc.

#

Good to know, thanks again....gonna need a list of notes if I'm going to keep modding in this game.

small topaz
# shadow geyser that would be a good solution that catches all cases. however you should also co...

ya... i also had in mind that this is only done when the stats have actually been changed (maybe on game start or during game when basics wants the player to be able to make the change somehow during gameplay). not necessary to do this more often. don't think that this will result in performance issues (except you are using another mod which allows you to have 10000s of items in your inventory. 😉 )

#

and instead of iterating... there are even methods to directly access an inventory item which will probably increase computation time a bit more.

shadow geyser
shadow geyser
small topaz
wooden falcon
small topaz
#

is there an option to find out whether the actual game takes place in multiplayer or singleplayer?

wooden falcon
#

if getWorld():getGameMode() == "Multiplayer" then from lua/client/OptionScreens/CharacterCreationProfession.lua

wooden falcon
small topaz
#

great! thanks!

kind fossil
#

Hello! Is it possible to commission modders?
Our dev is unfortunately not available anymore for private reasons et we are looking for a dev to help us develop a mod

#

It is a custom VOIP radio announcement system
a mod that plays sound files on specific Radio channels (for example 102.0 MHz) at specific time (timed announce for lore) and plays random files (like music or fluff announces)

drifting stump
drifting stump
drifting stump
drifting stump
kind fossil
jaunty marten
small topaz
willow swan
#

Hey… could I use the code from books?

#

As in, certain books require a certain skill level to read? Could I not transplant that with some slight modifications to make this work?

drifting stump
willow swan
#

Yep, think I’m pretty close

#

if self.character:getPerkLevel(Perks.Doctor) > 1 then
return false

could just plug that in I assume

drifting stump
#
local oldISStitch_isValid = ISStitch.isValid
function ISStitch:isValid()
    return self.character:getPerkLevel(Perks.Doctor) > 0 and oldISStitch_isValid(self)
end
willow swan
#

Oh? That's different what is so important about the "and" there?

#

Would that also work for suturing others?

drifting stump
#

nothing special just calling the previous logic to maintain it

#

and if its the same action then yes

willow swan
#

Gotcha, and thus necessary...I overlooked that

willow swan
drifting ore
#

What is the method to make a player move to a square?

grim rose
#
module MODNAME
{
    recipe Make ITEM
    {
        Thread=3,
    Sheet=2,
    Glue=2,
    RippedSheets=6,
    keep Needle,
        Result:ITEM,
        Time:20000,
        Category:Tailoring,
        OnGiveXP:Recipe.OnGiveXP.Tailoring10,
    
    }
}```
#

anyone can help how to add experience after doing recepie?

shadow geyser
grim rose
#

like i don't get xp

shadow geyser
#

oh i see, I assumed that was a copy paste from an existing recipe. there is no existing vanilla function for tailoring specifically

grim rose
#

how can i fix it?

shadow geyser
#

you need to then actually create the function that it can be called by the recipe. it isn't enough to just rename the function

#

you can see them in recipe.lua file

#

function Recipe.OnGiveXP.WoodWork5(recipe, ingredients, result, player)
    player:getXp():AddXP(Perks.Woodwork, 5);
end

#

you need to make a new one for tailoring, then declare that one to be used in the OnGiveXP of the recipe

grim rose
#

so i need to create new lua file for that?

shadow geyser
#

yes

grim rose
#

on side note

#

it just shows how tailoring is forgotten

thin hornet
keen cape
dry quail
#

General question about making a mod compatible with other mods, what would be the best way if any to override a lua file/local function from another mod?

shadow geyser
shadow geyser
grim rose
late hound
#
    player:getXp():AddXP(Perks.Tailoring, 15);
end
Give15TailoringXP = AZRecipe.OnGiveXP.Tailoring15

This is the function I use in reference to XP gained through a recipe

#
recipe Upgrade School Bag
      {
       Bag_Schoolbag_Tier_2,
        keep Scissors,
        keep Needle/SutureNeedle,
       Thread=3,
       LeatherStrips/DenimStrips=3,    
    
       OnCreate:PleaseKeepColor,    
          Result:Bag_Schoolbag_Tier_3,
       OnGiveXP:Give15TailoringXP,       
       Time:300.0,
       AnimNode:Disassemble,       
       SkillRequired:Tailoring=2,       
       Category:Tailoring,
       Tooltip:Tooltip_AttachBackpackTier3,
      }    

I then use it with the OnGiveXP tag

small topaz
dry quail
violet shell
#

I'm looking for a way to have players spawns with a specific item of my mod, without asking for the admins to change the servertest.ini file. Is there an event like 'when player spawns" that I could use to call a function that adds an item in the inventory of the new player ? Or is there a way to have the mod force SpawnItems=MyMod.MyStartingItem to be added in servertest.ini file ?

dry quail
#

Events.OnGameStart.Add(function() -- make sure our player is setup on game start
local player = getPlayer()
end)

dry quail
#

Responding to Asilar lol

jaunty marten
#

local player

dry quail
#

ah yes

violet shell
jaunty marten
#

if u make mod then better to create global table with unique name to save variables there and don't create global variables like PLAYER bruh

jaunty marten
fervent oar
#

I'm new to modding and want to make an item that makes nearby people sad. Are there other items or mods that have done that (that I could use a template)?

small topaz
#

now where i see maxwell218's example for adding stuff to the inventory via event OnGameStart... does this belongs to the client folder or to shared? i know it doesn't matter in singleplayer but clould be a thing in multiplayer...

dry quail
#

client works for my setup

jaunty marten
violet shell
#

when you would want it in sever side ?

small topaz
#

thanks for the info!

dry quail
#

once per player?

#

if you want to keep track of such a thing

small topaz
drifting ore
jaunty marten
# violet shell when you would want it in sever side ?

I'm new in pz and goes from gmod where is game have clear boundaries of client/shared/server but by my current experience functions with item can work on client always except ones that uses inventory of other players

jaunty marten
fervent oar
#

Where do mods get placed when you download them from steam workshop?

jaunty marten
violet shell
#

would this will work :
function AddStartingItem ()
local player = getPlayer()
local pData = player:getModData()

if pData.FirstTimeItem == nil then
    player:getInventory():AddItem(MyMod.MyStartingItem)
    pData.FirstTimeItem = 1
end
else return

end

Events.OnGameStart.Add(AddStartingItem)

jaunty marten
#

u fkd up with if structure

#

and better use anonymous function

#

cos u will use this one only once

#
Events.OnGameStart.Add(function()
local player = getPlayer()
local pData = player:getModData()

    if not pData.FirstTimeItem then
        player:getInventory():AddItem(MyMod.MyStartingItem)
        pData.FirstTimeItem = 1
    end
end)
#

fixed ver

#
if not pData.FirstTimeItem then

or

if pData.FirstTimeItem == nil then

use as you see fit but first looks better as I think

violet shell
#

thanks a lot !

jaunty marten
#

and don't use everywhere

else return

it needs only if u don't want to code execute after some line (in "big" functions). here's just 1 "if" structure so no necessary > looks clearly

lavish pine
#

hey, I have a question, can I somehow get the number of players on the server using python?(I do not know which of the chats to write with this question, I'm sorry if it's offtop)

violet shell
willow swan
#

I can ask and see but I doubt they will say how they managed it, was a bit of a drag apparently

lavish pine
vapid wind
#

is there any way to optimize the crafting menu? server im on is running a lot of mods and opening specific parts of the crafting menu soft locks your game

#

to the point that if you want to fix it you have to relog

viral flame
dry quail
#

Is there a way or key to hot reload files (in particular .fbx files) in game whilst in debug mode? Have to do some small changes and relaunching every time is a bit time consuming to say the least lol

eager pollen
dry quail
eager pollen
#

I don't think so. But I'd like to be proven wrong on that.

dry quail
#

Darn, oh well at least fbx is still quite useful

humble junco
#

Hi everyone. I'm currently looking to make a mod that adds permanent night to the game. The "The Sun Has Been Vanquished" mod sort of touches on the concept, but it heavily relies on turning fog the color black, so using a flashlight ultimately turns out to be completely ineffective. I know absolutely nothing about lua, but would definitely be willing to work with someone in trying to figure out a way to alter the way the day-and-night cycle works so that it's actually true darkness like it would be during peak night darkness.

#

I think I have an idea as to what needs to be changed, but I'm not entirely sure. In the ClimateMain.lua file, there appears to be different values for what color should be present both in the interiors and exteriors during dawn, day, and dusk

subtle sapphire
#

Hello zomboid modders!
I am working on a mod that should inactive zombies at a specific time. So far, I am using the OnZombieUpdate callback and a simple function like this:

local function setZombieInactive(zombie)
  if isNight() then
    zombie:makeInactive(true)
    return
  end
end

Events.OnZombieUpdate(setZombieInactive)

It works well when playing in SOLO/Single Player. But it doesn't work well in MP. Looks like that only zombies loaded in the player chunk are getting inactived, while all other zombies keep moving as usual. If I move to another chunk, the zombies are not getting updated. Does anyone have some ideas why this happens? Any workaround? 👀

carmine portal
#

hey can any modder create an electric floor heater mod, like those electric radiator heaters?

#

like this

#

have it "connect to local electricity" like how a generator can connect to your house, and lift the heating function from vehicles and give it the timer functionality of a stove/microwave. Maybe a temperature setting as well?

kind fossil
#

Do you know if it is possible to create a mod like survivor radio but only with our own custom radio?

sour island
#

Or that some players see frozen zombies while others do not?

#

Cause zombies outside of the loaded chunk are simulated

#

they don't even truly pathfind afaik - they just draw a line to the attraction source and update over time.

#

so you'll have to find where that's called and see if you can tap into it - but I would have assumed makeInactive would turn that off too.

subtle sapphire
#

Hi @sour island , after further tests, looks like that the OnZombieUpdate is not even called for these zombies.

sour island
#

But only in MP?

subtle sapphire
#

Yes, only in MP. In SP everything is working as expected

sour island
#

Are you running this code under client, server, or shared?

subtle sapphire
#

The code is running under the server folder. I can link the mod page if you want to see the code.

sour island
#

Nah, that's all I got - my custom zombie stuff is under server.

#

Probably has something to do with something MP specific and unloaded zombies - so that's out of my wheelhouse

subtle sapphire
#

Yes, thanks for your help btw! 👏 I am gonna try replace the OnZombieUpdate with something else.

sour island
#

You could try to force each client to do it - if it works in SP, then that might work

#

Should be as easy as moving the code to client

#

worst case scenario you'll have to force data back and forth using commands

subtle sapphire
#

Oh, I see, and then the server will be synced automatically?

sour island
#

I'm honestly not too sure how the MP stuff works exactly - but I was told the server code doesn't get ran per client in MP

subtle sapphire
#

Oh, ok 😄 I'll try this way

sour island
#

if you want the game world to do something specific put it in server, but then you'll have to update the connected clients

#

since you're not telling the zombies to be somewhere or do something that requires syncing - you're just flipping a boolean to true - should be fine

subtle sapphire
sour island
#

Np, hope it works

#

Are you trying to fix the night time zombies mods?

subtle sapphire
sour island
#

Ah nice

subtle sapphire
#

Hi @sour island , I had some time to make this change, move the lua script to the client folder, and unfortunately it didn't solve the issue. I start to believe there is something "broken" with the OnZombieUpdate event. For some reason the callback is not even called for zombies that are loaded outside the cell where the player spawn.

sour island
#

The zombies don't exist there

subtle sapphire
#

But if I move with the player, on that cell, I expect the OnZombieUpdate to be called, but nothing happen 🤔 Or am I missing something? 👀

frosty falcon
#

I think there is, the combat text mod decided against using it and instead opted for playerdamage instead; do you have alternatives? time based perhaps? what are you trying to do

subtle sapphire
subtle sapphire
#

Yes, using the OnTick and iterate over all the zombies present on a cell seems to work:

local zombies = getCell()::getZombieList()
for i = 0, zombies:size() -1 do
  local zombie = zombies:get(i)
  -- do all my magic with the zombie
end
frosty falcon
#

try not to use ontick though

#

its very expensive

#

its called 40-50 times a second or so

smoky meadow
#

function Recipe.OnCreate.Magazine556(items, result, player)
player:getInventory():AddItem("556Clip");
end

how to create a quantity of that item"556Clip" i want to have 10 "556Clip" but how?

willow estuary
subtle sapphire
#

@frosty falcon I am just in the process of finding a good amount of ticks 🙂

frosty falcon
#

there is everytenminutes

#

thats ingame minutes

#

but yea that might work, just returning until you reach 100 ticks or w/e

subtle sapphire
#

Just wanted to say thanks to @sour island and @frosty falcon for the help. Using Tick instead of OnZombieUpdate solved the issue 👏 You are awesome! 🌟

pulsar mango
#

I’m wondering, is there a way to control how the zombies look, restrict them to certain sets of clothing and physical appearances, for example make all my zombies wear baseball caps with cornrow hair and be skin tone 3 just for the sake of a hypothetical

hybrid sand
#

Two questions and some context. I've done a lot of interesting things using the exposed OpenUrl from the Lua engine (can loop readbyte exposed by the java engine to do arbitrary sidecar communication to/from lua). Having done that I know there is a big problem in server hosting with the client and server mod update timings. What I have been considering is creating a mod loader mod streaming the server announced mods into a contextually bound server mod folder to basically allow mod version consistency between client and server without interrupting standard mod handling in single player. In looking through I think I can accomplish the mod reload part (though theoretical at this point) what I really want to know is. 1) I'm pretty sure this isn't an intended use of OpenUrl and I'm not sure if the exposure of ReadByte is intended or if that will be patched out at some point and 2) would this mod syncing method be frowned on?

shadow geyser
# hybrid sand Two questions and some context. I've done a lot of interesting things using the ...

not sure if I entirely understand what you are trying to do, but if this is meant to be a solution to the problem with servers having a older versions of the mod due to not updating while they are running, there already is kind of a solution. there are already mods that can detect when an active mod has been updated on steam which would then close the server. Then setting the server to restart itself when shutdown would then bring the server back after updating the mods, so that the server would then be updated to the latest versions, which clients would have when trying to join, keeping all mods synced.

hybrid sand
#

This is more an effort to control that timing. The workshop is a wild west of deployment schedules. Essentially it would be running a single mod that leverages the OpenUrl method to communicate with a mod manager on the server side. Basically to allow a "vendor version lock" type functionality. The issue with the current solutions is mod publishing essentially can kick players at arbitrary times. And the problem scales with the number of mods applied. Instead, if I can load the mods using this method into a server bound folder on the client side and load the additional mods from there I get that vendor lock until the server decides it's time to update.

#

would still have the timing issue with the single mod but that's much easier to put deployment schedules around.

#

it somewhat goes against the "established mod mechanisms" mentioned which is where my main concern is. I don't want to push against the community direction.

#

the first question around OpenUrl is mainly because I didn't want to put a lot of work into doing it on my own servers if that method isn't intended to be exposed (it's not easy to tease out so it didn't feel intentional)

thin hornet
#

Iterating in lua is not as fast as java since it's lua interpreted by java

hybrid sand
#

yeah I keep it to a minimum in my other uses due to the cost. Mostly use it to communicate out world and player information to a database

#

with the mod loading it would be once at start

#

I'll push through on my server mod as PoC and come back 🙂 thanks everyone

#

oh and anyone who looks to do that also with OpenUrl, do it server side, don't do it client side. trigger events client side but have the server do the heavy lifting.

#

(in my usage, OpenUrl is only called server side in response to client messages on the bus)

surreal brook
#

disclaimer: I apologize for my broken English, as it is a lot of text I chose to use a translator to avoid delay in writing
summary of my problem: I recently decided to study about creating and modifying addons for project zomboid, however I don't have much knowledge and experience as a programmer, but I decided to try to create a modification for the game anyway
addon idea the mod would be summarized in the possibility of players being able to watch/listen to audios or videos directly from youtube/twitch/soundcloud through a media player integrated into the game's TVs and radios where everyone within range could listen/watch without the need to download
using the streaming idea from the above sites (very short explanation)

#

Can anyone tell if this is possible?

thin hornet
surreal brook
#

Wouldn't it be possible to make a way to bear it? using lua language

viral flame
#

Yes, but I don't think you can without modifying Java side.

Zomboid uses a whitelist of stuff you can access on the Java side, and I doubt networking is on there. So you would need to modify Java side to add a whitelisted networking component, which isn't possible using only a workshop mod.

knotty sandal
#

Is it possible for a crafting recipe to have a random output?

thin hornet
#

Might also want to add RemoveResultItem:true to the recipe script to prevent the default result item to be given

knotty sandal
#

Awesome!

wooden falcon
#

Anybody know if there is a lua function to modify the repair recipe of an item? (More info: If you have an item defined in media/scripts/myitem.txt:

module Base {
    item myItem
    {
        attribute1: ..,
        attribute2: ..,
        etc.
    }
    fixing Fix my Item
    {
       Require : myItem,
       
       ConditionModifier : 20,
       Fixer : repairMaterial1=2,
       ConditionModifier : 50,
       Fixer : repairMaterial2=3
    }
}

I can change the item's attributes with a call like

item = ScriptManager.instance:getItem("Base.myItem")
item:DoParam("attribute1= new attribute value")

But I'm not sure how to modify the repair recipes for the item.)

thin hornet
wooden falcon
thin hornet
#

well copy the original fixer script and in your mod script.txt add it back but with the modified fields inside

#

not sure if that would work i never really messed around fixer

wooden falcon
#

Ah okay. So I'm trying to make it so that users can change my weapon's attributes + repair recipes through their in-game settings.

#

So that's why I need the lua to do it.

thin hornet
#

oh

#

i see well i never heard of DoParam for fixer ill check real quick in the source

wooden falcon
#

<3

thin hornet
#

Real quick i dont see anything that would let us edit one.
Are you trying to edit existing fixer, cause otherwise you could make your own context menu and logic