#mod_development

1 messages Β· Page 178 of 1

trim mist
#

poooOOOOOG

#

I've been messing around with UI tooltip code, trying to show different values than the base item. I based my changes on expanded tooltips and i finally just got it working

#

or, uh, kind of working hahaha. that's supposed to be under the grapefruit

#

Does anyone know how to do this more simply?

ashen mist
#

how do y'all publish mods

#

idk how i'm messing up, but putting the mod in the workshop folder with the template just

#

doesn't work at all

#

it never reads it, it only ever recognizes the existence of the template

nimble yarrow
#

is it in this directory:
C:\Users\your_username\Zomboid\Workshop

ashen mist
#

im so stupid

#

i put it in the steam workshop thing

#

gonna move it there

nimble yarrow
#

and then the file structure is kinda wacky.
C:\Users\username\Zomboid\Workshop\modname\Contents\mods\modname\media\modded_stuff_here

ashen mist
#

it should probably function as is

#

it ran as a local mod

#

i just have to get it published

bronze yoke
#

copy the structure of the ModTemplate in that folder

ashen mist
#

it should already be good to go

#

it's a simple mod

#

i was just changing a repair recipe

#

left everything else untouched

bronze yoke
#

if you got the mod off the workshop it won't have the file structure for uploading

ashen mist
#

oh

#

it's like how it is above, right?

#

C:\Users\username\Zomboid\Workshop\modname\Contents\mods\modname\media\modded_stuff_here

#

what itsmars posted like that?

nimble yarrow
#

yes

ashen mist
#

sweet

#

i got it published

nimble yarrow
#

swag

#

time to repair

ashen mist
#

gonna test once more to make sure it works

#

the aa-12 is gonna be useable lmao

#

none of that fuckin repair an aa-12 with an aa-12

#

repair that shit with tool kits

bronze yoke
#

do you have permission to be reuploading this mod?

ashen mist
#

its not a public reupload

#

it's just for a server i'm in

#

hidden all the way

fading horizon
#

with the organized trait, will that effect be applied to a custom backpack I make? Or does the custom backpack need to be added to a table somewhere

#

or does the organized trait just apply its effect to any item in the bag category

#

I've never really worked with traits so i'm not sure which files I would do best to look at for references

#

can anyone point me in the right direction or know the answer?

vagrant valley
#

I think the trait multiplies the capacity for every single container

bronze yoke
#

yeah it just makes containers bigger

vagrant valley
#

I edited a backpack mod and it increases the capacity in accordance

bronze yoke
#

it would be much harder for it to be hardcoded per container than not

vagrant valley
#

It wouldnt even make sense to hardcode it

#

That would just be a waste of time

fast galleon
#

the check is made for the player not the container πŸ™‚

fading horizon
#

thank y'all for the help, I appreciate it

novel barn
#

I tried looking for an answer to this but couldn't find anything conclusive. I have generated over 100 new items to serve as drainable versions of vanilla items. This list is done and I can easily just drop the drainableItems.txt into the mod and call it a day. However I'm trying to plan ahead for mod compatibility and I think it would be better if I could dynamically create these items. They will always be near copies of existing items, they'll just be drainable with a useDelta and a different tag. Is it possible to create brand new items OnGameBoot or does the item have to already exist in a txt file? I was experimenting with DoParam but that requires an item to already exist.

fast galleon
#

You would need to have dummy items? Otherwise you will get warnings and errors? from item dictionary.

novel barn
#

Also my seatbelt is already be buckled to be told this is a terrible TERRIBLE idea

bronze yoke
#

yeah the world dictionary is going to screw you over there

novel barn
#

would it be possible to copy the existing item (since a copy is all I need anyway) and rename the copy, then DoParam? The original would be my "dummy".

bronze yoke
#

it'd still cause issues with the world dictionary

#

i'll be honest that i'm not really sure what the world dictionary does (i think it's probably a save optimisation?) but i do know that it screams at you if an item isn't in it

novel barn
#

I'm assuming among other things, at least one problem is that world dictionary is expecting 10 items and would freak out if somehow it found 11.

bronze yoke
#

it's actually one of the few ways to get the game to outright refuse to load

#

it's a shame, procedural items would be really useful

novel barn
#

@fast galleon my mod is currently HEAVILY based off your buckets mod. I'm currently looking at what appears to be an unused function from your ScriptEdits module. https://github.com/Poltergeistzx/Project-Zomboid/blob/16ba008461d2c064978351178df2813aff14f797/Workshop/BucketsMultipurpose/Contents/mods/BucketMultipurpose/media/lua/shared/MIC_ScriptEdits.lua#L69

function Edits.addItem(itemName, itemProperty, propertyValue)
    if not Edits.Items[itemName] then Edits.Items[itemName] = {} end
    Edits.Items[itemName][itemProperty] = propertyValue
end```
Were you also trying to do this? Or was this/is this for something else that I haven't noticed?
fast galleon
#

I thought some people might find this useful, it's very similar to what Item Tweaker had.

#

It would be used to populate the table I use to change things.

novel barn
#

oh I'm a dumbass... I wrote my own to do exactly that. πŸ˜‘

#

πŸ‘‹ Thank you both! Gonna turn in. Good night!

abstract raptor
#

I think I blacked out the board on this

fast galleon
abstract raptor
#

I'm having hella trouble setting ownership for these moving items

bronze yoke
abstract raptor
#

Can someone help me figure this out. It was moving stuff before, but then I wanted to add claiming a doggo so they wouldn't just move towards any moving player.

nimble yarrow
#

ive never seen so many nested if statements

abstract raptor
#

.> Whatever

vagrant valley
#

Does lua have switch like statements

abstract raptor
#

It was working fine till I added that you need to be an owner of the dog -- which was like, I Was gonna use mod data but it just wasn't working no matter what I did

#

so now I have this dumb work around where I'm like storying the item id in a table and it's all very confusing

bronze yoke
#

tables can be used like switch statements but not really no

odd notch
#

anyone know of a lua event that fires when sandboxoptions are updated?

nimble yarrow
#

never done it, but ive seen other mods use lines such as...

local objectInfo = xxxxxxxxx.GetObjectInfo(self.isoObject);
local modData = self.isoObject:getModData()
self.isoObject:transmitModData()

#

if data can be stored in an object itself, that seems like a good place to put the owner ? maybe ?
edit: unless those also use data tables / setmetatable

abstract raptor
#

lmao

nimble yarrow
#

i thought i found it

abstract raptor
#
local function setOwnership(playerObj, item)
    -- Check if the item is valid
    if not item then
        print("Error: Item is nil")
        return
    end

    local item_mod_data = item:getModData()
    item_mod_data.ownerID = getPlayer():getDisplayName()
    item:transmitModData()
    -- Set the ownership of the item

    print("Dog ownership set to Player: " .. item_mod_data.ownerID)
end

This look good?

bronze yoke
#

moddata is a table that is attached to the object, and is saved/loaded along with that object

nimble yarrow
bronze yoke
#

global moddata is mostly like regular moddata but not attached to a specific object

#

it also has some extra utilities to do with networking it but they're mostly the same thing

arctic gate
#

Hello everyone,

I'm currently working on a game project and I'm experiencing an issue with the muzzle flash of my weapon. It seems to be misaligned with the gun barrel, and I'm not sure how to fix it.

Could someone please guide me on how to move the muzzle flash in the game file so that it aligns correctly with the barrel? I would greatly appreciate any assistance or advice you can provide.

Thank you in advance!

mellow frigate
#

Is there a way to show the grid (tile grid) ingame ?

mild venture
#

is there a way to add a new vehicle skin to the existing ones? I would not like to overwrite the entire files. UPD: found solution

sharp minnow
#

I’m trying to make some time based loot respawn mechanics - does anyone know how it works with cells/chunks that haven’t loaded yet? Is it possible to update the contents of them or is it worth only adjusting them ones the player enters that 300x300 cell?

arctic gate
# mellow frigate it looks like a modeling topic. you'll have more help in modeling channel.

I wanted to take a moment to thank you for your offer of assistance. However, I have already found a solution to my problem. I also wanted to express my gratitude for everything you have done for the Project Zomboid modding community. Your contributions are truly appreciated. By the way, I have a quick question for you. Do you know if it's possible to modify the size of a weapon in game? Or would I need to go through Blender for that?

mellow frigate
mellow frigate
sharp minnow
#

Ok cool, I’ll take a look. Thanks!

sharp minnow
tawdry solar
#

can i make a pistol bolt acction/

sleek forum
#

I have made a custom profession that I can select when I create a new game but after dying and creating a new character it's not there anymore, do i have to do the initialization of the custom profession after some Event again?

#

the lua file is in the shared/NPCs/ folder, i've tried these:

Events.OnNewGame.Add(applyProfessions); Events.OnGameBoot.Add(applyProfessions); Events.OnGameStart.Add(applyProfessions); Events.OnCharacterDeath.Add(applyProfessions);

#

I think i'll just replace the BaseGameCharacterDetails.DoProfessions function..

fast galleon
sleek forum
#

yea

small dust
#

Hey I'm looking for help in developing a mod for zomboid and was wondering if anyone would be interested in helping as we would be commissioning outfits for you to make for the mod

rain shard
#

Hey guys, I've a custom item added in but I keep getting this error in the console:


LOG  : General     , 1688742568071> 10,398,843,741> InventoryItem.loadItem() item == null, skipped bytes. itemtype: PPZRP.AlternateExclaim4```

I don't understand why it can't create the item when the item is both in the viewer list and can exist in the world? Is it something else entirely?
fierce saffron
#

Hello! I am wondering if there is any way you can add references to the java api while coding with lua?

rain shard
#

Wait I think I figured it out nevermind.

fierce saffron
#

Thanks! Would this be prefered over PipeWrench where you write with typescript?

mint hatch
#

Hi all. I'm curious on the difficulty of creating a mod partly based on an already in-game item.

Basically, a rain catcher mod that incorporates a tarp, metal bars (or wood logs), and rope.

Similar to the one in Rust.

tawdry solar
#

this could break a game right

tawdry solar
#

now its stuck on** UI_Loading_Texturepack **

#

this is the shit i get

bronze yoke
bronze yoke
abstract raptor
trim mist
#

this is cute hahahaha

wet sandal
#

Amazing

#

It would be hillarious if it occasionally barked using the same "talking" system the player does when you press Q. With the overhead text.

#

"Bark.mp3"

#

"Woof.ogg"

pulsar rock
#

Is there a way to profile mod loading time?

pulsar rock
#

If you already have a workflow set up to export these, is there any actual benefit?

bronze yoke
#

the stubs only include classes and methods that are exposed, the parameters are named, it actually considers whether methods are actually instance methods or static (instead of assuming always instance)

#

the events module doesn't even have a capsid equivalent

wet sandal
#

As for profiling, the game leaves a lot to be desired

bronze yoke
#

the lua module still leaves a bit to desired (it's just harder to generate good stubs for a non-typed language) but it includes fields now

#

and for people who don't already have the workflow set up, they don't need to go through that annoying process, which notoriously just doesn't work for about half of the people who try it

pulsar rock
#

So, what are the specific benefits for people who don't mind the current workflow? Instance vs static assumptions?

mellow frigate
# pulsar rock Is there a way to profile mod loading time?

I guess if you have a file in shared with a name starting with '!!!!' it should be the first to load :D. store a getTimestampMs(), then compare the result with another getTimestampMs() in a client file with 'zzzzzz' as prefix, it should be a good approx of the lua loading time

wet sandal
#

Smart

pulsar rock
#

Hm

#

I wonder if there's a method you can hook into to profile each mod separately?

bronze yoke
#

instance vs static, named parameters, and that it won't show you stuff you can't use

pulsar rock
#

Is there an event for mod init & init done?

wet sandal
#

Nope

#

All mods load whenever and its chaos

#

Alphabetics seems to be the best control over order

mellow frigate
#

I have mods that require other files of other mods so anyway it is not one after each other.

wet sandal
#

Best option to profile a single mod's load time would be averaging without vs with

pulsar rock
#

Hm

#

And there's absolutely no hook when mods start their individual loading, and when mods finish their individual loading?

#

Or at least either?

mellow frigate
bronze yoke
#

if you enforce a load order in your mod, then when your first file starts and when your last file finishes

pulsar rock
#

No mod / package discovery before it starts loading a specific mod folder?

wet sandal
#

The lua scripts are all gathered up, then load in alphabetical order, only breaking order as needed by require

pulsar rock
#

Well, is there lua file individual start/finish stuff?

wet sandal
#

You can ask the game if a mod ID is enabled for the save

trim mist
#

Anyone know anything about bare feet? Is that an item? Trying to assign stomp power to bare feet

bronze yoke
#

i think you'd have to make a secret item if you can't set that on the character directly

neon bronze
#

Like the hands

trim mist
#

yeah there's a barehands weapon lol

#

I was hoping the same thing existed for feet

fierce saffron
bronze yoke
#

you should still decompile, but there's better tools to do it

wet sandal
#

Pure guessing, but its probably just a state in the java when you stomp and it sees you're not wearing shoes

tawdry solar
#

how make clothing

#

the steam workshop guide got deleted

trim mist
#

any damage is halved

tawdry solar
#

this is the guidew

#

its just an error

#

oh fuck yeah

#

wayback machone

mellow frigate
#

that's a channel error πŸ˜„

tawdry solar
#

im so confused

dark wedge
#

PSA: Always be sure to turn on God Mode when you fly to paint buildings, and/or mark the spot on your map where you do things. drunk

gilded hawk
#

It's absolutely hilarious like some user will come under your mods and be like "hey is it possible to disable 99% of the mod, and make it do something completely different"
lmao what

crystal oar
#

can i do contains in lua and relatedly, if i find a trait in TraitFactory:getTraits() can i get its name somehow?

wet sandal
#

TraitFactory:getTraits() returns a java list of Trait objects.
They have 2 methods for getting their names:
getType()
getLabel()

Label would be the pretty readable name, and type is the actual name of the trait used in code.

crystal oar
#

oh snap maybe this is doable then

sleek forum
#

what are you trying to do

wet sandal
#

This is the docs site I used:
https://zomboid-javadoc.com/41.78/

Pretty quick to find whats available on the java side. Not everything here is exposed to lua, but it usually just works.

rich void
#

Hey guys, anyone got any experience with generating custom log files? I've got most of the logic sorted for what I wanna stuff in there but I'm struggling to find an appropriate global provided by the api to pass through my desired file name and path, any help would be greatly appreciated πŸ™

bronze yoke
#

i'd prefer tis's site

wet sandal
#

They have a site with this?

crystal oar
bronze yoke
#

yeah? this is based off of that

wet sandal
#

Ah, I see. The site I'm using maintains prior versions.

#

I didn't realize it was thrid party

bronze yoke
#

the most significant difference is named parameters but there's also a tiny bit of documentation, and i think it's a bit more specific about types sometimes

#

the one you're using was used because tis's was outdated, but now it isn't really

sleek forum
#

@crystal oar should be possible yeah

crystal oar
#
    local list = SandboxVars.Doctrine.DisabledPerks
    if list then
        for item in string.gmatch(list, "[^;]+") do
            item = item:match("^%s*(.-)%s*$") -- Trim leading and trailing spaces
            
            print("looking for ", item)
            local traits = TraitFactory.getTraits()
            for trait in traits do
                if CheckForTrait(trait, item) then
                    print("Disabling ", item)
                else
                    print("Trait not found! ", item)
                end
            end
        end
    end
end

function CheckForTrait(trait, item)
    if trait.getLabel() == item then
        print("Disabling ", item)
        trait:setRemoveInMP(true)
        return true
    end
    return false
end

Events.OnInitGlobalModData.Add(DoctrineModDataLoaded)``` i'm sure my first draft will have some problems but i think it's getting there
trim mist
#

Question for y'all. How would I make a ghost item that gets equipped for shoes like barehands does for hands?

crystal oar
#

is there a shorter or smarter way to write player:getTraits():add(trait.getType())?

bronze yoke
crystal oar
#

item would be Axe Man and the trait is Axeman

#

so i think i have to loop through trait:getLabel()

sleek forum
#

@crystal oar

local function addTraitToPlayer(player, trait) player:getTraits():add(trait.getType()) end ?

crystal oar
#

can i have a function return a string or false and work right?

#

or should it be string or nil?

crystal oar
#

okay so this isnt working out for me function CheckForTrait(traits, item) for trait in traits do if trait.getLabel() == item then return trait.getType() end end return false end says java.lang.RuntimeException: tried to call a non-function

sleek forum
#

It can't find the method

bronze yoke
#

for trait in traits? there's no iterator here

crystal oar
#

traits is an array, does that not work?

bronze yoke
#

no, you need to do```lua
for i = 0, arrayList:size()-1 do
local item = arrayList:get(i)
end

crystal oar
#

weird, i have this that works for item in string.gmatch(list, "[^;]+") do

bronze yoke
#

string.gmatch is an iterator

crystal oar
#

also soimeone here said to start at i=1, do you know if i start at 0 or 1?

bronze yoke
#

0 if it's an arraylist/other java object, 1 if it's a lua table

crystal oar
#

and that's why there's the size-1 up top?

bronze yoke
#

yeah

crystal oar
#

okay so like function CheckForTrait(traits, item) for i=0, traits:size()-1 do local trait = traits(i) if trait.getLabel() == item then return trait.getType() end end return false end

bronze yoke
#

the calls for the trait methods should be with colons but yeah

crystal oar
#

the use of dots and colons trips me up a lot

bronze yoke
#

it's generally just colon if it's an instance method, dot if it's a static method

crystal oar
#

i honestly don't understand the difference yet, like just looking at something i have no idea if it's a static

#
    for i=0, traits:size()-1 do
        local trait = traits(i)
        if trait:getLabel() == item then
            return trait:getType()
        end
    end
    return false
end``` is still not doing it, but now it is throwing a different error something like "did not have __call metatable set at KahluaUtil.fail line:82."
bronze yoke
#

oh, traits(i) should be traits:get(i)

crystal oar
#

i think it's full on working now, time to test it some more. thanks as usual albion!

hasty horizon
#

i may have overthought something with two traits i added to my mod, vegetarian and carnivore. evolved recipes. theres vegetarian burritos and meat burritos .-.

neon hedge
#

hey guys, is there any way to make a function play after taking a pill i added in my mod?

teal slate
#

Argh. Why is the amount a propane tank refills a propane torch hardcoded to the vanilla torch's UseDelta

#
    result:setUsedDelta(previousBT:getUsedDelta() + result:getUseDelta() * 30);

    while result:getUsedDelta() < 1 and propaneTank:getUsedDelta() > 0 do
        result:setUsedDelta(result:getUsedDelta() + result:getUseDelta() * 10);
        propaneTank:Use();
    end

I also have no clue why that first line is there

#

far as I know previousBT (destroy BlowTorch) has been nuked by RemoveItem by the time this even gets called

#

but the important bit:

#

result:setUsedDelta(result:getUsedDelta() + result:getUseDelta() * 10);

#

unconfigurable hardcoded number! woo!

#

with the default torch usedelta of 0.1, 1/16 of the propane tank refills the torch entirely

#

but with a mod that changes it to 0.01, so that it has 100 uses instead of 10

#

it only refills 10%

#

(for some reason this leads to it taking 8/16 of the propane tank to refill the torch once? which is weird, I thought it would take 10/16)

#

I really have to wonder why a custom OnCreate is used for this at all

#

ah, I see

#

it's to keep the amount in the old blowtorch.

#

but you could still handle actually using the propane tank in the recipe code?

#
    recipe Refill Blowtorch New
    {
       destroy BlowTorch,
       PropaneTank=1,

       Result:BlowTorch,
       Time:50.0,
       Category:Welding,
       OnTest:Recipe.OnTest.RefillBlowTorch,
    }

guess I'll test to see if this works

crystal oar
#

OnTest:Recipe.OnTest.RefillBlowTorch, see i don't get when to use colons or periods still lol i would have thought this was all colons

teal slate
#

OnTest is the name of the variable you're setting

#

Recipe.OnTest.RefillBlowTorch is the value you're setting it to

#

time to test

crystal oar
#

gl!

teal slate
#

if this does fix it i don't know what to do honestly lol

#

i reported a radio bug + the fix two years ago

#

no dev comment in that entire time, confirmed it still happens + is worse than i thought

bronze yoke
#

this is because of the blowtorch buff

teal slate
#

buff? didn't they lower it from 100 to 10 lol

bronze yoke
#

yeah but they also lowered all the costs

teal slate
#

ah

bronze yoke
#

before then you would use a varying amount of the propane tank based on how empty the blowtorch was, but now one unit always refills

teal slate
#

well, not quite

#

one unit always refills 10x the UseDelta

#

which is fine by default because it's 0.1

bronze yoke
#

well yes, but if it's only caused by a mod it's not a bug

teal slate
#

it's unnecessarily complicated for what it does, and it's an unconfigurable hardcoded magic number in the middle of the code

#

it's effectively doing UseDelta * 1/UseDelta so it should just be adding 1

#

and then it'll always refill it, no problem. or they could at least make the amount refilled configurable

#

honestly this is just a minor annoyance since it means the capacity-changing mod still buffs it from 160 uses in vanilla to 200 with the mod

#

the main thing bothering me is the radio issue...

#

I get that for multiplayer, people who use text chat are a very small minority, those who use text chat over radio are an even smaller minority, and the main focus is on people using VOIP-over-radio or /all

bronze yoke
#

what was the issue?

teal slate
#
#

need to get a screenshot of it, but this is an issue in vanilla

#

an example is equipped radios receiving broadcasts with [img=music] in them

#

or [col=r,g,b]

#

both of which are used in the various radio programs

bronze yoke
#

i guess it's just not a high priority issue

teal slate
#

yeah, like i said

bronze yoke
#

at least radio text chat still works

#

you can't really say the same for radio voice chat

teal slate
#

really? I thought it was fixed a while back

#

though

#

an easy way to let modders fix this at least would be

#

expose ChatUtility

#

all we get chat-wise is

         this.setExposed(ChatMessage.class);
         this.setExposed(ChatBase.class);
         this.setExposed(ServerChatMessage.class);
#

frankly I feel like exposing ChatUtility and then just calling parseStringForChatLog from ISChat's addLineInChat would be better

#

then use message.chat:getMessagePrefix(message) .. message.getSanitizedText instead of dealing with getMessageTextWithPrefix overrides

#

since an unacceptable amount of sanitization is also done in getMessageTextWithPrefix

bronze yoke
#

from what i hear, the chat log is one of the oldest and least maintained systems in the game

#

it might even be one of the systems that was adapted from a mod...? that might have been an unrelated mod though

teal slate
#

i (briefly) helped maintain buffy's roleplay chat and had a mod that implements some of those features in a much, much cleaner way so i'm unfortunately aware of the chat log's issues

#

i had to write a library mod in order for commands to work

#

wiat

teal slate
#

i thought wreck recycling was a mod, but

crystal oar
#

wreck recycling is vanilla, vehicle recycling is a mod

bronze yoke
#

that might have been intentional...? i recall at first they didn't reduce wreck costs and recycling them was literally impossible

#

so they must have chosen these numbers

teal slate
#

argh

#

confirmed the edited recipe works

#

so it always refills 100%

bronze sand
#

I have a mod to release, and I need to know something

How can I add a translation to a mod?
How does that work?

nimble yarrow
#

folder structure would be
media\lua\shared\Translate
and you put one folder per language

#

and you refer to strings as variables, in your code. i guess. never done it before πŸ˜‰

bronze yoke
#

you replace any hard-coded strings with getText() calls that reference the translation strings in those folders

bronze sand
bronze yoke
#

e.g. if you have a string displayed to the player e.g. 'Hello World!', you'd want to replace that with something like getText("IGUI_HelloWorld"), and then in your translation files you'd have a IGUI_HelloWorld = "Hello World!", entry

bronze sand
#

I see, so I just place every String into a getText() function?

bronze yoke
#

every one that's displayed to the player at least, internal stuff should be kept as it is

#

as for stuff in scripts like items, you don't need to do anything special, they're already set up for it and just need entries added to the right translation files

bronze sand
#

Well, the mod only adds items

#

And their recipes

bronze yoke
#

ah, sorry, my mods are very lua heavy so that's where my mind goes first

bronze sand
#

So, I guess the getText() isn't really necessary then?

bronze yoke
#

not for scripts

#

you'd need an ItemName_EN.txt with pairs like ItemName_Base.AlarmClock = "Alarm Clock",

#

it'd probably just be easiest to look at the vanilla translation files to see what the patterns are and which file they should be in

bronze sand
#

Side question, can I have 2 Items with the same DisplayName?

#

Obviously, different item ID

bronze yoke
#

DisplayName is only used when there isn't a translation anyway

#

having two items with the same display name or translated name should be absolutely fine though

#

one thing to note is i think the way item stacking works is that it's based on the display/translated name, so two different items with the same one will stack in the inventory

bronze sand
#

Interesting

#

Anyone knows how to open and edit the model of a PZ Item?

#

And how to upload the model to the Workshop for the users to preview it as well

heady crystal
#

Is it possible to set a sprite's properties permanently instead of session only?

nimble yarrow
#

anyone ever make an RC car mod? I wanna blow up a pack of zombies like kevin bacon in tremors 2

drifting ore
#

If I wanted to add more skin textures to the player model, how would I go about doing it? Specifically, so they can pick it from the creation menu

nimble yarrow
#

go to this directory to see the folder structure and files.
\steamapps\common\ProjectZomboid\media\textures\Body\
see, theres MaleBody01 to MaleBody05, five different skin shades. and MaleBody01a - MaleBody05a, for chest hair variants.

edit those in photoshop (or whatever), and save your new copies in...
C:\Users\username_here\Zomboid\Workshop\yourmodname\Contents\mods\yourmodname\media\textures\Body\

#

check the ModTemplate for more info about required files, fouind here
C:\Users\username_here\Zomboid\Workshop\ModTemplate

drifting ore
#

I know how to overwrite skin textures, I want to keep the OG skin textures while adding more onto it. Through Variants

nimble yarrow
#

if that was possible, i feel like a mod would have done it by now, on the workshop. never seen it before. but i guess i havent really looked forit.

bronze sand
#

Is there any explanation as to how exactly the speed of a weapon works?
Between MinimumSwingTime , SwingTime and BaseSpeed
I'm just confused...

bronze yoke
#

it's also tied to the animation itself so drunk

bronze sand
#

Ahg, I'll just try to give it similar numbers to the weapon of another mod that's kinda similar

#

Ah yeah, the Base speed of a heavier weapon is lower, but the other ones are higher

drifting ore
bronze sand
#

It is very confusing

#

I think albion was replying to me

bronze yoke
#

i was

drifting ore
#

oh- okay gotcha

nimble yarrow
drifting ore
#

That may actually work, I'll add that to the list of mods I'm examining-

nimble yarrow
#

out of curiosity, i looked as well.
\steamapps\common\ProjectZomboid\media\lua\client\OptionScreens\CharacterCreationMain.lua
this lua doc has promising code inside, such as...
table.insert(buttons, charCreationMain.skinColorButton)
self.skinColor = desc:getHumanVisual():getSkinTextureIndex() + 1
self.colorPickerSkin:setPickedFunc(CharacterCreationMain.onSkinColorPicked)

anyhow, its not an enum like i thought, but an int index, and a table of buttons. i don't see why you wouldn't be able to add new options here.

sleek hull
#

Question, is there pre-requisites to how the pain stat of a character can be changed?

Im trying getPlayer():getStats():setPain(1) to set the players pain to the maximum, but it does nothing and remains at 0. Adjusting other stats such as fatigue does set it to the specified value though??

bronze yoke
#

it's most likely recalculated every tick based on the character's injuries, pain pills etc

#

some stats are like that

sleek hull
#

Yippie

#

Is there a way to cause neck pain (I think it's 'injury' is just called HeavyPain) and similar to other body parts then without just injuring the player?

bronze yoke
#

oh, alternatively it might be that pain is 0-100 instead of 0-1

sleek hull
#

Ill try that real quick

bronze yoke
#

i've been developing a stats api to get around issues like this but i haven't even gotten around to looking at pain yet so i don't have specific knowledge about it

sleek hull
bronze yoke
#

i'd look into adding HeavyPain then

#

alternatively i see BodyDamage has a setContinualPainIncrease(float ContinualPainIncrease)

nimble yarrow
#

can it be applied without specifying the bodypart?

bronze yoke
#

that might just be a multiplier to normal pain increases or something or it might be a way to add extra pain

sleek hull
#

Moodle is also increased

bronze yoke
#

oh great!

#

that's actually very simple

sleek hull
#

Knowing some of the quirks with Zomboid modding, I'm shocked

nimble yarrow
#

does this work?
player:getBodyDamage():getBodyPart(BodyPartType.FromString("Left Hand")):setAdditionalPain(100)

bronze yoke
#

BodyPartType.Hand_L is a correct way to reference the bodyparttype

#

i'm not really sure what FromString wants, so that might be right?

sleek hull
#

Ive never used BodyPartType.FromString before, but assuming it returns the same as BodyPartType.Hand_L, it should yes

bronze yoke
#

i would've guessed it would want "Hand_L" but that would make it redundant with valueOf

#

(and in lua, it's redundant with BodyPartType[str]/BodyPartType.str, which will probably perform a lot better than using a method)

sleek hull
#

It would appear to cause a runtime error, p:getBodyDamage():getBodyPart(BodyPartType.FromString("Left Hand")) is null and crashes when you try running setAdditionalPain(100)

#

p:getBodyDamage():getBodyPart(BodyPartType.FromString("Hand_L")) does work though

bronze yoke
#

i guess it's just redundant with valueOf then

sleek hull
#

Im bad at typing :/

bronze yoke
#

you should still just reference them with BodyPartType.Hand_L, java method calls are slow and i think it's just cleaner

#

if you're using a variable for whatever reason you can use BodyPartType[str]

nimble yarrow
#

^ i also avoid string comparisons in C#, theres always another way lol

hasty horizon
#

how would you guys handle evolved recipes that involve certain tagged items? like i have a vegetarian trait, a burrito can have bacon in it or something. how could i check if the burrito contains bacon or not?

hollow current
#

soo im working on a mod that spawns "stories" or "notes" written by victims/surviors supposedly during or at the beginning of the apocalypse. I've made it so that when it randomly picks a story from the list of prewritten ones, it'll pick them depending on the room the item was found. I.e. if a story makes sense to have been written in a bedroom, this story will spawn only in a bedroom. I use the following list for the rooms to define stories in:

https://theindiestone.com/forums/index.php?%2Ftopic%2F38185-new-room-definitions-4165%2F

My question is, are there more "specific" ways to get what kind of spawn the item is spawning in, for example, checking if its spawning on a zombie (how do I even make it spawn on a zombie?), or for example making it check/making it spawn in a car crash, etc. Situations that aren't necessarily bound by a room name

hasty horizon
hollow current
#

so basically a JSON seprating each story and defining what kind of rooms the story may spawn it, and the script just picks one randomly (and does its checks of the rooms element against the actual room the item spawned in)

bronze yoke
#

you can check if it's on a zombie by just checking if the item's container's parent is a zombie

hasty horizon
# hollow current can you emphasize on that? This is the way I set up my stories:

in your zomboids lua/server/Items/ProceduralDistributions and SuburbsDistribution (might be more). theres a guide somewhere where you can insert items into the tables inside the distributions. theres a couple different lines to do so from what i gathered, depending on the distribution. when you put your story on an item, you can put that item in the distro and its chances of spawning in a given container

hasty horizon
#

this is all assuming these stories are in book items.

#

you can then set up your stories as like, a list or something of stories that could happen in a house, then add those stories to the respective house distribution

hollow current
#

I kinda set up a base for the distrubitions already for testing/dev stage,

require 'Items/ProceduralDistributions'

table.insert(ProceduralDistributions["list"]["BinGeneric"].items, "TatteredPaper");
table.insert(ProceduralDistributions["list"]["BinGeneric"].items, 100);```

I guess I just need to alter it later to add the actual containers names
hollow current
bronze yoke
#

it's one of the distributions

#

i can't really check right now but it's something like proceduraldistributions.all.malegeneric

#

that's definitely not exactly right but it's along those lines

hollow current
#

okii I will do a quick search for anything similar to that

#

Thanks for assitance guys :)

hasty horizon
bronze yoke
#

oh, are you relying on onfillcontainer to set the data by chance?

#

it doesn't work on zombies, i have a work around for that but it's pretty complex

#

in your case i might consider just rolling to spawn and set the data on onzombiedead instead

hollow current
#

ermm I am.

-- Function that sets the saved room name in an item's mod data
function ImmersiveLore.OnFillContainer(roomName, containerType, itemContainer)
    for i = 0, itemContainer:getItems():size() - 1 do
        local item = itemContainer:getItems():get(i)
        if item:getType() == "TatteredPaper" then
            item:getModData().ImmersiveLore_savedRoom = roomName
            print(containerType)
        end
    end
end```
#

but shouldn't be an issue really, right? because I can just, before getting the savedRoom, I can check for parent container first

#

or check for both

bronze yoke
#

if you want it to work on zombies, they never fire that event

hollow current
#

Can I get retrieve room name from OnZombieDead?

bronze yoke
#

probably, you can get the room object from the zombie's square and i'm sure you can get the name from there

hollow current
#

hmm oki will try to work with that. Thanks for the heads up (otherwise I'd have probably spent hours trying to figure it out lol)

cunning dome
#

So I'm not sure if I'm having a fundamental misunderstanding of how loot generation works in conjuection with distribution tables... I was under the impression that the number of "rolls" a category has is finite, regardless of the length of the list, and the number of rolls a container has is modified by the sandbox loot settings?

So if I added twice as menu new items to a distribution table, it shouldn't be spawning more items in general, right?

bronze yoke
#

no

#

it rolls every single item individually, it's not a weight system or anything

#

more possible items = more items on average

cunning dome
#

... Oh, oof.

bronze yoke
#

that's why true music packs spam their cassettes everywhere, they literally cannot make them individually rare enough to compensate for that

cunning dome
#

Hmm.... which raises an issue with relying on sandbox settings to reduce a category of items, where it might be too general and cause other things to become much rarer as well.

#

I'm assuming there's no simple way to reduce the spawn chances of everything in a single distribution table, is there?

#

At least not without risking incompatibilities with a lot of other mods.

hollow current
#

btw any idea how to make things spawn on top of tables/counters/beds/etc?

bronze yoke
#

you could just loop through it and multiply every chance

cunning dome
#

Yeah, which is what I was thinking, but I am worried that will have an impact on other mod's items.

#

So what is the "rolls" for then? How many times every item has its drop chance rolled?

arctic yacht
#

ey is there a max map size?

cunning dome
#

Any ideas on how you could possibly add items to loot dist tables then that are more sensibly "weighted" to output a similar number of total items as originally? Or is our only recourse really just get a bit invasive and adjust the vanilla loot weights or use sandbox settings?

bronze yoke
#

for a book mod i had it automatically calculate the total chance for a book in that container and reduce the chances so that the total chance would be the same after the additions

cunning dome
#

I feel like I'm going to have to take that approach, no real way around it.

#

What mod was that one?

#

And would you mind if I took a peek at the code? ❀️

nimble yarrow
cunning dome
#

Seems quite likely πŸ™‚

#

Dependency actually makes me realise a good point, if I was going to go modifying vanilla item values like their loot spawn weights, I should probably use Item Tweaker API.

#

Assuming it has that functionality.

#

... whiiich it might not, damn.

heady crystal
#

Is there any way to know what action a Player is about to perform / has performed, if they used the Interaction button to do it?

#

E.g open or jump through a window with E

cunning dome
#

Am I crazy or do the Louisville Gym lockers not spawn anything?

#

Added some items to the GymLockers distribution table but... as far as I can tell, nothing actually uses it? 🀣

#

Opened an unmodded game save and debug checked the Louisville Gym's lockers and the don't seem to have any loot distribution tables added.

nimble yarrow
#

you using lootZed?

bronze yoke
#

that is one of my older mods and i haven't been able to push the update that removes the dependency yet

#

that api basically just changes the syntax of a function call

cunning dome
#

Of a vanilla base game function?

#

That seems sub-optimal.

cunning dome
#

Drop-down for the attached loot tables was blank.

#

Checked on a fresh save and everything.

#

At first I thought maybe my own mod broke the table somehow.

nimble yarrow
#

i checked 2 workout-looking buildings in louisville, the rooms themselves were correctly labeled lockers. then theres another building with blue lockers, but the room is labeled 'changing room'. anyhow, thats strange. did u teleport to some other place outside of louisville and check lockers to see if your distro was working

cunning dome
#

I gave up searching for another gym after about 15 minutes. 🀣 I figure I'll run into one eventually just playing, but I have no idea where another is on the map.

#

If it's that hard to find and my mod accidentally jackpots a loot cache in it, I figure what the hell and call it a "feature". πŸ˜›

#

Unlisted mod anyway just for me and mine so it's not a big deal.

nimble yarrow
#

im not a mapper so i dont know, but im assuming its more about the name of the room, and less about the container itself. or i guess a combination of the two.
lockers can appear in "hall" rooms (schools), "changing room" rooms (restaraunts, hotels) and "locker" rooms (police stations, fire departments, gyms) as far as i know.
edit: the reason i bring this up, is that i checked 2 gyms in louisville. the rooms themselves are just labeled "locker" -- hmmm.
but it'd be strange if they had police station loot, though.

lol, like i said, not a mapper. strange

cunning dome
#

Yeah I'm almost certain it's the room definition. Considering how hard it is to find dedicated "gym" buildings, I think that particular definition is just very rarely used.

#

And most of the time the only one players usually care about are the gym weights shelves.

#

Vanilla gym lockers, even if they did work, don't spawn anything interesting.

nimble yarrow
#

ah......... the gym is indeed labeled gym. but unfortunately, because the lockers are not in the workout portion of the building, they will not have the correct loot table !?!?

cunning dome
#

Derp.

#

This the big gym by the big bridge north of LV?

nimble yarrow
cunning dome
#

Yeap that's the one.

#

The change room basket outside in the hallway also has no loot tables.

#

There's a "GymLaundry" table that I'd have assumed goes there.

sleek forum
cunning dome
#

Pretty sure that's TileZed πŸ˜›

nimble yarrow
cunning dome
#

Didn't know about that second one.

sleek forum
#

ah, because i'm trying to find a way to create a map/visual of where a specific loot items are located

cunning dome
#

Oooh second one actually has a zombie heat map too.

nimble yarrow
#

it has maps and heatmaps for like 160* modded maps, too. very nice

#

there used to be a 'loot finder tool' on PZ reddit some years ago, but the developer's website went offline.

sleek forum
#

😦

nimble yarrow
#

there it is. yeah, i learned about this right after it went offline, so i never even got to use it. lol

sleek forum
#

I can see the distributions but not where the cells are defined

cunning dome
#

Huh; there's another weird one... The Fun XTreme building in LV has the reception area marked "gymstorage" ???

sleek forum
#

should be somewhere though

cunning dome
#
C:\Games\Steam\steamapps\common\ProjectZomboid\media\lua\server\Items\Distributions.lua:
 5553              procedural = true,
 5554              procList = {
 5555:                 {name="GymWeights", min=0, max=99, forceForRooms="fitness;gym"},
 5556              }
 5557          },```
#

That's where gymweights is being defined at least...

sleek forum
#

you're trying to find gym locations?

nimble yarrow
#

or 'fitness', i wonder where that is πŸ˜›

cunning dome
#

Well at the moment I'm just trying to find what "locker" is even supposed to point to. πŸ˜›

sleek forum
#

i have a hunch it's not referenced in the media folder as text

nimble yarrow
cunning dome
#
    changeroom = {
        locker = {
            procedural = true,
            procList = {
                {name="BowlingAlleyLockers", min=0, max=99, forceForRooms="bowlingalley"},
                {name="FactoryLockers", min=0, max=99, forceForRooms="batteryfactory;brewery;dogfoodfactory;factory;fryshipping;metalshop;radiofactory;warehouse;wirefactory;whiskeybottling"},
                {name="FireDeptLockers", min=0, max=99, forceForRooms="firestorage"},
                {name="GymLockers", min=0, max=99, forceForRooms="fitness"},
                {name="HospitalLockers", min=0, max=99, forceForRooms="hospitalroom"},
                {name="HuntingLockers", min=0, max=99, forceForRooms="hunting"},
                {name="PoliceLockers", min=0, max=99, forceForRooms="policestorage"},
                {name="PrisonGuardLockers", min=0, max=99, forceForRooms="cells"},
            }
        },```
#

There it is~

sleek forum
#

grep: media/maps/Muldraugh, KY/42_4.lotheader: binary file matches
grep: media/maps/Muldraugh, KY/20_17.lotheader: binary file matches
grep: media/maps/Muldraugh, KY/41_4.lotheader: binary file matches

#

these have references to clothesstorestorage, so they must be defined in the maps files

#

same for lockerroom etc

cunning dome
#

So I'm guessing that room in the gym was miscategorised and should have been "changeroom" not just "locker".

#

Or it's a hold over from pre 41.5x

sleek forum
#

SuburbsDistributions.locker = SuburbsDistributions.changeroom
SuburbsDistributions.lockerroom = SuburbsDistributions.changeroom
SuburbsDistributions.lockers = SuburbsDistributions.changeroom

cunning dome
#

Ahh.. hmm~

#

Okay so that should be working then?!

nimble yarrow
#

check this gym, it has "lockerroom" instead of "locker"

cunning dome
#

a'ight I'll fire itup

sleek forum
#

@nimble yarrow you can search for locations on the map?

nimble yarrow
#

not on the online map websites. probably, with the mapping software or debug tools.

cunning dome
#

Dead there too!

sleek forum
#

ah

cunning dome
#

No loot populated.

raw solar
#

Hey sorry if I'm interrupting anything but does anyone think I could get some assistance with a very basic/simple mod?

#

I want to use the base model for the already existing Hoodie asset, but I just want to add decals to the back and have it be a seperate item. Does anyone know how to achieve this? I have no experience modding PZ whatsoever and want to get into it a bit more.

cunning dome
#

Sure go for it Cauchemar, at this point I'm mostly just on this out of curiosity. 🀣

raw solar
#

Thanks ^_^

#

Right now I'm following this guide but I need it to be a bit more specific.

#

Like, do I need specific names for the files? Etc etc?

nimble yarrow
raw solar
#

Not yet, would it have the answers I'm looking for?

nimble yarrow
#

there are some 'your first mod' tutorials and guides linked there, yeah

raw solar
#

I wouldn't be modelling anything in blender, just retexturing

#

Alright thanks

cunning dome
#

As a pointer, I believe the file you'll be looking for that has the hoodies definitions should be media\scripts\clothing\clothing_jacket.txt

#

Find the right item in there, and that will tell you exactly what model it's using that you'll need to hunt down.

nimble yarrow
#

like that reddit post says, though, you will be taking vanilla, base PZ files from
\steamapps\common\ProjectZomboid\media\
and copy+pase+edit then putting them in your
C:\Users\username_here\Zomboid\Workshop\modname_here\Contents\mods\modname_here\media

you already have a 'mod template' folde there, which will show you the required folder structure and stuff

raw solar
#

Ohhh okay, that's very useful, thank you guys

cunning dome
#

ProjectZomboid\media\textures\Clothes\Hoodie has your texture files by the looks

raw solar
#

Perfect

cunning dome
#

Re: GymLockers saga, I'm pretty sure this is just something gone funky for the transition from the old loot distribution system.

sleek forum
#

are you trying to spawn something but it isnt spawning?

cunning dome
#

Yeah; added to the GymLockers distributions table expecting new items to appear in the gym lockers/gym changerooms, only to find those lockers don't spawn anything, since it seems like their definition is broken at the moment.

#

Was just planning on having fitness and strength xp books show up there really.

raw solar
#

This is what I've got so far, anything missing?

#

Like a model file? (.xml Im assuming)

cunning dome
#

You'll need to mimick the same folder structure for where those files came from.

raw solar
#

Ok so, make a scripts folder and a textures folder?

cunning dome
#

Exactly the same as the source files.

raw solar
#

Gotchya

cunning dome
#

If it'd be easier to work off an example, if someone else has made a mod that does something similar to yours, you could take a peek at its folder and file structure.

raw solar
#

I'll take a look on the workshop

cunning dome
#

.\Steam\steamapps\workshop\content\108600 will have all your subscribed workshop mods in them when you find it, folder inside there will be the workshop mod's id.

raw solar
#

Found a perfect one you

#

thank you *

cunning dome
#

Well that's a pain... the link to "Guide for adding new clothing items with modding for build 41" from the PZwiki modding page is dead.

raw solar
#

I did it!

arctic gate
#

is it possible to import the default animations from Project Zomboid into Blender? If so, what are the steps to achieve this? Are there any specific tools or plugins that I should use?

cunning dome
#

Even managed to generate a new GUID for it?

raw solar
#

Yup!

sleek forum
#

exporting the zomboid map to textures takes up a LOT of space :S

#

(and time)

cunning dome
#

Imagine how big the Google Maps/Earth database is.

sleek forum
#

hah yeah

#

getting somewhere now

cunning dome
#

Grats @raw solar πŸ™‚

tawdry solar
#

is there a reason my ga wont load with my mod

#

this is what happens when i use it

tawdry moss
tranquil kindle
tawdry moss
#

ty

fervent nova
#

good overhaul.

molten shell
#

is there mod that adds wood powered cars?

tranquil kindle
#

Could someone give me a some kind starter point on making a player do interaction with tile (like when you right click a tile with sink, you can then drink/wash/etc,), I would like to make a player to need to use for example table to be able to use certain recipe (simulating workbench for now). I'm not sure if there are mods that do with just standing next to tile for something like this to work, so i would be happy with context menu when clicking said tile.

fiery pecan
sleek hull
#

Singlehandedly fixes one of my worst gripes with vanilla

fiery pecan
#

πŸ™‚

pearl prism
fiery pecan
brave ruin
#

Is this not the correct way to have to skill requirements?
SkillRequired:Carpentry=3:Metalwelding=1,

teal slate
#

i think carpentry may be named Woodwork

brave ruin
#

But do you use : between then skills?

teal slate
#

semicolon, i think

#

see here

brave ruin
fiery pecan
#

thankies

hot patrol
#

What do all the upgrades look like? any mad max looking ones?

#

spikes and whatnot

trim mist
#

Hey modders, anyone know how dirty clothes interact with body cleanliness?

#

Do clothes protect the player from dirtiness?

#

Do dirty clothes dirty the player's body?

hot patrol
#

i feel like it is totaly random. I have had times where seconds after cleaning my character and his cothes they will get stains on their pants without me even movign

fiery pecan
#

for now

hot patrol
# fiery pecan no. Just plates and bars

gotcha. stil great. now that you got all the vehicles covered ith some basic armor you can expand upon it with ease if you want. I read the description and i like the uniform design you are going for

fiery pecan
#

thankies

hot patrol
#

keeps all the cars from looking totally different

fiery pecan
#

ya

trim mist
limpid vine
#

would it be possible to prevent certain items from loading when the 'All Clothing Unlocked' option is enabled? I noticed the code is in media/lua/client/OptionScreens/CharacterCreationMain.lua but I'm not sure how I would go about preventing individual pieces of clothing from displaying

distant rapids
#

Can anyone send me in the right direction for UI creation?

trim mist
#

Can you tell me more about your use case?

obsidian bison
#

Guys, is it difficult to mod the game? I would really like to make a really simple mod that adds an action that the player can do and an extra option in the context menu

#

I have experience in coding, although I have not yet touched what PZ uses

teal slate
#
         float var11;
         if (Math.abs(this.clientControls.steering) > 0.1F) {
            var11 = 1.0F - this.speed / this.vehicleObject.getMaxSpeed();
            if (var11 < 0.1F) {
               var11 = 0.1F;
            }

            this.VehicleSteering -= (this.clientControls.steering + this.VehicleSteering) * 0.06F * var8 * var11;
         } else if ((double)Math.abs(this.VehicleSteering) <= 0.04D) {
            this.VehicleSteering = 0.0F;
         } else if (this.VehicleSteering > 0.0F) {
            this.VehicleSteering -= 0.04F * var8;
            this.VehicleSteering = Math.max(this.VehicleSteering, 0.0F);
         } else {
            this.VehicleSteering += 0.04F * var8;
            this.VehicleSteering = Math.min(this.VehicleSteering, 0.0F);
         }

those 0.04Fs should probably be this.vehicleObject.getSteeringIncrement() instead

teal slate
teal slate
#

getSteeringIncrement is currently unused even though it's defined for vehicles

#

(0.4 by default)

bronze yoke
#

that's not really unusual for the codebase i'm afraid, particularly vehicles

teal slate
#

being able to configure it would let the bike mod make steering less janky, for example

#

(it steers very slowly for a bike, imo)

bronze yoke
#

maybe in the vehicle overhaul

teal slate
#

fingers crossed

#

from my perspective it isn't a huge change to fix it but with a project as large and sprawling as PZ, well

bronze yoke
#

it's not really a bug from TIS's perspective

#

it'd be nice but it doesn't even appear on that priority list

vagrant valley
#

Are there any resources on how to create gun mods?

crystal oar
#

if i grab a recipe with local recipe = getScriptManager():getRecipe(recipeName) can i just be like recipe.obsolete(true) or how do i make it obsolete?

teal slate
#

personally i consider unused variables and hardcoded magic numbers to be bugs :P

bronze yoke
#

recipe:setIsHidden(true) should work

#

(setIsHidden drunk)

crystal oar
#

thanks

bronze yoke
#

this doesn't technically delete it like obsolete does but it should have the same effect of hiding it

#

obsolete isn't actually a field, it deletes the recipe from all lists as soon as it reads that line, and unfortunately the relevant doparam-equivalent isn't possible to use from lua so you can't invoke that

teal slate
#

i wonder if my hacky code to expose additional classes in debug mode still works

bronze yoke
#

from lua? no way

teal slate
#

relies on field/method being exposed

#

so, debug mode only

bronze yoke
#

when did you do it? we haven't exactly had a patch in a while

teal slate
#

41.65, i think

#

and i know it's still exposed in debug mode in 41.78

#

not too useful in production but maybe fun for testing

bronze yoke
#

maybe that's why they aren't exposed normally

#

i was a little curious about the reasoning behind that

teal slate
#

here it is

#

looks like i gave up on using it for the purpose i made it for, and just like

#

edited the bytecode to flip that var instead

sour island
#

For what it's worth you can read in non-debug

#

writing is what's blocked

teal slate
#

i believe there are specific helpers for method/field stuff in non-debug mode, yeah

sour island
bronze yoke
#

there are but you can't do too much since you can't manipulate the objects

sour island
#

Similar idea

bronze yoke
#

i wonder if we could do some fun metatable stuff with them actually...

sour island
#

I mean, it's still useful to know what a value is in some cases

#

In the above example snippet it's for weapon script's length

teal slate
#

learning about __classmetatables broke my brain

bronze yoke
#

use a __index metatable to invoke getclassfieldval

#

that could be fun

teal slate
#

i wrote some really bad code in the name of writing good code down the line...

bronze yoke
#

might not be thinking it through properly yet

trim mist
sour island
#

Sure

bronze yoke
#

i suppose you could just add getClassFieldVal s to the existing __index but then the syntax would be () which seems bad

#

i gotta try this out

sour island
#

Simple solution is for TIS to expose the exposer and let mayhem happen drunk

crystal oar
bronze yoke
#

oh, maybe...?

#

is there a reason you can't just set it obsolete with a script as normal?

crystal oar
#

i want to define recipes in the sandbox vars to disable them, so it can be a general purpose tool

bronze yoke
#
    if not SandboxVars.WaterGoesBad.NeedFilterWater then
        getScriptManager():getRecipe('WaterGoesBad.Make Tap Filter'):setNeedToBeLearn(true)
    end
```in a mod i just set it to require learning the recipe
#

this won't work if the recipe you're trying to remove actually can be learned though

crystal oar
#

hmmm what about addRequiredSkill(obsolete, 11)? or something like that

#

so there's no way to have the required skill? then i hide it too and it won't show up either in the context menu or in the crafting menu?

#

seems to have worked, a bit janky of an approach tho

bronze yoke
#

i'm going to work on that more tomorrow, that could be crazy useful

distant rapids
# trim mist ^

Sorry about that I fell asleep, I just need the fundamentals on UI creation as the documentation that does exist doesn't help too much

distant rapids
fast galleon
#

@dark wedge If you think about reversing the climb I might have some code that can help you. I just gave up because it broke and the player would fall after the second reversal.

#

It also includes jumping off the rope into the direction the player chooses.

fickle relic
#

Hey all, I'm having real trouble setting up a test mod to print to console.

I only have my mod turned on in PZ, but none of my 'print' commands are coming through at all

dark wedge
sour island
#

If not I got hit by some deja vu

bronze yoke
fickle relic
#

Could be! Would that create an error in the console.txt?

bronze yoke
#

i don't think so

fast galleon
#

also didn't always happen.

fickle relic
#

If I can see this, does that mean it loaded correctly?

#

Or could it still be failing silently

bronze yoke
#

oh i see

#

your file is in lua, it needs to be in lua/client lua/shared or lua/server

dark wedge
fickle relic
#

😱 thank you! I followed the file structure of the example mod, that didn't have /client or /server

fickle relic
late hound
#

Does anyone know where in the code the shadow is applied to the player?

heady crystal
#

Is it possible to add two IsoObjects to the same tile?

#

I seem to be getting an error when fetching the second Obj every time.

bronze yoke
#

yeah, the game already has a bunch per square

heady crystal
#

Why is this happening then

#

Here's my code to fetch the objects:

local sq = cell:getGridSquare(emptySqX, emptySqY, i)
if sq then
  local objs = sq:getObjects()
  for n = 0, objs:size() - 1 do
    local obj = objs:get(n)
     ...
  end
end
#

I get an error in line local obj = objs:get(n), specifically in get

#

If it helps these are IsoObjects I am spawning myself

#

I get:
java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor334.invoke
Stack trace: java.lang.reflect.InvocationTargetException

#

If I spawn only one IsoObject on the square it works fine, but the moment I add two, poof, get this error.

dark wedge
late hound
fickle relic
#

Thank you for your help earlier πŸ™‚

now I'm trying to find the square that is underneath the mouse (OnMouseMove), so that eventually I can find the container that the user is hovering over.

Does my z-value for "getSquare()" need to be something other than 0 ?

((get square is not working at all))

dark wedge
late hound
fickle relic
#

For anyone interested, this code appears to work:

function ObjectContextMenu(x, y, xMultiplied, yMultiplied) print("on hover") local hoveredSquare local mX, mY = ISCoordConversion.ToWorld(x, y, 0); mX = math.floor( mX ); mY = math.floor( mY ); -- get the cell local cell = getWorld():getCell(); -- get grid square (tile) hoveredSquare = cell:getGridSquare(mX, mY, 0); if hoveredSquare ~= nil then --print("Found square!") local squareObjects = hoveredSquare:getObjects() --print("Found objects!") for i=0, squareObjects:size()-1 do local currentObj = squareObjects:get(i) --print("Found object!") --print(currentObj:getSprite():getName()) if currentObj:getContainer() then local container = currentObj:getContainer() print("Found container!") end end end end -- Register our event handler function. Events.OnMouseMove.Add(ObjectContextMenu)

distant rapids
#

For UI design does anyone know how to allow UI toggle?

hollow current
#

any up-to-date list of room definitions? The ones I find are missing few definitions

modern hamlet
#

Hello, I want to make a VHS mod, but I don't understand the auto-generated part. Can anyone guide me?

hollow current
#

there a way to return the client language of a player?

bronze yoke
#

getCore():getOptionLanguageName()

cinder frost
#

Any ideas why a simple

if player:HasTrait(*) then

would keep throwing an error?

bronze yoke
#

most likely player is nil

#

i'd have to see the error

cinder frost
#

HasTrait of non-table: null

type error

bronze yoke
#

player is nil

cinder frost
#

why would it be nil if the statement is run in the middle of a recipe result

bronze yoke
#

i can't tell you that without seeing your code

hollow current
sleek hull
#

Can you check if a function has already been added to an event, such as exampleFunc in Events.OnTick or something like that?

#

It seems that you can add a function to the same event several times without issue, and that is an issue for me atm πŸ™‚

fast galleon
sleek hull
hollow current
#

so, weird error

-- Function that gets a random story from the stories.json file based on a saved room name
function ImmersiveLore.getStory(savedRoom)
    if getCore():getOptionLanguageName() == "EN" then
        print("THE LANGUAGE IS INDEED ENGLISH")
    end
    local jsontext = ImmersiveLoreUtils.readModFile("ImmersiveLore", "media/lua/client/jsons/EN/stories.json")
    --rest of code
end```

When I try that on English language, the print statement is printed, and the rest of the code is executed without any issues or error, however, when I moved the ``local jsontext = ImmersiveLoreUtils.readModFile("ImmersiveLore", "media/lua/client/jsons/EN/stories.json")`` to inside of the if statement, I get the following error:

```ERROR: General     , 1688921481887> ExceptionLogger.logException> Exception thrown se.krka.kahlua.vm.KahluaException: nil passed to JSON:decode() at BaseLib.error line:292.
ERROR: General     , 1688921481887> DebugLogStream.printException> Stack trace:
se.krka.kahlua.vm.KahluaException: nil passed to JSON:decode()```
fast galleon
hollow current
#

not sure what exactly is going wrong there

#

aa wait actually i think I know

#

I am defining a local variable inside an if statment

reef portal
#

so from the dev logs i've read that zomboid is a custom engine built on openGL?

#

whats the codebase written in?

#

cuz Lua is used for scripting yeah?

jolly breach
#

Newbie question regarding tilesets...

If I use tiles from another creators tileset on steam workshop, do I need to either:

A) Repackage the custom tiles into my own mod (This feels like an infringement on the creators work)

or

B) The tiles will work if the user has also downloaded that tileset from the workshop. (Add as a dependency mod?)

This assumes the creator gives permission to use their tiles, and credit is given in the mod.

reef portal
#

probably add a dependency, but you want to becareful not to enter dependency hell by having too many lol

#

but its the cleanest way i suppose

#

im not too sure as to credit as im new, but i imagine you just credit the author and/or get permission then continue, moreso as a sign of good will ala the "be lovely" rule that the company has for their game and overall spirit of dev/modding

bronze yoke
#

a couple parts have been converted to c for performance but it's primarily java and lua

reef portal
#

really? wild.

#

good old java, so then you can decompile it eh? do people do that to get a feel for the codebase when modding? or is that agaisnt EULA?

bronze yoke
#

honestly most people don't, but i feel it really holds them back

#

lots of questions here that i answer in a couple seconds with ctrl-f πŸ˜…

reef portal
#

ah okay

#

my bad hehe

bronze yoke
#

so i'd highly recommend decompiling

reef portal
#

I probably will, i wanna see how the thing works under the hood tbh

#

I do solo dev stuff in Unity but nothing beyond prototypes and experiments for now

#

and maybe some modding in the meantime will be a boon

bronze yoke
reef portal
#

tho theres already quite a few great content and QoL mods for this game so its like the bases are covered ya know?

#

kk fair

bronze yoke
#

i think modding's a really great way to get comfortable with big codebases and to get some portfolio work while doing it

reef portal
#

yeah hey, no kidding

#

I've made some mods for RimWorld and Space Haven as well, but nothing too extravagant

#

(Space Haven is also written in java!)

#

RimWorld I mostly fixed other peopls mods, Space Haven I wrote some modding guide for, tho idk if anyone uses it lol

#

Zomboid, we'll see what it has to offer

#

seems like its fairly extensible given the current existing mod library

#

I guess once B42 is going itll be open to stuff like making logic simulators like wire mod for Gmod or redstone stuff for MC

#

cuz of the devices and machines/crafting ui overhaul

bronze yoke
#

it varies, some systems are very hardcoded but a lot of it is quite open

reef portal
#

thats so cool.

wet roost
#

why is my muzzle flash so massive, how do i fix that

bronze yoke
#

i need to do so more sleuthing around to see if this is actually viable to do but the proof of concept is there

#

at the moment the big limitation is i seem to need an instance to generate the metatable, and there just isn't a catch-all way to get instances of every class

mellow frigate
bronze yoke
#

the problem isn't finding the classes, i need an actual object because the getClassField etc stuff uses .getClass()

#

if i pass it a class itself it doesn't work

#

it might be necessary to just generate them out of game by parsing LuaManager as you say, which is not as elegant as doing it in-game would theoretically be futureproof

#

also, it will add a slight overhead to all java calls - it needs to be examined how large this is, if it's significant at all then the method your mod uses is preferable

mellow frigate
#

Wha do you wanna do ?

bronze yoke
#

with what i've written the syntax for getting a field is just object.field

#

e.g. looking at the syntax on your mod page, in your modlua local frameStageValue = getPublicFieldValue(getCore(),'frameStage') in my test would just be```lua
local frameStageValue = getCore().frameStage

mellow frigate
#

that's an interesting exercise. out of my knowledge πŸ˜„

tranquil kindle
#

If you use blender, apply scale so every axis is in scale 1, then scale it all down to 0,01 (i found this scale to work the best with muzzle, but you can adjust it from there depending on your liking), go to modeling and edit mode and there adjust size (changing size in modeling edit tab does not change "scale" which we aim for) so it looks good in game

#

In conclusion, scale 0,01 makes muzzle flash size pretty much the same as vanila gun.

hasty horizon
#

ive been thinking of different ways to be able to tag evolved recipes depending on what you put into them, is there a function i can hook like i've done with eating before to be able to check for ingredients?

sleek hull
#

Hoping to get an opinion:

Im making a mod that makes clothing adjust the characters comfort, and baded on this comfort, it will adjust their sleep quality and a couple other things. My dilema is when to show this moodle:

  • Display when player is sleeping: To me this is the one that makes the most sense so far that I could implement easily, but then you don't know your sleep is going to be affected before you sleep.
  • Display at all times: The moodle only affects your sleep, so to me it doesn't make sense to show the moodle when no effect is happening

Anyone have ideas/suggestions for when the moodle should be shown to the player?

bronze yoke
#

how about here?

nimble yarrow
#

when you right click a bed/chair, the tooltip reads:

Too panicked to sleep. (this line optional)
Bed Quality: Good (or poor, etc)
Clothing comfort: 60/100 (or something)
#

sheeeeeeeei

sleek hull
#

That would be a good spot, could just attach the moddle status there and ditch the moodle entirely

#

I've never worked with the UI's though, how would I access/modify/add the text to that?

nimble yarrow
#

I'd personally look at existing mods. subscribe on the workshop and take a peek.
There's a 'sleep in bathtubs' mod, but that probably edits the tub, not the tooltip.
theres a 'item tooltip expanded' and 'show weapon stats', but those look weapon related.
theres 'do i have a key for that' which extends doorknob tooltips, but we want bed tooltips. <- might be a good place to start?

sleek hull
#

Do I Have A Key For That seems to have something similar to what I'd need to do, it uses Events.OnFillWorldObjectContextMenu and iterates through it for a IsoDoor object. By the look of it, however there doesn't seem to be a IsoBed object 😒

bronze yoke
#

the game knows what objects are beds, so there's a way

#

the way i would do this actually is OnFillWorldObjectContextMenu search the context menu for the sleep option

#

if it's there you can just change the tooltip from there

sleek hull
bronze yoke
#

try just```lua
local option = context:getOptionFromName(getText("ContextMenu_Sleep"))

sleek hull
#

You're a life saver

nimble yarrow
#

osnap

sleek hull
bronze yoke
#

it's from a lua class, ISContextMenu

#

you can just check the file it's from

#

you can get intellisense for it with umbrella

sleek hull
bronze yoke
#

media/lua/

bronze yoke
#

you should be able to access any instance fields with just object.field syntax

#

e.g. local username = player.username

sleek hull
# bronze yoke media/lua/

I managed to add an option above the Sleep option.. No dice yet on adding it to the Sleep option. I think I'm just not understanding the structure behind it.
I'm assuming Sleep is an object of ISContextMenu, and the UI with the bed quality info is a SubMenu of Sleep, or how far off am I?

bronze yoke
#

i can't be sure how that tooltip works but it might just be an ISTooltip, in which case you can grab it with option.tooltip

#

or .Tooltip or something, i have a feeling it was weird like that

#

you should look into where this tooltip is actually added so you can get a clearer idea of how it works

sleek hull
#

option.toolTip returns something

#

Of which, option.toolTip appears to be a table

#

tooltip["description"] also appears to be what I'm modifying

#

@bronze yoke Your help is godly as always

nimble yarrow
#

osnap

sleek hull
#

I also just realized that me doing what I just did ate the last half of the bed quality part lol

bronze yoke
#

<BR> eats anything it doesn't have a space between for some reason

#

e.g. foo<BR> bar eats the foo but not the bar

sleek hull
#

So anything between the two <BR> tags gets eaten?

bronze yoke
#

no, you just need a space between a <BR> and a word

#

it eats anything it's touching

sleek hull
#

Ohhh, so it'd have to be <BR> Bed Quality: Good <BR> as opposed to <BR>Bed Quality: Good<BR>?

bronze yoke
#

yeah!

sleek hull
#

Gotcha gotcha

nimble yarrow
sleek hull
#

Fixed it, seems that <BR> only eats what's between them if both tags do not have a space between the tag and the word

bronze yoke
strong scaffold
#

Hello! maybe you could help me out here @albion, do you know anything about britas weapon pack by any chance?

bronze yoke
#

not really, sorry

nimble yarrow
#

lol 85,000 errors.

#

is this bad

fickle relic
#

So, now I know I can get objects on a grid square.

Is it possible to programmatically get the object associated with whatever sprite is directly under the mouse?

(for example, if you hover over the topmost crate in a stack)

nimble yarrow
#

@bronze yoke for a 10 years later / six months later / water & elec disabled playthrough, sinks start with 20.
WaterGoesBad sandbox options -- drain 20, chance 100, start 0, min amount = 2
not bad, but now every sink in the game has 2 water.
I'm looking for, let's say, ZombRand(0,7), so I figured i'd make a small WaterWentBad mod that loads after yours.

local WGB = require 'WaterGoesBad/WaterGoesBad'

local function NewTaintWater(square)

    local objectArray = square:getObjects()
    for i = 0, objectArray:size() - 1 do
        local object = objectArray:get(i)
        if WaterGoesBad.IsValidContainer(object) then       
            object:setTaintedWater(true)
            object:setWaterAmount(ZombRand(0,7))
        end
    end
end


Events.OnInitGlobalModData.Add(function()
  Events.LoadGridsquare.Remove(WGB.TaintWater)
  Events.LoadGridsquare.Add(NewTaintWater)
end)

I successfully replaced your function, but IsValidContainer threw 85,000 errors lol
edit: and I think I tried if WGB.IsValidContainer(object) then as well, hmmm

bronze yoke
#

should be WGB or it will throw 85,000 errors

nimble yarrow
#

Maybe WGB:IsValidContainer instead of WGB.IsValidContainer?

bronze yoke
#

check the function definition but i don't think i wrote any classes for WGB

#

so . should be all you need

gilded hawk
#

Is there a way to the return the instanceof of a table in zomboid's lua?

#

I know I can do instanceof (item, "InventoryContainer") but what if I don't know the type of item? How can I print that?

bronze yoke
#

if you just need to print it, print(item)

#

if you actually need it usable in code it's a bit more annoying

gilded hawk
bronze yoke
#

yes, but i don't think this does what you think it does

#

this is the equivalent of```lua
getmetatable(t).Type

#

Type is set by derive for lua classes, it won't be set for java objects

gilded hawk
#

Oh yes

#

That's exacly what I need

#

Inside ISTimedActionQueue im trying to figure out which action is derived from

#

OH YEAH

#

Thank you! @bronze yoke πŸ™ ❀️

#

Now I can implement my ultra minimal "speed the fuck up the game" mod

nimble yarrow
#

I've died twice due to "Chop Tree" + F4 😦

gilded hawk
#

???

#

❓

nimble yarrow
#

performing an action, then speed the fuck up the game. zombies zoom to you out of nowhere and give you a bite πŸ˜‰

gilded hawk
#

Ah yes

#

What my mod is doing is making the action itself faster

#

Not the entire game time

nimble yarrow
#

swag

gilded hawk
#

If this mod works, it's quite a pogger moment ngl

nimble yarrow
#

strange, @bronze yoke i got it working, but i... had to not use the function............?

--if WGB.IsValidContainer(object) then    <-- throws 40,000 errors
if object:hasWater() then -- pulled from IsValidContainer()
    if object:getProperties():Is(IsoFlagType.waterPiped) then -- pulled from IsValidContainer()
        object:setTaintedWater(true)
        object:setWaterAmount(ZombRand(0,7))
    end
end
sleek hull
#

How can I get the originalName of an InventoryItem object, or is there a way to sanitize a display name to not include modifiers (worn/bloody/wet/soaked)?

#

item.originalName is always nil, and I'm guessing it's because the field is in the Java class, with no get() method :/

bronze yoke
#

you could do getItemNameFromFullType(item:getFullType())

sleek hull
#

Actual lifesaver
Is there a better guide for what functions do other than the API that I'm missing? Or have you just been through the gauntlet of hell that is modding PZ?

mystic vessel
#

Hi good evening, I would like to know how I can make this tile "pickable", it already exists in the game. However, it cannot be picked up differently from a conventional computer. I've tried a few things here and it doesn't work.

fast galleon
mystic vessel
#

The model already exists in the game, but there is no way to get it, I just want to be able to get it through the pickup

fast galleon
mystic vessel
fickle relic
#

(Reworded to be much more clear)

  • Is there a command to find an isoObject at coordinates x/y?

  • Or; is there a command to find the sprite that is under the cursor at the mouse x & y world coordinates?

Use case: I'd like to know the IsoObject that a player is hovering over with their mouse/cursor.

(Without referencing a grid square or needing to click, since these could fail if the object sprite spills over into a different square visually on the screen)

Surely there has to be some way to do it, since Project Zomboid knows which crate you are hovering over when the player clicks to open its inventory (for example)

crystal oar
#

is there an event when players teleport?

polar prairie
#

could somebody link me a guide to backpack modeling? weapons work just fine but my backpacks are either invisible or look like they exploded from within. something is missing.

rich void
#

Hey guys, is anyone able to provide a simple demonstration of how I can store a virtual table of data across restarts, I'm using table.insert to populate a table with data but I'm presuming this data is gone as soon as the server restarts? I guess I'll also need to add events on save to save the data and onboot to load the data back up to repopulate the table with the correct info? any help would be greatly appreciated as always πŸ™

sour island
rich void
# sour island You should look into the global modData object. But if the data is related to an...

Legend thank you so much, the data is the time stamp of territory wars and the result, with the key value being the control point itself, I've sorted all the logic to figure out time difference between one faction capturing a zone and another taking it off of them, pumping out the results weekly to a log file, It looks like I can add data through add(string, table), simple enough, is there a major difference between Init() and load()? and then I'm using get(string) to retrieve the table related to the string defined in add?

fringe heart
#

Hi, do you know how you can make a character stop limping at all after bandaging his leg? Or maybe you know the mods for instant wound healing?

drifting sky
#

Hi! I'm completely new to modding PZ but I want to try making a simple mod that adds decorative items to the game. Can anyone help me out in terms of showing me where to start?

cobalt fiber
#

See if you can find something related to the Chunk Debugger in debug mode, as it show the current x & y of your mouse cursor without clicking πŸ˜‰

#

For the isoObject, I use "getCell():getGridSquare(x,y,z):getObjects()", this will return a java ArrayList, then you can use a for loop to iterate on all the objects in that square, and use a filter to get the object you want, like a name or something

crystal oar
#

is there an event when players teleport?

sharp minnow
# drifting sky Hi! I'm completely new to modding PZ but I want to try making a simple mod that ...

Mod resources is a good place to start: https://discord.com/channels/136501320340209664/1070852229654917180

Decorative items you're probably ooking at adding new tiles etc - Daddy Dirk has a pretty good set of help guides on it starting here: https://www.youtube.com/watch?v=87JWHO5hs8g

Or maybe even here for making an item: https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/scripts/README.md

drifting sky
#

thank you!!

bronze yoke
sharp minnow
# drifting sky thank you!!

Another good way to start is to download a few mods that do similar to what you're trying to achieve and work out how they work. Best not to copy the code but it should help you do thinks like find event hooks, in file references, get you used to the mod structure. If you're making something that will need to spawn into the game somewhere you'll need to get familiar with the distribution files, again - some guides in the big list.

On top of that, ask questions here. You might not always get an answer because while people love to help - everyone has their own commitments, but I've learned a lot by listening, or searching to see if someone asked something similar.

rich void
sharp mural
#

is there a file or folder that lists every trait in the game and how it works?

bronze yoke
#

no, traits are initialised in MainCreationMethods and then their actual implementation is just inserted wherever in the lua or java they're relevant

#

if you want to see how a specific trait works you should find its internal name and then search the source for references to it

sharp mural
bronze yoke
#

i'm not sure any of them have clocks, if they have a constant effect it'd likely be baked into the character's main update method

sharp mural
#

i guess that is a point, alot of them only statically affect the player.
for something like smoker however, would that have a clock?
for traits that affect the players mood when their dirty/bloody/whatever, are those just checked based off of an event (more dirty the player is => see if they haave trait x => do y)

bronze yoke
#

the stressed when bloody trait is just part of the stress update method, which is part of the Stats update

sharp mural
#

so basically they just check the players traits when another event fires instead of haaving their own specific event

bronze yoke
#

it handles them by hardcoding literally everything drunk

sharp mural
#

why not make a table and iterate through that 😭

bronze yoke
#

with the older stuff you can really tell tis did not have any lua developers

sharp mural
#

honestly though even if they were new lua coders, they still made it rather wwell

#

its stood the test of time even with modding support and hasnt shatteredd into a quadrillion piecces

bronze yoke
#

i just wish they'd used modules

sour island
#

The oldest stuff is in need of TLC forsure

#

Massive if trees make mod compat near impossible

#
  • yeah a lack of module use sets a bad learning example -- not that they're obligated to teach people or make their code focused on modders. But would also corral a lot of issues users have in the end.
#

Contrary to popular opinion, mods don't have to fire off errors every second/minute lol

drifting ore
#

Does anyone know what causes this issue? There is a lack of proper display and the item itself doesn't show up when worn.

sour island
#

I'm guessing you're getting errors every frame?

#

May or may not be related to the item in question - if you have another mod that changes bodylocations as well

#

A good example I know of is UndoMaskExclusion

drifting ore
#

Yep!- I think I realize the issue then since I have other mods for testing

I'll disable all other mods and see if that fixes the issue, thank you for the suggestion

sour island
#

Being this is a custom item, could be it itself

#

No problem, I made a mod that debug this issue - if it's the same one.

#

There's 2-3 ways to brick tooltips that don't relate to the actual tooltip Lua code. πŸ˜…

#

I meant to expand on it to find the other issues, but never got around to it. This will forcibly add the location the code is looking for though. So it may provide a clue in the logs.

drifting ore
#

Ah! Thank you! This already helps a lot since I didn't know where to start with the mod- I appreciate it!

lavish otter
#

I've had a bit of a thought about vehicles. I think they could be added upon by adding oil and coolant to their functionality along with the need for a battery and gas.

drifting ore
#

The item shows up fine, it's just when it comes to the texture, this happens.

The guide for clothing items also disappeared from steam so 😭

bronze yoke
#

you can wayback machine it if you still have a link

#

as far as i know all of dislaik's guides (which is likely the one you're talking about) are still available that way

drifting ore
#

Oh! okay got it! Thank you for the advice!

severe zenith
#

I don't know where to ask; Where can I learn how to make animations for Project Zomboid?

#

I imagine I'd have to learn how to use blender on top of trying to code it in the game.

#

A guide on how to make a dance with True Actions might be useful. I'm not making a dance but learning how that's expressed in the game and how to make an animation model would be very helpful.

bronze yoke
polar gyro
#

I trying to add another weapon placement on belt with ISHotbarAttachDefinition.
How I can add another attachment via table.insert in SmallBeltLeft/SmallBeltRight?

lavish otter
# sharp mural batteries and gas are a thing

My issue is that once you get a battery and a generator, the battery being the easier part, you basically have a car forever. I want to add some more need to loot to keep a vehicle functional

slender oar
#

looking at adding spawn points, how can i easily find the worldX/Y and posX/Y? on pz map online i can get the regular x,y but then it seems spawn points need the world/pos that are cell and relative x,y?

bronze yoke
#

world co-ordinate is (x / 300) rounded down, relative co-ordinate is (x % 300)

ancient condor
#

Is possible to make guitars attachable to the backpack?

#

was trying to get screenshots for a guitar retexture im working on and it wouldnt let me

slender oar
crystal oar
#

is there something like [Recipe.GetItemTypes.RipClothing_Leather] for shoes/footwear?

#

umbrella shows Shoes but idk where it gets that from since i am new to umbrella

slender oar
#

is there any easier way to make the spawnpoints file than manually editing? i saw a forum post someone mentioned a "Spawn Region" thing in sandbox settings, but i failed to find what they were talking about...

crystal oar
#

can i fetch all items that have BodyLocation = Shoes?

bronze yoke
#

you can loop through the item list and check whatever conditions you need to

crystal oar
#

do i just make a lua fucntion to do that and then replace [Recipe.GetItemTypes.RipClothing_Leather] with the name of my lua script? and is that going to run the scrips each time someone goes to rip shoes?

bronze yoke
#

yeah, the square brackets mean it's the name of a lua function

crystal oar
#

am i going to be looping through all the items in the game a bunch that way? is that why the vanilla rip item tooltips take so long to load?

bronze yoke
#

nah don't worry, getitemtypes only gets called once while loading

crystal oar
#

ah okay

bronze yoke
#

the vanilla rip tooltips take so long to load because of the preview of what items you can use, it literally checks your inventory for every single clothing item in the game ded

#

just to only display ten of them

nimble yarrow
slender oar
#

for spawn points... how do these occupations listed line up? can i leave all but 1 out if i want a spawn region to just have 1 spawn point? i tried that(only defined unemployed) and it doesn't seem to spawn me where i want. should i just copy the same coords to every occupation then? and this is definitely not the whole list of possible occupations

slender oar
#

err, maybe it was spawning me in right spot. not very random tho

drifting ore
#

Does gendered-textures exist? Is it possible to make an apparel change textures depending on male or female?

cobalt fiber
#

Hey guys! Is there a good way of knowing if something Lua related (eg. a command) NEEDS to be client/server/both? Some things I know, like ProceduralDistributions or UI related stuff, they are server and client respectively. Would be cool if there was some kind of "rule" that says what needs to be executed where. moley

#

Also, not necessarily Lua related stuff, Java methods too

bronze yoke
#

in terms of lua, it's mostly arbitrary, and you should either put it where you want, or if your code ties into vanilla code closely, put it the same place they did

#

if you're not aware, the server folder isn't server only (there's a huge amount of client-only code there even) - so it usually only matters in the cases that either you're trying to hook into something from client (which is client-only, thankfully) or you need to ensure load order (as lua loads shared -> client -> server)

#

@cobalt fiber

autumn temple
#

ok so I am trying to make a item that acts like any other edible consumable. and I just want to make sure. is the "EatType:" the animation that plays when you use the item?

cobalt fiber
#

@bronze yoke Thanks for the help! spiffo

slender oar
#

how do i set the description/picture for a spawn region? only vanilla ones show anything for me. all of the map mod ones are blank

#

i installed the map mods via steam workshop, then added the name/file line to Zomboid/Server/servername_spawnregions.lua

#

and of course included the Map name and Mod IDs in the servername.ini file, that's all working

fickle relic
#

πŸ€” do all InventoryItems have an Item?

I'm looking to get the icon for the InventoryItems in a container, but the InventoryItem class doesn't have a :getIcon() function

dark wedge
fickle relic
#

πŸ™ thanks @dark wedge !

nimble yarrow
#

do Events.xxx.Remove(xxx) fail silently? or do I need to perform a nil check first? just in case the event im trying to remove doesnt exist?

nimble yarrow
#

or rather, is there a way to get a list of functions that are subscribed to an event?
I need to know what is getting called each time Events.LoadGridsquare,
so that I know if I need to remove something, or not. hmmm,

fickle relic
#

Time to work on an ISPanel ... I'm trying to create my own 'class' called PanelClass.

But the script fails immediately as I open the game on the first line 😦 I've done a lot of diving on how other folk have implemented ISPanel, but this error message is confusing me 😒

neon bronze
#

Put the derive outside the function

#

Look overall how the vanilla panels do that they all derive from IsPanel

#

And store the derive in a local var for which they make all the function like create etx

fickle relic
#

If I want to make multiple PanelClass:new(),

#

will every call to the derive mutate the same panel?

neon bronze
#

You wanna make multiple :new() functions that have different vars parsed through?

fickle relic
#

Yep!

#

I usually use C#, so Lua is a bit of a change πŸ₯²

neon bronze
#

I don’t know if thats possible tbh

#

You could make a second class that derives from your og class but has a different :new() function

fickle relic
#

oh hang on let me try to explain better, I'd like to create more than one instance of PanelClass ?

#

But I'm worried that moving IsPanel:derive outside of PanelClass would mean that I can't override its render with the PanelClass properties

neon bronze
#

Or you just make a new2() function for your class

hollow current
#

do survivors' houses have special room names/special containers name? or the dead survivors found in the house itself? Basically want to handle certain spawns in survivors houses

fickle relic
#

Is there a way to get the ID of a ItemContainer? 'ID' seems to be a public variable, but it doesnt have a getter method

#

nvm, just going to use the id of the container's IsoObject πŸ‘

#

Nevermind, getKeyId of IsoObject returns -1 πŸ€”

bronze yoke
#

you can't get a list of added functions but you could generate one by hooking Event.Add as long as you can ensure your code runs before anything you're interested in

nimble yarrow
#

if two separate mods add a lua file with the same name, in the same directory,
im assuming the last mod loaded in the load order 'wins

neon bronze
#

Yes which is why you should never replace vanilla files but hook into their functions

mellow frigate
#

How can I control the sound radius of a sound emitted on a square ? I use isoSquare:playSound('MSR788Shoot') from a square and the range of Z attraction is big. How can I control it ? I do not see no soundradius parameter associated to the sound (there is one associated to the weapon though but I aint got no weapon and I wanna be able to use any sound)

neon bronze
#

Do you mean the soukd volume or the sound attraction radius?

tawdry solar
#

hey dudes

#

how easy is it to make custom voice sounds

neon bronze
#

If you have the events for when it should fire then its pretty easy

nimble yarrow
#

can you use addSound instead? as it has an overload for radius. /shrug

tawdry solar
#

for a custom shout sound

#

im doing a commission so i needa know

neon bronze
#

Dont think there is a shout event but you can check for which key is pressed through the KeyPressed event

tawdry solar
#

oh sick

neon bronze
#

The pz wiki has all the events in the game

mellow frigate
mellow frigate
bronze yoke
#

i've done the sound and attraction separately in the past

neon bronze
#

Would be better if you defined that in the item script but if the sound itself attracts zombies would be good to look at the script

#

But usually you define the hear radius in the sound script and the attraction radius in the item script

mellow frigate
#

hum.. maybe I did not test enough. Many Zs have been attracked but It may be due to something else

neon bronze
#

Well i dunno how the vanilla sounds work since they are defined in their own way

mellow frigate
#

yep, that's it. There is no attraction with playSound.

sour island
#

There isnt

#

The attraction one is addSound if I remember

spare pecan
#

Has anyone made a mod that adds more Mannequin poses? I've come to realise there's only like 4 default poses haha

limpid grail
#

There's a mod called disable sleep in single player, unfortunately the guy who created the mod can't makes it so sleep isn't required but allowed, is there anyone that could work with him to make it so sleep isn't required but you can sleep to skip time