#mod_development

1 messages ยท Page 216 of 1

cosmic ermine
#

I know, I meant files. Resetting the whole game's Lua code just seems to be a bit too slow for me.

thick karma
#

Then yeah that'll work unless it doesn't ๐Ÿ˜‰

#

(Probably many times when it doesn't but the times I know for sure won't go well include files that decorate functions with behavior that cannot safely happen twice... If you decorate a function and reload that file, you'll decorate your new copy of the function, and that may cause stuff to happen twice. Also, if your file has functions that have already been added to events, you would need to remove them or you'll add new copies of those functions to the same events again.)

cosmic ermine
thick karma
#

0-1

cosmic ermine
#

I wanna do something similar to this:

thick karma
#

Number means any number in Lua

#

Floats are numbers in Lua

cosmic ermine
thick karma
#

Not integer

cosmic ermine
#

So it can also be float. I haven't used Lua in a while.

pulsar heath
#

i have a dumb question, is there anyway to add a stroke to the uitext?

#

in the enum i only see size and type

#

large dialogue etc

thick karma
#

RGB specifically is usually 0-1 and in fact there are cases where trying to save certain RGB states as numbers over 1 can cause errors to be thrown on game exit

pulsar heath
#

my stats ui in the snow... is a bit unreadable to say the least

thick karma
#

Your UI doesn't have dark background light font?

pulsar heath
#

my ui has no background

#

it was made to mimic the UI ingame

#

so no background

thick karma
#

Mmmm afaik standard Zomboid way is to give things backgrounds... Never seen anyone with letter glow or anything

pulsar heath
#

or perhaps a way to just change the text color?

#

if thats possible ill just run a check for snow

#

and change the text color when snow is active...

cosmic ermine
#

Is there a search feature?

thick karma
#

Yes you can change text color in the functions for drawing the text

thick karma
cosmic ermine
thick karma
#

Under white window

cosmic ermine
pulsar heath
#

@thick karma last time i coded for a zomboid mod using ui was like... 2 years ago... can you provide me an example of how to alter the text color?
ATM i only have this: self:drawTextRight(alivefor ,self.width-40,10,1,1,1,1, UIFont.Large);

thick karma
#

It could be rgba if that doesn't come out right

#

I think different parts of ui do it backwards from others.

pulsar heath
#

trial and error will save the day... thanks for the help

thick karma
#

Good luck

thick karma
cosmic ermine
#

I DID NOT SEE THAT

thick karma
#

No offense taken just saying lol

#

Good luck!

cosmic ermine
# thick karma Good luck!

Thanks. Finally starting to learn.
Not gonna lie though, modding this game is extremely difficult. It requires you to look at other people's code whether that be a mod or the decompiled source code, you even have to look at a bunch of references from projectzomboid.com/modding and pzwiki.net/Lua_Events.

neon bronze
#

Look at vanilla code for reference

thick karma
#

Also I use this so much I feel guilty for not adding co as a contributor on every item I've published

cosmic ermine
#

How do I make the character say something?
IsoPlayer:Say() does it but how do I use IsoPlayer:setHaloNote()?

neon bronze
#

Think its the same say as player:Say()

thick karma
cosmic ermine
#

How do I use it properly?

#

I want to change the color.

thick karma
#

Oh it can work both ways:

#

Maybe it takes RGB-255 in the 3rd version above. Not sure.

#

Haven't tried the 5-variable version.

#

Since arg2 arg3 arg4 are integers, it can't be RGB-1

slow graniteBOT
#
sethhhhhhhhh has been warned

Reason: Bad word usage

cosmic ermine
#
local InjuryRedTextTint = (100 - self:getPatient():getBodyDamage():getHealth()) / 100
InjuryRedTextTint = math.max(InjuryRedTextTint, 0.2)
local str = self.healthPanel.javaObject:getDamageStatusString()
self:drawText(str, self.healthPanel.x + 165, y, 1.0, 1.0 - InjuryRedTextTint, 1.0 - InjuryRedTextTint, 1.0, UIFont.Small)
y = y + fontHgt
```This part, it is responsible for the color of the "OK" text.
thick karma
cosmic ermine
thick karma
# cosmic ermine How would you do something like `os.sleep` but isn't blocking for the game?

Well you probably don't literally want to make the program sleep because that would lock up Zomboid until your function finishes. What you want to use instead is probably either counting ticks, or during OnTick counting passed game time and converting it to seconds to figure out if enough seconds have passed before continuing the process you want to happen after the delay.

But what exactly are you trying to delay? The kind of event you want to delay will determine the best way to wait for it to happen

#

Btw I am at work but will be able to respond more freely in an hour.

cosmic ermine
acoustic dust
#

hey there, i was wondering how to change the location of where the sleepingbag model attaches to the bag?

thick karma
cosmic ermine
#

Who knows, I might use it in other mods too in the future.

thick karma
#

I believe some people have posted utility modules here in the past for telling a function to happen after a specific number of seconds, but I do not have one readily available. I think you get a time in milliseconds, convert to seconds, create the function you want to happen, store any necessary variables the function will require, and add an on tick event that waits for the desired milliseconds/seconds to pass before calling said function.

#

The javadoc I posted is searchable for functions that get time in ms

cosmic ermine
#

getTimestampMs(), yes, I've seen it.

#

-.-

#

Alright, I might make my own utility function. I'll even share it for other modders.

#

Really...

thick karma
# cosmic ermine Really...

I think Tyrir posted some useful stuff for this in the past... You might try searching their messages. All of Tyrir's stuff is gold.

small topaz
#

Hi! Does anyone knows whether the vanilla moodles have some type of priority system attached to them determining which moodle is displayed on top of the moodle stack? (I mean the vertical list of moodles which is displayed right hand side of your screen when playing the game.)

bright fog
#

good question

small topaz
#

I am asking cause I noticed that sometimes new moodles are appended to the list and sometimes new moodles are put on the top of the list. Wasn't able to figure out what the system behind this is.

bright fog
#

Maybe you could find the code for the vanilla moodles ?

small topaz
bright fog
#

rip

#

Well gl, you could ask on the modding Discord too

small topaz
#

but I'll wait a bit. maybe someone here knows more too

bronze yoke
#

when i was rewriting moodles i never noticed any explicit priority system

#

i think they're just rendered in order of their ids?

small topaz
# bronze yoke i think they're just rendered in order of their ids?

Ok. Thanks for the suggestion. That was also my suspicion but was not sure about it! I am currently planning a mod which will touch the moodle system and I try to arrange stuff as it is in the vanilla game. Was therefore wondering whether there might be a special priority system or smth working in the background.

bronze yoke
#

what are you working on? i rewrote moodles entirely in lua for statsapi if that might be useful to you

small topaz
# bronze yoke what are you working on? i rewrote moodles entirely in lua for statsapi if that ...

I started working on a mod introducing a hygiene system. I plan to use moodles for indicating that the character is dirty and other things. But the project is still in it's infancy. Have just a few fragments of code here and there (and not sure if and when I'll finish it).

I think that I may also do some rewrite of the vanilla moodle system to make it work smoothly (while still trying to keep compatibility with other moodle mods ofc). Already heard about your statsapi mod during my research on moodle modding! ๐Ÿ˜„

fleet bridge
#

There's a moodles api

abstract raptor
#

anyone who know python interested in helping me with the map generator thing I'm working on?

small topaz
fleet bridge
small topaz
fleet bridge
#

oh yea, that's what its called... smh

#

my mistake

small topaz
cosmic ermine
cosmic ermine
rancid panther
#

can someone help me with a math-related dilemma?

#

a very algebra question

#

i want to make an RNG that will increase as you survive longer and get closer to the power shutoff date

#

but, i dont want it to ramp up too soon for people who have later shutoff days, like 1 year

cosmic ermine
#

Depends on what you want, it could be linear, exponential, etc.

rancid panther
#

it should be exponential

#

im trying to see how i can make my blackouts ramp up if you are close to the shutoff date

cosmic ermine
rancid panther
#

the shutoff date is a random number based on the setting u chose for the game. in some runs it can happen within a month (some within a week, but ppl using my mod probably would choose a longer setting) as long as a year

#

it is based on the day

cosmic ermine
#

So it could be 60 days or something?

rancid panther
#

yea

cosmic ermine
#

I see.

cosmic ermine
rancid panther
#

my variables would be
X: Blackout Chance (%)
Y: Days Survived
Z: Shutoff Date

#

it's a fixed Chance

#

if ZombRand(1, 101) <= blackoutchance then

#

that users of the mod can choose with the sandbox option

cosmic ermine
#

I see.

rancid panther
#

ideally, i'd like that chance to scale based on if they enable the option for ramping up blackouts

cosmic ermine
#

Let me do a few tests.

rancid panther
#

kk

#

i was gonna put this off but decided might as well add it since there was something else i needed to fix and while it is still on the front page

cosmic ermine
#

Yeah, yesterday it was on 400+ subscribers, now you're at 900+

#

Getting pretty popular.

rancid panther
#

i still havent gotten any comments confirming if it will work in multiplayer

cosmic ermine
rancid panther
#

getGameTime():getNightsSurvived()

#

shutoff date is SandboxVars.ElecShutModifier

rancid panther
#

what is each variable in this

cosmic ermine
#

a is the probability if ZombRand(1, 101) <= blackoutchance then
b is the steepness
x is the getGameTime():getNightsSurvived()
and c is the halfway point.

#

I'm not sure how to modify the x in this calculator but it and blackoutchance should be responsible for the height of that curve.

rancid panther
#

so the X axis on this graph is nights survived and Y axis is blackout chance?

cosmic ermine
#

Eh, not exactly.

rancid panther
#

it would be huge if it ramped up once you were very close to the shutoff date

#

maybe i can explain what im picturing

cosmic ermine
#

nightsSurvived/x and blackoutchance/a are the ones responsible for the height, the steepness/b modifies the curve and the halfwayPoint/c is the one modifying how soon the chances ramp up.

rancid panther
#

interesting

#

i super wish i could understand this

cosmic ermine
#
blackoutchance / (1 + math.exp(-steepness * (days_until_shutoff - halfway_point)))
#

Try to play with that formula.

rancid panther
#

is the halfway point a number i can choose/set

#

could i make it like shutoffday - 10 for example so it only starts ramping up in the last 10 days?

cosmic ermine
#

Yes, like I said, that modifies how soon the chances ramps up.

#

You can even ignore it and set it to 0 but that would be useless since that is also the day the electricity powers off.

rancid panther
#

i see. and what about steepness? is that responsible for the shape of the graph? or does it also affect the peak?

#

wait, is the blackout chance here measured by its peak?

#

ah wait i think im starting to understand

rancid panther
#

so i would need to add a tooltip saying this is the peak chance if you enable ramp up

#

can i control the minimum too? do i just add a number at the end?

#

like the formula with a + variable at the end

cosmic ermine
#

Yeah, keep in mind though that even if you modify different variables, the result could be extremely similar.

rancid panther
#

oh wait if i use a plus sign i think it would actually shift the whole graph up

cosmic ermine
cosmic ermine
rancid panther
#

thanks! i'll play around with this and see if i can come up with something

cosmic ermine
#

Uhh, does anyone know how to make a settings tab in the pause menu option? Not the sandbox option when creating a save.

fast galleon
cosmic ermine
#

There was a tab called (mods) before, I'm not sure where it comes from.

rancid panther
#

is there a way to prevent the game from muting when im speeding up time or in ghost mode

rancid panther
#

i added a very simple version of blackout ramp ups to my mod since i still couldn't get the exponential ramp ups to work how i wanted - and i needed to update the mod to fix a bug before too many people get far enough in their runs to experience it

i'll have to give it another shot another day

#

someone suggested making weather affect blackouts so maybe i will look at those at the same time

thick karma
#

Doesn't create your own options page but does let you create a category in that Mods tab you mentioned.

rancid panther
#

Finally got a comment from someone who used my mod in multiplayer and I can see if there are any problems

acoustic dust
#

is there any tutorials on how to make a melee weapon mod?

nova socket
#

ha

#

so is every community, zomboid has a blatant copycats lmao

#

some well-known dude literally copycated one of mods I made almost 1-to-1 conceptually, but I guess its his word against mine since he is like a bit popular it seems.

thick karma
nova socket
# thick karma Did they reupload or just do exactly what you did by writing the solution from s...

Nah, code seems like scratch but mod does replicate everything exactly the same. I usually don't bother with such as ideas do overlap, but when people randomly keep posting DMs with "hey bro you seen that mod seems like a copy of yours" randomly here and I come to check it again to know author deleted my message saying `Nice it seems like we had a similar idea" or something (non-derogatory at all or aggressive). Wanted to confront the guy but according to the comments he usually posts with content like "Wouldn't do that feature, mod didn't get too much traction, not effective" I came to realization that he is pretty miserable already and that's probably the only way to get any attention, so not gonna give him one.

#

Seen a lot of these before, just first time in Zomboid.

#

Gotta admit Zomboid so far is least toxic so far, people are more into creating than competing it seems.

thick karma
#

I just do my best to make all of my mods trivially easy to patch and leave the rest in the hands of fate, tbh, but if someone does reupload your code you can definitely have that taken down.

nova socket
#

Nah not THAT blatant unfortunately, but idea is completely mirrored there yeah. The funniest about that is that this mod "is not viable" in his eyes as "its unpopular". Well mate, stop copying other people ideas then, because ideas cannot be copied. kek

thick karma
#

I'm very curious which of your mods we're discussing. I see many on your page. Also I see you finished your Shops and even seem to have done some controller support; that sounds exciting, definitely gonna give that a try.

nova socket
#

hopefully not to bad for your taste kek

thick karma
#

Bruh if you even got halfway there I'll probably fix it out of appreciation for the fact that someone tried to do their own controller support for a custom UI

#

โค๏ธ

gilded pewter
#

are there mods that replace zombies with other things like monsters or such? is it even possible?

rancid panther
#

seems like my blackouts r still not synced across clients for all players

thick karma
# nova socket oh god

Bro I'm just getting a chance to read this carefully and follow your voodoo; does this work because the settings folder in your mod falls outside of the Lua checksum and you just load what you need serverside and pass it along?

(Seems like shopkeeper is not gamepad interactable for me... not sure if it's a conflict. Only prompt I can find is "TAB" on screen while near trader.)

rancid panther
#

i might need to see how the game codes the world power shutoff

bronze yoke
#

i had a quick look at your mod, i think it'd work fine if you just moved most of it to the server and used a server command to trigger/end the blackout on clients

rancid panther
#

thanks! can you explain what you mean by moving it to the server and using a server command?

bronze yoke
#

right now your code is in shared, which means it's running on the server *and* every client, if you want it to be synchronised you would want to have most of the logic only run on the server (the random chance etc) and just have the server tell the clients when to turn off the power

#

right now every client is rolling these random chances individually and blacking out their game only

rancid panther
#

ok, so the folder does matter.

so would that mean basically putting the main functions in server and keeping the event handler in the shared folder be enough for what i need?

bronze yoke
#

i haven't written a formal guide on it yet but here's an explanation i gave a while back of how commands work

bronze yoke
rancid panther
#

ok

bronze yoke
#

the client folder is the only one that doesn't always load frustratingly

rancid panther
#

i'll have to look at this when i am on pc then

lunar plover
#

Is there's a way to change fire rate if TwoHandWeapon = FALSE?

rancid panther
#

i think i understand. so i need to make the roll happen on the server, and the actual blackout happen on all clients

i do this by making the roll server sided and using the result of the roll to send a server command?

bronze yoke
#

yeah, that's right

rancid panther
#

looking at my files, are the server-sided stuff and client-sided stuff mostly already isolated from each other? or is there anything in either file that should happen on the other side?

bronze yoke
#

for the most part yeah, the moddata stuff should probably happen on the server but the event handlers you use to start/end the blackout are mostly client stuff and the rest looks like it can be server stuff

rancid panther
#

ok. i'll ask more questions when im on my pc! thanks!

#

i mean i will see if i already understand first without asking and if i need more help i'll ask! spiffo

bronze yoke
#

good luck!

sleek hull
#

I had 2 people offer to create translations for my mod, I'm now going through and double checking that things appear properly, but the diacritics from other languages appear to be problematic in Zomboid's UI, but in Notepad ++ everything looks correct. Is this an issue with how the translation file is encoded, or is it that my system is set to English and not using the correct text formatting?

bronze yoke
#

the file might not be saved with the correct formating

sleek hull
# bronze yoke there's a table on the wiki showing which formatting to use for which languages ...

This was the issue, all Notepad was defaulting to UTF-8 and German/French really didn't like it. Found a file with the right formatting and overwrite what was in it and renamed the translation file and now the text appears correctly.

I'll have to look in Notepad++ and see where exactly those encoding settings are or how to configure them properly, I couldn't find any encoder named Cp1252, Cp1250. The closest thing I could find was Windows-1250/Windows-1251/Windows-1252.

daring badger
#

Hello everyone, I am new to zomboid modding and wanted to ask if there were any guides people recommend for weapon mods.

fleet bridge
#

Does anyone know how to get context menu items to be unclickable if certain conditions are not met? For instance the option should show up but it cannot be clicked because you don't have a certain item in your inventory

glossy crane
#

Do items have metadata, where I can edit and add my own information?

fast galleon
# nova socket some well-known dude literally copycated one of mods I made almost 1-to-1 concep...

People have no shame, one guy made pretty much the same thing I do (a minor change mod) and when I said that this has been done before they proceeded to trash my mod for every tiny detail. Meanwhile everything they said was false and inaccurate and their mod didn't work.

Also when a popular modder made another copy mod and people called it original, I said it was done before and then a fake reddit user praised them for being popular and that justified it. Then they deleted the account.

nova socket
#

and there is no need too, unless you host. JSON is stored server-side anyways

#

client always requests fresh copy from server

nova socket
glossy crane
#

lol

#

that was a fun find hahaha

#

nice

hollow current
#

is there an equivalent of "SendCommandToServer" but for running a command directly from the server?

open drum
#

์šฐ๋กœ โ€” ์–ด์ œ ์˜คํ›„ 9:44
heya guys
does anyone knows if GIF is able to be played in project zomboid ?
is there any way?

outer crypt
#

Does anyone know if a 3d object in PZ can have multiple textures? I see many FBX files with 2 or 3 texture files as opposed to just one. Thank you

fast galleon
outer crypt
#

I would imagine the fbx file would need to be rewrapped with one UV map instead of 3 for it to work in PZ

fast galleon
bronze yoke
#

yeah, you'd have to rewrap it

#

pz won't use more than one texture

outer crypt
#

Thank you ๐Ÿ™‚

#

at least I know what direction I need to go in... crash course in blender...

fast galleon
#

oh I see now

outer crypt
#

completely different topic, is it possible to change a sprite into a container during Events.OnLoadedTileDefinitions.Add()? I have tried doing it but it fails. Either I am missing a property or the way I am trying to set the values...

coarse sinew
outer crypt
#

oh I was so close...

#

what I was trying...

#

Thank you!!

coarse sinew
#

Np

outer crypt
# coarse sinew Np

Exception thrown java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "zombie.core.properties.PropertyContainer.Val(String)" is null at CellLoader.DoTileObjectCreation line:136.

#

tried this as basic as I could figure and it still pulls this error...

#

makes me think there is another value it needs to have set

fast galleon
outer crypt
coarse sinew
outer crypt
# coarse sinew After

thanks, just tried before and it killed the chunk again. Nice to see half the house blown out though ๐Ÿคฃ

#

doh! same error... even afterwards

coarse sinew
#

in shared ?

outer crypt
#

yeah, is that a killer?

#

figured it would be safe there to test anyways

coarse sinew
#

No, that's where it should be, I just don't know why it's giving you that error because I tried it and I don't have it

outer crypt
#

so weird, yeah... I saw this come up in the history on this discord for a bit and this was not my first test. I tried just about every way to write it and it hits the same wall every time.

#

Trying to get around calling this sort of change in LoadGridsquare

slow graniteBOT
#
sartori_zz has been warned

Reason: Bad word usage

golden galleon
#

i have a server im hosting and i was wondering if it would be possible to teleport between two map in the game. for example
map one would be the vanilla map, map two would be a standalone map. and the players in the world would be able to transfer between the two anytime. is this something that would even be possible ?

nimble yarrow
#

you cannot move between MAPS, but you can warp huge distances (so far away, even outside of the normally accessible play space, it might as well be a new map). I'm assuming this is how people do RV interiors, or basements, but I have no idea.

MrAtomicDuck has a video on doing an "elevator" that teleports players to a "dungeon". heres one of the vids where he talks about it. maybe this could lead you in the right direction...? https://www.youtube.com/watch?v=b_DLKU8-V0E

golden galleon
#

Thank you this is perfect

chrome egret
#

GM folks and thanks to @bronze yoke for mentioning BeautifulJava. Much easier than using Capsid.

fleet bridge
chrome egret
#

I could use a little help understanding modData relating to world objects generated and spawned into the map. My intention is to create new kinds of generators, to allow propane and dual-fuel generator usage, but I'm not sure how I can set up modData to be assigned when the objects are generated. Sorry if this is a basic question or I'm missing the obvious reference/documentation!

#

Uh-oh. IsoGenerator inherits from IsoObject, where setModData seems to come from IsoThumpable extending IsoObject... Presumably that means generators can't have mod data set directly?

#

Maybe there's a way to hack it into the global mod data, but that seems inadvisable if there's another solution.

#

NVM, setModData isn't the way to do this:

crystal oar
#

does anyone know where in the code catching a cold is?

frank elbow
outer crypt
chrome egret
jaunty glen
#

Hey guys. Hitting a brick wall a little bit here, was hoping someone might give me a direction.
Trying to make a mod connected to farming - an alternative to "removing furrows" of sorts. I started by just adding a copy of furrow removal action to the context menu, like this:

`function testShovel(player, context, worldobjects, test)

local sq = nil;
local currentPlant = nil;

for i,v in ipairs(worldobjects) do
    local plant = CFarmingSystem.instance:getLuaObjectOnSquare(v:getSquare())
    if plant then
        currentPlant = plant;
        sq = v:getSquare();
        break
    end
end

if currentPlant then
    context:addOption("Worms test", worldobjects, ISFarmingMenu.onShovel, currentPlant, player, sq);
end

end

Events.OnFillWorldObjectContextMenu.Add(testShovel);`

The action gets added, it seems like the player and other global vars are being read correctly, but when I click on the new action, I'm hitting an "Object tried to call nil in walkToPlant" error (call to walkToPlant is the first line of ISFarmingMenu.onShovel that I call with my context menu function).

I did LUA modding before, but not in Zomboid, so if there's any guide that covers this particular topic, I'd appreciate it.

thick karma
#

In ISFarming.onShovel, player is a player.

#

(As, in my opinion, it should be.)

#

Meaning an object with data and functions and the whole shebang

#

The controller and holder of a player's data, position, actions

#

But in OnFillWorldObjectContextMenu event function code, player is (often/usually) only the player's index. ๐Ÿ˜ฆ

#

My signatures (for OnFillWorldObjectContextMenu events) therefore look like this:

JukeboxMenus.load = function(playerIndex, menu, worldObjects)
#

That's a function that gets added to OnFillWorldObjectContextMenu in one of my mods.

#

You can then say local player = getSpecificPlayer(playerIndex) if you need the actual object.

#

Which you do

#

@jaunty glen

fleet bridge
#

Try that

thick karma
#

Here, he calls:

context:addOption("Worms test", worldobjects, ISFarmingMenu.onShovel, currentPlant, player, sq);

which, as written would rely on player from:

function testShovel(player, context, worldobjects, test) 

and call

ISFarmingMenu.onShovel(worldobjects, plant, player, sq)

The problem is...

#
ISFarmingMenu.onShovel = function(worldobjects, plant, player, sq)
    if not ISFarmingMenu.walkToPlant(player, sq) then
        return;
    end

onShovel expects a player object for walkToPlant

#

which becomes increasingly obvious when you check its signature:

function ISFarmingMenu.walkToPlant(playerObj, square)
    if ISFarmingMenu.cheat or playerObj:isTimedActionInstant() then
        return true;
    end
#

Again, realizing player is playerIndex in the context menu code and using it as such will give onShovel the info it needs. Although might also be wise to ensure you find a sq before adding that option, too. albion wins again

bronze yoke
#

but there can't be a plant without there being a square

thick karma
#

Oh duh

#

Nevertheless player is an issue lol

fleet bridge
#

Player is passed down isnt it?

#

Oh NVM you're saying the player info being passed down is the player index number

nimble yarrow
#

@bronze yoke i found the exact house from the screenshot and recreated your thumbnail

bright fog
#

lmao

#

just, why

#

was about to ping a mod (not for the thing above)

nimble yarrow
#

LOL (context missing, spammer reported and kicked)

bronze yoke
granite glade
#

Does anyone know how to make the "WorldStaticModel" function work properly in relation to a clothing item??

#

The model path connects for the item itself when worn, but it's been having issues connecting to the model used for the floor. I suspect this is a coding issue?

drifting ore
#

Is there anyone that takes mod requests? specifically Weapons and clothing

bright fog
drifting ore
#

can i get an invite or?

bright fog
#

unlock your dms

drifting ore
#

should be fixed

jaunty glen
# thick karma which becomes increasingly obvious when you check its signature: ``` function IS...

Wow. I did NOT expect so much input so fast ๐Ÿ˜… Thanks a lot guys.

@thick karma , I actually noticed that "player" is just an index, not an object, just didn't know what to make of it. Now that you pointed to onShovel definition... It did become obvious.
So if I got you right, I should be doing this:
`function testShovel(playerIndex, context, worldobjects, test)

local player = getSpecificPlayer(playerIndex)`
jaunty glen
bronze yoke
#

no, that's what burryaga suggested before editing his message - it isn't necessary

#

you use sq to find the plant, if there's no square you wouldn't get that far anyway

jaunty glen
thick karma
#

But the most important thing is to know the type of variable you're passing at all times (and how it will be used when it gets there).

#

Whatever you call it.

jaunty glen
thick karma
#

Yeah, and sometimes character

jaunty glen
thick karma
#

I can see the argument to be made for either word. I think a clear standard should have been set early but unfortunately it is very late in the game for that. I think most people would know you didn't mean playerIndex if you said character when reading your code. Usually, vanilla character only shows up in their classlike modules that are used to instantiate objects; so you'll access it e.g. as self.character. Some modules use the distinction self.player => index, self.character => object, where others use self.playerIndex => index, self.player => object, and I'm sure there's some using playerObj somewhere. A lot of functions I've seen seem to prefer playerIndex, player, but I haven't counted up the various uses or spent equal amounts of time in every file of the game by any means. The OnCreatePlayer documentation favors playerIndex, player, and for me I think that helped set a tone from the beginning of writing a mod involving players on what to use.

#

I would say self.character is less ambiguous in Zomboidland. Oh, and sometimes you'll see isoPlayer. That's fair enough but I don't love the way it looks lol.

#

isoPlayer is somewhat logical as the only referenced instance of an IsoPlayer in some generic context.

#

But... ugly? lol

#

I just don't love the weird abbreviations, they make my code feel less readable

#

I understand it means isometric

#

I just don't like it

#

Or I should say, honestly, I think know that it means isometric, but the person who initially wrote IsoPlayer has never personally confirmed this for me, so how can I really know, and that's why I hate it.

#

๐Ÿ˜ญ

bronze yoke
#

it's better than the lua

#

it's a pretty safe assumption that the iso- classes mean 'isometric'

#

but the lua IS classes?

#

also isometric? Indie Stone?

jaunty glen
jaunty glen
#

I know whining about "b42 too long" is a bad tone, but they've been working on this update for over 2 years now. Honestly I can see them spending a week or two purely on renaming variables. Compared to 2+ years it's nothing

slow graniteBOT
#
saint2805 has been warned

Reason: Bad word usage

jaunty glen
#

uh-oh

tiny sail
#

Anyone have a guide to setting up spawn locations from map mods on a dedicated server?

thick karma
sonic osprey
#

I'm trying to make a mod that adds a book, I want it to affect two skills (Electricity and mechanics), but I don't know how to put it in the script in SkillTrained.
I thought about just separating both skills with commas, but it doesn't work lol

fast galleon
sonic osprey
fast galleon
chrome egret
#

Needing to modify logic in ISWorldObjectContextMenu.createMenu is... rough...

#

Certainly wish more of this was broken up into individual overridable segments, if not dissolved into some kind of "handler" abstraction which would allow configuration closer to the type of objects.

chrome egret
#

Anyone familiar with modifying context menus and know if there's an easier way to hook into it?

neon bronze
#

There are OnFillWorldObjectContextMenu and OnPreFillWorldObjectContextMenu

#

Both fire when you right click in the world

#

So if you need to just add an option you dont have to hook into vanilla context menu

chrome egret
#

I need to override the vanilla code applying to generators, unfortunately

#

There are item predicates and other bits and bobs declared locally

neon bronze
#

Well in that case store tbe old function in a var and call it in your declaration of the create function for context menu you should have all the local stuff from the old one accessible in your new one

#

Unless they store such options in a global table

frank elbow
#

You won't have access to the variables local to the function by calling it in an overriding function, but it does define stuff as globals (unfortunately, I would argue) like generator

chrome egret
#

So do you expect that I can call the vanilla ISWorldObjectContextMenu.createMenu function, then go back to nip and tuck? I know how to add context menus, but haven't looked at possibly removing and reworking them.

#

Those are the options I can observe right now: Replace the entirety of the function, or run the original function and try to remove old generator entries + create new if applicable.

#

For reference, I'm trying to modify generators to sometimes run on gas, sometimes propane, and sometimes be dual-fuel to select between either. The use of local predicates related to petrol is problematic.

frank elbow
#

It's certainly possible to modify existing options in a context menu & that'd likely be a cleaner option than replacing the whole thing. I've done so for the chat context menu & others and I think in both cases I just added an event handler for the relevant event (this is not the case for the chat menu, since that had to override onGearButtonClick instead)

chrome egret
#

Do you have a GitHub (or other) link to an example I could look at, or would I need to download one of your mods to take a peek?

frank elbow
#

I'll grab a relevant example on GitHub, one sec

chrome egret
small topaz
#

Hi! I am currently trying using TileZed to unpack some texture .pack folders in Linux. What I can do is opening them in TileZed's .pack viewer but I am unable to extract them so that they become a normal image file (for example .png). Is there a special procedure to accomplish this? I just tried the "Extract Image" option in the .pack viewer but no success so far...

#

In the "Extract Image" option, what am I supposed to write into the field "Prefix"?

gilded hawk
#

How can I move items only on the server side? I need a way for the server to pull an item from the player inventory, and put it in a container

#

I know that I can use addItemOnServer to move an item, but do I have to remove it too from player inventory too, right?

jaunty glen
# jaunty glen Hey guys. Hitting a brick wall a little bit here, was hoping someone might give ...

Hey guys, me with the shovelling thing again ๐Ÿ˜ฌ
I do this.
ISPlowAction:new(player, sq, handItem, 110)
It works as expected, one thing I want to do is to call a function after this timed action is finished. Is there an event I can subscribe to, or should I check every tick if this action still exists in the queue? (Seems sub-optimal so I'd rather use a better way, if there's any)

I know I can alter ISTimedActionQueue:onCompleted(action) to do what I want when the specific action is finished, but I'd rather not mess with vanilla functions if I can help it.

bronze yoke
#

i'd probably just hook ISPlowAction.perform/stop

#

if your changes are significant you might want to just make a new timed action that inherits from it

chrome egret
#

I also did some workaround stuff in Item Searcher where I pass through the table of "next attempts" for searches so the end of the current action can queue up what's next, but having seen addAfter I'm thinking it can be removed ๐Ÿ™‚

plain crest
#

Is there a folder/download for the file structure for hair mods? I have 0 modding/coding experience but am t try ing to see how possible it is to add some hairs into the game and I find the file structure from the guide to be uh. Confusing for my dumb ass.

#

And to add insult to injury Iโ€™m on a Mac so ๐Ÿคข๐Ÿคข๐Ÿคฎ

#

If that makes a diff

gilded hawk
plain crest
#

(this is just empty folders btw)

fleet bridge
plain crest
#

Does anyone have a link to the female body model in PZ? The links i'm finding are dead :(

#

i can find the male one but not the female one ๐Ÿ˜ญ

plain crest
#

i found it never mind!

bright fog
sleek hull
#

I'm trying to get the 'Sleep' slice in the vehicle radial menu so I can adjust the text in it's confirm dialogue to include additional info about the player.

The only getSlice method I can find is in RadialMenu.class but it's private. Is there a file that I can look into for an example of how this might be done? The only things I've been able to find so far is adding new slices :/

hollow current
sleek hull
fleet bridge
sleek hull
sleek hull
#

This seems to just keep the old function however, the text remains the same

hollow current
#

another approach would also be simply changing the translation itself, though idk if its possible to easily overwrite vanilla translation

sleek hull
#

Also noticed that it was erroring out because I was trying to do local old_ISVehicleMenu.onSleep = ISVehicleMenu.onSleep instead of local old_ISVehicleMenu_onSleep = ISVehicleMenu.onSleep ๐Ÿ™‚

plain crest
#

does anyone know what to do w/ this? i've double, triple, quadruple checked my file structure and i'm certain it's correct i'm dying

sleek hull
plain crest
#

lmk if this isn't helpful but that's everything

#

aaaaaand i see i didn't expand the textures folder. but there's nothing in it.

#

JUST in the contents folder is the preview.png (which, when i deleted it, zomboid got mad) and the mods folder

sleek hull
#

Move preview.png out of /Contents to be at the same level as the Contents folder

#

Should look like this:

plain crest
#

it is D:

sleek hull
#

Oh nvm

plain crest
#

sorry i'm not good at explaining things but that's everything/the file order

#

and i'm like

#

SO CERTAIN it's right but please correct me if i'm wrong..?

#

i even double checked with another hair mod in the steam workshop folder to see what other ppl did and it's...this. shot for shot.

#

so clearly people are SOMEHOW successfully uploading with this structure..?

hollow current
#

.

#

check this out

#

@plain crest

sleek hull
#

That's the issue

plain crest
#

I KNEW IT! I HATE MACS!

#

SON OF A BIIIIITCH!

sleek hull
#

lol

plain crest
#

i thought i could do the cmd+shift+. thing to find/delete those but NO!

sleek hull
#

That would be too easy of a fix for Apple

plain crest
#

thank you and i hate apple. idk who the ceo even is. but i hope they have crumbs in their sheets.

#

this is what i get for trying to work on stuff while not at my home pc LOL

hollow current
#

hahaha

plain crest
#

i was literally thinking "doesn't mac do that stupid thing where it just makes random dumb files..? nah, it wouldn't do that..."

#

GRR! i've been agonizing over this.

#

THAT WAS THE PROBLEM WHY DOES IT DO THAAAAT!

plain crest
hollow current
#

Pleasure!

sleek hull
hollow current
gleaming sorrel
#

I need to ask how to upload a mod to the workshop
I finished mine but have no clue how to upload it

trail lotus
#

anyone interested in making a gambling mod? maybe simple slots players on the server could play to try there luck, possibly other types of gambling games like black jack not sure what the complexity would be of that. also i was thinking for pool tables allow players to challenge others in pool and bet money on it basically its a game of chance who comes out on top and the winner of it gets the money. this could also introduce a billards skill type thing and the more you win the more you level it and it slighly gives you a modifer to increase your chances of winning. if anyones interested in working on something like that let me know im willing to comission it.

thick karma
gleaming sorrel
thick karma
gleaming sorrel
#

I uploaded it and used the example mod folder

thick karma
#

Uploaded it where? You mean downloaded it?

By where is the mod saved, I mean exactly where? What is your mod's filepath?

#

@gleaming sorrel

thick karma
#

I'm trying to figure out what level of organization you've reached when you say you have a finished mod but need help uploading it. It's clearly not finsihed in the sense of "ready for upload" so I am trying to figure out exactly what you mean. Are you missing the Workshop-level directory? Are you missing images? Are you missing the link from Contents to mods? Do you have workshop.txt filled out?

#

Or do you have a working Lua file in some other mod that needs to be entirely relocated to its own mod? Or is your file buried in a generic template directory structure that needs to be adjusted to reflect what your mod does?

gleaming sorrel
#

It's saved to program86%->steam->steamapps->workshop->content->108600->3152792427

#

Then the inner files are
Mods->

Knox Infection->

Media, mod.info, poster, ReadMe.txt->

Textures->

Body

#

Then all of the textures

#

As that's all the mod does

thick karma
gleaming sorrel
thick karma
#

Mods/Knox Infection (which I thought had to be mods/Knox Infection) is mods/YourMod

#

Okay cool

#

You need to put mods/YourMod inside a folder called Contents (written like that), then put Contents in another folder with your mod's name (Knox Infection if that's your original name), then put that folder in %UserProfile%/Zomboid/Workshop.

#

Then you go into %UserProfile%/Zomboid/Workshop/Knox Infection and you make a preview.png and a workshop.txt adjacent to Contents.

#

workshop.txt needs something like this:

version=1
title=Knox Infection
description=Your mod description on Steam.
tags=Build 41;Items;Misc;Multiplayer;Pop Culture;Realistic;Silly/Fun;Traits
visibility=public

(but probably remove / change some tags).

gleaming sorrel
thick karma
#

Yes.

#

This is going in a specific place.

#

I should have clarified that. create Contents, and then put that in a newly created folder named after your mod.

#

After you do everything above you can go into Project Zomboid and select the workshop tab and find your workshop item there and upload it through the available menus.

thick karma
#

Good luck!

proven heron
#

Is it possible to make a mod to limit the gameplay to only Ravencreek, Pitstop and Rosewood?

And have the other maps blacked out.

plain crest
#

so they can't download the mod or use it without it

#

i'm new to this/learning so pls correct if wrong

jaunty glen
# gleaming sorrel Thank you

Hey mate, just thought you may find this useful, it covers a lot of basics
https://youtu.be/N6tZujOPnDw?si=i7XX48hAJ22ktvPs

This tutorial video will show you how to make a simple drink in Project Zomboid. I will go into the steps involved from start to finish. Read more below.

0:00 intro
1:08 Start
1:44 Searching for images to use in game
2:30 Searching for the Sound Effect
3:06 Creating mod file directory
3:54 Creating mod.info
4:34 Creating a poster
7:14 Adding ne...

โ–ถ Play video
gleaming sorrel
#

I'm actually surprised I was able to follow the steps without getting distracted and forgetting them all

#

I'm growing stronger

proven heron
plain crest
#

i kinda want to rip my eyes out and flush them down the toilet. but i made dis. this is literally my first Day using blender so any tips/gentle feedback is appreciated while i try to get this god damn hair mod off the ground...

#

pls use small words for toddlers and babies my brain is smol

jaunty glen
# chrome egret I also did some workaround stuff in Item Searcher where I pass through the table...

not necessarily ๐Ÿ™‚ The problem with addAfter is that (as I understand it) all variables you pass to the next action nave to be already filled the moment previous action starts.
In my case, the thing I want to operate with in the second action is the plant that I create with the first action. So it's not there until the first action completes.
To complete the example, this is how I create timed action
local plowAction = ISPlowAction:new(player, sq, handItem, 110) ISTimedActionQueue.add(plowAction);
But I can't do this straight away
ISTimedActionQueue.add(ISShovelAction:new(player, handItem, CFarmingSystem.instance:getLuaObjectOnSquare(sq), 40))
Because until the first action is completed, CFarmingSystem.instance:getLuaObjectOnSquare(sq) will return nil.
So, if the thing you did allows to circumvent this, don't remove it yet ๐Ÿ™‚

jaunty marten
# jaunty glen Hey guys, me with the shovelling thing again ๐Ÿ˜ฌ I do this. `ISPlowAction:new(pl...

u can do this trick:

local plow_action = ISPlowAction:new(player, sq, handItem, 110)
local plow_action_perform = plow_action.perform
function plow_action:perform(...)

    local result = {plow_action_perform(self, ...)}

    -- here u paste ur code and it will work as `ISTimedActionQueue:onCompleted`

    return unpack(result)

end

tbh u can remove result part cos perform should never return anything but I did it due to some strange author can have a different view and added smth there

local plow_action = ISPlowAction:new(player, sq, handItem, 110)
local plow_action_perform = plow_action.perform
function plow_action:perform(...)

    plow_action_perform(self, ...)

    -- here u paste ur code and it will work as `ISTimedActionQueue:onCompleted`

end

here's full example

local function updateReadPerform(read_action, player, item, player_inventory, container, callback, with_transfer)

    local read_action_perform = read_action.perform

    function read_action:perform(...)

        local result = {read_action_perform(self, ...)}

        if not with_transfer then

            callback()
            
        else

            local new_item = findNewItemInInventory(player_inventory, item)

            if new_item then

                local transfer_from_inventory = ISInventoryTransferAction:new(player, new_item, player_inventory, container)

                transfer_from_inventory.onCompleteArgs = {}
                transfer_from_inventory.onCompleteFunc = callback

                ISTimedActionQueue.add(transfer_from_inventory)

            end

        end

        return unpack(result)

    end

end
jaunty glen
jaunty marten
jaunty glen
# jaunty marten

actually I decided to create my own version of ISPlowAction after all, in this case it's just easier and removes the parts I didn't need anyway. But thanks for your tip, I'm sure it will be useful in some other task ๐Ÿ™‚

swift moon
#

Are there resources on adding placed item models to items? can't find it on the modding page

jaunty glen
#

So I got the shoveling thing working ๐ŸŽ‰ It's better than I first had in mind actually. However, I need another advice on a thing I'm trying to add...

As it is now, player character walks to the furrow when they're about to remove it, fertilize it, etc. One thing they do telepathically though is digging furrow.
I think I can get a grasp why; in almost all actions, ISFarmingMenu.walkToPlant(player, sq) is involved, which in turn is a timed action:
ISTimedActionQueue.add(ISWalkToTimedAction:new(playerObj, adjacent))
Function ISFarmingMenu.onPlow is different from the rest though:
ISFarmingMenu.onPlow = function(worldobjects, player, handItem) local bo = farmingPlot:new(handItem, player); bo.player = player:getPlayerNum() getCell():setDrag(bo, bo.player) end
My understanding is that farmingPlot:new() creates a "blueprint" of a furrow, which is then placed on the ground, triggering digging action.

However, I did not find any declaration of farmingPlot; moreover, since ISFarmingMenu.walkToPlant(player, sq) is a timed action, it is always performed after the furrow is dug, even if placed at the very beginning like this:

function ISPlowAction:waitToStart() self.character:faceLocation(self.gridSquare:getX(), self.gridSquare:getY()) local adjacent = AdjacentFreeTileFinder.Find(self.gridSquare, self.character) ISTimedActionQueue.add(ISWalkToTimedAction:new(self.character, adjacent)) return self.character:shouldBeTurning() end

So, am I correct to assume that this part is happening somewhere outside of LUA and therefore is out of our reach? Or am I not seeing something?

digital osprey
#

noob question, whats the command to display some text above the player in a function?

bright fog
#

That does that

#

This is for the same text as the level up thing

#

That's all from the modding Discord, can't tell you more tho

#

player:say()
player:setHaloNote()
are what you need to look at

barren acorn
#

Completely new to modding, just THINKING about starting - wondering if it was possible to change zombie behavior based on the outdoor temperature

#

Does the game have a variable that the temperature is set to (like 0.01 - 1.00) that the game then displays as Celsius or Fahrenheit? And is this variable able to be referenced?

runic siren
#

is anyone able to alter the audio around certain areas

#

proposal: play The Gonk in malls over a loudspeaker or something

bright fog
barren acorn
bright fog
#

Give me a sec I'll try to find it

barren acorn
#

Cheers. I tried searching with no results myself

barren acorn
#

Oh fuck yeah

runic siren
bright fog
runic siren
#

oh yeah i forgot about that ded

queen oasis
rancid panther
#

i could either add a folder for a multiplayer version or just update the base mod if it is better overall for both modes

#

i think any updates would overall improve the mod, but adding a multiplayer version might make it more clear to ppl who already downloaded it to revisit the mod (within the same workshop entry)

bronze yoke
#

it'd put a maintenance burden on you to update two separate mods

bright fog
bronze yoke
#

multiplayer code should usually be fine for singleplayer

bright fog
#

Yes of course but if he wants to make two parts, instead of doing two mods he can still keep it in the same and it should automatically adapt to multiplayer or solo

#

Tho maybe I didn't understand the issue correctly from the few reads

thick karma
# bright fog Yes of course but if he wants to make two parts, instead of doing two mods he ca...

Joy is deciding whether they want to add an alternate mod version, i.e. a literal second mod, to the same workshop item so that people can choose the version they want, or update the core mod to simultaneously support singleplayer and multiplayer.

I think it would acceptable to make a secondary mod that could be disabled IFF that mod depends on the core mod and interacts harmlessly with it in singleplayer.

However, I think in Joy's case a single mod would probably work. So my preferred approach would be to update the core mod and just make it work for singleplayer and multiplayer.

In that vein, @rancid panther, I have code that could be trivially refactored from True Music Jukebox to do exactly that if you want some help in DMs.

What I personally would never do is release two incompatible versions of the same mod in a single workshop item.

rancid panther
#

i just havent gotten to because of school and family responsibilities

rancid panther
#

i'm so busy that i dont even have time to think about or look at my mod rn

bright fog
grizzled needle
#

Hey so I've noticed that drunk and food temp goes down waaay too fast, especially noticable on longer time scales.

I've written a script that can increase or decrease Drunkenness, but unless I trigger it consistently with a timer based on lastDrink age (which is counted in real life seconds, not in game hours), it's frankly useless.

I'm trying to make it so level 4 drunk takes at least 12 hours to go away, which would be 1hr IRL using default timescale. That's about a 10th slower than it currently goes down. But obviously if I just apply a modifier to my script, and only applies to my script. How do I change the base game decrease value?

And along that same line of questioning, what's the function for food temperature? Even on 4x time scale you basically have to eat food within 10 seconds after you remove it from the oven or it goes cold and you get the "better hot" debuff.

digital osprey
#

how can i use the OnCooked command to apply to every item im cooking? this is what i need to do extra things when something is cooked right? i left the parameter empty and it doesnt seem to work

digital osprey
#

this doesnt work, looks too simplistic to me to work but thats as much as the wiki gives me and i cant find the function in the files
`module OvenAlarm
{
imports
{
Base
}

OnCooked = SoundAlarm_OnCooked,

function SoundAlarm_OnCooked()
    player:Say("My meal is done!")        
end    

}`

neon bronze
#

You dont put your function in the recipe file

#

But in a separate lua file

digital osprey
#

that i put in lua folder yea?

neon bronze
#

Yea

#

lua/server i believe

digital osprey
#

oh nice thank u

small topaz
#

Hi! I am currently working with an object which is derived from ISUIElement. This comes with a render() function which is constantly executed to display graphical ui elements. Is it somehow possible to make it so that the render() function is called more often? Afaik, it is by default called on every three ticks. Is it possible to call it on every tick for example?

bronze yoke
#

the ui has a separate framerate on purpose to save performance (rendering the ui is by far the most expensive part of the lua), you can change the ui framerate in your game settings or do what you need to on your object's update() function

small topaz
#

update() function sounds good! How exactly is this supposed to work?

bronze yoke
#

i'm unsure if it's safe to just call your rendering stuff on update or if there's some special context when render() is called but it's worth a try

small topaz
#

do you know when the update() function is called?

bronze yoke
#

it's every tick if i'm remembering right

small topaz
#

kk. this might help. thanks!! I already tried to experiment a bit with the onTick event but wasn't able to transmit the "self" (which is required for rendering stuff). But update() might help then...

bronze yoke
#

a trick to use events with self```lua
Events.EventName.Add(function(...)
object:method(...)
end)

grizzled needle
# grizzled needle Hey so I've noticed that drunk and food temp goes down waaay too fast, especiall...
-- Decrease Drunk Decrease
local lastDrunkennessValue = getDrunkenness()

function decreaseDrunkenness()
    local currentDrunkeness = player:getStats():getDrunkenness();
    local decreaseAmount = lastDrunkennessValue - currentDrunkenness
    local modifiedDecreaseAmount = decreaseAmount * 0.1 -- Adjust the modifier as needed

    setDrunkenness(currentDrunkenness + modifiedDecreaseAmount)
    lastDrunkennessValue = currentDrunkenness + modifiedDecreaseAmount
end

This is the code I have currently written. Its not working as intended, I think I've missed a callout somewhere.

small topaz
bronze yoke
#

you'd need the object when you're adding the event, e.g.```lua
obj = MyCode:new()

Events.OnTick.Add(function(...) obj:MyFunction(...) end)

#

unless you're mimicking a singleton pattern, then what you had would work

small topaz
#

kk. So obj is just the self I need for my function? And the brackets (...) may contain additional parameters?

bronze yoke
#

yeah, ... stores all the parameters sent to a function

#

using it here to just pass it to the class function regardless of what event it is

#

in your implementation you might just prefer to write out the parameters

small topaz
azure onyx
#

Hello! I just joined this server because i need some help with a school project. Iโ€™m a game design major and my midterm project is re-doing some of the sounds for project zomboid and packaging it as a mod. I have no prior modding experience. My question regards a sound effect found in the tutorial that is attached below as a short clip ( sorry for the quality ). Does anyone know what the name of this file is in the sound bank? i have been searching forever and cannot find it. Any help is appreciated :)

bright fog
#

Wtf is even that sound lmao

bright fog
#

I'm interested if you find a way for no manual install tho

#

I ... Might have something related to a tutorial zombie sound, check out the script file for zombie sounds and bottom should be a tutorial zombie sound but idk what it id, could be that ?

#

No idea if it'll help you find the sound within the bank file but hey that's something at least ?

azure onyx
#

iโ€™ll take a look! thank you! iโ€™m also using Fmod to edit the bank files

dusky flower
#

Zombie dinosaur will be insane

nimble yarrow
#

its not packed.

#

\steamapps\common\ProjectZomboid\media\sound\fzombierand5.wav

#

what school btw @azure onyx

azure onyx
#

George Mason University MasonM

#

think my group and i got it figured out, thank you all for your help :)

jaunty glen
# grizzled needle ```lua -- Decrease Drunk Decrease local lastDrunkennessValue = getDrunkenness() ...

Hey, I'm only in PZ modding for a few days, so I can't offer you a confident advice, but I hope you'll get it - this sounds like a mod I'd use, things like food temp, drunkenness and highness drunk do pass too quickly in this game!

As for your questions, AFAIK food temp only influences the amount of happiness bonus. If I had to guess, I'd try to find and override the variable that defines how many ticks each state lasts, but again, I hope someone more experienced offers your some advice as well!

wild dagger
#

Hey guys, I'm just wondering (maybe veterans or veteran modders would know) if it would be possible to make a custom map to give to players, only containing writing, sort of like a pre written to do list.

I wanted to give them to players in a 10 years later world as soon as they spawn in with a new character. Maybe I could create a map and upload it as a mod, then edit the physical map.

open drum
# wild dagger Hey guys, I'm just wondering (maybe veterans or veteran modders would know) if i...

I am no veteran but the steps I would take, if i want to make it possible:

  1. Create an image item with custom designed map.

  2. Create a item script and a script recipe that would run ISimage .lua

  3. code the .lua to show the custom map image when interacted

  4. use Event.OnNewGame.Add(function) to run the .lua function that would run a snippet code which add item to the character when game starts

  5. Use functions like getPlayer():AddItem(args) within the item giving function

  6. test in the game

#

And ofcourse there are much easier ways like using ingamemap items to call the image you saved etc etc.

bronze yoke
jaunty glen
#

Hey dude. That's a powerful tool you got there. Should be pinned or something, can save a ton of monkey work

#

Doesn't work for me though ๐Ÿ˜ฆ An error says:
< Translating mod: digworms > Traceback (most recent call last): File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 365, in <module> main() File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 357, in main elif try_translate_mod(root): ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 340, in try_translate_mod Translator(translate_path).translate_main() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\basil\Zomboid\mods\pz-translator-main\pz-translator\translate.py", line 52, in __init__ source = self.config["Translate"]["source"] ~~~~~~~~~~~^^^^^^^^^^^^^ File "C:\Python312\Lib\configparser.py", line 941, in __getitem__ raise KeyError(key) KeyError: 'Translate'
Think I did it as instructed (although your readme says to run path_to_script/pz_translate.py while it doesn't exist, so I run path_to_script/pz_translator/translate.py)

#

I have Python 3.12.0 if that matters

upbeat harness
#

Broken mod

jaunty glen
#

You mean the mod I try to translate? Any way to find out what exactly is broken?

upbeat harness
#

I think there is a syntax error or {};

jaunty marten
jaunty glen
jaunty glen
# jaunty glen So I got the shoveling thing working ๐ŸŽ‰ It's better than I first had in mind act...

Didn't find how to do that thing, so I decided to leave it out.
I think the "Shoveling thing" is ready to be published ๐Ÿ˜Ž
https://github.com/toomanynights/digworms
I would appreciate a bit of a code review though. it's my first Zomboid mod, so I imagine I did a lot of things wrong.

GitHub

Contribute to toomanynights/digworms development by creating an account on GitHub.

digital osprey
#

is there a way to make a loop to go through all food items and change the value of a variable or would i need to do it by hand?

digital osprey
#

i need to change the OnCooked parameter to all items that are cookable, im sure i can manage that check but trying to figure out the correct synthax for the loop

#

by default its blank for all i believe#

#

as in i can manage checking if the item itself is cookable but trying to figure out how to reference the items_food script and search it with a loop

bright fog
#

Is that something in the script file ?

digital osprey
#

yeah its a vanilla file

bright fog
#

I mean in the script file or lua files ?

digital osprey
#

item script is txt

#

projectzomboid/media/scripts/items_food.txt is the one i need to search

neon bronze
#

item:DoParam(โ€œOnCooked = my_funcโ€)

digital osprey
#

that will set it right? i kinda thought to do a loop of all food items just in case there is modded food

#

cos with this method id have to hard code each item separately right?

#

or am i just reading that wrong

neon bronze
#

you get ScriptManager i think and it can get every item

#

You then just filter by item type and add your oncooked func

digital osprey
#

sweet thanks ill get onto it ๐Ÿ™‚

#

function fires correctly already but i only have one item it works for for now ๐Ÿ™‚

bronze yoke
#

if it's to do with file reloads (most issues like this are) i don't use them anyway

jaunty marten
#

idk what's more issues can be with file reloading

#

single issue that I got for all time is events with anonymous funcs

bronze yoke
#

all event handlers are prone to issues unless you have specific handling for removing them if the file is reloaded

#

and it doesn't scale well with modules

bright fog
fleet bridge
#

if you do it globally you will also overwrite any recipes that have an oncooked function already

digital osprey
plain crest
#

for this hair mod, is my lua correct for hats? I can get the hair to show up with no hat on, but hats make it disappear

#

i threw the same hairstyle in all groups cuz...testing.

#

actually, i'm noticing whenever I export the FBX file it's only exporting the armature even when I select the shapes...weird.

austere sequoia
#

Hey guys! I am currently trying to make a mod that add hats, but somehow I ran into a wall. I got my item script, and the XML sheet in clothing/clothingItems. I must miss something - when I use an existing hat (I use ChefHat) with my script item, it works. When I rename the ChefHats XML file, and link my script item to the renamed XML file, it all stops working, even though it should just pull the ChefHats model and textures. What am I missing?

small topaz
austere sequoia
#

fileGuidTable.xml What is this?

small topaz
# austere sequoia fileGuidTable.xml What is this?

When adding a new clothing item, your mod must also contain a file called "fileGuidTable.xml" which lists all the new modded clothing items (in addition to the script.txt and the .xml files in clothing/clothingItems). Best idea might be to have a look at other clothing mods to get an idea of how it works.

austere sequoia
#

Is the guid random? or does it have to be specific?

small topaz
austere sequoia
#

Ahhhh! Awesome! Now my last question: does the file have to be named fileGuidTable.xml (exactly likes this)? Or should there be some variation? As in scripts, when I dont change the scriptname I override the vanilla scripts

small topaz
#

Should have exactly this name and located in yourMod/media

#

to see how the fildeGuid has to be organized, check out some clothing mods from other people

austere sequoia
#

Awesome dude! ๐Ÿ™‚ Thank you a thousand times for your help, thats awesome

west dock
#

how are you guys feeling about b42

#

its gonna make redundant countless qol mods and ruin loads of map mods

plain crest
#

the performance optimizations are exciting imo. and i think i'd rather have to download less mods than have to keep layering them on, so i don't mind the redundancy.

bright fog
thick karma
#

I WISH vanilla Zomboid had that level of gamepad support. Please make everything I ever did redundant, Zomboid Santa.

outer crypt
thick karma
#

@rain rune @crystal oar

#

Bread needs to acquire a new file

#

Validating now.

#

So that could be significant to this issue.

crystal oar
thick karma
#

Oops

#

๐Ÿ˜ญ

crystal oar
#

all good lol

digital osprey
#

how would i get the size of an ArrayList? this doesnt seem to work

local items = getScriptManager():getItemsByType("Food"); local int se = arrayList.size(items);

hollow current
#
local items = getScriptManager():getItemsByType("Food");
local itemsSize = items:size()
print(itemsSize)```
digital osprey
#

perfect no more syntax errors, but size comes up as 0

#

should i make it global or something or do i need to import the file

#

with the food items

#

thanks by the way, im tired tired

hollow current
#

i don't think it'll work the way you're expecting it to to work since "Food" is more of a category

#

This is meant to be used for something like "Needle"

digital osprey
#

hmm so i have to getAllItems() and check for type variable? in the scripts food items have type set to "Food" thats why i assumed

#

yeah with getAllItems() i get 2285 size, thats disappointing

digital osprey
#

kill me this way doesnt work either ๐Ÿ˜„ without the if statement it prints out Food

`for i = 0, itemsSize-1 do
local c = items:get(i):getType();
--print(c);
local f = "Food";

if c == f then
    print("Found Food, Loop: ", i);
end 

end`

hollow current
#

Should work

#

item:getType seems to return a IsoObjectType rather than a string

digital osprey
#

yess thank u so much

#

maybe i can make that other function work so

#

getitembytype

mystic vessel
#

Good evening everyone, I would like to ask a question. A while ago I managed to download PNGS tile files
(I want to repeat the process to make a model with reference to this tile)

However, 70% of the tiles do not appear here in this tool, and I don't even remember how to download just one specific tile as an image

#

I probably don't know how to do the tile import process

coarse sinew
hollow current
#

Hello! Just wanted to say that after literally months of trying to fix an issue in my mod, where in multiplayer, if you try to change an item's name in a container that is not main inventory, the new name wouldn't stick, I finally managed to fix it by simply using the following snippet after setting the new name. :')

item:getContainer():getParent():transmitCompleteItemToServer()```

Edit: nvm solution duplicates the containers for some reason
jaunty glen
austere sequoia
#

Hey guys! I am trying to get the hair textures, whom I guess are hiding in the characters.pack file. TileZ cannot open or display or extract this one pack for me. How do I get to the needed files?

austere sequoia
#

I know about the F_Hair_White textures etc existing outside of the .pack, I am specifically looking for all the colored ones

#

Or maybe even better: Is there a way to implement the color-pick-stuff that we have in character creation to ingame itemcrafting? As in being able to pick on crafting, wether a shirt is red, blue or black?

thick karma
slow graniteBOT
#
bema600 has been warned

Reason: Bad word usage

nova storm
#

is there any one source of documentation for PZ modding? I'm beginning work on an Archipelago Randomizer integration for Zomboid and would like to know where to start with research

halcyon monolith
nova storm
chrome egret
# frank elbow https://github.com/omarkmu/pz-omichat/blob/dev/Contents/mods/OmiChat/media/lua/c...

Hey again @frank elbow! I'm adapting my code from your example, and wanted to ask what your motivation was for grabbing the player off of the context menu option, instead of using the first param passed to your onContextMenu function (which you have wired into Events.OnFillWorldObjectContextMenu), as well as the isParamPlayer check that verifies player is an instance of IsoPlayer? I think my case might just be a little more complicated, and param2 for the context menu option doesn't always end up being the player, whereas you were always able to count on param2 being the player.

frank elbow
#

Might be clear from context but just in case, the purpose of the snippet I sent is using player names rather than usernames in context menus (which is why it involves another player)

chrome egret
slow graniteBOT
#
scarbug13 has been warned

Reason: Bad word usage

digital osprey
#

where in the files can i find the getter functions? trying to get the value of IsCookable but getIsCookable or getCookable gives errors Found it cheers!

terse salmon
#

hi guys, don't judge too harshly, first question

I have a Lua code that runs on the server and creates zombies near the player. After that I want to add items that zombies will have after death.

a zombie is created, but after death the set of items is standard. I suspect that the problem is in zombie synchronization between the server and the client. How do I start the synchronization process?

    local zombie = helper.createZombie(player:getX() + 3, player:getY() + 3, player:getZ())

    zombie:clearItemsToSpawnAtDeath()


    for i=0, playerItems:size()-1 do
        local item = playerItems:get(i);
        if item ~= null then
            print(item:getFullType())

            if (item:getFullType() ~= null ) then
                zombie:addItemToSpawnAtDeath(item)
            end
        end
    end

thank you in advance

digital osprey
#

why does this throw errors

local stk = getScriptManager():getItem("Base.Steak");
print(stk:isCookable());
neon bronze
#

Its isIsCookable

digital osprey
#

ugh.. thanks again!! can u tell me where do u find those?

neon bronze
#

In the javadoc for pz

digital osprey
#

oh i was checking InventoryItem tyvm again

fleet bridge
terse salmon
fleet bridge
terse salmon
#

If you throw documentation on synchronization at me, I will be very grateful, I couldnโ€™t find such a guide on the Internet

fleet bridge
terse salmon
#

Thx, I ll try shortly

hollow current
fleet bridge
hollow current
#

I never saw that method before. Could try it

fleet bridge
#
   public void putRequestSyncItemContainer(ItemContainer var1) {
      if (var1 != null && var1.parent != null && var1.parent.square != null) {
         this.putRequestSyncIsoGridSquare(var1.parent.square);
      }
   }

   public void putRequestSyncIsoGridSquare(IsoGridSquare var1) {
      if (var1 != null) {
         SyncIsoGridSquare var2 = new SyncIsoGridSquare();
         var2.x = var1.x;
         var2.y = var1.y;
         var2.z = var1.z;
         var2.reqTime = 0L;
         var2.reqCount = 0;
         synchronized(this.requestsSyncIsoGridSquare) {
            if (!this.requestsSyncIsoGridSquare.contains(var1)) {
               this.requestsSyncIsoGridSquare.add(var2);
            } else {
               DebugLog.log("Warning: [putRequestSyncIsoGridSquare] Tryed to add dublicate object.");
            }

         }
      }
   }```
nova storm
#

are there any server admin commands able to send an item to a specific container instead of a player's inventory?

#

for archipelago i was thinking of letting players designate a "checks cabinet" where all their received items would go

#

and since my intention is to have AP communicate with a locally hosted server, i think admin commands could simplify a lot of things

nova storm
#

followup question: is it possible to make a backpack style item fit in any slot? Like say, a bag of holding type underwear? For nothing weird, just need clothing to store AP items being sent when in combat because i'd hate to see someone die because they got sent a sledgehammer while running from a horde and would like to not take up any actually useful clothing slots

bronze yoke
#

to my knowledge clothing can have an inventory in any body location

nova storm
#

exquisid

#

the boxer shorts of Holding will be real

sleek hull
#

Is there a get function for getting the 'Bloody' value of a player shown in the 'Wash' context option? I thought getPlayer():getTotalBlood() might be it, but it returns 17 instead of the expected 95. Looked at getTotalBlood() in IntelliJ and it seems to just be adding the blood level of clothing to var1 += ((HumanVisual)this.getVisual()).getTotalBlood(); (haven't looked at this part of it yet).

bronze yoke
#

the value in this ui is calculated with this```lua
local visual = playerObj:getHumanVisual()
local bodyBlood = 0
for i=1,BloodBodyPartType.MAX:index() do
local part = BloodBodyPartType.FromIndex(i-1)
bodyBlood = bodyBlood + visual:getBlood(part)
end
bodyBlood = math.ceil(bodyBlood / BloodBodyPartType.MAX:index() * 100)

sleek hull
bronze yoke
#

yeah, i cut out the dirt stuff to make it clearer but they do it exactly the same as part of the same loop

sleek hull
#

I imagine with the dirt calculations its basically just local bodyDirt, bodyDirt = bodyDirt + visual:getDirt(part), math.ceil(bodyDirt / BloodBodyPartType.max:index() * 100) next to where it does the same things for blood.
Thanks again ๐Ÿ‘

jaunty glen
sleek hull
#

Was too focused on the blood & dirt part

torn igloo
#

Are there an workshop project on github that uses action workflow to upload to workshop? I want to use it as reference to setup mine.

karmic wedge
#

I've made a script that transcribes Star trek TNG episodes to VHS tapes
Oh lord time to do literally every episode.

digital osprey
bright fog
pulsar rock
#

Please do Enterprise & Voyager next (the objectively better-than-TNG shows)

karmic wedge
#

RikerSip wrong
But I'll probably make the tool public n MIT so community can just have fun transcribing all their favorite shows

karmic wedge
#

Is there an nice list of codes that work on VHS tapes somewhere?

graceful niche
#

Im thinking about making a map, one that would be a perfect base in my mind and its based off of my irl work place. I have zero mapping experience for im looking for any pointers or tips.

karmic wedge
#

I made the tool convert emojis on lines thrown into the transcript, that way I dont have to manually add all the codes for events I want other than the generic boredom

nimble yarrow
#

LootZed doesn't work for zeds, does it?

digital osprey
delicate ginkgo
#

can you call other mods sanboxvars just by using SandboxVars.XYZ, or do you need to somehow tell game its not vanilla sandbox setting?

grizzled needle
#

How hardcoded is the health system?

bronze yoke
#

very

grizzled needle
#

I'm looking in the lua files (might have to crack open some java classes) trying to see if there's a way for me to add more types of injuries, body parts, etc

bronze yoke
#

it's all hardcoded java stuff

grizzled needle
#

What about death?

#

I've noticed the camera hooks on your body when you die

#

I want to see if its possible for me to use that system to allow people to knock you out, and pick you up like any other corpse

#

As well as reviving you, directly

bronze yoke
#

i haven't seen the code for that specifically but i would imagine it's also java and as hardcoded

#

the longer something has been in the game the more likely it is to be crazy hardcoded

grizzled needle
#

I'm better with LUA than I am with Java, buuut, at least it isn't C..... which I simply cannot do beyond edits

#

I know java modding is possible with this game

#

But, I have to learn how to actually do it

#

LUA is easy, you can just make a file and make sure the structure is correct

#

Java.... I dunno where to begin with that

bronze yoke
#

it's usually done by decompiling a class, editing it, recompiling it and just replacing the vanilla class file with the modded one, it's not elegant at all

vast sphinx
#

Im having some trouble Overriding recipies and i dont know why

#

The first file works perfectly fine and overrides properly, but the second file just doesn't override

cosmic ermine
#

My mod is finally finished, it supports Mod Options. I only need to make a icons now.

jaunty glen
#

been wondering about something. You can knock a mailbox over with your car, but it won't react to melee attacks. Been wanting to mod that in for some time now for... reasons. Does anybody know where to dig? I've searched through LUA code and only found translation and loot distribution stuff. So, being knocked over is probably something that happens in java, right?

cosmic ermine
#

If it does exist in Java then it might be a bit difficult to read since some of the variable names are literally just varX.

karmic wedge
#

Can a crafting recipe result in multiple things?

fast galleon
karmic wedge
#

Alright, though so. Thanks

karmic wedge
#

Wait, do generated VHS tapes not have an ID for spawning?

#

Wont be able to spawn it via craft recipie, oh no.

#

Unless there's some way to use the change recording function. Need some docs

bright fog
#

uh

#

I'm trying to think of a mod that would do something with VHS like that but none comes to my mind

fast galleon
karmic wedge
#

Yeah I found that debug option but I cant find a lua function

fast galleon
karmic wedge
#
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
    for i = 1, 26 do
        player:getInventory():AddItem("VHS_Retail");
        player:getInventory():getLastItem():setRecordedMediaData(TNG_VHS_S1[i]);
        player:getContainer():setDrawDirty(true);
    end 
end

Blessed, potentially?

fleet bridge
karmic wedge
#

Neat

#

Just need to be able to spawn all 26 so doing it as a function

fleet bridge
#

you can just add them to the distributions, no?

karmic wedge
#

I could but I dont want to bloat the spawn tables too much
178 episodes is a lot...

fleet bridge
#

oh you're doing some sort of box-set item

karmic wedge
#

I feel like you'll never all of them in one zomboid world with RNG I believe.
So gonna mix in some box collections in homes, yeah

fleet bridge
#

never seen getLastItem()

karmic wedge
#

Neither have i, copilot reccomended it, we'll see how far it gets

fleet bridge
#

fairly certain it's not an actual function

karmic wedge
#

Haven't gotten an error thrown yet but zomboid isnt able to find the lua function

#

If there's an error in the code like the getLastItem bit will it just not be able to find the function?

fleet bridge
#

no it'll just pop the error when it hits that line

karmic wedge
#
local TNG_VHS_S1= {
    "TNG_S1E1+2",
    "TNG_S1E3",
    "TNG_S1E4",
        ... This continues up to 26 items
}

function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
    for i = 1, 26 do
        player:getInventory():AddItem("VHS_Retail");
        player:getInventory():getLastItem():setRecordedMediaData(TNG_VHS_S1[i]);
        player:getContainer():setDrawDirty(true);
    end 
end
    recipe Open Star Trek: The Next Generation VHS Collection 1,
    {
        TNG_VHS_Collection_S1,
        Result:TNG_VHS_EmptyCollectionBox,
        RemoveResultItem:true,
        Sound:PutItemInBag,
        Time:20.0,
        OnCreate:Recipe.OnCreate.TNGVHSCollectionS1,
    }

Not sure what im doing wrong here

fleet bridge
#

is the mod file that contains the recipe function loading?

karmic wedge
#

Yeah

fleet bridge
#

try removing the comma from your recipe name?

#

not sure if that matters, but nothing else looks wrong

#

you can change for i = 1, #TNG_VHS_S1 so the function will just adjust based on the size of the array, but i dont think thats an issue either

#

if you're in debug mode, you can see if the file is loaded or not - if for whatever reason it did not load it won't show up in debug when you press F11

karmic wedge
#

Oh. It's not loading the recipecode.lua file

karmic wedge
#

Should the lua file for recipiecode be in server or shared?

#

other mods Ive looked at for stuff like this put it in server

neon bronze
#

Put it in server

fleet bridge
#

you should not be overwriting recipecode.lua though

karmic wedge
#

Apologies, yeah.
Has it's own name TNG_recipiecode.lua as to no overwrite anything

fleet bridge
#

yea, it doesnt matter if its in client or server, but most people will look in server for it since thats where the vanilla file is located

karmic wedge
#

item:setRecordedMediaData(SeasonOne[i]); upsidedown_cry throws an error

#
function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
    for i = 1, #SeasonOne do
        local item = player:getInventory():AddItem("VHS_Retail");
        item:setRecordedMediaData(SeasonOne[i]);
        item:getContainer():setDrawDirty(true);
    end 
end

Scrapped getLastItem in favor of this currently.

neon bronze
#

Is seasonone declared somewhere?

fleet bridge
#

it was suppose to be TNG_VHS_S1[i]

#

unless you renamed that array

karmic wedge
#

Yeh, SeasonOne now.

local SeasonOne = {
"TNG_S1E1+2",
"TNG_S1E3",
"TNG_S1E4",
"TNG_S1E5",
...
}

function Recipe.OnCreate.TNGVHSCollectionS1(items, result, player)
    for i = 1, #SeasonOne do
        local item = player:getInventory():AddItem("VHS_Retail");
        item:setRecordedMediaData(SeasonOne[i]);
        item:getContainer():setDrawDirty(true);
    end 
end
fast galleon
#

setRecordedMedia takes MediaData as argument, that's probably why you get error.

#

this seems to be the way to get it getZomboidRadio():getRecordedMedia():getMediaData(id)

karmic wedge
#

SUCCESS! duin_cheer

#

Complete snippit for anyone searching for this in the future

-- Add VHS_Retail to player's inventory
local item = player:getInventory():AddItem("VHS_Retail");
-- get media Data for the related tape name
local mediaData = getZomboidRadio():getRecordedMedia():getMediaData((YourMediaID));
-- set the media data to the item
item:setRecordedMediaData(mediaData);
-- Refresh the inventory
item:getContainer():setDrawDirty(true);
fleet bridge
#

is the inventory refresh necessary? what does that do?

ivory gyro
#

Hey, anyone know how to get player by his steamid ?

fleet bridge
#

you might be able to using the scoreboard

rugged heath
#

So I'm trying to add a custom option to the context menu when right-clicking on a zombie corpse:


TakeFromCorpse = {}

TakeFromCorpse.inventoryMenu = function(playerId, contextMenu, items)
    local player = getSpecificPlayer(playerId)
    local item = nil
    for _, v in ipairs(items) do
        item = v
        if not instanceof(v, "InventoryItem") then
            item = v.items[1]
        end
        if item:getType() == "CorpseMale" or item:getType() == "CorpseFemale" then
            contextMenu:addOption("Take [Item] From Corpse", player, TakeFromCorpse.takeFromCorpse, item)
        end
    end
end

TakeFromCorpse.takeFromCorpse = function(player, corpse)
    return
end

Events.OnPreFillInventoryObjectContextMenu.Add(TakeFromCorpse.inventoryMenu)```

This works when I pick up the corpse and then right-click it inside my inventory, but not when I right-click the corpse on the ground. Does anyone know why? Is there a different event I have to register it to?
fleet bridge
#

you're using inventory object event

#

you need to use the world object event

#

Events.OnFillWorldObjectContextMenu.Add

rugged heath
#

thanks, i figured it was something like that

misty cloak
#

so i made a discord bot to monitor my pz server named Queasy bot . idk if its realavant to mod development but im willing to share the source code if anyone interested

bright fog
delicate ginkgo
#

Hi, I would like help. I was trying to patch ones mod function using one guide, but it seems it doesnt work.
I checked that my lua file with patch is loaded after original. I even see that lua in debug.
original function:
local function getMaxSkill(character, perk, bonus)

new function:
local function new_getMaxSkill(character, perk, bonus)

At the end of Patch lua I have event callback which should overwrite original function

#
--if getActivatedMods():contains("SkillLimiter") then

    local original_getMaxSkill

    --local currentXPBoost = player:getXp():getPerkBoost(Perks[skillName]);
    local function new_getMaxSkill(character, perk, bonus)
    print("Running Patch version of getMaxSkill")    
            --local character_profession_str = character:getDescriptor():getProfession()
            --local trait_perk_level = 0
            --local currentXPBoost = 0;
            
            -- Go through all traits and add their relevant perk level to the total
            
        local perk_name = perk:getId()
        local currentXPBoost = character:getXp():getPerkBoost(perk_name);
            

            -- Go through the XPBoostMap of the profession and add the relevant perk level to the total

        --if bonus then
            currentXPBoost = currentXPBoost +1 
        --end

        if currentXPBoost <= 0 then
            return SandboxVars.SkillLimiter.PerkLvl0Cap
        end
        if currentXPBoost == 1 then
            return SandboxVars.SkillLimiter.PerkLvl1Cap
        end
        if currentXPBoost == 2 then
            return SandboxVars.SkillLimiter.PerkLvl2Cap
        end
        if currentXPBoost >= 3 then
            return SandboxVars.SkillLimiter.PerkLvl3Cap
        end
    end
    
    -- add a even callback that performs the overwrite
    Events.OnGameBoot.Add(function()
    -- store the original function. Note we dont store until we're ready to overwrite
    original_getMaxSkill = getMaxSkill
    -- now overwrite
    getMaxSkill = new_getMaxSkill
end)```
nimble yarrow
#

You can save custom variables onto an IsoObject, by using setmetatable in its getModData().

Does this have to be a metaTable? Can't I just save a custom int, or string?

also, if this object is picked up, then placed in the world again, does the item have the custom modData, or is it created fresh, when dropped?

plain crest
#

Question: If I want my mod to have a longer description (with pictures and the like), what do I need to do to the Workshop file so it doesn't overwrite any changes I make on Steam's end? Do I need to code/write the description in the workshop file..?

bronze yoke
compact mason
#

Hi. Explain the difference between the server, client, and shared folders?

nimble yarrow
plain crest
bronze yoke
compact mason
nimble yarrow
#

@bronze yoke

#

using WaterGoesBad + my patch, WaterDispenser + my patch ...
having fun playthrough, so thirsty......... exploring Dirkerdam, found 6 full WaterBarrels.
surprise 2400 units of clean water.

New mod is in the works, everything is going well. But ideally I could just save a variable into the modData for vanilla WaterBarrels, to know if I've already tainted them. Currently just saving a whole table

bronze yoke
#
local modData = obj:getModData()
modData.idealCustomInt = 1
modData.customTable = {}
#

i think you're overcomplicating it

#

mod data is just a table

nimble yarrow
#

can I just remove customTable then?

bronze yoke
#

if you don't need it, yeah

nimble yarrow
#

osnap

nimble yarrow
#
local barrel = SomeFunctionThatReturnsIsoObjectBarrel
if barrel ~= nil then
    local barrelModData = barrel:getModData()
    --code is happy, but look at these nested if's. instead, let's use 'inversion'. That's probably a better coding practice.
end
local barrel = SomeFunctionThatReturnsIsoObjectBarrel
if barrel == nil then end

local barrelModData = barrel:getModData()
--158,000 errors! attempted index: getType of non-table: null
small topaz
#

Hi! Does anyone knows whether the game calles the render() functions you find in the java code more frequently than the render() functions you find the lua code?

sleek heath
#

i hate the fact that if i wanna rename a singular song (due to an incorrect spelling mistake) in my music mod I have to essentially reupload the entire mod and I know people are gonna rage when i do cause they'll all have to redownload a 7GB mod lol

gleaming sorrel
#

I finished my zombie re-texture mod
But I want to try to make a custom animation
Does anyone have and sort of tutorial
I can use to find out how to do so?

bright fog
#

You have a few examples of mods that modify zombie animations

nimble yarrow
#

is there a lua event that can be used as a psuedo 'placed furniture' or 'finished carpetry craft' ? hmmm

hollow current
sleek heath
#

i had to do this because with true music you cant simple change the name of a file

#

it might break the mod itself due to the names not being the same

#

and well every time i tried for some reason file explorer would lock up and freeze lmao

#

its funny how doing the true music thing makes my cpu go at like 100 Celcius lmao

#

i had run my desk fan into the pc cause of that

#

LOL

#

but its all done i just gotta reupload but imma wait til the next batch of music

#

i also wish the workshop updated the actual size of the mod

#

wait hold up

bronze yoke
#

it will only replace files that have been modified, if you replaced them with identical files with the same name it won't redownload them

sleek heath
#

it actually updated it

#

wow

#

that wasnt the case before

#

jesus hahaha

#

music is large

bronze yoke
sleek heath
#

meanwhile my actual music collection

#

i like how im trying my best to add as much jungle/drum & bass music to these mods while respecting the year of release

bright fog
#

wtf

sleek heath
#

mostly just dnb and jungle though

bright fog
#

Understandable then

gleaming sorrel
#

Though I can try to figure out what shenanigans they pulled to reanimate them

bright fog
#

Depends what you want to do

#

Are you planning on replacing the animations for every single zombie ?

#

Or just for a few ?

#

I had to reverse engineer those mods to fully understand how they work and how to modify the animations of zombies

#

Since I work on a mod that adds different types of zombies, I had to understand how to trigger custom animations for specific zombies and LeaperZed was the solution

nimble yarrow
gleaming sorrel
bright fog
#

New ones, without replacing the current ones ?

gleaming sorrel
bright fog
#

Okay so that's the easiest part

#

Do you know how to create animations for PZ ?

gleaming sorrel
#

I gotta learn somewhere

bright fog
gleaming sorrel
#

Thanks for that

bright fog
#

This guide won't answer 100% of your questions, but on the Blender part it's fairly good

#

Also it has an IK character for easy animation

gleaming sorrel
#

I struggle most with blender so I'll definitely need that the most

bright fog
#

Search for small tutorials on how to animation an armature

#

It's fairly easy to understand but can be tough to master if you don't know shit in animation

gleaming sorrel
#

So hopefully it's at least doable for a first animation

bright fog
#

Out of curiosity, you're taking inspiration from something ?

gleaming sorrel
bright fog
#

๐Ÿ‘Œ

#

I'm working on The Last of Us Infected and explored custom animations to recreate Clickers the past 2 months

#

Currently rewriting the mod to make it more flexible and easier to modify + more optimized but once I'm done with the basics I'll code back in the custom animations, finish them

gleaming sorrel
bright fog
#

Worked with a friend to make a couple animations, at first he was working in parallel but he can't work on it at all rn

gleaming sorrel
bright fog
#

yup

#

I was able to make it trigger randomly after some time

gleaming sorrel
bright fog
#

Possibly yes

#

I believe almost anything is possible with animations

#

The issue is just the pure lack of documentation and examples on the subject

#

I'm basically the second guy exploring custom animations for different zombies after Glitcher with his LeaperZed lol

gleaming sorrel
#

I can imagine that being nice to fill in the missing level of immersion
My zombies turn by throwing up, twitching and then ripping their jaw off
Which isn't present with the base textures
They just appear on you when you turn

bright fog
#

If you're interested to maybe go more deeply in it, you could come on the PZ modding Discord, I explained a lot of stuff in the animation channel and talked a lot about it and how it works + added examples of the result in-game in the post for my mod

gleaming sorrel
#

Hell yeah

swift moon
#

Could I also get an invite to that?

#

Do UVs also have to be 64x64?

bright fog
#

Only the size of the texture matters

stark spade
#

Hello, I'm trying to apply arsenal's attachment to the nerf gun I made. Most of the time, I put all the existing arsenal guns in DoParam() and then add my nerf gun, which leads to a messy situation in the code.
Other than DoParam, is there a way to simply 'add' the parameters of a specific script?

local gunfighter_rifle="MountOn= K13_SMG;M16A1; M16A2; M16A3; M4; M4A1; Bush_AR15_MOE; Bush_XM15; Bush_XM15_Custom;M723; XM117; H416; AR18; AR18_Fold; AR57_PDW; AR57_PDW_Fold; AR57_PDW_Long;LVOA_C; ColtM16; M16Tape; M16Wood;AK47; AKM; AK103; AK74; AN94; AK12; AK12_Fold; AK12_New; AKM_Gold; AKM_Custom; AK74_Custom; AK308; RPK74;G36; G36C; G36KV; G36_Fold; G36C_Fold; G36KV_Fold; SCARL; SCARH; SCAR20; SCAR_B; Shrike; XM8; XM8LMG; L85; L85A2; K2C1_PH; K1DEV; K2_C1; K2_1; K2_203; DR_200; K2_ADVK2; K2_Grunt; K1A_DEV; K1A_DEV_Fold; K1_1; K1_1_Fold; MK47; ADAR; KAC_M203; AssaultRifle,Nerf_gun_inc"

If it was like this, it wouldn't be beautiful.

slow graniteBOT
#
sirclixy has been warned

Reason: Bad word usage

tranquil reef
#

Anyone know how I can replace / add a clothing item to a zombie through a script

#

Or any mods that do this so I can reverse engineer lol

tranquil reef
#

Also, giving a zombie an item on runtime works, but the item doesn't appear in the corpse inventory when it dies. Any way to keep the item in existence there?

glossy frost
#

Hey, I would like to change the loading music (when you connect to a server), do you guys knows how I can do that please ?

#

I tried to replace in file named preface.ogg in media/music but it doesn't work

karmic wedge
small topaz
#

Is the lua event "OnGameStart" also triggered when the player joins an existing world with a new character (i.e. player dies and then chooses the option "Create new character")?

sour island
#

Also slapped up this hot new spiffo for the occasion

delicate ginkgo
#
        --CurrentXPBoost -> 0/1/2/3 based on player:getXp():getPerkBoost(Perks[skillName])
        if (CurrentXPBoost == 0) then
            CurrentLimit = SandboxVars.SkillLimiter.PerkLvl0Cap
        elseif (CurrentXPBoost == 1) then
            CurrentLimit = SandboxVars.SkillLimiter.PerkLvl1Cap
        elseif (CurrentXPBoost == 2) then
            CurrentLimit = SandboxVars.SkillLimiter.PerkLvl2Cap
        elseif (CurrentXPBoost == 3) then
            CurrentLimit = SandboxVars.SkillLimiter.PerkLvl3Cap
        end

Dont you know what I could be doing wrong?

#

I checked log using print and I get after this code

#

since CurrentXPBoost is 0 I was expecting to first if to trigger and fill CurrentLimit with 4

#

but it skipped all and just left CurrentLimit at default number

small topaz
#

How do I recompile a decompiled java file from the vanilla code so that it becomes a .class file again?

delicate ginkgo
#

nevermind already found out what was wrong and it works now

tranquil reef
#

I wanna play a theme when a zombie is nearby, any way to do this? I know I can use zombie:playSound but how would I go about looping this

bright fog
#

like a do while loop that checks if conditions are met

crystal oar
#

does anyone know how vehicle start chance is calculated and where i can find that info in the game files for reference?

smoky karma
#

`` -- LockForcingMod.lua

-- Function to force lock on doors
function forceLock(worldObject, player)
local screwdriver = player:getInventory():FindAndReturn("Screwdriver")

if screwdriver ~= nil and instanceof(worldObject, "IsoDoor") and worldObject:isLocked() then
    worldObject:setLocked(false)
    print("Lock forced successfully!")
else
    print("Unable to force the lock.")
end

end

-- Hook into the right-click context menu
Events.OnFillWorldObjectContextMenu.Add(
function(_worldobjects, _player, _context, _worldobjectsMenu, _test)
for i = 1, #_worldobjects do
local worldObject = _worldobjects[i]
local option = _context:addOption("Force Lock", worldObject, forceLock, _player)
option.toolTip = "Attempt to force the lock using a screwdriver."
end
end
)
``
Why doesn't this work? I just keep getting a non-specfic error

bronze yoke
#

what error?

smoky karma
#

``STACK TRACE

function: Add -- file: LockForcingMod.lua line # 18 | MOD: LockForcingMod
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@5d237c0
function: createMenu -- file: ISWorldObjectContextMenu.lua line # 1543 | Vanilla
function: createMenu -- file: ISMenuContextWorld.lua line # 50 | Vanilla
function: createWorldMenu -- file: ISContextManager.lua line # 28 | Vanilla
function: doRClick -- file: ISObjectClickHandler.lua line # 60 | Vanilla
function: onObjectRightMouseButtonUp -- file: ISObjectClickHandler.lua line # 379 | Vanilla.
[17-02-24 14:09:05.390] ERROR: General , 1708200545390> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: __len not defined for operand at KahluaUtil.fail line:82..
[17-02-24 14:09:05.391] ERROR: General , 1708200545391> DebugLogStream.printException> Stack trace:.
[17-02-24 14:09:05.392] LOG : General , 1708200545392> -----------------------------------------
`` That's all I can get

bronze yoke
#

your OnFillWorldObjectContextMenu handler doesn't match the signature of the event

#

int playerIndex, ISContextMenu context, table worldobjects, boolean test,

bright fog
#

Also to put things in code block you can use ` 3 times instead of just 1

#

Like this

this is a code block
bronze yoke
#

if you read what i just deleted about addOption disregard it ๐Ÿ˜… misremembered something

smoky karma
#

Okay so far so good, it doesn't cause errors right away

nimble yarrow
#

@bright fog

bright fog
chrome egret
#

Vanilla has some code in \server\Map\MapObjects\MOGenerator.lua** which wires up a local NewGenerator function using MapObjects.OnNewWithSprite. I've created my own server\MOGenerator.lua file to replace this behavior and call my version, but I never see my function called even when I come upon a generator in the world, or add the item version into my inventory and drop it in the world. Can anyone offer some insight into what I might've missed?

#

I see the log message at the end of the file, so I know the code is executing/not bombing with a lex exception.

#

Sorry, the vanilla path is \server\Map\MapObjects\MOGenerator.lua. I'm not using a path like that but don't expect that to make a difference.

outer crypt
#

I have a change in a script file that mutes the RadioTalk by giving it a soundless audio file. But there is another mod that uses this file and adds to it. Is there a way that I can still suppress the vanilla file without affecting another mod? I tried this but obviously this kind of code can't run here...

digital osprey
#

trying to use OnFillWorldObjectContextMenu but this line throwing errors

local worldobjects_size = worldobjects:size();
bright fog
#

send the errors too or don't expect much from people

digital osprey
#

object tried to call nil, but when i get rid of this line and just do print worldobjects it prints a list link

bright fog
#

a table "link" you mean

digital osprey
#

yes

bright fog
#

did you declare worldobjects_size before ?

digital osprey
#

no the file looks like this

bright fog
#

looks like what ?

digital osprey
#
function NF_ISWorldObjectContextMenu_OnFillWorldObjectContextMenu(player, context, worldobjects, test)

local worldobjects_size = worldobjects:size();
print(worldobjects);
base_menu =  context:addOption("Upgrade Stove", worldobjects, nil);

end

Events.OnFillWorldObjectContextMenu.Add(NF_ISWorldObjectContextMenu_OnFillWorldObjectContextMenu);
#

was formatting commented out stuff ๐Ÿ˜„

bright fog
#

Why is your function name so long oh god

#

Anyway, try changing the variable name ? worldobjects_size

#

Also you don't have any use for worldobjects_size in your function

digital osprey
#

hmm no still the same named objectssize

#

i dont think there is a var inside the entire mod called that

#

and what i sent is the contents of the entire file

bright fog
#

There's no point for local worldobjects_size = worldobjects:size(); to exist is there ?

digital osprey
#

i want to check for stoves, make a loop to go through the list of things, decide if i want to show my button or not, i think i need the size to make the loop

lost ocean
#

Brad Vickers From Resident Evil. My first attempt at a mod for Project Zomboid. (Otherwise just a model for blender if i can't figure out how.)

#

the mod is the outfit.

bright fog
digital osprey
#

i just got this table that i cant even get the size of ๐Ÿ˜„ i want to be able to make upgrades to the stove, but not sure if you can do it with recipes when its a moveable so figured ill do it through the context menu, OnFillWorldObjectContextMenu is passing the list of worldobjects but cant figure out how to get actual container references from it so i can get to the isostove class or something

bright fog
#

instead of worldobjects:size()

digital osprey
#

nice works thank u, gonna try figuring out how to get the data out now

hollow current
#

Hello! I faced the "offset issue" with the addGridSquareMarker in calculating whether or not the player is inside the marker. I came across your solution with using the CircleIsoMarker. The only problem is that it creates an outline of the circle, and doesn't actually fill it. I tried to use a workaround where I create multiple circles while decrementing the radius by 0.01 till we reach 0, but that ended up just looking so ugly. I can't find anything relevant either in the docs. Have you ever figured out a solution to this?

nimble yarrow
#

reeeeally struggling to call a function in another lua file. lots of non-table errors.
here's an arbitrary example?

script1.lua

local RT = require("ReturnsTen")

local function TestFunction --works. calling this in game.
  local myNumber = RT.MyFunction --attempted index: MyFunction of non-table: null
  print ("should be 10 - " .. myNumber)
end

ReturnsTen.lua

function MyFunction  --not a local function
  return 10
end
bronze yoke
#
local RT = {}

function RT.MyFunction()
  return 10
end

return RT
#

you can also just return the function directly instead of putting it in a table but i'm guessing you're trying to see how modules work

nimble yarrow
#

nah, simpler would be better. I'm realizing I can just call the function, since its not local.

#

My code is working, but printing is not. super strange, maybe a lua thing?

local myNumber = FunctionThatReturnsNumber()
print("the number I was given is " .. myNumber)

What would be the correct way to print() and send this generated myNumber into the console?
edit: unless this is completely fine, and the issue is elsewhere

bronze yoke
#

should be that, what's happening? error? no print?

nimble yarrow
#

I suck at reading stack traces. I think maybe myNumber is nil, hmm

bronze yoke
#

try tostring(myNumber)

#

or if you do print("the number I was given is ", myNumber) it should do it for you

nimble yarrow
#

using tostring resolved the concat error! I'll go ahead and try out the 2nd method, as well.

bronze yoke
#

they're pretty much the same thing

nimble yarrow
#

mathf.floor (10 * 0.1) * 1
Attempted index: floor of non-table: null
HUH

bronze yoke
#

math.floor

nimble yarrow
#

odang

#

it even turns green in notepad++

hollow current
#

wouldn't recommend using Notepad++ for coding

nimble yarrow
#

yeeeeeah. i use visual studio for C# in unity. i only meant to throw together one quick mod for zomboid. i just accidently keep making them

cosmic ermine
#

Hello, where can I find image assets used in the game?

nimble yarrow
#

such as?

cosmic ermine
nimble yarrow
#

Not sure. But maybe here:
steamapps\common\ProjectZomboid\media\texturepacks
you'll need software to extract the .pack file format

cosmic ermine
#

-.-

nimble yarrow
#

in the top right of discord, theres a search bar.
you can Ctrl+F and type... in: mod_development extract pack
and theres 12 results, which may be promising