#mod_development

1 messages ยท Page 205 of 1

azure mauve
#

from 0-?

sleek heath
#

what would I rename though

#

wouldn't renaming these files prevent the mod from even working since it needs to read from a particular folder?

bronze yoke
#

as long as they're in the folder they will be read, you're expected to rename them

sleek heath
#

the folder or the files?

bronze yoke
#

the files, but the folder would work too as long as it's not a base folder (client/shared/server)

#

renaming files now after release is kind of a nightmare though

sleek heath
#

yea

#

i'd rather just have 2 separate versions of my mod

#

it takes up space on my computer but its all good

#

lol

heady crystal
#

Anybody know if it's possible to draw a 2D element like an image or text in a square location? Like 3D to 2D? You know, like how the forage system adds that little icon on the ground when you're near something

tame mulch
heady crystal
#

I actually want to draw a text in a 3D position yes. Or at least, close to it I guess.

tame mulch
heady crystal
#

Thank you! spiffo

tame mulch
shadow leaf
#

If anyone can take a look at this one would be appreciated, I would imagine it's not super hard to mod but I know next to nothing about PZ modding atm unless someone got some leads for resources to send my way. Either way anything would be appreciated spiffo

formal rain
#

nvm saw the comments

shadow leaf
#

I believe most of the bugs are happening in MP I remember using it in SP but haven't tested it since to see the bugs for myself, but I also don't wanna get it added to the MP server and people running into problems with it

formal rain
#

i'll take a look but no promises, i'm a baby modder

shadow leaf
#

thank you spiffo

tame mulch
# tame mulch I will check now, maybe will be easier way ๐Ÿ™‚
BravenDrawData = {}
BravenDrawData.plNum = nil
BravenDrawData.isSquareSet = false
BravenDrawData.text = "Aiteron is a birb!"

-- TEST FUNC --
local function OnKeyPressed(key)
    if getPlayer() ~= nil and key == Keyboard.KEY_Z then
        local square = getPlayer():getSquare()
        BravenDrawData.sqX = square:getX()
        BravenDrawData.sqY = square:getY()
        BravenDrawData.sqZ = square:getZ()
        BravenDrawData.plNum = getPlayer():getPlayerNum()
        BravenDrawData.isSquareSet = true
    end
end
Events.OnKeyPressed.Add(OnKeyPressed)
-- TEST FUNC END --


function BravenDrawData.OnPostUIDraw()
    if BravenDrawData.isSquareSet then
        local x = isoToScreenX(BravenDrawData.plNum, BravenDrawData.sqX, BravenDrawData.sqY, BravenDrawData.sqZ) - getPlayerScreenLeft(BravenDrawData.plNum)
        local y = isoToScreenY(BravenDrawData.plNum, BravenDrawData.sqX, BravenDrawData.sqY, BravenDrawData.sqZ) - getPlayerScreenTop(BravenDrawData.plNum)
        getTextManager():DrawStringCentre(UIFont.Large, x, y, BravenDrawData.text, 0.5, 0.5, 1, 0.9)
    end
end
Events.OnPostUIDraw.Add(BravenDrawData.OnPostUIDraw)
azure mauve
#

is there a way I can add my script that I'm testing without making a whole mod file for it?

heady crystal
formal rain
#

Sound was completely fine too, I believe the comments and whatever problems you had might be about their load order

#

Since this mod overwrites filibuster's it has to be loaded after those

shadow leaf
formal rain
#

yep

#

i clipped some videos too if you wanna see

#

this my friend testing it in my hosted server to make sure sound works properly and there are no errors here either

#

we checked the numbers of the tank and tried canceling actions too, all working fine

#

i'd say you check it in a seperate server with your current modlist in the correct order before adding it to your main dedicated server if that's the final goal

#

some mods overwrite propane tanks, that also might be a problem with some of the comments

shadow leaf
#

Sweet! I'll keep that in mind, thank you for the preliminary test @formal rain โค๏ธ

formal rain
#

SCWblushHEART i hope it works out for you too

verbal yew
formal rain
#

true and real

#

i'll grow up to be like you one day

verbal yew
#

im baby modder drunk

formal rain
#

speaking of, ive been checking some farming mods to figure out how to code new stuff

#

where exactly are the farming tiles (the visual stuff: .pack) are tied to the items/results?

#

it's confusing me so much nehehe

verbal yew
#

dont know, im not work with this part drunk

formal rain
nova socket
#

~~Does anyone has idea how to properly use zomboid.socket? ~~
It does seem like server does create it but it never listens to what's written to it?

nvm there was some tomfuckery with socket that was left behind.

tulip valve
#

Socket?

muted garnet
#

Is it possible to change the character's turning speed while running or sprinting? The OnTick event does not work, its value is always set to 0.8 and 0.65 while the player is running or sprinting

latent lance
#

Is there a way of checking whether or not the the player is holding a weapon? Currently, I have this set up:

        player:setHealth(0)
    end```
However, I'd prefer checking if the item is a weapon instead of manually checking individual types
median mantle
latent lance
thorn brook
#

yours too, i just saw it and it's way bigger than mine, a lot of the same songs though

#

for me i just grabbed my personal playlist

#

threw out the stuff that goes beyond 1993

#

and made a mod

#

how did you get the file size down that much? what did you compress the songs to

#

for me i did 22050kHz and that took off like half the size or more

#

but it's still pretty good quality

muted garnet
#

Is it possible to change the character's turning speed while running or sprinting? The OnTick event does not work, its value is always set to 0.8 and 0.65 while the player is running or sprinting

latent lance
#

I'm not sure if there's a way to change the character's turning speed while running or sprinting, I can only see a way to change the character's turning speed when they're walking

wise parcel
#

Started working on my first ever mod today, a pretty simple one called Morphine that removes all pain for 24 hours, and makes you deathly ill if you take more than one within 24 hours. Only issue, is that my mod icon isn't showing up. It's 400x400, and a .png file, and is also linked correctly in my .info file. Any help would be nice.

compact warren
#

does anyone know where tile textures are stored

#

like for wall and all

wise parcel
#

found my issue

sleek heath
muted garnet
scenic glade
#

I made a post on the subreddit, but would someone be willing to help make a super simple workshop mod? Im unsure if this is the right channel to ask.

dusty wigeon
#

trying to move the object to where the tile is highlighted but i cant figure out how to move the origin of the object

#

nvm i got it i forgot i needed to close out of the game completely for it to reset

pseudo apex
#

Hi! What is wrong with this ? ๐Ÿ˜ฆ

require "Items/SuburbsDistributions"

table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Money")
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100)

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.SpecialMoney")
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 0.01)

muted garnet
#

Is it possible to implement so that zombies, when the player is sleeping, do not just approach, but attack and kill the player? If such a mod already exists, please send me the link.

trim skiff
#

hello guys, is there a way to check what fish is being created while the player is fishing? my goal is to get info if the player is catching 118cm fish and turn it into a "reward item"

sour island
trim skiff
trim skiff
# sour island New to Lua and programming?

i have been self learing for sometime while making private mod for pz. but now kinda stuck to how to call the function in ISFishingAction.lua to get the info that player is fishing. like what event should be used to trigger the funcion when the player is fishing?

sour island
#

So to get started you just need to understand two basic things: @trim skiff

require "original file"
---To call on/load a file before the current file
local storedFunction = originalObject.Function
---If the `originalObject.Function` uses `originalObject:Function` you'll need to call `storedFunction` with (self,arg1,arg2,etc)

function originalObject.Function(arg1, arg2, etc)
  ---do stuff before
  storedFunction(arg1, arg2, etc)
  ---do stuff after
end

function originalObject:Function(arg1, arg2, etc)
  ---do stuff before
  storedFunction(self, arg1, arg2, etc)
  ---do stuff after
end
#

The require and the stuff itself has to match the vanilla file in terms of directory. So:
media/lua/client/Fishing/TimedActions/ISFishingAction.lua - require calls should be made in client (or shared)

require "Fishing/TimedActions/ISFishingAction"

local originalGetFish = ISFishingAction.getFish
function ISFishingAction:getFish()
  local fishGotten = originalGetFish(self)
end
#

If you're looking to manipulate or do something with the getting fish event, it actually (and fortunately) returns the fish in question - so it should be easy enough to do stuff there

trim skiff
pearl oracle
#

I am interested with this too. Did you get some answer?

muted garnet
#

Is it possible to implement so that zombies, when the player is sleeping, do not just approach, but attack and kill the player? If such a mod already exists, please send me the link.

trim skiff
# sour island The require and the stuff itself has to match the vanilla file in terms of direc...

Mr Chuckleberry, its seems the data returned from lua ISFishingAction:getFish() is didnt contain the length of the fish. the length of the fish is recorded in the name of the fish when the fish is created.
i was trying to call lua ISFishingAction:createFish() since its return the data i need, but its error, because i was calling createfish function without any proper parameter.
and i kinda stuck again now haha.

vestal path
#

Hi everyone! Got question about .getModData(). I added custom status to corpse with that method:

function Recipe.OnCreate.ADBandaging(items, result, player)
local item
local corpseStatus = {};
table.insert(corpseStatus, "IsBandaged");
for i=0, items:size() - 1 do
item = items:get(i)
print("OnCreate item=", item, " item type=", item:getType())
if item:getType() == "CorpseMale" or item:getType() == "CorpseFemale" then
item:getModData().corpseStatus = corpseStatus;
print("OnCreate Added Status item=", item, " corpseStatus=", item:getModData().corpseStatus)
end
end
end

#

but if I put it out of my inventory - it change it itemID or something, and no longer got that .getModData.corpseStatus

tame mulch
vestal path
# tame mulch How you check moddata from corpse after you put it out from inv ?

I get it back in inventory and try to do my stuff. I got OnTest function:

function Recipe.OnTest.ADBandaging(sourceItem, result)
local statuses = sourceItem:getModData().corpseStatus
print("OnTest item=", sourceItem, " corpseStatus=", statuses)
if statuses ~= nil then
print("OnTest !!!ITEM WITH CORPSESTATUS FOUND!!!")
for i=1, #statuses do
if statuses[i] == "IsBandaged" then return false end
end
end
return true
end

#

so, as long as it in my inventory after craft - it got that modDataStatus

#

but when I put it out of my inventory and get it back - it change it comboitem name and no longer got that Status I made

#

Is there a way to save that status for that corpse?

muted garnet
#

how can I deal damage to a player, like a hit from a zombie, well, for example, at the end of the action the player receives a hit from a zombie or how you can add a bite to a selected part of the body?

tame mulch
true plinth
#

Hello all,
i'm working on a mod for simulating some "anomaly" like in Stalker Anomaly game.
So i used the "AttachAnim" method for adding "smoke" animation onto a tile square.

            local smoke = IsoObject.new(square, "floors_burnt_01_0", "anomaly", true)
            smoke:AttachAnim("Smoke", "02", 1, frameSpeed, 0, 12, true, 0, false, 0.7, color)
            square:AddTileObject(smoke)

So the tile display a smoke, it's good, but the smoke is not animated.

Does someone know why please ?

fast galleon
true plinth
#

yeah i tried by replace the 1 frame by 4, but the result is the same :/

#

it seems that animation is only played with IsoFire object

latent lance
#

Does anybody know how a user is assigned their online ID?

#

I'm assuming it's based on when they join and how many players are online at the time?

#

and they are assigned the ID based on the index?

fast galleon
#

I know AttachAnim works for players and zombies too in the current version (manual mp sync). Other objects might need manual update every tick.

true plinth
fast galleon
latent lance
#

If I wanted to attract zombies at the player position, would this be done with the addSound() function and be done server-side?

#

I figured it out

compact gate
#

I'm relatively new to dealing with item distributions from mods. I would like to edit them, but I need help with a critical issue. Changing the item distribution file of a mod causes checksum errors for clients.

If I manually edit a mod distribution, every user must manually install the revised distribution for the given mod. This is an issue for obvious reasons.

My question would be: Is there a way to overwrite mod item distributions simply on the server side? If not, then the follow-up would be, if that's not possible, would it be possible to make a mod to overwrite another mod's distribution? Or is my only choice to try and re-pack the mod itself?

Anyone's insight would be greatly appreciated.

true plinth
#

example of use :

for i=1,getNumActivePlayers() do
        local playerObj = getSpecificPlayer(i-1)
        if playerObj and not playerObj:isDead() then
            setAggroTarget(i-1, playerObj:getX(), playerObj:getY())
            playerObj:getStats():setHunger(0.0)
            playerObj:getStats():setThirst(0.0)
            playerObj:getStats():setFatigue(0.0)
        end
    end
muted garnet
#

how can I deal damage to a player, like a hit from a zombie, well, for example, at the end of the action the player receives a hit from a zombie or how you can add a bite to a selected part of the body?

hearty timber
#

Hello buddys, how do I spawn with the clothes of a certain profession? I'm doing a customized profession

#

I'm using already MainCreationMethods.lua to get the examples, but i didin't found any .lua that can i choose the clothes

true plinth
nova socket
#

is there like a mod for safehouse management? Like so admin can change X,Y without fully releasing and replacing it?
Players could toggle to see their own safehouse area like admin tool does?

Because if there is none its about time to do one.

formal rain
#

it allows you to right click on any body part and add any kind of injury of any severity

viral notch
#

and nah i don't found working one that what are on workshop are lagging server or half works ...

zenith igloo
#

do custom items automatically added to zed loot table? I dont want it to spawn in zeds yet zeds have them anyway while I even didnt touch loot tables etc.

#

ps : not replacing a vanilla item

#

I thought that it wont spawn as long as I dont edit the zed loot distros

zenith igloo
#

they run but sometimes? :p

thorn brook
#

because the songs were in great quality

#

so i had to compress them

#

to reduce size

latent lance
#

How can I check whether or not the player is on a multiplayer server?

vestal path
latent lance
# muted garnet I meant method, but thanks

I'm not sure what events you are looking for, but you can damage body parts by getting the part. For example:
local playerHead = player:getBodyDamage():getBodyPart(BodyPartType.Head)
and then you can do something like playerHead:setCut(true) etc for damaging that specific bodypart

#

This is from memory, so I'm not entirely sure if that's the correct way

hallow hearth
#

That should have every method you need

muted garnet
viral notch
latent lance
#

Anybody know what could be causing my mod to not work in multiplayer when downloaded through steam workshop?

#

Only works in singleplayer

bronze yoke
#

does it work in multiplayer when not downloaded through steam?

latent lance
#

Yeah

#

When it's in my mods folder it works in multiplayer, but doesn't when it's in the workshop folder

#

that steam places it

bronze yoke
#

is the mod private on steam?

latent lance
#

Unlisted

thorn brook
latent lance
#

very strange

bronze yoke
#

did you add the mod to both the workshop and mods tabs?

latent lance
#

I removed it from the mods tab and am just using the one downloaded through workshop

bronze yoke
#

i mean in the server config

#

the workshop tab chooses which workshop items to download, the mod tab chooses which modids to activate

#

the mod needs to be in both

#

otherwise it'll be downloaded but not activated or vice versa

outer crypt
#

Does anyone know if it is possible to search for a sound emitter in a square? I know how to search for objects and sprites but is there a way to identify an emitter that has set coordinates? I found a getFreeEmitter(x, y, z) but I don't think that looks for emitters that are playing. The intent is to remove all the audio playing from a known square.

latent lance
#

That was the issue

tulip valve
#

Is it possible to create a bag without a model? I just want a backpack to be invisible on back when worn

thorn brook
#

since you don't need a model

#

and that's like the most time consuming part

#

i might try to make that mod

tulip valve
#

I've been trying to do that, but its not working xD

#

I tried making a ClothingITem .xml file with just a GUID id and also put that in fileGuidTable.xml but that didnt work

#

And removing ClothingItem from the item script will make the bag not spawn at all

left merlin
#

Hey sorry to interject into this conversation just got a quick question was hoping you guys might be able to answer it for me? Since I imagine you all have spent a bit of time in this game and I am just starting... I'm looking for a mod that makes it so I can see a zombies in situations where they should have been able to be seen but aren't. Anyone know of a mod for that?

thorn brook
#

if i do it i will upload the mod for you and the others to use

trim juniper
#

Does anyone know - do the standard (unmodded) loot rarity multipliers affect the chances of backpacks/hikingbags/etc. appearing on zombies?

left merlin
#

Can someone help me?

trim juniper
# left merlin Can someone help me?

You might do better to ask in mod_support - this group is for coding/development, not really general mod-finding questions. Might want to rethink the phrasing a bit too... it's not all that clear what you're actually asking for... in what particular situations should a zombie be able to be seen but isn't?

brave ruin
#

What is the max damage on weapon you can put?

#

Like in game you see a bar, what is the max of it?

trim juniper
brave ruin
#

Can u explain?

tulip valve
trim juniper
#

I'm not sure - he's mentioning a bar ingame... that sounds like condition - "damage" to the weapon itself. There's no bar showing damage output.

brave ruin
#

I meant the damage bar

trim juniper
#

Hmm, unless I'm forgetting...

brave ruin
#

You can see how much dmg the weapon do

tulip valve
# thorn brook i think i know how to do it, i'll let you know soon

I got it working, I made .fbx file without anything in it and a texture without anything and that actually worked lol, only problem is the preview of the character is completely gone, I have to unequip that bag and reequip it in the clothing selection when creating the character

#

after that my character shows up

#

Weird

trim juniper
#

Oh, okay... sorry, I forgot there's a damage output visualization. Not sure what the equation is for the length of it.

#

There's not one single damage value for weapons, there's a MinDamage and MaxDamage. I assume you could set them to anything you wanted, and it would just cap the ingame bar at some point.

brave ruin
#

Yeah

#

What is a OP value and balanced value?

#

In your eyes?

thorn brook
#

i think i know how to solve the other issue though

tulip valve
#

Strange why the character preview goes away like that

trim juniper
#

Well, the Machete is min 2.0, max 3.0 - which is very high. The Katana is min 8.0 and max 8.0, which is pretty much insane.

tulip valve
#

around 8.0 the damage bar hits the max, thats for sure

trim juniper
#

Most weapons clock in somewhere more in the min 0.5 to max 1.0 range

grim rose
#

hey lads

tulip valve
grim rose
#

having small issue

#

tried to update my mod

#

as my friend updated model

#

nothing changed

#

but model

#

and now it doesn't spawn

#

does adding nods to .fbx is going to make model unusable

#

?

tulip valve
thorn brook
#

and it works without having to spawn with it

#

i'm gonna publish it in a minute and you can get it

tulip valve
#

Dont need

#

This way is better for me, but I can take a look

tulip valve
#

๐Ÿ‘

compact gate
#

This may be beyond what I'm capable of, but I'm trying to make a sub mod to change the distribution files for a couple mods on my server.

The actual changes to the distribution are easy enough, but I'm pretty lost when it comes to actually implimenting them into a mod. On paper all it has to do is overwrite specific distributions. Any suggestions?

outer crypt
outer crypt
bronze yoke
# outer crypt

you can just use getActivatedMods():contains("ModID"), your isFriendlyModEnabled function is much slower

outer crypt
heady crystal
#

Anybody know how to force a player to play X animation?

#

Outside of a timed action

dreamy geode
#

Can one create a server side only mod that doesn't require installation on the client?

bronze yoke
#

yes but no

#

the game enforces client and server having the same mods, but you could create a mod that loads code stored on the server and doesn't do anything on the client

dreamy geode
#

But the client would still need to have the "mod" registered to join the dedicated server?

bronze yoke
#

yeah

#

there's no way to get around the server making sure the client has the same mods enabled, and that it has the exact same copies of every mod

#

but if you wanted to do this to keep a mod private to one server for example, this could be done with a loader mod like that

dreamy geode
#

I just want to have code on the server that collects game data info and writes it to a file on the server.

bronze yoke
#

if security/secrecy isn't a concern i wouldn't really bother doing anything special like that

#

you can instruct your code not to run on clients, but unfortunately installing at least something to the client side isn't avoidable

dreamy geode
#

Any modders available here for hire?

shadow leaf
#

A mod idea I think some people might be interested in, currently there is no small vehicles like battery powered golf carts (or gocarts), it would make driving short distances more interesting I think and useful for larger base compound. Pros: better acceleration and faster handling, small. Cons: low top speed, no defenses against zombies, fragile, only two seats.

thorn brook
#

Maybe I can get the models somewhere though.

shadow leaf
# thorn brook Maybe I can get the models somewhere though.

Perhaps another modder who is more knowledgeable with modeling can help you make a custom one and yall can credit each other. Either way I wish you all the luck in the endeavor and looking forward to checking out any progress ๐Ÿ˜„

thorn brook
#

gonna try it when i get home

true plinth
#

hello all,
Does someone have a link for documentation/tutorial or anything "clear" to explain "SGlobalObject" and "SGlobalObjectSystem" mechanism please ?
Because this mechanism is quite complicated to understand, even ChatGPT gets a little lost ๐Ÿ˜„

Thanks you

fast galleon
latent lance
#

I'm trying to addBlood at a dead player's location on every client, how can I pass through the player's square?

#

Currently I'm passing this

            commandArgs.y = player:getCurrentSquare():getY()
            commandArgs.z = player:getCurrentSquare():getZ()```
#

but I need to pass an object as the param for addBlood(), is it possible to get the IsoGridSquare at these coordinates?

fast galleon
#

works for loaded chunks

latent lance
winged pebble
#

Greetings PZ Modders, i've added a Vortex mod manager support for PZ. This means that non-steam users can now just download straight from nexus without needing to install mods manually.

i've added GOG support but i haven't tested the GOG version because i don't own the GOG version of the game.

sour island
#

@dreamy geode @bronze yoke - actually you could have a server side only mod and have it be entirely Lua -- the only thing that would need be in the workshop is something pulling text into a loadstring call.

#

And have the "string" Lua code be stored on the server

#

One could make their mods exclusive in this way, but it would be a massive packet to send on connect if you need clients to have any of the code- unless the mod is entirely serverside than you're in the clear.

true plinth
#

Hello Everybody,
I'm working on a mod, and i have some trouble about adding IsoFire on square.
I want to have a "perpetual smoke" on IsoGridSquare, so i coded this :

 addSmoke = function(square, cellTag)
        ---@type IsoFire
        local smokeOnSquare = AnomalyZoneFactory.isSmokePresent(square)
        local colorRarity = AnomalyZoneFactory.getColorForZone(cellTag)
        local frameCount = 4
        local frameSpeed = 0.1

        local color = ColorInfo.new(colorRarity.r, colorRarity.g, colorRarity.b, .5)
        if smokeOnSquare == false then
            AnomalyZoneFactory.writeLog("addSmoke - No Square Smoke found")
            -- check if square already have a smoke TileObject
            local cell = square:getCell()
            ---@type IsoFire
            local smoke = IsoFire.new(cell, square, true, 500000, 500000, true)
            smoke:AttachAnim("Smoke", "02", frameCount, frameSpeed, -16, -78, true, 0, false, 0.7, color)
            square:getProperties():Set(IsoFlagType.smoke)
            square:AddTileObject(smoke)
        else
            AnomalyZoneFactory.writeLog("addSmoke - Square Smoke found and anim attached")
            smokeOnSquare:AttachAnim("Smoke", "02", frameCount, frameSpeed, -16, -78, true, 0, false, 0.7, color)
        end
    end,

Everything working well : the smoke is perpetual and added on the grid square.
BUT when i teleport on the map, and i come back where the IsoFire should be, nothing appear, the grid square is empty, IsoFire is missing...

Someone have an idea please ?

thorn brook
#

can't be that hard

#

i mean it's just a go-kart

sour island
#

And I misread that anyway

median mantle
fierce tartan
#

Hmm. I'm trying to mess around with crafting modding for shits and giggles but I can't find any of the recipes that relate to placing objects in the world, like adding sheet to windows and doors or placing carpentry walls, etc. Any tips as to where I can find that stuff so I can mess with it a bit?
I'm at least looking at the media folder inside the Zomboid directory and there is some stuff, but definitely not all.

true plinth
thorn brook
#

@shadow leaf

shadow leaf
#

@thorn brook pog, its cool doe, I've been there before with STALKER modding, takes a lot of time, thx though hopefully you get to check into again when you have the chance. I still like golfcarts over gocarts but these are pretty nifty too!

latent lance
#

Any resources on creating UI?

#

For example, rendering text centre screen

regal mantle
# outer crypt

I have a very similar question to ask. I found a mod that I like, but I just had to have a look at the code after complaints in the comment section about performance. Turns out we do some pretty heavy lifting every. single. tick.

So I want to overwrite the lua function of one particular mod. Can I use "require" to make sure it is loaded before my mod?

bronze yoke
#

yeah, any file you require will be loaded at the point require is called if it hasn't been loaded already, regardless of mod load order

regal mantle
#

For curiousitys sake, does it also prevent the mod from being loaded again later?

#

VS Code makes it sound like it just loads it in at require, but no more "checks" are done

bronze yoke
#

yeah, require won't load the same file twice

regal mantle
#

Ty ๐Ÿ™‚

latent lance
#

Anybody know how I can create a 5 second timer before removing UI from display?

brazen loom
#

So I'm using RemoveLoot function to remove vanilla firearms and items with a mod I'm working on. This works fine for single player, but when testing the mod in multiplayer, I still find vanilla firearms spawning. When I open lootZed, I can't see them on the list, yet they still spawn, but only in multiplayer.

bronze yoke
#

your code might be running too late, or not on the server

#

the lootzed discreprancy is because lootzed reads directly from the lua tables, but the actual loot logic uses a version the itempicker caches at a certain point in world loading

brazen loom
#

Maybe I need to do something else, still learning lua, but I have "Events.OnPreDistributionMerge.Add(modifyAllLootTables)" at the end of the script. Would something else be better?

bronze yoke
#

that should be good, which folder is your file in? as long as it's not client it should be okay

brazen loom
#

Client. I'm guessing the obvious thing is I should have it in server.

bronze yoke
#

as long as it's not client, i would recommend server yeah

thorn brook
#

i only got it to spawn once

#

somehow

brazen loom
bronze yoke
#

just the server folder, everything else is just for organisation

thorn brook
# thorn brook somehow
require 'Items/ProceduralDistributions'

table.insert(ProceduralDistributions.list["ClothingStoresShirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresShirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresOvershirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresOvershirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStorageAllShirts"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStorageAllShirts"].items, 1.0);
table.insert(ProceduralDistributions.list["ClosetShelfGeneric"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClosetShelfGeneric"].items, 1.0);
table.insert(ProceduralDistributions.list["BedroomDresser"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["BedroomDresser"].items, 1.0);
table.insert(ProceduralDistributions.list["CrateClothesRandom"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["CrateClothesRandom"].items, 1.0);
table.insert(ProceduralDistributions.list["WardrobeWoman"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["WardrobeWoman"].items, 1.0);
table.insert(ProceduralDistributions.list["DresserGeneric"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["DresserGeneric"].items, 1.0);
table.insert(ProceduralDistributions.list["WardrobeMan"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["WardrobeMan"].items, 1.0);
#
table.insert(ProceduralDistributions.list["GymLockers"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["GymLockers"].items, 1.0);
table.insert(ProceduralDistributions.list["Locker"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["Locker"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresSummer"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresSummer"].items, 1.0);
table.insert(ProceduralDistributions.list["ClothingStoresSport"].items, "Base.Shirt_Hawaiian_Houndstooth");
table.insert(ProceduralDistributions.list["ClothingStoresSport"].items, 1.0);
#

i tried setting the spawn rate to 1.0

#

so a 100%

#

but it wasn't there again

bronze yoke
#

looks fine, 1.0 isn't 100%

brazen loom
thorn brook
#

it isn't?

#

that explains it then

bronze yoke
#

it's technically out of 100 but default loot settings are 40% of 'normal' so it's more like out of 250

thorn brook
#

so i should set it to a 100 for testing?

bronze yoke
#

1 is actually a 0.4% chance of spawning

thorn brook
#

i actually thought it was way higher than that, like for example in my true music addon

#

i got the spawn rates set to 0.02

#

and it still spawns

#

pretty often

thorn brook
#

how do you calculate this?

bronze yoke
#

you can just do your number * 0.4

#

the reason for that is because the spawn chances aren't weighted, every single item is rolled individually, so if you have 1000 rare items like that, it's still pretty likely at least one of them will spawn

#

that's why cassettes get so out of hand in big true music packs

thorn brook
#

so what's the spawn rate i should set for that shirt? so it's still pretty common, but it doesn't spawn too much you know

thorn brook
bronze yoke
#

i'd look through the vanilla file to see what the default clothing is like

thorn brook
#

also this

thorn brook
thorn brook
#

i'll try

bronze yoke
#

only thing to watch out for is some containers have multiple rolls

#

e.g. the one you just posted has 4 rolls, the chance per roll is 24% but after 4 rolls the chance that at least one has spawned is ~67%

thorn brook
thorn brook
bronze yoke
#

that's something different, there is no item limit

#

that's for the game picking which item list a container should use

#

e.g. in this situation it randomly picks between a shirts list, dress list, etc, so the items don't seem completely random as a clothing shop would usually organise things

thorn brook
#

maybe to 45

#

so it's gonna be 18%

#

nope i went to a clothing store and that's way too much

fast galleon
#

these numbers are not exact, at 80 I had ~100 chance to spawn item per roll

thorn brook
#

so what should i set it to?

#

i'm thinking of trying out 20 now

bronze yoke
#

i think the best is to just base it off of vanilla values

#

it's way too difficult to visualise what these numbers actually mean

thorn brook
#

is 10 the chance?

bronze yoke
#

yeah

thorn brook
#

after setting it to 10

#

i found 8 of them in the barg-n-clothes store

#

to be fair the store is pretty big

#

but isn't that still too much?

#

think i'm gonna set it to like 7

heady crystal
#

The whole distro thing is a mess

#

Specially with mods... and most people use a ton of mods

#

Best bet is to open the game with Debug mode on, activate loot zed and individually check the containers you assigned your item to

#

It'll show the spawn % of each item, including yours.

#

So then you have a decent idea of how it'll be like

heady crystal
frozen aspen
#

hey, so I've created a new wild food item in items_food, could anyone point me to where the world spawning for items is configured? I can see something that looks relevant in lua/shared/forageDefinitions.lua ?

red sorrel
#

I'm not sure if this is the right chat for this, but I've been working on a tool that'll streamline map mod management by automating a spreadsheet that details what mods your using and their incompatibilities. Here's the functionality thus far. When it runs, it it gives you a list of mods that have a maps folder in media organizing them and grouping them by their steam id. It also generates an excel file with currently 2 pages. The first is just a version of the list the program gui gives you when you run it with the steam page hyperlinked and requirements listed in mod.info commented. The second page is where incompatibilities are laid out. The first section just lets you know which mods are incompatible with what. The border formatting is meant to be a visual indicator of mods with the same steam id since those could potentially just be variations of the same map. The next section lays out the actual incompatibilities on a individual cell basis. That one is still WIP, but I wanted some alternative perspectives before I continue. This tool has been laying in the dust for a few months and I just now got the motivation to finish it up, but I haven't actually played or messed with map management in a while so I'm not sure if some other formatting would be more convenient or if there is a particular functionality that would be beneficial to add. If you guys have any recommendations or ideas, please let me know.

drifting ore
#

Can we use these with in our own mods & make our own Perks?

polar gyro
#

Is there any good mods examples where i can find how to insert items into foraging?

polar gyro
#

Thanks

true plinth
dark edge
#

Hello!
I cannot figure out one thing, i want to add new OnCreate function in a separate mod file, but when i load the mod, it's showing a lot of errors
ERROR: General , 1700226026100> RecipeManager.LoadedAfterLua> no such function LuaGiveXP = "Recipe.OnGiveXP.Blacksmith25" in recipe "Make Shovel"
for all the recipies even my new one.
How can i properly import new func into the game?

My code looks like this


function Recipe.OnCreate.ScrapVehiclePart(items, result, player, selectedItem)
  local success = 50 + (player:getPerkLevel(Perks.MetalWelding)*5);
  if ZombRand(0,80)<success then
      player:getInventory():AddItem("Base.UnusableMetal");
  end
  if ZombRand(80,100)<success then
    player:getInventory():AddItem("Base.UnusableMetal");
    player:getInventory():AddItem("Base.UnusableMetal");
    end
end```

Also, without the "Require", error is:
```java.lang.RuntimeException: attempted index of non-table

P.S. The problem was with the selectedItem param.

heady sluice
#

Where is a good place to go and get the details on the interface exposed by the game that mods can access? I am seeing a huge gap in some role playing aspects and I think I know why, but wanted to verify...

fast galleon
# heady sluice Where is a good place to go and get the details on the interface exposed by the ...

https://pzwiki.net/wiki/Modding
https://github.com/FWolfe/Zomboid-Modding-Guide
https://projectzomboid.com/modding/

You can also check the game files. Not exposed are mainly the java classes, with some exceptions. You can see most exposed classes in the LuaManager class.

GitHub

Guide to modding various aspects of Project Zomboid - GitHub - FWolfe/Zomboid-Modding-Guide: Guide to modding various aspects of Project Zomboid

jovial harness
#

I just found out that some weapons from Brita's Weaon Pack have negative chances of spawning in the loot tables. Anyone knows why ?

drifting ore
#

Question is their away to get Mod Options to to work with Procedural Distributions file, say i want Item A to spawn but not Item B when first setting up a world or say down the track.
Now i have the Custom Mod options working with in the World settings and able to toggle the tick box but just don't understand how to get the Procedural Distributions to work with it?

fast galleon
fast galleon
flint lance
#

How to make a mod using profession framework?

#

Actually how to make a mod

#

Wait wrong channel

drifting ore
median mantle
true plinth
dark edge
#

Does anyone know how to remove result after crafting?
player:getInventory():Remove(result); doesnt do shit

The idea is to make the recipe dynamic, so it will give you the result that depends from your skill, but i cannot remove the recipe result from inventory, no matter how hard i try

P.S. Found the solution (RemoveResultItem in recipe config)

thorn brook
#

@bronze yoke hey, check your dms when you have a moment

rich void
#

Can we use PlayAnim(") from within the isozombie class?

tulip valve
#

Where does Zomboid store their item icon images? I want to find the Petrol.png for Petrol Can

#

nvm found it from the wiki lol

hallow panther
#

Hi I'm new here and I'm trying to learn how to mod this game, at moment I'm playing around with vehicle modding and I need help with how to make the storage area of a car have the green highlight (I've managed to define the storage area and although it seems to extend beyond the area I set?), is there anyone that can help me with this because my knowledge of lua/scripts is very limited. cheers

trim juniper
#

Quick sanity check - getPlayer() called on a multiplayer client script should return whichever player that client is controlling, right?

bronze yoke
#

yeah

trim juniper
fleet bridge
#

hi, i'm trying to use TileZed and it gets stuck loading a .pack file - any ideas what is wrong?

red whale
#

hey guys, please let me ask a question... is it possible to get a random valid xyz position or square from lua even if there are custom maps added from mods? I dont need to preload or load that chunk at all if its not loaded, but I need a valid random xyz position which is guaranteed its not outside of a playable map area... my last idea is to generate random number between 0,0,0 and 19799,15799 in a loop until getWorld():getMetaGrid():isValidChunk returns with true unhappy

rich void
#

literally

function getRandomCoordinateInRectangle(x1, y1, x2, y2)
    local randomX = ZombRand(x1, x2)
    local randomY = ZombRand(y1, y2)

    return randomX, randomY
end
#

Here's an idea, draw a few rectangles, note down their corners so that you basically have a few rectangles defined with their x1, y1, x2, y2 etc. you could pretty much cover the entire map, little bit of busy work but this will work 100%

#
-- Function to get a random coordinate within a rectangle
function getRandomCoordinateInRectangle(x1, y1, x2, y2)
    local randomX = ZombRand(x1, x2)
    local randomY = ZombRand(y1, y2)

    return randomX, randomY
end

-- Table to store rectangles
local rectangles = {
    { x1 = 10, y1 = 20, x2 = 30, y2 = 40 },  -- Rectangle 1
    { x1 = 40, y1 = 50, x2 = 60, y2 = 70 },  -- Rectangle 2
    { x1 = 70, y1 = 80, x2 = 90, y2 = 100 }, -- Rectangle 3
    { x1 = 110, y1 = 120, x2 = 130, y2 = 140 }-- Rectangle 4
}

-- Function to get a random rectangle from the table
function getRandomRectangle(rectangles)
    local randomIndex = ZombRand(1, #rectangles)
    return rectangles[randomIndex]
end

-- Get a random rectangle from the table
local randomRectangle = getRandomRectangle(rectangles)

-- Get a random coordinate within the chosen rectangle
local randomX, randomY = getRandomCoordinateInRectangle(randomRectangle.x1, randomRectangle.y1, randomRectangle.x2, randomRectangle.y2)

mellow frigate
red whale
#

Thanks @rich void & @mellow frigate

#

I went this way, seems like its working. I assume that the metaGrid maxX and maxY gives back correct data even if someone using a custom map

#
function Test:rnd()
    local w = getWorld()
    local metaGrid = w:getMetaGrid()
    local rX = ZombRand(0, metaGrid:getMaxX() * 300)
    local rY = ZombRand(0, metaGrid:getMaxY() * 300)

    local isValidChunk = metaGrid:isValidChunk(rX / 10, rY / 10)
    local isValidSquare = w:isValidSquare(rX, rY, 0)

    print(string.format("random square: %s,%s,0 isValidChunk=%s, isValidSquare=%s", tostring(rX), tostring(rY), tostring(isValidChunk), tostring(isValidSquare)))
end
#

as I can see on the official map there is a zone around the useful area of the map so tbh the rand would be better if x is between 15-45 and y is between 5-45

#

but it applies only to the official map, so I think i will calc with getMax[X|Y]

red whale
mellow frigate
nimble badger
#

How do I re-add a muzzle flash to my mod gun? I deleted it but re-adding it doesn't seem to work

rugged latch
#

does anyone know how to see all the cells in a world? im trying to make a random spawn position thing but it doesnt seem like there is a way to access all the cells in the map or positions of them (i dont want to write them all down)

#

wait shoot

#

is this thing righht above like

#

literally the answer lol

#

it is, wow thats convenient. hope im not treading on someone elses ground

gilded hawk
#

Would anyone appreciate a mod that makes it so that when you die, you don't have to re-read all the skill books, as long as your previous character has read them?
I think it would help make the game less tedious, but I'm looking for feedback.

rugged latch
#

personally i think i like the lore of you died and therefore your a new guy whos coming and taking the old ones stuff

#

it sucks that you lose all your knowledge and it really isnt always that fun but

#

if you could find a more lore friendlyish way to implement it maybe

bronze yoke
#

as the author of a skill book mod i've kind of come to the conclusion that skill books are an inherently tedious mechanic

#

'you only have to do it once' is a bit more convenient but it doesn't really attack the core issue

rugged latch
#

if it wasnt a scroll bar and had some sort of input or skill? behind it maybe?
but its not like you can put a minigame in a book its just sort of reading it wouldnt make sense

gilded hawk
#

Ah, and minor spoiler about my Inventory UI update ๐Ÿ˜…

gilded crescent
#

Because as someone who renames containers a lot, that would be amazing but I use Tetris in every playthrough now

rugged latch
#

i know this is dumb but like, just how do i do this? im not the biggest lua user ever

bronze yoke
#

PZMath.lerp(fearDarkStress, fearDarkStressDest, 0.1)

rugged latch
#

huh

#

swear i tried that, thanks!

shadow leaf
#

Is there a way to make a water container use up more of a water unit for watering crops? like for example make it so that the watering can can water plants even better than jug of water or large water bottle but without making it straight up being able to store more water, making it heavy and clumsy to use every time you want to water a buncha plants by hand.

random finch
#

Anyone suggest an event for registering a zombie zone definition for MP?

media/lua/client/CM_Zones.lua:

local function OnRegisterZone()
    --Cedar Hill
    getWorld():registerZone("CedarHill", "ZombiesType", 4805, 5703, 0, 300, 322)    
end

I've tried these three and no dice:

Events.OnGameStart.Add(OnRegisterZone)
Events.OnLoadedMapZones.Add(OnRegisterZone)
Events.OnServerStarted.Add(OnRegisterZone)
#

This is my media/lua/shared/NPCs/CM_ZombieZoneDefinition.lua:

require 'NPCs/ZombiesZoneDefinition'

CM_ZombiesZoneDefinition = ZombiesZoneDefinition or {};

ZombiesZoneDefinition.CedarHill = {
    Santa = {
        name="Santa",
        chance=20,
    },
} 
random finch
#

Nvm, I should have been using media/lua/server/ rather than media/lua/client/

manic relic
#

some ideas why the tube is invisable at some angles?

#

its not normals, allready checked that 1000 times

#

wierdes thing is, from the front its just fully invisable

shadow leaf
manic relic
#

2d texture?

shadow leaf
#

its like flat

manic relic
#

sorry I cant follow you

shadow leaf
#

is the model flat or is it actually a cylinder?

manic relic
#

oh

#

no, its a actual 3D cylinder-ish thing

#

like a long square thing

shadow leaf
#

I wonder if it's just straight up clipping through your character

manic relic
#

dont think so, cause the thing is infront of the head

#

it connects to like the gas mask

shadow leaf
#

I think I see a little bit of it here

#

I also noticed that even from behind some of it appears to not fully render, maybe it's just due to the reder not being able to pick up very thin texture at certain angle

manic relic
#

hmmm

#

that would be a explanation

#

guess Il have to run some more tests on it

#

thanks tho :D

tulip valve
#

Is there anyway I can make my new gas can item compatible with fuel tankers? Its tsar common library that deals with that code

shadow leaf
gilded hawk
fierce tartan
#

Ok I'm losing my mind here. I'm new to modding here and I'm messing with crafting. Trying to get my recipe to give tailoring xp and I just can't make it work.

I have this in lua/server

function OHC_Tailoring10XP(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Tailoring, 10);
end

and then this in my crafting recipe
OnGiveXP:OHC_Tailoring10XP,

But it just won't give any xp at all. I had a look at different crafting mods and it seems to be the same idea there, so I'm not sure what I'm going wrong.

mellow frigate
#

when messing with scripts if you are not familiar with the various files reloading rules, restart the game after each change.

#

ensure there is no error in your logs that could tell you what is going south.

#

during your tests you can slightly change your recipe name on each reload to know when a reload is correctly taken into account.

tulip valve
#

Is there a way to make a trait that increases the capacity of all gas cans? You see my mod is a trait that just gives you a new gas can that has more more fuel capacity, but a much better way would be if I could actually increase the capacity of all gas cans with a trait rather than give a new gas can item with larger capacity

worldly depot
#

a trait you can choose?

#

because if so how would a trait magically add more capacity for a gas can?

#

unless the mod is not centered in realism

tulip valve
#

The mod wouldnt be centered in realism obviously, a more realistic approuch would be to have a bigger model of a gas can and give it larger fuel capacity and let the player start with it if having the trait, but since I can't model that goes out of the window xD

bronze yoke
#

the game already has traits that magically change the size of containers

rich void
#

Pretty chuffed with the progress made on these, really been stepping out of my comfort zone and learned a hell of a lot in the process, none of it possible without the help of this awesome modding community ๐Ÿ™‚

https://www.youtube.com/watch?v=qN7EXkFvEj0

Brace yourself for intense battles in a Bloodsucker Village! ๐Ÿ”ฅ Experience the adrenaline-pumping combat in this Project Zomboid mod showcase. Can you survive the Bloodsucker Apocalypse? ๐ŸงŸโ€โ™‚๏ธ๐Ÿ’ฅ #ProjectZomboid #Bloodsuckers #stalkeronline #stalker #stalkerrp

โ–ถ Play video
tulip valve
#

You mean Organized? ๐Ÿ˜„

earnest drift
#

OKAY I've had this issue a lot and I've had to restart multiple models because of it, and honestly I just want to know if this is an engine limitation or something I can fix in the future. When I delete a vertex on an outer limb in blender on a player model, for some reason that vertex likes to snap to the cursor in game. How do I get the vertex to just stay in its position relative to the in game model

#

example

#

Okay more accurately: They always snap to the center of the screen

#

Already checked the weights, they're all good

tranquil kindle
#

There probably is a small part without weight painted on it.

#

At least in my case it usually is.

polar gyro
#

guys, im trying to add sandbox setting to increase weapons durability in my mod, but after exit the game and load game again, durability reset. anyone know why?

local SOMWSbvars = SandboxVars.SOMW;

local function SOMWCondLowerChanceMultiplier()
    local items = getAllItems();

    for i = 0, items:size() - 1, 1 do
        local item = items:get(i);
        local CondLowerChance = item:getConditionLowerChance()            
        if item:getTypeString() == "Weapon" and not item:isRanged() then  -- and CondLowerChance ~= nil
            SOMWAdjuster(item:getFullName(),"ConditionLowerChanceOneIn", CondLowerChance * SOMWSbvars.CondLowerChanceMultiplier);
        end
    end
end

Events.OnGameStart.Add(SOMWCondLowerChanceMultiplier)
Events.OnGameBoot.Add(SOMWCondLowerChanceMultiplier)```
bronze yoke
#

when OnGameBoot fires, sandbox options haven't been set so it uses the default values

#

OnGameStart does have the 'real' sandbox option values, but that fires after the first chunks have been loaded so the items there are set to the default values

polar gyro
bronze yoke
#

try making your changes OnInitGlobalModData

#

this is the earliest event where sandbox options are available, but it might still be too late

polar gyro
#

well

#

seems like it works

#

at least when I enter the game, my crowbar have new condition lower chance

#

and newly added also have new data

#

seems like working

#

๐Ÿ™

#

thank u

formal rain
#

how can i add a line for the % chance of success in my script?

formal rain
#

^to increase 95% to 100%

vague hedge
#

I read somewhere that if I wanted to make my own category in the crafting gui, all I have to do is rename "General" or something else. Is that correct?

formal rain
#

yes

vagrant hollow
#

Hey hey friends, I am using the More Traits mod and have the perk with the antique items. Now I found the Maul, an antique Sledgehammer. The problem is that the right click menu does not present the option "destroy". My question is: How can I edit the Maul's file (which I already found) or what do I have to add to it to give me that option?

Finding the vanilla Sledgehammer file is proving weirdly difficult for me, but seeing how the items are written I assume I have to add the line "Tags = ..." with ... being the sledge right click destroy trait. What is that one called?

Edit: Eh, just found the answer on the wiki out of all the places. I'll leave this here for anyone else having trouble. Solution is to add "Tags = Sledgehammer," at the end of the Maul's entry.

sleek hull
#

Question about Events; if I have two mods, mod1 and mod2, and both add a function called testFunc to Events.OnTick, if either mod then calls Events.OnTick.Remove(testFunc), does it remove the function that was added by the mod that called Events.OnTick.Remove, or does it remove both functions from the event?

I'd like to make a compatibility patch for my mod and Working Seatbelts, but I'm paranoid about removing an OnTick event that Working Seatbelts has, and potentially removing a function from a completely different mod.. Can anyone offer some wisdom here? Would getting in touch with the mod author and asking them to implement a WorkingSeatbelt.enable() and WorkingSeatbelt.disable() function I could use instead to toggle their event on and off be more wise?

bronze yoke
#

it removes the function that the variable currently points to

#

the name doesn't matter, it doesn't even know the function's name, just the actual underlying function reference

slender stream
bronze yoke
#

if there is a name clash then it'll be whichever loaded last

fierce tartan
# mellow frigate what you share here is correct.

Well, that's mildly disappointing, I was hoping I was being dumb. Which I guess is still an option ๐Ÿ˜„ I tried to check if the recipe updates by changing the results each time or changing the time it takes to make, so I'm fairly certain it reads my newest updates. Just wont dish out that sweet XP.
I'll just keep messing with it. Thanks for the answer!

tiny venture
#

hey boys anyone wanna play?

modern hamlet
#
player:getModData().MHStats = {}
player:getModData().MHStats[1] = {
                
  Secim = {}, 
  SpawnKoordinati = {x = 123, y = 321},
  RolStatlari = {},
  IliskiPuanlari = {},
  GorevListesi = {}
}
                
  -- Fill Tables
  MHStats = player:getModData().MHStats
                
  MHStats.IliskiPuanlari = {} -- HERE?
                
  for k,v in pairs(Birlikler) do
    if not MHStats.IliskiPuanlari[v.name] then
      MHStats.IliskiPuanlari[v.name] = {IliskiDurumu = 0, TamamlananGorev = 0}
    end
  end

Hi, If I do not define the table again before the for loop(at "-- HERE?"), the loop does not work. I wonder why there is a need to define table again when it has already been defined above? Is there something wrong with the MHStats table I created above?

mellow frigate
modern hamlet
#

eehhhh panic

tiny wolf
#

Hey guys ๐Ÿ™‚

Looking for a way to wipe all vehicles saved into the vehicle.db into the singleplayer save game folder by using the lua code.
Objective is to improve the wipe function of the EFK project mod.
Does anyone knows if it's possible ? manipulate this db file seems to be complicated... ๐Ÿ˜ฌ

tulip valve
vagrant hollow
tulip valve
#

๐Ÿ‘

marble pelican
#

Hey! I made this roll command, /roll s (s being the number of sides on the die), and I'd like it to override the vanilla /roll command. Currently it activates both simultaneously and it's very ugly.

How could I do this?

marble pelican
gilded hawk
#

Do we have a vanilla-ish way of saving lua tables to file?

I can't use GlobalModData, as I need to read this data before a save file has loaded

solar moth
#

Hello! I am trying to make a potion mod for project zomboid lol. Im starting small (or so I thought) by making a basic health potion but im having trouble figuring out what string of code Id need to make the item restore a lump some of HP when drank. I thought I had all my code figured out last night but when I tried to load it up, the items didnt even show up in game despite the mod being on the list not sure what I did wrong. ):

marble pelican
gilded hawk
#

It sounds like you might have some files that are not formatted/written how the game wants you to

solar moth
gilded hawk
solar moth
#

sure im down lemmy just check a few things quickly

gilded hawk
#

Sure no rush, I'll make a VC channel in the server

#

Ight, I'm at the bottom of the VC channels

deft skiff
#

Bumping this. Didn't get a response last time. Any ideas?

gilded hawk
deft skiff
#

Manual .txt file update. I haven't sat down to learn .lua, but there's a pretty decent list of features that people have requested that require it (mod compatibility, no perishing only in powered freezers), so learning lua is slowly moving up my list of free time activities.

gilded hawk
deft skiff
#

Sure. You want to start a DM? I've got a decent amount of free time over the upcoming holiday break.

gilded hawk
#

Cause via .txt it will be a pain to maintain on the long run

deft skiff
#

It is. I ended up writing a .py script that does it automatically, because the hand updates were getting very annoying.

gilded hawk
deft skiff
#

Unable to VC currently, have some company over. Asynchronous DM would be preferable, if that works for you. It's your free time you're offering, so I can try to accomodate otherwise.

gilded hawk
#

Sure, let's DM then

solar moth
#

sorry taking me a little bit lol my friend plugged my code into chatgpt and it fixed a few things so Imma try to run that code and see if it fixes it

mellow frigate
hot patrol
#

anyone know if there is a guide for how you would go about making full model outfit mods using models from other games similar to the COS mods?

hot patrol
hot patrol
#

I know playermodel replacements use clothing as the base so that's part of what I need but i'm more stumped on configuring the model for pz

heady crystal
#

Anybody know how to set time of day through script?

#

Like set it to 5pm etc

bronze yoke
#

i think gametime does have a time of day setter

#

but be wary

#

bad things Might happen

heady crystal
#

Huh weird

#

getGameTime():setTimeOfDay() worked but am making a challenge and the Vanilla code calls that by default and it doesn't work there ๐Ÿค”

frozen elm
#

I might need need a bit of help making sure I understand how to overwrite vanilla functions correctly

#

The way I understand it, you would write it like

function vanillafunction:new(var1, var2)
    if not condition then
        --function stuff
    else
        return original_function(self, var1, var2)
    end
end```

Do I need to include the 'self' variable in the original_function table?
heady crystal
#

What about triggering a storm, anybody know how to?

#

getClimateManager():transmitTriggerStorm() doesn't seem to work in SP

#

Trying getClimateManager():triggerCustomWeatherStage() but it always triggers snow

near haven
#

Does anyone know how the game replaces the water bucket with a full water bucket on the ground when it rains? I want to use the same method to turn one item into another item on the ground/in inventories but can't find the code for it anywhere in the codebase. Or just how to replace an item on the ground with another item in general?

tulip valve
#

Why does this happend?

#
    {
        DisplayCategory =  SkillBook,
        NumberOfPages    =    220,
        Weight    =    0.8,
        Type    =    Literature,
        DisplayName    =    BookAiming1
        Icon    =    ABBookgun,
        SkillTrained = Aiming,
        LvlSkillTrained = 1,
        NumLevelsTrained = 2,
        StaticModel = Book,
        WorldStaticModel = BookClosedGrey_Ground, 
    }

    item BookAiming2
    {
        DisplayCategory =  SkillBook,
        NumberOfPages    =    260,
        Weight    =    0.8,
        Type    =    Literature,
        DisplayName    =    BookAiming2,
        Icon    =    ABBookgun,
        SkillTrained = Aiming,
        LvlSkillTrained = 3,
        NumLevelsTrained = 2,
        StaticModel = Book,
        WorldStaticModel = BookClosedGrey_Ground, 
    }

    item BookAiming3
    {
        DisplayCategory =  SkillBook,
        NumberOfPages    =    300,
        Weight    =    0.8,
        Type    =    Literature,
        DisplayName    =    BookAiming3,
        Icon    =    ABBookgun,
        SkillTrained = Aiming,
        LvlSkillTrained = 5,
        NumLevelsTrained = 2,
        StaticModel = Book,
        WorldStaticModel = BookClosedGrey_Ground, 
    }```
#

I have no clue why this is happening, super strange, I've checked everything, tried everything, its always the same, the first aiming book icon dosnt show up lol

gilded crescent
tulip valve
#

Oh shit

#

you are right

gilded crescent
#

lol, I've done that one a few times, got pretty good at catching it

tulip valve
#

that fixed it lol

#

I looked at that code so much but didnt see that

#

thanks!

near haven
#

AddWorldInventoryItem() seems to work to add the item to the world, but it causes strange duplication bugs when used in multiplayer servers. Is there another method I can use that literally just swaps one item with another and takes into account the rotation and location of the old item?

grizzled goblet
#

Hello! Any Idea why it's not working?

OnWeaponHitCharacter(weilder, character, handWeapon, damage)
  if instanceof(character, "IsoPlayer")
    character:getBodyDamage():getBodyPart(BodyPartType.UpperLeg_L):setScratched(true, true)
  end
end

No errors and stuff
enemy does not get scratched on that body part?

frozen elm
grizzled goblet
grizzled goblet
#

any event that fires when player gets hurt by zombies?

grizzled goblet
#

also adding

  character:setHealth(character:getHealth() - damage * 0.15)
  if character:getHealth() <= 0 then
    character:update()
  end

seems to just make the other player go dead in animations in my screen but is still normal, alive and well in their screen .. no additional damage too eyeshake

bronze yoke
#

their client is authoritative over their own health, changing their health from your side doesn't actually affect them

grizzled goblet
bronze yoke
#

i don't think any health changes will transmit over

grizzled goblet
#

Thanks! no available work arounds?

grizzled goblet
gilded crescent
# tulip valve thanks!

sorry, late response, no worries, and yeah that stuff can be hard to spot and it's a pretty common mistake

tulip valve
hot patrol
#

Yea, I know about that part I'm more so stuck on configuring the the model to work with PZ the one I've got has a lot of different pieces, isn't posed properly and could ideally use a reduction in poly count.

eager grotto
#

hi guys, newbie here, i just wanna know if there is a function code or a way to know if a zombie is close to the player?

kind fossil
#

Hi I was curious if PZ voip could be improved
I was thinking in using tokovoip (gta rp) and use it to externalize PZ voip to TS3
It would need to communicate playerโ€™s coordinates to work
It would also have to listen to Walkies frequencies, state (on/off) and mic status (on/off)
I donโ€™t know if some people already had this idea before?

rich void
#

Anyone an easy way to play sounds that can only be heard by one player? instead of player:playsound which is heard by all around them?

autumn garnet
kind fossil
#

c'est un enfer ร  mettre en place un projet pareil tu penses?

autumn garnet
# kind fossil ah oui tu penses?

Hey ^^ regarde le nombre de contributeurs sur Task force Arrowhead Radio.. le nombre de langages utilisรฉs et n'oublie pas que tu tentes de faire รงa sur pz ๐Ÿ˜… mais รงa serait tellement bien

kind fossil
#

We know if TIS is going to improve VOIP for 42?

#

because there is no point to work on such tool if they are going to overhaul everything with b42

trim skiff
#

hello guys, i have question, whats the difference between

tracker = {}
tracker = ModData.getOrCreate("tracker")

with

if getSpecificPlayer(0):getModData().tracker == nil then
  getSpecificPlayer(0):getModData().tracker = {}
end

what the effect in multiplayer enviroment?

sullen bobcat
#

Hi guys.

Is anyone able to make Tiles for a commission? I would love to get a tile of a M2 Browning Machine gun on a tripod, with the tripod as a container and the MG as a overlay that can be removed.

If not, would anyone be able to make a set of 3d sprites in ISO perspective facing all four directions of the same thing?

Thanks

Reference Images Below:

solar moth
#

Hello! So I am looking through the Debug log to figure out an error with my mod thats causing it to keep the game from launching but im not really sure what im looking for in here

manic relic
#

so been a while

#

but I remember somewhere on the pz wiki there was a list with the file names of places where clothing items could spawn

#

does anyone have a link there?

#

where the names of the different containers were like ArmyStorageOutfit

#

never mind found it

heady crystal
#

Why the hell does RoomDef:getObjects() return a "MetaObject"? It has barely any info at all to top it off.

bronze yoke
#

it's a definition not an actual room, it doesn't store 'real' objects

heady crystal
#

I am practically giving up on my biggest mod yet just because this stupid game won't let me fetch a SQUARE

#

Literally trying everything right now, and it just won't fetch stuff.

#

Then I try to forcefully fetch a square using LoadGridsquare... and the game crashes

#

X:getBuilding() returns true instead of the building. Fetching a room using building:getRandomRoom() returns some bugged object that I can't interact with, because literally any relevant method like getID, getObjects, even get its position, returns errors.

#

getRandomFreeSquare() won't cut it either

#

I manually fetch the square, yet the game refuses to send me any data whatsoever

#

Starting to think rosewood prison is just completely broken

bronze yoke
#

which object is getBuilding returning true on? i can't see a getBuilding that should be able to return a boolean

heady crystal
#

local prisonSq = getCell():getGridSquare(7641, 11855, 0)
local prison = prisonSq:getBuilding()

#

It will return the building... Until I try to get a room from it. Then somehow, it magically becomes a boolean because who cares about logic

#

No idea how, where or when it does it but it just happens

#

I am sooooo frustrated right now ๐Ÿ˜ฆ

#

I've been at this for hours

bronze yoke
#
public IsoBuilding getBuilding() {
    IsoRoom room = this.getRoom();
    return room != null ? room.getBuilding() : null;
}
```odd...
#

i think i've used it successfully in the past too

heady crystal
#

It does work

#

Except for this case where I try to fetch a room

slim cosmos
#

Hi, I just started developing my first mod, and I have difficulties.

Finally figured out how to create a project using the "pzstudio" tool from GitHub and I successfully ran my first mod.

The problem is the lack of the documentations and courses or tutorials.

I'm really struggling to find the right API for what I need.

Do you know any resources I can use?

outer crypt
# slim cosmos Hi, I just started developing my first mod, and I have difficulties. Finally fi...

I have not seen anything even close to a full tutorial for modding. There is a video about changing the color of crates and there are a couple of youtubers that have released things in pieces. If you are looking for a map mod there is daddy dirkie dirks videos. There is the forum, but answers are usually found here faster if you get the right audience. There is the project zomboid index where you can search for commands to use for programming but no real description of them. Realistically most learn by reading through other modder's code to see how they did it.

outer crypt
slim cosmos
#

Uhmm ๐Ÿค”, this is a huge problem here not having an official docs, man I came from dart, using docs all the time, I don't know if I can be patient with this situation, this makes me bored unfortunately

outer crypt
#

For instance, I'm looking into making an item that can dry the wetness from a player character. There are only two that I know of, the bath towel and the dish towel. Completely copy that original code and only change the name and you get an item but not one that dries.

#

No documentation anywhere on how that works. the forum reveals nothing, the index shows nothing useful. The code shows a dry self command, but I have no idea how they link together. And that's what the majority of my code time is, trying to figure out how to get from once play to another.

#

Its not horrible, just not efficient.

#

And there are a few people here that really know the system.

slim cosmos
#

The reason I decided to learn modding is that i used to play a game called "TLS: Dead Zone", it's shutdown now.

I was wondering if I could create a hard coded mod to behave like it.

outer crypt
#

Okay, is dead zone an old mod or a completely different game?

slim cosmos
#

Different game

outer crypt
#

Gotcha, never played it, but there are a few mods that completely alter the way this game works.

#

I would start out small, like... I wanted to make a soda fountain but started with a popcorn machine. It was a simpler option to learn how to effect the code as I never coded in Lua before either.

slim cosmos
#

That's cool

outer crypt
#

Slowly building up skills and adding things to the list. Then eventually learning my older code is crap and rewriting it again. I seems the evolution of all programming.

slim cosmos
#

I think because the game is still under development, the devs are not ready to provide a good resources

outer crypt
#

If the changes you want to make are map changes, you can check out for dirkie dirk's videos. There are others too that will help get a map made. I found the map making completely different that making new objects or coding interactions with sprites in the world. Each has it's own knowledge base.

bronze yoke
#

i sort of suspect their own documentation is just lacking

outer crypt
#

That is true, the code of the base game is still not fully fleshed out, so all the knowledge we have today may be different after the next patch.

bronze yoke
#

the lua is barely commented and the java api site seems to use comments from the code when they exist, which implies that they just don't exist for the vast majority of it

outer crypt
#

And you ahve helped me out a few times, Albion. Much appreciated.

#

The tough part is even if someone makes a full blown tutorial, it will need updates. The mapping tutorials are already out of date to an extent.

rugged latch
#

the big block of lua documentation is nice but if it was like a wiki where it could be edited by users, personally id like to be able to just write some stuff in that i find out. since itd help for everyone else next in line to me trying to find out the same problem

outer crypt
#

Heck sometimes I dig into code, takes me hours to understand how it works and if I don't leave myself a note to explain it, I have to relearn it.

slim cosmos
outer crypt
#

I can only imagine how many things I am actually using "wrong", moddata is still elusive to me. But I finally coded something that spoke from client to server and back again successfully. I just don't know if I am reinventing code that already exists and I am just not using it right.

#

The next big update will probably bring some changes that we'll need to correct mods for. But that growth is needed.

slim cosmos
#

Exactly, practicing is good

outer crypt
#

Two words of advice, do this for yourself, make it a passion and never be slave to the code. If you don't love it, you won't do it for long and if you do it for yourself, it never matters how many others enjoy it.

#

Most of what I have made was because I wanted it. And people who also like it suggest things and I change it for them so they can like it too.

slim cosmos
#

Well, good luck norby, I hope you find your way making good things for you to enjoy and for others.

I appreciate your advice.

outer crypt
#

And when I can give back, I do because I have been stumped too and know how it feels to be rudderless.

#

So focus on some small part and if I can help I will.

bronze yoke
#

there are tools in development that will allow for thorough documentation

#

i'm not sure on the progress but i will do my part when they're ready

slim cosmos
#

Maybe I'll come back later when it's officially stable

bronze yoke
#

well we'll see you in about fifteen years then

outer crypt
#

It's actually stable just growing like all of us.

bronze yoke
#

they do generally avoid breaking changes (excessively in my opinion) but when entire systems are redone it's not avoidable for them

#

i have no idea what's going to happen with them rewriting crafting entirely, it could easily break half the mods on the workshop

outer crypt
#

yeah and modders patch things pretty quickly in between. It is one of the most stable bug free early access games I have seen.

outer crypt
bronze yoke
#

oh, all map mods will be broken, that's been stated

#

supposedly in most cases they'll simply need to be re-exported, but if original creators aren't around it's not going to happen

outer crypt
bronze yoke
#

yeah, i know someone has a tool to decompile maps but i think they're keeping it private, which is probably for the best

slim cosmos
#

Guys, does it support just-in-time development?
I didn't go further in this, but I watched a video where the dev restarting the game after fixing a bug?!!

outer crypt
#

Years ago I was coding on a mud and they made a conversion utility to convert coded bits automatically because a manual system was going to be insane. Just hoping there will be some conversion process if it gets to that point.

bronze yoke
#

something like that could certainly be seen for recipes

outer crypt
#

Often I can use the same save with the new code

rugged latch
#

you can reload scripts in debug

#

although some stuff you might need to make a new save since its already too far gone

slim cosmos
#

Oh, I seee

bronze yoke
#

yeah, modders don't need to compile anything generally

outer crypt
#

That reminds me, I need to clean out my save folder...

bronze yoke
#

one of the main reasons i started using a separate cache for debug is just so i would easily know which saves were safe to delete ๐Ÿ˜…

outer crypt
#

3Gb of local saves since Oct 17th.

outer crypt
bronze yoke
#

oh, i always tested my mods in complete isolation, i just didn't want to accidentally delete a save i actually played on

#

it's also nice to be able to join servers without having inconsistency issues because of unfinished updates

outer crypt
#

My play time is restricted to a server we have that is saved in the multiplayer folder and duck's server.

bronze yoke
#

plus while it does add a bit of tedium to testing certain mods being able to cut it off from the workshop entirely and not worry about weird issues coming from there is nice

#

more than a couple times it's loaded a file from the live version of my mod instead of the local version

#

i learned to just unsub to my mods when i'm working on them but it's still tedious

outer crypt
#

Yeah, you have to test in isolation and maybe with a compatible mod that you work with. That way to you see the console errors easier

bronze yoke
#

i'm sure it also improves loading times a fair bit

outer crypt
#

yep, especially since the server loadout is over 200 mods.

#

make sure you have an M.2 drive. LOL!

#

the toughest is testing multiplayer things... Eventually I have to wait for a friend to help there.

#

I think I spent a week working on a multiplayer audio piece just to watch it self destruct in about 15 minutes in multiplayer once I could test it.

#

not horrible, just inefficient

bronze yoke
#

you can run multiple clients locally to test things out

outer crypt
#

I have not tried multiboxing with this yet

#

But I do have a dedicated server just to blow up

bronze yoke
#

as long as you're in -nosteam it won't have any issues with running multiple instances

outer crypt
#

oh good tip, ty!

#

also if you mod doesn't need zombie interaction it sure does speed up to load with no zombies

bronze yoke
#

i wonder how much a tiny debug map could help too

finite yarrow
#

Good evening!
Does anyone know where in the game files the code for this little pop up window is when you hover over a skill?

#

I think i found it: \media\lua\shared\Translate\EN\IG_UI_EN.txt
Seems to have most of the text you can find in common UI elements

#

though it seems to be just templating that's being used for the final output somewhere else so i'm at a loss again hungover

bronze yoke
#

primarily in the updateTooltip function

finite yarrow
#

thanks so much!

gilded hawk
#

Is there a way to access a specific save game global mod data, before the save game has been loaded?

rugged latch
#

is it from your own mod?

#

im not sure if there is an EASY way to do it but i dont see why you couldnt write some code to save the data in the mod folder assigned to the save?

#

but that might not be what your looking for

bronze yoke
#

yeah, if you're the one writing the data it'd be easiest to just go around global mod data

gilded hawk
#

At the moment I'm saving data in a JSON file, but I was looking for a more PZ vanilla solution

bronze yoke
#

i'm going to have to check my info but i *think* there's a way to get into the save folder and then you could just parse the mod data binary

gilded hawk
bronze yoke
#

i wasn't able to find it, must've misremembered something

gilded hawk
#

That's okay, thank you anyway ๐Ÿ˜„

rugged latch
#

mhm?

#

i understand

broken cloak
#

hi i gave a name to a zombie on server side , how to pass that name to client? getModeData() seems not work

pale hamlet
#

does anyone have experience with adding controller support to mod?

sour island
#

You could create a table of IDs. But you'd need to use server/client commands to send this information.

#

Furthermore, some objects respect IDs when you use them as arguments in commands-- I know players and items do this, I don't know if zombies do as well but it may be worth looking into.

keen silo
#

Second, and the reason for this post.

in my mod Voiced Radios and TVs

I need access to the radio device that says the line. I solved this issue by searching for it with the coordinates, and this works fine in single player

I get the radio coordinates in single player.

However, in multiplayer, for some reason for the radios I get (-1,-1,-1) as if the radio was a walkie talkie instead of a real world object
this only happens with radios, not tvs, and only in multiplayer
does anybody have an idea as to what may be the issue?

drifting ore
#

getting this error after attempting to create custom clothing mod

#

I have created a fileGuidTable, a script, and the clothingItem XMLs, though I still get this error

#

I do not have a clothing.XML however, I didnt think you needed one to spawn them

pine patio
#

A fileGuidTable, script and clothing.xml are all you need if you are relying on vanilla models

drifting ore
#

i tried to resolve it by copy pasting another clothing mod script and xmls, though the issue persists

pine patio
#

Are the guid in the fileGuidTable and in clothing.xml the same?

drifting ore
#

no, I didnt think it needed to be

pine patio
#

It's an ID, they have to be the same and unique

#

Use a randomly generated one and paste it in both files

drifting ore
#

Alright thanks, ill post here again if it dosnt work

tulip valve
#
    if player:HasTrait("AdrenalineJunkie") then
    if player:IsRunning() == true or player:isSprinting() == true and player:getStats():getPanic() > 89 then
            SpeedFramework.SetPlayerSpeed(player, 2.25)
        end
    end
end```

Trying to make so I get the speed boost when extremely panic and running or sprinting, but it dosnt seem to work, the moment I run or sprint, the speed activates even if I dont have panic lol
bronze yoke
#

in lua the operator precedence means that this says if isRunning or (isSprinting and panic > 89) then

#

using brackets
if (player:IsRunning() == true or player:isSprinting() == true) and player:getStats():getPanic() > 89 then would avoid this

tulip valve
#

thanks I will try it ^^

#

It worked perfectly

#

I just need to adjust the panic value, 89 seems to still be extremely panic

hybrid crest
#

Hey guys, a quick question
What's the best way to override a local function from another mod?

bronze yoke
#

you can't

#

you can overwrite the entire file or in some cases you might be able to overwrite whatever calls the local function, but you can't access locals from another scope/file

hybrid crest
#

thanks. A bit suboptimal, but file isn't very big thankfully. How can I properly overwrite a file?

finite yarrow
#

I managed to release my first mod today! Couldn't have done it without the help i got from here so i wanna say thank you! spiffo

muted garnet
#

if anyone knows, please tell me which method is responsible for the character's viewing angle

crisp kettle
#

@keen silo can you link the mod? I'm curious

finite yarrow
#

this is the biggest coincidence, but i'm literally installing it as you posted this

crisp kettle
#

Thank you

muted garnet
#

if anyone knows, please tell me which method is responsible for the character's viewing angle

finite yarrow
# crisp kettle Whats the mod?

It's called "Skills and Traits Explained" and shows information about traits and each of the skills in their respetive tooltips in the character window. So now i can at a glance figure out how to level a skill without having to look it up spiffo

crisp kettle
#

Cool!

keen silo
#

I managed to fix it btw, turns out there is a 7th parameter that is the device

#

So i dont have to search for it with the x y coordinates

outer crypt
#

Does anyone know the distance of OnGridLoad()? Is it a static number of squares or based more on the map chunks loaded?

muted bronze
#

What is the data type of ingredients in the following code: function Recipe.OnGiveXP.Default(recipe, ingredients, result, player)

bronze yoke
heady crystal
#

Does anyone know if game time 4x is actually 4x or

#

Like the speed control thing at the top right

wise spire
#

like for singleplayer?

finite yarrow
bronze yoke
#

definitely a lot higher than 4x

heady crystal
#

Yeah sounds like it's 1x = 1, 2x = almost but not entirely 5? 3x = 20 and last = 40x

sonic needle
#

and wrong thread rip.

muted garnet
#

if anyone knows, please tell me which method is responsible for the character's viewing angle

green prism
#

when overriding Glue to be a part of some EvolvedRecipes like this, its always showing up in the context menu for Create Stew and Create Soup as Glue (0) no matter how many are in my inventory

module Base {
    item Glue
    {
        DisplayCategory = Item,
        HungerChange = -1,
        Weight    =    0.1,
        Type    =    Food,
        EvolvedRecipe = Omelette:10;Soup:10;Stew:10;Pie:10;Stir fry;PastaPot:10;PastaPan:10;Taco:10;Burrito:10,
        DisplayName    =    Glue,
        Icon    =    Glue,
        FoodType = NoExplicit,
        Carbohydrates = 0,
        Proteins = 0,
        Lipids = 0,
        Calories = 1,
        StaticModel = Glue,
        WorldStaticModel = Glue,
        EvolvedRecipeName = Glue,
        Tags = MinorIngredient;Glue,
    }
}
#

Looking at definitions for other food items I don't see anything different, am I missing something about how food objects are handled elsewhere?

#

To be clear it does work, but it only uses 1 Glue regardless of the count set in EvolvedRecipe

#

Even weirder is that if I override Worm to be usable in a Stew for example, regardless of the amount in inventory/the quantity set in EvolvedRecipe it will always display the quantity as Worm (1) in the Create Stew context tree

#

Any items that already have Type = Food but no EvolvedRecipe definition in the base class (like Cockroaches) work fine when made usable in recipes. The abnormal behavior doesn't change if the definitions are identical except for the item name, so I'm guessing the issue must be elsewhere

#

Or would anyone be able to point me to where I can find the actual code for evolved recipes?

sour island
muted bronze
#

How does one access the base game sandbox variables in a Lua script? Like in mods you it's typically SandboxVars.<ModName>.<ModVariable>. What would be the middle part for the core game if any?

abstract pine
#
for i=1,SFarmingSystem.instance:getLuaObjectCount() do
    local plant = SFarmingSystem.instance:getLuaObjectByIndex(i);
    local square = getWorld():getCell():getOrCreateGridSquare(plant.x, plant.y, plant.z);
    local isoObj = SFarmingSystem.instance:getIsoObjectOnSquare(square);
end

Why is the isoobject always null when away from the square even though the square itself is properly loaded by this?

abstract pine
edgy steppe
#

Hi @bronze yoke , thank you for this comment!
If I may ask, can I do something similar with a zombie? If I have a square that is occupied by a zombie, e.g. zombieSquare, I can run zombieSquare:getLightLevel(..) but requires a playerIndex - Shouldn't that be irrelevant ? Is the LightLevel relevant to the Player ? I am attempting to get how much light is at the square that the zombie is to modify its behavior.
Apart from the packages overview that contains the function signatures etc, is there any more details about the functionality of all these or is it trial-and-error ? Thank you!

bronze yoke
#

the player number is required because the light level is player specific, for example traits can change the lighting

edgy steppe
abstract pine
# abstract pine ```lua for i=1,SFarmingSystem.instance:getLuaObjectCount() do local plant = ...

Tried getObjectAt and some other functions as well, in addition to iterating through the object list:

for i=1,square:getObjects():size() do
    local obj = square:getObjects():get(i-1)
    if SFarmingSystem.instance:isValidIsoObject(obj) then
        isoObj = obj;
        break
    end
end

Everything I try returns null, what is the trick to getting an IsoObject object on an unloaded cell? I can get the square fine along with the other data I want on it, the lua object itself is easy to retrieve, but after I update the lua object, I thought I would be best off doing what the vanilla code does for netcode (not sure if necessary):

if isServer() then
    isoObj:sendObjectChange('health')
end
plant:toModData(isoObj:getModData())
isoObj:transmitModData()

Except I can't manage to retrieve the isoObject ๐Ÿค”

bronze yoke
#

you cannot

#

that's the point of the global object system, you can read and write to the lua object and it'll synchronise when it is actually loaded

abstract pine
#

That explains it, so I only need to write to the lua object when it's unloaded anyway, and only need to transmit mod data when the object/cell is actually loaded?

bronze yoke
#

that's right

abstract pine
#

Thanks ๐Ÿ‘ that clears up a lot for me with more than just this

wooden flame
#

Hey, I want to add a patch to a mod that has this fun weapon that can't be put onto the hotbar. Would I be able to simply add an attachment to the weapon which will allow it to be hotbar'd, or would I need to create a separate version of the weapon that is holster-able?

#

Apologies if my request isn't entirely clear, im new to modding and im still trying to figure out how things fit together

lone hound
#

I would like to ask a question about vehicle mods.
Is there any way to make the wheel stay still?
I don't want it to spin; I want it to remain stationary and only move left and right when the player turns the steering wheel.
Thank you very much for your attention!

long grove
#

https://github.com/Konijima/PZ-Libraries
Trying to decompile, follwing this. B) pre setup step 2. JDK version 17 is not available. Downloaded and selected it.

  1. Installing Capsid with build.gradle
    Once the project is set, it should automatically open build.gradle.
    Add this line to the plugins table
    id 'io.pzstorm.capsid' version '0.4.2'

Get following errors:

Failed to query the value of task ':compileGroovy' property 'javaLauncher'.
No matching toolchains found for requested specification: {languageVersion=8, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
No locally installed toolchains match and toolchain download repositories have not been configured.

????????????????

GitHub

Complete tutorial to decompile and use Intellisense for Project Zomboid modder. - GitHub - Konijima/PZ-Libraries: Complete tutorial to decompile and use Intellisense for Project Zomboid modder.

bronze yoke
#

i wouldn't use this, it's very outdated

#

if you need the libraries it generates, umbrella does the job, if you need to decompile, beautiful-java actually works without downloading an old version of idea

long grove
#

ok thanks

#

For umbrella:

Setup
Vscode installed.
Lua Language Server extension installed.
Create new project.
Clone the repository into a folder.

clone which repository into a folder? How do I do this?

bronze yoke
long grove
#

I've only done some basic networking java course, I'm not really familiar with Github and all these programs. Umbrella exposes the typings to intellisense through the emmyluas which I just downloaded and extracted. What do I do with beautiful java to use the emmyluas I extracted?

muted bronze
#

Looks like restarting my game made it take affect, so the SandboxVars.XpMultiplier by itself works. It's just using the Sandbox in game to change it doesn't update in the code

long grove
#

How do I integrate umbrella and beautiful java?

abstract pine
bronze yoke
#

SandboxVars is just a table for lua use, in cases where the java needs them they aren't read from there

ebon burrow
#

first time modder here. no idea how any of this works. anyone know how easy it would be to add custom vhs tapes into the game? (i.e. unique items each with their own custom text & whatnot)

#

also, whatโ€™s the limit for how long/big(?) vhs text can run for? if iโ€™m putting 23 minutes worth of a showโ€™s dialogue into it, would that work?

long grove
#

I can't even work out how to decompile the code properly lol

ebon burrow
#

aw dang

muted bronze
solar moth
#

I was wondering if anyone knew the string of code that makes the player invisible when they enter ghost mode? And or where it might be in the files?

green prism
#

does anyone know if its possible to override something in package zombie? trying to fix someone elses mod but to do it I need to make a change to the vanilla climate manager at zombie.iso.weather.ClimateManager

#

never had to override vanilla functions before

median mantle
green prism
#

really just need to add two lines to GetAirTemperatureForSquare:

         if (var8 > var4) {
            var8 = var4
            ...

to check if its negative and += instead if so

green prism
#

I was trying to fix a mod for multiplayer so that wouldn't really work

#

the climate manager is pretty weird, it doesn't allow for cooling sources, only heat sources, so to make air conditioners work in multiplayer would require adding that functionality via GetAirTemperatureForSquare

#

its very annoying that the original class is only 1 if statement from adding that functionality

#

only other way to accomplish it without breaking workshop install server join i guess is to make the modification on server side and then remove temperature function from digital watches so player cant see the temperature going insane as its overidden by server packets

nimble badger
#

How does brita's weapon pack handle the rpg? When I try to use the code to make my own rpg the firebomb spawns on player location instead of the zombie you shoot at, where can I find the lua that handles this?

short yoke
#

does anyone know if you can change the size of entities? (Players, Zombies, 3D objects)

green prism
#

idk about players or zombies

#

Scale being property of object and not function

short yoke
#

hmm

#

so probably doesnt work on something that moves on screen

#

oh well

red sail
#

anyone here whoโ€™s experienced in modeling, texturing and maybe rigging?

tardy crater
#

Hello people who mod the game, I have zero idea what I'm getting myself into, but I would really like a mod that changes the skill ui to look like the Runescape skill UI.
I'm committed to making sure a thing, but I'm wondering if anyone here can point me in the right direction of what to do, if this is possible?

bronze yoke
heady crystal
finite yarrow
fast galleon
#

I've had the best time in SP playing challenges, this seems like a good addition ๐Ÿ™‚

fast galleon
broken cloak
mint rose
#

is there a way to lock a recipe to be only craftable by a profession . for example if i want somethin only a electriction can craft

fast galleon
shell hazel
#

Hey guys! I recently discovered the game and started gaming a lot on it. I'm currently working on a mod that put an item back in the storage it was after the player uses it (because having to put it back manually is annoying) and I was wondering if it already exist? I didn't found anything on the workshop, but I'd like to prevent scripting something that's existing to focus on nice stuff people would like to see in the workshop

fast galleon
#

A number of vanilla mechanics do this. You need to save the previous container and then move the item back.

shell hazel
#

I already see how I'll make it work but I was mostly wondering if someone already did something like that on the workshop, to prevent duplicates

#

But yeah store the storage in a tmp var then run player action to put the stuff in the storage back

#

I guess there's a OnPlayerUse hook or something like that

#

With parameters like where the item comes from, and the id of the item

fast galleon
#

You said there is an action, if it has a lua table then it can be saved there. Move it back when the action ends.

trim skiff
#

is it possible to use Ai to help creating a mod?

fast galleon
#

Ask ai this question.

#

They are good tools to help people.

shell hazel
#

If you provide them with all the context it needs it could, but otherwise only asks him about logic or about lua

#

But it's very unlikely that it would cook a ready to use code for you

trim skiff
shell hazel
#

You could but theres so many files to feed to the AI and your inputs should match the sources variables like if you say something like: "Make the user sick" and in the sources it's player theres a likelyhood that he will make stuff up because he won't make a link between a user and a player

#

AI is a great tool to improve your logic and stuff but shouldn't replace your code knowledge

#

Thats like using StackOverflow

#

The good prompt gets you to the good thread and hopefully you'll have the answer to your question, sometimes it takes a bit of rework because the code isn't to use as is in your project context

hardy ingot
#

Been looking to make a barricade mod that just gives plank barricades a zillion health but a bug remains that putting 2 planks on will delete both and bug out the tile into thinking there is still one there preventing opening of doors/windows. Tried out editing other barricade editing mods to high values and it creates the same issue, is this just a limitation of the game?

robust briar
#

I lol'd

finite yarrow
#

Thatโ€˜s the name of the challenge scenario

mental relic
#

Not so much the correct channel but I believe this might be the best place to ask. With the discord integrations is it possible to link certain radio chatter instead of only /ALL https://theindiestone.com/forums/index.php?/topic/24509-new-chat-system/

The Indie Stone Forums

New Chat System In prior versions of the game, Project Zomboidโ€™s chat system treated messages as though they all came from a single source. Now, in build 40, chat is separated into a variety of streams. These streams can be customized on the server. Chat Streams Chat streams can be turned on or o...

drifting ore
#

anyone got a link to the clothing assets pz uses?

#

im after the fedora model UV's, which arnt in this tutorials commonly shared file

tough whale
#

Helloooo so I am struggling hard in attempting to make a mod

#

(For a bit of background to explain my potential stupidity I have never made mods for anything)

#

I've roughly followed a tutorial and then did my own thing and am currently stuck at trying to boot up the game only to be met by this

#

(Specifically happens if I enable the mod)

#

Basically just trying to add a mask into the game

#

So yeah I have no clue what happened where

bronze yoke
#

make sure your script file doesn't conflict with a vanilla one

#

if it has the same name and directory (e.g. scripts/items.txt) it'll override the vanilla one, causing these missing items

tough whale
#

I see

#

How would I make the mod add things to the vanilla ones then? Just need to copy everything from it and slot mine in somewhere?

bronze yoke
#

just don't use the same name

#

e.g. MyMod_items.txt instead of items.txt

finite yarrow
tough whale
#

I seee

#

Appreciated, thank you both

#

I shall try this

#

Status report

#

It has not crashed this time

#

However now as far as I'm aware it is not showing in the Items list in debug

tough whale
#

Okay that problem has been fixed

#

Now onto the next...

#

I have gotten to the stage of it existing as an item, having stats however not having the model being visible nor an item description (I have no clue where to even begin on that)

#

Ookay the stats working deceived me

#

They infact do not

#

maybe they do? I don't even know LOL

tough whale
#

I have yet to fix this

#

I have also figured out that dropping the item makes like 50% of things invisible

dry chasm
tough whale
#

Potentially? I downloaded a welding goggles mod off of the workshop and swapped out my .fbx's with its to see if that would change anything though it resulted in little change

#

Judged by that I'm assuming it's probably not an issue with the model but something somewhere else I have no clue about

dry chasm
tough whale
#

Nnnope, though looking at it again they are attached to the eyes rather, hm.

#

Changing to Eyes changed nothing

muted garnet
#

if anyone knows, please tell me which method is responsible for the character's viewing angle

muted garnet
solar moth
#

I don't mean to flood channels about this issue but im having a hard time figuring out how to load my 3d model for an item into the game. When the item is placed on the ground its invisible. As far as I know everything is formatted correctly, faces are in the right direction, code looks okay but for whatever reason the model wont show.

rugged latch
#

Not at my computer right now but project zomboid Vector2 class on that same website has a convert to angle from direction of another vector2 in there somewhere

#

Itโ€™s in radians tho not degrees

#

Youโ€™ll need to make a function to convert it to degrees since I tried personally to find one available already and couldnโ€™t get it

rugged latch
#

oops didnt mean to reply

#

sorry Mence

undone crag
#

Are those screenshots of Java?

rugged latch
#

lua

#

i think my highlight thing is messed up tho lol

#

im too lazy to fix it

undone crag
#

The second one I am not familiar with in Lua, but I think it works in Java and C++ or something. Idk.

rugged latch
#

oh no they are both just attempts of me trying to do the same thing

#

in lua

undone crag
#

new is a keyword in C# but I don't know if you can put a function call after it.

rugged latch
#

yea thats my problem lol

#

i know c#

undone crag
#

:o

rugged latch
#

i come to lua and its like

#

where the heck did the arrays go

#

why is there no continue?

undone crag
#

(I learned Python from ChatGPT)

rugged latch
#

hey as long as you learn it

#

and at least chat gpt has infinite patience

undone crag
#

Instead of continue you can use goto in Lua, but PZ uses Kahlua for Java integration which doesn't have goto ๐Ÿ˜”

rugged latch
#

yea the lack of continue is...

#

something alright

undone crag
#

Is OnceEvery a Lua class or something else like a "Lua event" or something in Java?

rugged latch
#

here

#

im trying to get this

#

i need to check something every second but thats not an event

#

and this lets you set a custom time check thingy

undone crag
#

If that's available to Lua you could do something = OnceEvery(somethingelse)
edit: apprently not :d

#

Also in Lua you don't need ; if you use newline. Also I think you might not need either also...

rugged latch
#

yea its kinda just habit

#

i figure i should probably stop doing it since its lua not C anymore

#

but im too far gone now

#

i think your thing worked btw? i have to check if i can run stuff from it

#

im assuming not?
im not sure tho i just know lua likes to pretend like its working and you got farther when you really didnt

#

bare with me i havent been forced to encounter classes yet in lua lol

fast galleon
undone crag
#

You could try printing cryCheck right after. It would probably print nil or null (whichever)

rugged latch
#

well thanks for the help

#

im assuming that means i cant do nothing wiht it btw

fast galleon
undone crag
#

If it didn't fail when you tried calling OnceEvery and only failed when you tried to treat what it returned as a table then maybe it is exposed to lua?

rugged latch
#

well from what i barely know classes in lua are only like half real, and everything is a table so i couldnt tell you, my guess is it got SOME value and then pretended like it was good to go

#

but it wasnt really the class or anything so i wasnt getting a function out of it

bronze yoke
#

it's very odd for it to continue past the initial call if it isn't exposed

#

you should get an attempted to index null error

rugged latch
#

that is what i got in the second screenshot

bronze yoke
#

yeah, but you should've got it on the new() call too

undone crag
#

No that when u do check on it eeee

bronze yoke
#

it's strange that you didn't

rugged latch
#

thats why i think lua was playing tricks on me lol

rugged latch
#

but then errors when i tried to run the check on it

undone crag
#

y u no print(cryCheck)?

rugged latch
#

oh

#

good idea lol

#

well yea now it wont get past that

#

huh

fast galleon
#
`โ€‹`โ€‹`lua
--no spaces between
`โ€‹`โ€‹`

request to post the file or snippet instead of images

undone crag
#

(Also you don't need to restart the game to reload the lua)

rugged latch
#

sure thing

#

its not much else besides this

#

i know everything below it works since i tried it first with ticks

undone crag
rugged latch
#

sorry hit character limit had to cut my stuff down

#

there is more below that but couldnt fit it

rugged latch
#

this does run every player update but that shouldnt change anything

undone crag
#

There is getGameTime():getTimeDelta()

rugged latch
#

if that works as long as i can get some number not related to the fps

#

im sorta invested in finding out how to do this now but

rugged latch
#

i probably shouldve thought to look if there was just a delta thing before all this huh lol
got tunnel visioned into one method, yea this works thanks guys!

karmic elbow
#

Hello @quasi geode
I want to ask you if it's okay to fork your Zomboid-Modding-Guide repo and create my own guide?

finite yarrow
#

consider contributing to the original guide, there's still quite a few empty sections spiffo

karmic elbow
#

I saw the last commit was on Jan 22. So I concern about the updates

boreal garnet
#

is there a guide to teach me how to create new crafting recipes drunk

drifting ore
# boreal garnet is there a guide to teach me how to create new crafting recipes <:drunk:72136153...

https://youtu.be/-yrmCAwzTbY?si=ZUXKQZgfYRhGoog3 Watch that video, this lad goes over how to make a crafting recipe.

1:11 Step 1 - Know your file locations
4:06 Step 2 - Storyboard your ideas out
9:03 Step 3 - Get your files from the game or other mods
11:47 Step 4 - Build your mod files
1:01:54 Step 5 - Create the textures (mislabeled in the video, oops)
1:19:45 Step 6 - Put your mod files in the right structure
1:30:37 Step 7 - Test your mod (please back up ...

โ–ถ Play video
boreal garnet
#

appriciated!bunnydance

drifting ore
tough whale
#

I wish there was an easier way to identify where an issue is, currently struggling to figure out why my model doesn't show up in-game. Unsure if it's a directory issue, a script issue or an issue with the model itself

#

This being my first experience with modding and programming altogether is contributing greatly lol

opal pier
#

Guys do we have any common error in this patch or something about things placed on the ground being duplicated? Some users of my mod are saying that a water container is being duplicated but im unable to reproduce the error or find an error in the code

errant sable
opal pier
#

I don't know if it could have something to do with the weight of the container being 40 full and the game bugs when you try to place it or something like that

finite yarrow
#

If it's only a visual bug under certain conditions i wouldn't bother about it toooo much personally

polar gyro
#

I have question about loot tables.
If I adding new items via table insert it increases amount of loot or replacing it in game?
Ping me if you have the exact answer, please. ๐Ÿงก

finite yarrow
polar gyro
#

I assume so. But maybe someone knows it exactly

polar gyro
finite yarrow
#

yeah i'm afraid that's as detailed an answer as we're gonna find

polar gyro
#

Seems like it more loot in general. If all items in the list are rolled twice.

steady obsidian
#

Hello, I was making the machete mod and an error occurred that I could not solve and I need your help. I just started modding and I wanted to add a machete to the game, and when I added it, the problem was that the machete did not appear in the character's hand and there was a question mark on the icon. All other functions work, I can attack, I can wear it on my back.

opal pier
#

as in this example, in the code it is "icon = Katana" but the texture in the folder is called "Item_Katana"

gilded hawk
#

Would this design pattern help with avoiding zomboid lua crashes? And the famous "tried to index value from nil"

I'm tempted to add this to my utils, but I would like the opinion of other experienced pz modders

https://youtu.be/VgA4wCaxp-Q?si=uSM2i8UVmk5JH-Mv

Programming often relies on combining functions in data pipelines. The monad is a design pattern which makes pipelines with effect much easier to write and maintain.

Monads are often explained using haskell in complicated ways but I tried here to simply explain the pattern with javascript to build an intuition of them.

โ–ถ Play video
valid steppe
#

Is this where I ask about commisions?