#mod_development

1 messages · Page 153 of 1

ancient grail
drifting ore
#

cool!

fading horizon
#

maybe instead of getting rid of the shadow, theres a way to recolor it or replace the shader?

drifting ore
#

how can i get PZ API for making mods in visual studio code?

sand dagger
#

Hi Guyz,

what could it be, when a zombie gets a custom HP value over lua that the zombie just disappears instead dies on a MP server

frank elbow
frank elbow
sand dagger
#

will set on client and server, but will check for the post here

timber river
#

In regards to spawn points... Is it possible to raise the point so that you can have spawns on rooftops?

modern hamlet
#

I want to spawn items on the ground at the given coordinate. I think something like this has been discussed before, I searched but couldn't find it, can anyone help?

timber river
hot patrol
# ancient grail

Looks cool. You should make it compatible with the autotsar boat mod if possible since that has swimming as well but the char is invisible.

ancient grail
#

But why?

#

Ok i guess

hot patrol
#

Just a suggestion since the anim on your's is cooler than the one in the boat mod

ancient grail
#

Yeah it does make sensse

minor pumice
ancient grail
#

You just dont see it when the player turns around

red tiger
#

Linter logic seems to be holding up so far:

{
    "type": "error",
    "location": { "start": { "row": 3, "col": 5 }, "stop": { "row": 3, "col": 14 } },
    "message": "Unknown word: animation"
}
bronze sinew
#

Do masks need to connect to a bone?

trim mist
#

Hey y'all, how do you test a mod? I've been throwing mine into another mod's workshop folder and launching my game, but i've been getting an error. I need to figure out if that's normal or something wrong with what I wrote

#

gotta love that java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).. error

#

and empty stack trace lmao

tawdry solar
#

anyone help? i have no clue whats wrong

module Base
  {

    item Kurki
    {
        MaxRange    =    1.23,
        WeaponSprite    =    Kurki,
        MinAngle    =    0.7,
        Type    =    Weapon,
        SwingSound = MacheteSwing,
        HitFloorSound    =    MacheteHit,
        ImpactSound    =    MacheteHit,
        DoorHitSound = MacheteHit,
        HitSound    =    MacheteHit,
        MinimumSwingTime    =    4,
        KnockBackOnNoDeath    =    FALSE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    LongBlade,
        ConditionLowerChanceOneIn    =    25,
        Weight    =    2,    
        SplatNumber    =    2,
        PushBackMod    =    0.3,
        SubCategory    =    Swinging,
        ConditionMax    =    13,
        MaxHitCount    =    2,
        DoorDamage    =    10,
        SwingAnim    =    Bat,
        DisplayName    =    Kurki,
        MinRange    =    0.61,
        SwingTime    =    4,
        KnockdownMod    =    2,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    Dudclub,
        TreeDamage  =   10,
        CriticalChance    =    20,
        CritDmgMultiplier = 5,
        MinDamage    =    2,
        MaxDamage    =    3,
        BaseSpeed = 1,
        WeaponLength = 0.3,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = CutPlant,
        DoorHitSound = MacheteHit,
        HitSound = MacheteHit,
        HitFloorSound = MacheteHit,
        BreakSound  =   MacheteBreak,
        SwingSound = MacheteSwing,
     }


        model Kurki
                {
                mesh = weapons/1handed/Kurki,
    
                attachment world
                {
                offset = 0.0000 -0.1660 0.0070,
                        rotate = -180.0000 0.0000 0.0000,
                }
            }
}
tawdry solar
tawdry solar
fading horizon
tawdry solar
fading horizon
#

it's a program

#

ShareX

tawdry solar
#

ah

ancient grail
#

ShareX

tawdry solar
#

and it auto makes it gifs/

ancient grail
#

Yiu record as gif

fading horizon
#

you can clip regions of your screen for images, mp4, or gif

#

and it will auto paste it to your clipboard

tawdry solar
#

oh thats coo

#

cool

fading horizon
#

and optionally upload to an image host / save to a file

#

really useful program

tawdry solar
#

i love 3d modeling and hate coding smh

fading horizon
#

like windows snip tool but with gif / video function

#

i hate modeling and love coding

tawdry solar
#

thats actually usefull

tawdry solar
fading horizon
#

that's why my project ive been working on is almost entirely modeling

#

trying to get these damn wings to work is killing me

tawdry solar
#

work?

#

the mod looks good anyway

fading horizon
tawdry solar
#

ooh

fading horizon
#

making a biblical angel styled backpack

#

normals are super messed up lol

tawdry solar
#

last night

#

my model

#

half was normal

#

and not

#

when i re calc it just swapped sides

#

so i couldnt texture it

#

it looked like this

shadow trench
#

just select all the faces and hit

#

'recalculate outside'

#

if you're using Blender

fading horizon
#

doesn't work unfortunately

#

it just flips them

soft current
#

is there any known tool/method of profiling code?

trim mist
#

Could someone take a look at my mod and see if i'm doing anything wrong? after doing some fixes i'm still getting Error 1 on the bottom right of my screen after attempting to turn my mod on

#

and the log continues to be unhelpful

ancient grail
#

Install error magnifier

trim mist
#

ooh, where do i get that? the workshop?

ancient grail
#

Ye

trim mist
#

I probably should have specified that after it gives me an error, i get the menu screen but blank

tawdry solar
#

could somone help me

trim mist
#

I took a video so it'll be a lot easier to understand what's going on on my end

#

any ideas?

#

Could really use some help haha

trim mist
ancient grail
#

I have never delt with overlays.
Dried fish mod(made by poltergeist)
Uses a single tile fish rack
Where you can hang the fish to dry

But what we are doing now is a crab netting thing and it has 4 tiles

If theres anyone who knows or has an idea as to how do the same thing but with 4tiles
( only requires to inteact with one of em but all 4 should change)

Pls let us know how

Thnx

bronze yoke
tawdry solar
#

if it was modeling

ancient grail
tawdry solar
bronze yoke
#

by the way, usually you want your working folder to be Users/username/Zomboid/mods or Zomboid/Workshop, following the mod templates in the respective folders

tawdry solar
ancient grail
#

You have like a missing comma or closing pare thesis or something like that

tawdry solar
#

oh

#

right

ancient grail
#

Sometimes it doesnt know what tl do if theres a syntax error

tawdry solar
#

i didnt know if you were talking to me or not

ancient grail
#

Also usual culprit would be
Missing end

Var1 and var2 and ...end

trim mist
ancient grail
#

Could also be

local table {stuff1, stuff2}

#

Forgetting the =

trim mist
tawdry solar
trim mist
#

Integrated Development Environment. Like Visual Studio Code, Visual Studio, Eclipse...

#

or are you using a text editor like notepad ++ or something?

tawdry solar
#

notepad

#

the one you get with windows

#

i have ++ and vsc

#

i use ++ for .kua

#

lua

bronze yoke
#

oh thank goodness

trim mist
#

I highly, highly recommend editing in visual studio code

#

there's a .lua extension

#

that can help you find some syntax issues

bronze yoke
#

i'd recommend vsc but notepad++ is at least usable for code

tawdry solar
#

alright

#

how do i see errors

bronze yoke
#

if you launch zomboid in debug mode it'll pop up on your screen, or else you can read console.txt in the Zomboid folder

tawdry solar
#

i dont belive there is errors btw

#

cause this is an old code that i used as a template

#

but idk

#

nvm

#

fml

#

i found it

#

wait nvm

trim mist
tawdry solar
drifting ore
trim mist
#

your name lmao

#

i thought you were a bot for a sec

drifting ore
#

its in my passport, cat jumped on the keyboard when they registered me

#

Also, you have won a big JACKPOT, I need your credit card info.

ancient grail
#

Its not loading on my mobile

#

Ah its the swim mod

#

Its far from done

drifting ore
#

while you at it, make a simple canoe mod too

trim mist
tawdry solar
#

what if im doing a weapon

trim mist
#

I think the modules for that are something custom-written by the zomboid devs, correct me if i'm wrong

#

you'd have to compare what you're writing to a mod that work's weapon modules

tawdry solar
#

so its not the same

tawdry solar
bronze yoke
#

you don't usually need any lua for custom weapons

#

just a weapon script

tawdry solar
#

im not using lua

#

i could send my weapon code if you would like

trim mist
# tawdry solar i used one of my other weapons

Clearly there's something up with that one, I'd download another mod that adds weapons and see how they do it and what differences there are between yours and theirs. Try to follow their format exactly just to see if it works

tawdry solar
#

i have working weapons

trim mist
#

Are you sure it's the weapon script itself then? Maybe you forgot to include it somewhere? What's the actual error you're getting in game?

tawdry solar
#

wait

#

hold on

#

somone once told me that somtimes it doesnt apear inside the spawner meny

#

menu

#

i forgot the command tho

#

i got it

trim mist
#

what was the issue?

timber river
#

it would show up in the debug item spawner, you using -debug?

tawdry solar
tawdry solar
#

it happened to me before

#

i used the command additem

#

and it went in my inv

#

but it wasnt in item spawner

timber river
tawdry solar
#

i forgot the command smh

#

it didnt work i mean

timber river
#

for adding an item?

/additem username item amount

tawdry solar
#

ah

#

didnt work

timber river
#

post your file here

tawdry solar
#

alr

#
module Base
  {

    item Kurki
    {
        MaxRange    =    1.23,
        WeaponSprite    =    Kurki,
        MinAngle    =    0.7,
        Type    =    Weapon,
        SwingSound = MacheteSwing,
        HitFloorSound    =    MacheteHit,
        ImpactSound    =    MacheteHit,
        DoorHitSound = MacheteHit,
        HitSound    =    MacheteHit,
        MinimumSwingTime    =    4,
        KnockBackOnNoDeath    =    FALSE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    LongBlade,
        ConditionLowerChanceOneIn    =    25,
        Weight    =    2,    
        SplatNumber    =    2,
        PushBackMod    =    0.3,
        SubCategory    =    Swinging,
        ConditionMax    =    13,
        MaxHitCount    =    2,
        DoorDamage    =    10,
        SwingAnim    =    Bat,
        DisplayName    =    Kurki,
        MinRange    =    0.61,
        SwingTime    =    4,
        KnockdownMod    =    2,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    Dudclub,
        TreeDamage  =   10,
        CriticalChance    =    20,
        CritDmgMultiplier = 5,
        MinDamage    =    2,
        MaxDamage    =    3,
        BaseSpeed = 1,
        WeaponLength = 0.3,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = CutPlant,
        DoorHitSound = MacheteHit,
        HitSound = MacheteHit,
        HitFloorSound = MacheteHit,
        BreakSound  =   MacheteBreak,
        SwingSound = MacheteSwing,
     }


        model Kurki
                {
                mesh = weapons/1handed/Kurki,
    
                attachment world
                {
                offset = 0.0000 -0.1660 0.0070,
                        rotate = -180.0000 0.0000 0.0000,
                }
            }
}
trim mist
#

i have to ask, do you have the weapon somewhere as "kukri" and in here you have it referenced as "kurki"?

timber river
#

Well the actually spelling of the real weapon is "Kukri" your file here says "Kurki"

I'm not too familiar with weapon mods yet (was gonna start work on one today actually) but if it is labeled as "Kukri" anywhere in your mod that would give you problems

#

The kukri (English: ) or khukuri (Nepali: खुकुरी, pronounced [kʰukuri]) is a type of short sword with a distinct recurve in its blade originated in Nepal. It serves multiple purposes as a melee weapon and also as a regular cutting tool throughout most of South Asia. The kukri, khukri, and kukkri spellings are of Indian English origin, with the o...

tawdry solar
#

ooh

#

yeah mispelled

#

but nothing is wrong

trim mist
#

unsure why that was crashing stuff

blazing pond
#

does anyone here know how to separate male and female animations?

fading horizon
#

Would it be possible to give a backpack an animation

#

I'm assuming no or it would have been done / I would have seen it by now

#

I was wondering if I could make the wings on my backpack slightly animated

gaunt thorn
#

Hey all, where can I find the file that defines what the vanilla traits do?

blazing pond
#

just sounds like a set variable

#

but what your wanting though

#

i would think it'd be possible

fast galleon
fast galleon
gaunt thorn
#

Ah okay

#

Thanks this is super helpful

#

That’s very different than how trait mods work

trim mist
#

Anyone know how to directly access a body part?

#

this would be so much easier if I could do just getBodyDamage("Foot_R") rather than throwing in another for loop

bronze yoke
#

i think bodydamage:getBodyPart(BodyPartType.Foot_R)

trim mist
#

oh nut, i saw that when the error screen came up in game but didn't know I could access it like that

#

thank you

patent lichen
#

Is there any one I could ask a quick question about making a mod that just creates in game cash spawns?

nimble spoke
trim mist
#

Anyone know the difference between setInfected and setFakeInfected? Is former for a knox infection and the latter is for a regular infection? Or is the latter a obsolete hypochondriac thing

bronze yoke
#

infection is zombie infection, infectedWound is regular infection, fake infection is used instead of infection when infection mortality is off

trim mist
#

albion again coming out to save the day

#

thank you

bronze yoke
#

fake infection behaves like real infection but once it reaches 100 it starts decreasing

fading horizon
#

i'm loving how this backpack is coming out

ancient grail
#

It does what you need to do the animation

#

Just have to keeep on changing em

fading horizon
#

awesome, ill look into it

#

thank you

#

little preview of some of the bags in my new mod

crystal oar
#

when does the death stranding inventory mod come out lol

reef karma
#

hey yall, what is the event to call a function during mp server bootup?

#

trying to load some counter from a previous game kind of thing -- if that makes sense

bronze yoke
#

if you want it to run during bootup you don't really need to attach it to an event

#

if you're relying on a system that loads after lua like moddata you should attach it to the event for that loading but otherwise you can just do it when the file executes

reef karma
#
local function CBTS_ServerSetup()
    print(DebugPrefix .. "Setup Server Defaults for The Calm Before The Storm")
    print(DebugPrefix .."RandomDurationFlag=" .. tostring(SandboxVars.CBTS.RandomDurationFlag))
    local modmodData = ModmodData.getOrCreate(CBTS_STATE_KEY)
    if modData.CycleCounter == nil then
        modData.CycleCounter = 0
    end
    if modData.CurrentCooldownDuration == nil then
        modData.CurrentCooldownDuration = 0
    end
    if modData.CurrentCalmDuration == nil then
        modData.CurrentCalmDuration = 0
    end
    if modData.CurrentStormDuration == nil then
        modData.CurrentStormDuration = 0
    end
    print("this is inside CBTS_ServerSetup")
end
``` i this is the function i want to start when the server boots
#

so i can access modData later on

#

is that what your second sentence is referring to? (very new to all of this so i have no idea what i am doing)

bronze yoke
#

yeah, you'd want to use OnInitGlobalModData then

reef karma
#

that is what i thought but it keeps yelling at me. let me get the error.
to be sure, it would be Events.OnInitGlobalModData .Add(CBTS_ServerSetup) correct?

bronze yoke
#

without the space but yeah

reef karma
#

also that is a typo ^ gotta fix thst

#
local function CBTS_ServerSetup()
    print(DebugPrefix .. "Setup Server Defaults for The Calm Before The Storm")
    print(DebugPrefix .."RandomDurationFlag=" .. tostring(SandboxVars.CBTS.RandomDurationFlag))
    local modData = modData.getOrCreate("CBTS_STATE_KEY")
    if modData.CycleCounter == nil then
        modData.CycleCounter = 0
    end
    if modData.CurrentCooldownDuration == nil then
        modData.CurrentCooldownDuration = 0
    end
    if modData.CurrentCalmDuration == nil then
        modData.CurrentCalmDuration = 0
    end
    if modData.CurrentStormDuration == nil then
        modData.CurrentStormDuration = 0
    end
    print("this is inside CBTS_ServerSetup")
end```
#

Error java.lang.RuntimeException: attempted index: getOrCreate of non-table: null
which is the 4th line in the snippet

bronze yoke
#

ModData.getOrCreate

reef karma
#

a fuck

#

i wonder how much time i wasted because of the M
thank you btw

atomic stream
#

Is there a way to add scratch/bite protection to certain body parts? Or is there any mod that has done it before? (i.e. only add 10 protection to torso, or 10 protection to torso and arms)

atomic stream
#

Turns out it is connected to "BloodLocation" in the script files

#

But is there a workaround for this? TO have partial protection with complete body blood texture enabled

drifting ore
obsidian horizon
#

an idea for someone, making the jukebox work for vinyl and cassette tapes found in truemusic mod

gaunt thorn
#

I'm having trouble setting up intellij and gradle. I'm getting this error:

#

I've looked everywhere and have no idea how to fix

sour island
sour island
#

Are you using Konijima's guide?

gaunt thorn
#

yeah

sour island
#

Are you getting this error when you try to run the tasks?

#

Or better yet, which step are you on?

gaunt thorn
#

B)3)

#

Pre-setup

#

I made it further before but I forgot what I did

#

either way, the time I made it further, I ran into the same error

fast galleon
#

v 17 doesn't work, use a higher version. It's how most people get it to work.

gaunt thorn
#

ah okay

#

I'll try that

#

Should 20 work?

fast galleon
#

Maybe the problem is with gradle version though.

gaunt thorn
#

or should i stick around 17

fast galleon
gaunt thorn
#

oh shit okay

#

thanks I'll update here

fast galleon
#

but the decompiled code looks different when you use v17, so I'm not sure of what is the best solution

gaunt thorn
#

working is better than not haha

dry mauve
#

I followed that guide last night with no problem and used java 17

gaunt thorn
#

I passed the problem step with no problem

#

ran into the other issue

#

poltergeist mentioned the issue might be with the gradle version. How can I go about changing it?

sour island
#

there's a plugin's section in the IDE

#

Under File > Settings

fast galleon
#

Guide by Konijima about PZ Libraries (v2)

https://github.com/Konijima/PZ-Libraries

Works with next settings:

  • Capsid 0.4.2
  • Intellij 2023 -> new project -> advanced settings: Gradle 7.6, JDK azul-17
    Known Issues:
  • gradle 7.0 does not support jdk 17
  • gradle 8.0+ not working

Notes about decompile and capsid:

  • Current version of FernFlower bundled with Intellij throws error and fails to decompile certain methods. Last working version fully decompiling PZ v41.78.16 was included in Intellij 2022.3.
  • Capsid includes a version that works and successfully decompiles.
  • Capsid is missing files like: server/Vehicles/VehicleCommands.lua, several GlobalObject systems.

Other Tools

#selfpins decompile tools

#

@gaunt thorn

sour island
#

for this project I think Yooks set it on a hosted site

#

there was an issue with the previous iteration of 'pz-mod' (capsid's predecessor) breaking because the game no longer used java8

gleaming lynx
#

Hello.
I am making a mod that allows you to teleport selected car to the player. The problem is that the car does not teleport.
Here are the methods I use:

  vehicle:setY(y)
  vehicle:setZ(0)
  vehicle:setSquare(square)```
When the function is executed, there are no errors, but the vehicle doesn't teleport. I check "square" variable, it's not "nil", I check "vehicle", it's not "nil" either, but still the car doesn't teleport. The vehicle coordinates before and after execution of the line "vehicle:setSquare(square)" are different, but after execution of the function are the same.
I can't figure out what's wrong. Ran through all of Project Zomboid's code, but found nothing new, just these methods that belong to "IsoMovingObject".
Please help me out.
quartz badge
#

how do I manage to get a custom item i made to spawn in the world

#

not on zombies, but in containers

gaunt thorn
#

IT'S WORKING

#

thank you

neon bronze
#

thats where all the loot for the containers is defined

#

you'd just need to insert.table your items and spawn chances in the desired container

trim mist
#

Anyone have any idea why my sandbox-options.txt file would be crashing the menu on loading the mod?

#

i think i stuck it in the right place. The formatting of my file seems similar to other mods'

#

am i missing something?

fast galleon
trim mist
#

really.

#

really?

#

type= vs type =

#

I hate programming sometimes because of stuff like this. Thank you

#

lol

fast galleon
#

added help

trim mist
#

fixed it

trim mist
bronze sinew
#

how do I find where all my mods are installed? I cant seem to find them in any mod folder ;-;

trim mist
#

if it's not there then you shouldn't have them, unless they're in your user's zomboid mod folder

lime steeple
#

Does everyone else just close and reopen their game a billion times while developing? I've tried reloading from the debugger, that works randomly but only for certain extremely minor issues I can't fully fathom. I've tried quitting the game (but not to desktop) and toggling on some other mods just to get it to reload the LUA. That doesn't work. I've tried the Reset Lua button in the bottom right of the menu screen -- nothing. 99.985% of my dev time is just restarting the game over every typo. Surely I'm doing something stupid.

drifting ore
#

does restarting lua not work?

fast galleon
bronze sinew
fast galleon
#

If you use an event then you need to remove your function before reloading the file and add it after reloading. For testing you can do a dummy function that calls a global function if you're bored and need to reload a lot.

lime steeple
fast galleon
#

Or make a script that does the mentioned logic by itself. As long as it's not happening during reload of the file.

forest escarp
#

Is there any way to interact with the HealthPanel w/ lua, I can't find anything within the game's own lua and there seems to be random missing attributes in some objects

Anyone in the future this peice of code in XpUpdate.lua shows how

getPlayer():getID() can be used to get player ID :)

xpUpdate.displayCharacterInfo = function(key)
    local playerObj = getSpecificPlayer(0)
    if getGameSpeed() == 0 or not playerObj or playerObj:isDead() then
        return;
    end
    if not getPlayerData(0) then return end
    if key == getCore():getKey("Toggle Skill Panel") then
        xpUpdate.characterInfo = getPlayerInfoPanel(playerObj:getPlayerNum());
        xpUpdate.characterInfo:toggleView(xpSystemText.skills);
    end
    if key == getCore():getKey("Toggle Health Panel") then
        xpUpdate.characterInfo = getPlayerInfoPanel(playerObj:getPlayerNum());
        xpUpdate.characterInfo:toggleView(xpSystemText.health);
        xpUpdate.characterInfo.healthView.doctorLevel = playerObj:getPerkLevel(Perks.Doctor);
    end
    if key == getCore():getKey("Toggle Info Panel") then
        xpUpdate.characterInfo = getPlayerInfoPanel(playerObj:getPlayerNum());
        xpUpdate.characterInfo:toggleView(xpSystemText.info);
    end
    if key == getCore():getKey("Toggle Clothing Protection Panel") then
        xpUpdate.characterInfo = getPlayerInfoPanel(playerObj:getPlayerNum());
        xpUpdate.characterInfo:toggleView(xpSystemText.protection);
    end
end
bronze yoke
#

i just reload the save, the individual file reload thing is not very reliable because of stuff like altering the global namespace and it only takes twenty seconds to reload

quartz badge
trim mist
#

speaking of, is there such a thing as a mod wiki or tutorials? I’m kind of piecing things together here and there from old videos and articles such, but with years between official PZ releases a modding wiki would be so helpful

tawdry solar
#

Can somone help it doesnt work ingame im gonna sleep tho so i wont respond ping if yoy find the error pls

#
module Base
  {

    item Kurki
    {
        MaxRange    =    1.23,
        WeaponSprite    =    Kurki,
        MinAngle    =    0.7,
        Type    =    Weapon,
        SwingSound = MacheteSwing,
        HitFloorSound    =    MacheteHit,
        ImpactSound    =    MacheteHit,
        DoorHitSound = MacheteHit,
        HitSound    =    MacheteHit,
        MinimumSwingTime    =    4,
        KnockBackOnNoDeath    =    FALSE,
        SwingAmountBeforeImpact    =    0.02,
        Categories    =    LongBlade,
        ConditionLowerChanceOneIn    =    25,
        Weight    =    2,    
        SplatNumber    =    2,
        PushBackMod    =    0.3,
        SubCategory    =    Swinging,
        ConditionMax    =    13,
        MaxHitCount    =    2,
        DoorDamage    =    10,
        SwingAnim    =    Bat,
        DisplayName    =    Kurki,
        MinRange    =    0.61,
        SwingTime    =    4,
        KnockdownMod    =    2,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    Dudclub,
        TreeDamage  =   10,
        CriticalChance    =    20,
        CritDmgMultiplier = 5,
        MinDamage    =    2,
        MaxDamage    =    3,
        BaseSpeed = 1,
        WeaponLength = 0.3,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = CutPlant,
        DoorHitSound = MacheteHit,
        HitSound = MacheteHit,
        HitFloorSound = MacheteHit,
        BreakSound  =   MacheteBreak,
        SwingSound = MacheteSwing,
     }


        model Kurki
                {
                mesh = weapons/1handed/Kurki,
    
                attachment world
                {
                offset = 0.0000 -0.1660 0.0070,
                        rotate = -180.0000 0.0000 0.0000,
                }
            }
}
nimble spoke
tawdry solar
#

I mean

#

The item doesnt exist

nimble spoke
#

That is usually due to an error that makes it fail to load.... or a txt file placed in the wrong folder

fast galleon
#

ZedScript intellisense would be useful here, if it doesn't appear in debug item list try checking logs

fast galleon
#

console.txt file in your Zomboid folder

trim mist
#

is there a console.writeline or a function that writes to the debug log?

#

I'm using player:say() but it seems really, uh, picky about when it actually activates

bronze yoke
#

print()

trim mist
#

bet

honest pier
#

Anyone have an idea why my custom crafting recipes do not show up in the crafting ui?

#

I followed the exact same way the default game does it but it just doesnt show up, and I know the mod is loaded

bronze yoke
#

the file is either not being read or unreadable

#

it might be in the wrong directory, missing a file extension, or there's a syntax error in it

ancient grail
honest pier
bronze yoke
#

if you're using vscode jab's working on an extension for that, not sure exactly what it's capable of at the moment though

honest pier
#

I hate how picky it is, I removed a random , and it suddenly started working but only the second recipe showed up stressed

bronze yoke
#

only the second? stressed

#

usually if only some show up you expect it to be the earlier ones since that means something broken is making the parser give up

#

could you show your script? i might be able to spot the issue

honest pier
#

I managed to fix it but now I'm trying to use a custom tool in a recipe and in game it wont let me craft the recipe and it doesnt show the tool as a requirement

#

Tho as I said, It lets me create the toolkit and it shows up in my inv

bronze yoke
#

it should just be keep Base.Screwdriver/TechniciansToolkit,

#

square brackets mean the thing between them isn't an item but the name of a lua function that returns a list of items

honest pier
#

Ah ok

#

If thats so, then why does keep [Base.GardenSaw/Base.Saw/Base.Axe/Base.HandAxe/Base.AxeStone/Base.WoodAxe/Base.Scissors], work?

bronze yoke
#

does it?

#

i can't find exactly where the lua functions are handled but from my reading of other parts of the source i think it would partially work

#

i think it'd find most of the items, but it would look for [Base.GardenSaw and Base.Scissors], which obviously aren't valid items

#

found the code i was looking for, seems like that's definitely what would happen (in theory)

viscid drum
#

which folder has item icons in it?

bronze yoke
#

textures

#

the vanilla ones are in texturepacks though

odd chasm
#

hello to anyone have the knowledge of mod making : not me
I just have an idea for project zomboid mod and I think its cool and I wanna try the game with this idea buuut- I cant make the mod I want
so I am here to tell you guys the idea so maybe one of you friends can make it and also I think its a good idea so why not I get my mod you get 5 star on workshop

the idea is about making PZ more realism:
1-some new traits adding to PZ.
2-it has a new gameplay mechanic
3-idk but its cool 👍

Well, people in the real world may not like every food. And like some foods more
But in PZ the world is destroyed, you have to eat to survive. But it is so easy that in the apocalypse you can eat whatever you get, even a mouse by just peeling off its skin.
Well, this mod brings 4 new traits
Two positive and two negative

The first negative trait is to choose 50 different foods for example. (randomly)
And when you want to eat this food, you get bored and unhappiness
The second negative trait does the same thing to 150 foods at random.

The first positive trait makes you like 25 foods and you can eliminate boredom and unhappiness by eating them.
And the second positive trait does the same with 50 foods

#

In my opinion, sections like first aid and cooking are interesting but boring.
There is a way. New mechanics.
For example, when you want to cut or peel something. A new page will open for you, forcing you to play a mini-game to succeed. If you succeed, the food will reduce hunger more and vice versa if you don't succeed
My idea was to open a new page, a 2D page, to pour different things into the cooking pot.
You can drag and put in, for example, foods that can be used. Or you can peel the potato. Or remove the leafy head of the tomato.
Or even a mini game to break the egg and pour it into the pan.
This mod can also be used for first aid! For a short mini game for bandaging around the hand.. or Disinfect or stitch

I will not leave the topic of cooking. The last thing that came to my mind is a job that forces you to cook cleaner. If you cook with a pan that has blood on it, you might get sick or even start turning into a zomboid.
You need oil so that the food does not stick to the pan. If this food sticks, it will make you less hungry and make the dish dirtier, forcing you to use a sponge to wash the dish. If you don't do it, the pan will be dirty and oily with pieces of the previous food, and cooking it again will bring boredom and unhappiness, so washing it is a must.
My last idea is a mini-event. If you eat a lot of fatty food (too much) and you are also fat, you may get a heart attack in the middle of activities like sports or fighting with Zambia, which will not kill you, but it will make you tired and take 50% of your health.

bronze yoke
#

corpses *are* special. a zombie's outfit and any visible weapons is moved to the corpse immediately when they die, but random inventory loot such as cigarettes isn't generated until a player comes into looting range

#

you can still add items to the container at any time, even when the zombie is still alive (though i doubt anything you add will save if the zombie unloads)

#

i thought i'd mention this here since it seems many people are very sure it is not the case

fast galleon
bronze yoke
#

this wouldn't really be a big deal but corpses don't fire the onfillcontainer event

sour island
#

🤔 is that the event itemPicker calls from/to?

nimble spoke
viscid drum
#

I've almost got this mod working, but im not sure how worldstaticmodel works, the icon works, and so does holding it

viscid drum
#

k, figured out that part, just gotta figure out how to swap the texture now :/

modern hamlet
#

I'm trying to teleport player when the player's health is low. When I add the function to OnTick it works fine, but when I add it to OnPlayerUpdate it cannot teleport the character. I wonder why?

ancient grail
#

I think i was just offered to create an npc mod for 1$
Well not directly but implied

ancient grail
#

After Days of work
You cant even afford a decent meal

autumn garnet
autumn garnet
ancient grail
#

not bad if thats the case haha

fading horizon
#

mushroom backpack!!

ancient grail
fading horizon
ancient grail
#

i wonder if its possible to add a light inside of stuff

#

like make it glow

fading horizon
#

that would be so cool

#

i know theres a lightsaber mod that adds light to the weapon

#

so maybe?

ancient grail
#

i watched the vid

#

its just the flashlight

bronze sinew
fading horizon
#

i swear this is the last one ill add

#

i'm up to 12 new backpacks now

#

😅

#

or else ill never release it

bronze sinew
#

if me and my gf ever play pz together im definitely telling her about the backpack lmao

fading horizon
#

my mod is adding a bunch of cute goth backpacks

#

there will be a black mushroom too

#

some of them

next sky
fading horizon
#

soon

#

it depends on if i want to research and try to make them spawn on zombies or not

#

i may save that for v2

bronze sinew
#

Im gonna add all the hotline miami masks with mine but i have no idea what to do lmao

fading horizon
#

just need to do item distributions and its done really

#

all the models and code is there

#

all backpacks craftable

#

oh wait

#

that image doesn't show the coolest bag

#

several bags have multiple textures

#

i'm excited to release it

bronze sinew
#

oooooooo i love that

fading horizon
#

now it has a cute little mushroom zipper

bronze sinew
#

YES

viscid drum
#

so I'm not sure what I'm doing wrong.....it looks like i've swapped the texture, but when I drop it in game its a flat 2d image :/

fading horizon
#

did you define WorldStaticModel

viscid drum
#

i believe so, in item script i have the name of the file listed there

fading horizon
#

anything in the error log?

viscid drum
#

not that i can see

#

i'm sure i'm probably doing something wrong in blender

fading horizon
#

think its finished

#

time for a black version

bronze sinew
#

YESSSSSSSSSSSSSSSS

tawdry solar
fading horizon
#

okay black version is done

#

any requests for other colors?

bronze sinew
#

a purple one would be kinda cool

fading horizon
#

okay yeah I agree, purple looks cool

nimble spoke
timber river
#

Is there a way to equip items to the hotbar on character spawn like you can equip clothing pieces to the character?

fading horizon
#

not that i'm seeing

#

but i just did a quick search for "hotbar" in the class lookup

nimble spoke
timber river
# nimble spoke There must be something you could add to the OnCreatePlayer event for that

I was actually about to announce that I found it. It can be found in steamapps\common\ProjectZomboid\media\lua\client\Hotbar\ISHotbar.lua

There's actually quite a bit that can done it seems. Going to play with it for a few days, see if I can't go full schitzo with my insurgent patch so you spawn full equipped and ready for battle 😂 right down to hotbar items already being equipped

fading horizon
#

last backpack i swear

viscid drum
next sky
fading horizon
#

cat shape is already done

#

black heart will be done

next sky
#

Oh yay

fading horizon
#

theres the cat

#

it has a purple texture too

#

so it looks like the sailor moon kitty

next sky
#

Ah I missed it earlier lol

trim mist
#

this is a super cool mod btw

fading horizon
#

yay! thank you!

#

i'm excited to release it

trim mist
#

I would 100% be interested in running a cute-punk character that is a zombie killing badass hahaha

fading horizon
#

if y'all have any other requests for backpack i'm all ears

#

ive been having lots of fun modeling lol

sullen thicket
#

I mean....

trim mist
fading horizon
#

ooo

#

good idea, i like it

viscid drum
#

Ty again everyone, finally got the mod fully functioning 😄

fading horizon
#

making good progress on the heart

#

not really happy with the strap color though

#

but i can't decide on a good color

fading horizon
ancient grail
# fading horizon ooo

sooner or later mae will beat authentic z's record (number of clothing item on a single mod)

fading horizon
#

if were counting different colors of the same bag

#

i'm up to 20 bags

#

at this point i'm going to have to do a custom context menu for the recipes because theres so many. Don't want it to crowd players inventories

#

after this heart itll be 22 bags

#

and i think ill start working on distributions at that point and release v1

#

i can always add more bags later

#

next texture is done

quartz badge
#

are "toSpawn" and "chance" the same variable?

#

like are they interchangable?

bronze yoke
#

toSpawn is how many of the zone are allowed to spawn in the entire map

#

oh, sorry, i'm looking at something else

#

toSpawn in the context of zombie outfits (which i think is what you're talking about) guarantees that at least that many of that outfit spawn

#

it only gets applied if mandatory is true

quartz badge
#

ok i see

trim mist
red tiger
#

You can list the other one as a secondary, third-party alternative.

#

I have my own third-party documentation that only shows exposed API.

#

These aren't called "Lua Objects". Are you defining the term locally?

#

I don't want people to confuse "Lua Object" as "Lua Table".

#

It's also "Deprecated" not "Depreciated".

#

@trim mist

#

I'd rewrite this as it has grammar issues:

While modding, this can be useful to look at to get an idea of how to use objects for your purposes; however, not all objects and variables may be exposed via the game's Lua API.

It's one sentence trying to say too much and is too wordy.

#

With a list of objects, this page will be very long and very redundant. Refer to the JavaDocs on a list of objects.

bronze yoke
red tiger
#

=)

#

I refer to mine as well because it is only the exposed API.

bronze yoke
#

it's a nightmare trying to work out what a method is supposed to do when it just says int1, int2, int3, int4

red tiger
#

The documentation itself can be confusing. A lot of non-native English speakers wrote it.

#

Depends on where nuance is needed for certain tasks.

bronze yoke
#

i never expect anything to do anything i want without reading the source, but it gets me to the right places sooner

red tiger
#

I have a PZWiki account and have edited a bit already.

quartz badge
#

how do you make a certain type of zombie outfit enter the "Default" zombie spawn pool after a certain amount of time?

mossy steeple
#

what folder are traits found in? what they do, specifically, not the MainCreationMethods.lua file- eg if i was looking for Speed Demon's speed increasing thing

bronze yoke
#

all over the place

#

speed demon is probably in the vehicle java

mossy steeple
#

gotcha, i suppose that does make sense even if it's a little disorganised

fading horizon
#

i think i'm done

ancient grail
fading horizon
#

ah wait i forgot the suggestion up there someone mentioned i gotta do one more

mossy steeple
#

oh yeah i figured, i just meant from this specific standpoint of wanting to work on traits haha

fading horizon
#

idek how to model that one

#

that's gonna be difficult

#

most of these have several textures each btw

#

lol

viscid drum
#

is there a guide or walkthrough for adding weapons somewhere? trying to add a texture swap to a pen and the mod just keeps crashing :/

fading horizon
#

i got you

#

i remember i saw one long ago

#

lemme see if i can find it

viscid drum
#

ty, i'll go watch that

fading horizon
trim mist
#

I feel like i'm not really grasping the difference between Lua tables and objects. I want a word that encompasses these objects you can use and the functions / vars inside them

bronze yoke
#

i've always called them java objects

trim mist
#

so when we do lua scripting, are we working directly with the Java objects, but only some of them/their functions are exposed to Lua? Or Kahlua or whatever java-lua is called

bronze yoke
#

pretty much

trim mist
#

I thought the objects were like, translated into lua, and were updated when the lua objects were updated

#

that's different than the equivalent of writing getters and setters in a different language

bronze yoke
#

the game uses a lot of objects created through lua too, so it'd be best to save the term 'lua object' for those

viscid drum
#

hrm, not sure what im doing wrong, only error I keep getting is that steam fails to download the mod :/

red tiger
#

I feel like this is one of those areas of the Wiki that requires a pretty solid understanding of not just programming in Lua and Java, but the relationship between Lua and Java in the PZ environment.

#

It's a silly environment, the PZ scene.

#

I can see people with master's degrees still flop somewhat when introduced to this madness.

#

All I'm asking is to be careful and not create new ways of explaining something that could end up confusing everyone.

#

It's already crazy enough.

trim mist
red tiger
#

Then you know your shit and I won't lecture you. =P

trim mist
#

I mean, go ahead. The more I know the better

red tiger
#

I specialize in doing the most niche shit here.

#

Going to be doing C# soonish. Been doing VB for my job for an ancient ASP.NET site.

#

4.8 ASP framework?

#

Not even modern enough for C# syntax candy.

icy dome
#

Hello, im creating a mod. Basically, when a zombie die i spawn a item in his inventory.

Im testing in a alone world, but doesnt spawn the 'base.ham' on zombie inventory.

No erros logs

red tiger
#

Also I might take a break from working on my VSCode extension.

#

Having trouble getting my linter to work for ZedScript.

trim mist
#

so if i’m understanding correctly, you’re working on an IDE for zomboid coding?

red tiger
#

VSCode is honestly more than a rich text editor but I won't call it a full-blown IDE.

trim mist
#

that’s poggers

red tiger
#

Visual Studio is too overwhelming.

#

I have to use it at work but I only use it to run the project. I use VSCode to code.

#

I'm trying to write a linter for diagnostic support for ZedScript... however I'm running into a wall on how to setup clean & straight-forward rulesets with recursive scanning of scoped property bags.

#

So thinking about how to re-approach.

trim mist
red tiger
#

I have a solid tokenizer.

bronze yoke
#

is there anything in your console.txt?

red tiger
#

I have a passive, non-aggressive tokenizer / formatter and an aggressive one that rewrites the script entirely

bronze yoke
#

no errors means it must either be AddItem that's failing, or that the code is not executing at all

icy dome
red tiger
icy dome
viscid drum
#

[24-04-23 21:48:59.820] LOG : General , 1682387339820> 755,682,307> Workshop: onItemNotDownloaded itemID=2966858504 result=15.
[24-04-23 21:48:59.820] LOG : General , 1682387339820> 755,682,308> Workshop: item state DownloadPending -> Fail ID=2966858504.

#

This is the only error my mod keeps throwing, what would cause this?

bronze yoke
#

is this when you try to test it in multiplayer?

#

trying to open the workshop page for that id shows it's private, and the server can't download private mods(i think?)

viscid drum
#

its on hidden

#

i didn't want to put it as public since im trying to add something to an already working mod

bronze yoke
#

try making it unlisted

viscid drum
#

that was probably the problem, i must have gotten hidden and unlisted mixed up :S

#

looks like its loading, tysm! now I get to see whats broken haha

#

ugh

#

now it hangs on intializing, and the debug isn't saying anything :/

trim mist
#

elaborate on "hangs on intializing"

viscid drum
#

just stays on intializing forever

#

these are the last few lines in the debug log

#

[24-04-23 22:09:38.778] LOG : Mod , 1682388578778> 756,921,266> loading TheyKnewMore Testing.
[24-04-23 22:09:38.782] LOG : Mod , 1682388578782> 756,921,270> mod "TheyKnewMore Testing" overrides media/fileguidtable.xml.
[24-04-23 22:09:39.165] LOG : Lua , 1682388579164> 756,921,653> Loading: media/lua/shared/Sandbox/Apocalypse.lua.

#

theres only 3 mods being loaded, I have a working version of the mod, but when I tried to add a texture swapped pen it craps out :/

#

oh.....now I let it run longer and it threw an out of memory error...

red tiger
#

Lovely loop logic

sour island
#

For anyone who might use ParseScript I figured out my issue -- it doesn't seem to play well with recipes that are not Base. Even though it imports Base it doesn't seem to recognize it as a valid recipe(?) The items appear, and I can use the 'give ingredients' successfully, but it's not able to be activated. 🤷‍♂️

For clarification, I made a recipe dynamically generated from sandbox options.

#

Going to do more tests tomorrow - may have to leave the core recipe as Base instead - or parse each ingredient to check if it needs "Base." otherwise require fulltype.

mossy steeple
#

i'm not quite certain how this works, so i want to check something before i start digging in case it's obvious- am i able to directly type the strings for the name and description here, like i have it? or do i need to use the getText method that's used in the MainCreationMethods.lua file?

bronze yoke
#

you can directly type them, but getText() is used so that it can be translated

mossy steeple
#

gotcha, makes sense

#

issue's probably lying in the other lua file, then. i'll keep looking

bronze yoke
#

is this the full file? nothing calls initTraits

mossy steeple
#

oh duh, you're right, i completely blanked on that

#

it'd just be an Events.OnGameBoot.Add(initTraits()); right?

bronze yoke
#

yep!

#

oh, wait

#

Events.OnGameBoot.Add(initTraits), no ()

mossy steeple
#

gotcha, gotcha

fading horizon
#

this one came out really good i think

red tiger
fading horizon
#

i'm not

#

i'm having a lot of fun

mossy steeple
#

i think i'm probably just goofing on this logic somewhere, seeing as the trait shows up fine in game but doesn't seem to work from my testing- i did look at a couple of other mods that touched how car damage works in order to make this and i don't 100% understand some of it, especially how the stat tables factor in (my best guess is that they're an array that stores the health of each car part, looking at it)

#

oh whoops ignore that comment on line five, i renamed checkPartChanges to reduceDamage to be a bit clearer but forgot to change the comment

bronze yoke
#

what calls these functions?

mossy steeple
#

oh man is it that again. man i really need to just check that first, let me look

#

yep, exact same mistake again. i wrote down the Events.OnPlayerUpdate.Add(checkCar); earlier but i must have deleted it on accident 😔

#

thank you for catching my obliviousness twice, heh

mossy steeple
#

hm, after fixing up a couple of other things and a good bit of testing in-game the trait still doesn't seem to be reducing vehicle damage

#

the logic of it seems to check out to me? but i could be missing something, of course

#

OnPlayerUpdate updates every frame, doesn't it? or close to it?

bronze yoke
#

it should, yeah

mossy steeple
#

hm... what does player:getModData().VehicleImpactTable[i] do, exactly? i can tell that it's pulling the data of something from the stat table that's getting created using the specified part, but past i'm actually not quite sure

#

oh, hang on. i might've found it?

bronze yoke
#

i'm not really sure why it uses moddata, that kind of just seems to complicate things

mossy steeple
#

i assumed it was something or other to make it work with modded vehicles

#

i'm eyeballing that last statement setting player:getModData().VehicleImpactTable[i] to midHP
thinking that should probably be set to the final HP value, not midHP?

bronze yoke
#

yeah i noticed that

#

i'm not sure if that's the cause of your issue but that should be changed

mossy steeple
#

i'm trying that now, popping in one more variable

bronze yoke
mossy steeple
#

huh, gotcha

#

teaches me for overreliance on the code of other mods i suppose

#

probably a better way to figure this whole modding thing out

bronze yoke
#

yeah, unfortunately despite being the best resource to work out how to start modding, obviously the mod scene is primarily amateurs and most mods aren't going to be excellently well written

mossy steeple
#

i just wish 80% of the guide links on the wiki weren't red, heh

bronze yoke
#

but the moddata approach should still *work*, it's just unnecessary

mossy steeple
#

tried putting two DebugLog.log("check"); statements in a couple of spots to see if they were even activating and they seem to not be, so i do believe that the issue is relatively early in the reduceDamage function (at or before if(startHP ~= midHP) then, at least)

#

assuming that you can have those print from the middle of a function in lua, anyways- most of my experience is in java so most of this is fairly new still

#

this is what it's at now (i commented every line to try to make clear what each line is supposed to do)

#

"DefensiveDriver functioning!" shows up in the log, but neither "Damage detected" nor "Damage adjusted!" do when i test smashing a van into a wall

bronze yoke
#

oh, i see

#

if(player:getModData().VehicleImpactTable[0] == nil) then

#

this errors out because player:getModData().VehicleImpactTable has not yet been initialised as a table, but it's being indexed as one

mossy steeple
#

oh, huh, i think i see what you mean

bronze yoke
#

usually we have a function attached to OnCreatePlayer that initialises any moddata tables if it doesn't already exist to avoid problems like these

#

just throwing player:getModData().VehicleImpactTable = player:getModData().VehicleImpactTable or {} in there should be enough to see if that's the only issue though

mossy steeple
#

replacing line 11?

bronze yoke
#

before line 11

#

it's kind of a bad idea to have it in there, it should be initialised in oncreateplayer (or not moddata at all) but that'd be enough to ensure that's the problem

mossy steeple
#

pasted in, let's give this a shot

#

out of curiosity, why's it a bad idea to have it there?

bronze yoke
#

it'd be checking if it exists every frame, which is just kind of wasteful

mossy steeple
#

oh yeah, of course

#

partial success! sorta, kinda. i think i'm accidentally doubling damage instead of halving it? i'm testing with a mostly consistent distance and have gone from taking 25-30 damage to taking 50-60

#

at least things are changing though! it's just me figuring out my math now i think

#

or huh, wait, hang on. i tested it with a third van and that one took the same 25-30

#

i think those first two must've been flukes, weird

#

either that or it's breaking after going off twice? i could see it breaking after one run through but i have no idea how it'd break after two

bronze yoke
#

oh!

#
                local finalHP = (startHP - (dam / 2));
                                ...
            end
        end
        player:getModData().VehicleImpactTable[i] = finalHP;
```finalHP is out of the scope of the last line, so it's actually setting it to nil
mossy steeple
#

oooh, you're right

#

hmm... probably best to declare finalHP earlier, set it to the starting value, and adjust finalHP if needed otherwise leave it alone?

#

just as a quick double check between lua and java. i can just say finalHP = (...) instead of local finalHP = (...) after the first time, right? don't need to declare it every time?

#

actually no wait yeah, of course, i am literally doing that multiple times already

bronze yoke
#

yeah, once it's local it's local

#

sometimes you have to be careful with naming since a side effect of this is that you lose access to variables from higher scopes with the same name

mossy steeple
#

gotcha, i usually try to keep unique names for as many of them as i can anyways

#

those debuglog commands should be printing to the console, right? just did another test and there's no damage reduction or printout in the console

#

oh whoops

#

how do you do that box thing?

bronze yoke
#

i'm not sure of anything to do with debuglog.log, i've seen people using it before but i just stick to print

#

```lua
code here
```

mossy steeple
#
function reduceDamage(player, vehicle)
--counts the parts for use in the for loop
    partNum = vehicle.getPartCount();
--loops through every part of the car, checking to see if the condition of any part is
--unequal to its frame on the previous frame
    for i = 0, partNum - 1 do
--selects the appropriate part
        local part = vehicle.getPartByIndex(i);
--sets the hp value to check against to, presumably, the hp value set in the stat table
        local startHP = player:getModData().VehicleImpactTable[i];    
        local finalHP = startHP;
--finds what the new hp value would be, assuming normal damage
        local midHP = part:getCondition();
--checks the hp value against the new hp value. if these aren't the same, then one can assume damage took place
        if(startHP ~= midHP) then
--calculates the damage done
            DebugLog.log("Damage detected");
            local dam = startHP - midHP
--verifies that damage is not zero or a negative number (repair)
            if (dam > 1) then
--sets the condition equal to the starting hp value minus half of original damage done
                finalHP = (startHP - (dam / 2));
                part:setCondition(finalHP);
                DebugLog.log("Damage adjusted!");
            end
        end
--sets the initial value that was checked to see if the vehicle was damaged to the final hp value
        player:getModData().VehicleImpactTable[i] = finalHP;
    end
end
#

i'd imagine that finalHP is in scope with that, i don't see why it wouldn't be

bronze yoke
#

yep, should be

mossy steeple
#

honestly i wonder if it wouldn't be better to rewrite this to not use moddata at all

bronze yoke
#

it'd run better, and might be a bit prettier, but i don't know if it'd help with the issues you're seeing

#

oh, actually

mossy steeple
#

moreso for readability than anything else

#

oh?

bronze yoke
#

since moddata is persistent, it's probably not working because the nil values from before are being loaded

#

oh, actually, it deletes the table if you get out of the vehicle

#

so it shouldn't matter

mossy steeple
#

hm yeah, assuming those are all working properly

#

oh hey, shouldn't local dam = startHP - midHP have a semicolon?

bronze yoke
#

oh...

#

i just noticed something pretty obvious and pretty bad!

mossy steeple
#

oh, scary

#

what is it?

bronze yoke
#
function checkCar(player, vehicle, args)
    local car = player.getVehicle and player:getVehicle() or nil
    if (vehicle == nil or not vehicle:isDriver(player)) then
        removeStatTable(player)
    else
        if(player:getModData().VehicleImpactTable[0] == nil) then
            createStatTable(player, vehicle);
        end
        reduceDamage(player, vehicle);
    end
end
```the player's vehicle is stored in ``car``, but the checks check ``vehicle``
mossy steeple
#

aggh, yep, i think you're right

bronze yoke
#

vehicle is always nil (it's the second argument of the function, but OnPlayerUpdate only passes one argument), so it should delete the table every time

mossy steeple
#

changing it to if (car == nil would do the trick, right?

bronze yoke
#

yeah, as well as car:isDriver

mossy steeple
#

gotcha, gotcha

#

i'm not sure which are actual functions that already exist and which are referring to that variable

bronze yoke
#

oh, the createStatTable and reduceDamage calls are passing vehicle instead of car too

mossy steeple
#

ah, so pretty much all of those that aren't VehicleImpactTable should be swapped to car?

bronze yoke
#

yeah, looks like it

mossy steeple
#

ooh, this is new

#

errors on line 37 and 15, let's check those out

#

oop, i think partNum is out of scope since i have it in two functions

#

or wait, no, not in two functions, i just never declared it

#

hm... that wouldn't need to be changed to car.getPartCount(), would it?

bronze yoke
#

oh! it should be :getPartCount()

mossy steeple
#

oh! yeah that's a lua thing, isn't it?

bronze yoke
#

unless they're static, java functions should always be called with a colon

mossy steeple
#

gotcha, gotcha

bronze yoke
#

local part = vehicle.getPartByIndex(i); the same mistake is over here

mossy steeple
#

both of those fixed, let's see if it's all functioning

#

these typos keep tripping me up

bronze yoke
#

it's always syntax

mossy steeple
#

ah, not getting hundreds of errors per second anymore! that's certainly an improvement

#

oh, i think it worked, too! albeit it does seem to be looping indefinitely until i leave the car, flooding the log with the practice 'damage detected' message i put in there

#

it... actually just occurred to me that none of this is actually linked to the Defensive Driver trait, actually. hm, let me figure out how to do that

red tiger
#

I feel bad watching you hurt yourself into learning modding PZ.

#

Heheh

autumn temple
#

is there any resources to help me learn how to work with custom audio files? since the Modding wiki page for audio doesnt exist?

red tiger
#

We all had our self-inflicted wounds learning this madness.

mossy steeple
#

i'm having fun at least haha

#

i've put out two simple mods already, i wanted to see if i could learn something a little more complicated by playing with some actual code

#

i don't suppose there's a simple 'if(player has trait:DefensiveDriver) then' thing i could encapsulate this whole file in, is there?

bronze yoke
#

player:hasTrait("DefensiveDriver")

#

you couldn't wrap the file in it because the player object won't exist when the file executes

mossy steeple
#

hm... i could toss that into checkCar, probably? only have it progress beyond the first line if the player has that trait?

bronze yoke
#

it'd be best to start the checkCar function with a if not player:hasTrait("DefensiveDriver") then return end

#

yeah

#

it's a bit annoying to have to do a check every update like that, but it gets a bit difficult when splitscreen comes into the mix to just avoid adding the event or something

mossy steeple
#

hey, as long as it works, i can deal with a little bit of poor optimisation for now

#

i can see why it's doing the infinite loop, just gotta figure out how to fix it

#

since player:getModData().VehicleImpactTable[i] is changed to finalHP as the last action, checkCar is detecting that the hp value has changed in the last frame and immediately running again

bronze yoke
#

i'm not really sure why it's getting to the damage detected part every time, but keep in mind that when properly working that function should be running once for every vehicle part every frame

#

if it was a true infinite loop, the game would lock up

mossy steeple
#

yeah, not so much infinite loop as it's running further into the function than it should every frame

#

poor wording on my part

#

hmm... could i set a public/whatever the opposite of local variable to 2 or 3 and have that count down once per frame, give it a cooldown of a few frames before damage can be reduced again?

#

though that might reduce the effectiveness against the car melting aura that happens when too many zombies are around

bronze yoke
#

yeah, i'm curious why this is happening in the first place: i've written similar code before and didn't run into that

#

it could be a rounding error

mossy steeple
#

oh, yeah, that'd make sense

bronze yoke
#

if you replace the finalhp with a getCondition at the end that'd account for any java-lua shenanigans

mossy steeple
#

i'll pop that in

#

oh hm, before that though

mossy steeple
bronze yoke
#

oops, it's HasTrait

mossy steeple
#

ah, gotcha, gotcha

#

i should give the zomboid documentation another look sometime, last time it melted my mind a bit but hopefully i'll understand a bit more now

viscid drum
#

ugh

#

how do I fix workshop item is different from server.......i'm uploading the mod and subscribing and unsubscribing and its not working

vast palm
#

how long has the server been up? How many mods are enabled on the server?

#

Has anyone figured out how to change an item's type without having all of that item get deleted when loading an existing save?
IE: Normal to Drainable

#

unless that's been addressed by basegame now.

viscid drum
#

theres only 3 mods, and I'm going through host to try to test it

vast palm
#

do any of those mods have another mod as a dependency?

viscid drum
#

yeah, the mod im working on has 2 dependencies

vast palm
#

two that aren't yours?

viscid drum
#

correct

vast palm
#

which two

viscid drum
#

CoolBag and They Knew

vast palm
#

hm

fast galleon
#

@viscid drummaybe check that discussion

vast palm
#

yea, I always found issues when trying to load when I still had my mods in the workshop folder

ancient grail
#

Darkslayer you item tweaker correct?

vast palm
#

that is mine yes

fading horizon
#

This is exactly why I made a local cached version of zomboid

ancient grail
fading horizon
#

Makes it easier

vast palm
#

I mostly wanted to know because I remember the -other- item tweaker did things really weird and caused all sorts of chaos

viscid drum
#

ah, k I'll try taking it out of that folder once I get done redownloading everything :S

ancient grail
rancid panther
#

sudden ping i thought something i made was relevant here 💀

ancient grail
#

Pls read this very carefully

fast galleon
#

oh sorry

rancid panther
#

no prob

vast palm
#

funny enough

#
function ItemTweaker.tweakItems()
    local item;
    for k,v in pairs(TweakItemData) do 
        for t,y in pairs(v) do 
            item = ScriptManager.instance:getItem(k);        
            if item ~= nil then
                item:DoParam(t.." = "..y);
                --print(k..": "..t..", "..y);
            end
        end
    end
end```
#

my script DOES do DoParam

#

which is why it was brought up

ancient grail
#

Ah so it wasnt yours that made the chaos
Who made the other one then

vast palm
#

it was more for people who didn't know as much of LUA to figure it out themselves

ancient grail
#

I know that

#

Tbh i dont understand why it breaks mods

rancid panther
#

i'll try coming back and finishing the blackouts mod after the semester ends. haven't been feeling this game lately

vast palm
#

nah I made this mod 7 years ago. the fact that's it's been working this whole time has been surprising, but I guess it's because the doParam function never changed

#

he made it try to make the changes on map load I think, instead of on LUA/mod init

#

but if I recall correctly, map load is after checksum

#

then again, I haven't modded for PZ in like 7 years.. so I could easily be wrong

ancient grail
#

Cuz we fixed sapph cooking when remove item tweaker dependency
And other occasion with the same thing but to tbf to you i dont know of it was your item tweaker or the other one
All i know is that theres something causing error for somereason

vast palm
#

well, I just found a mod today using my code four times in it

ancient grail
#

Ahhhh

vast palm
#

like, redeclared my entire script, and included my entire mod in it's workshop link

ancient grail
#

I get what youre saying
So why didnt he fix it

vast palm
#

as far as I know, the other item tweaker guy made his mod unlisted

#

but any other mod that was built on that version will have problems, since it's different than mine which loads on lua/script init

#

though his mod probably works fine in SP

ancient grail
#

Ah man. Youre the one suffering from others actions
But they just dont know

Cuz comst modders dont even go to dev chat

vast palm
#

comst?

#

oh most?

#

Funny enough, I was actually trying to rewrite my documention for the mod, and reupload it as the documentation update.. Not sure if I should if we can just get people to do DoParam more commonly

#

so I see people mentioned the fact that my item tweaker was printing stuff to the log... Turns out I thought I actually uploaded the version that disabled that print 7 years ago.. I'm so sorry to everyone for that..

ancient grail
#

Most sorry typo

#

Maybe you can
Actually

Maybe post it on the description. The technical aspect of doParam and instructions somewhere like a steam guide
And we post that guide on the dev thread

vast palm
#

was thinking of using this to catch people's eyes for when I update and we finish planning out the new guide

#

this work okay?

bronze yoke
#

looks perfect

vast palm
#

actually, I should edit the green text to
"For mods using this:"

ancient grail
#

Thank you

viscid drum
#

well I thought I was making progress with the workshop error, now I'm back to the out of memory error :S

vast palm
#

=(

#

okay, so before I can upload the changes, I suppose we'll need to finish the actual guide

#

I'm horrible at writing, and still don't 100% understand how to explain how it works lol

#

I know I'm 6 months late, but I didn't quite understand just -how- bad things had gotten regarding clones of my mod and such.
As you can see a little above this, I've decided to depreciate my mod (while still keeping it up for existing mods), and ask modders to make use of DoParam, as is best.
I haven't uploaded changes yet, as I didn't want to write anything prematurely.

I'm pinging you (sorry) to ask how you'd like me to go about doing it since you seem to have been stuck dealing with the aftermath of my mod for so long.
Please ping or PM me a response, as I most likely will not see it otherwise.

vast palm
#

that being said, is there a difference between these two?
scriptItem and item

in this

local scriptItem = ScriptManager.instance:getItem("Base.EngineerMagazine2")    
if scriptItem then 
    scriptItem:DoParam("TeachedRecipes  =   Make Smoke Bomb;Make Improvised Gas Mask")
end
local item = ScriptManager.instance:getItem("Base.Vest_BulletArmy")    
if item then 
    item:DoParam("Weight    =    8")
end```
#

could either of them be item or scriptitem?

drifting ore
#

is that possible to detect any action player do in certain area?

nimble moon
#

... ummm idk if i should write this here but!... whoever made the insurgent mod ( it is crashing )

carmine arch
#

Hey all, I’ve been on this server for a while but never really used it. I was wondering if there was any advice or tutorials you could give me. All I want to do is a simple recolouring of a hat/adding a marking to it. Any help would be greatly appreciated as I have never done anything like this and have zero experience.

soft current
#

which version of lua is zomboid?

#

im trying to use the debug library but it doesnt seem to be present in zomboid

fast galleon
#

how I can separate these from walls? Are there more "walls" that are not full size?

ancient grail
fast galleon
ancient grail
ancient grail
#

you cant mask them but maybe you can resize eem

#

ingame

#

not sure tho

#

but i know icons can be scaled thats it

carmine arch
sour island
#

@vast palm oh hey, glad to see the OG is back. In your snippet it appears both of those variables are calling the same thing. Also you can use getScriptManager() instead. (Internally it's calling the instance but it looks a bit neater to do so.)

#

Also it should be noted keeping your files in the client folder can cause some issues due to MP checksums and if a modder wants to refer to scripts/recipes on the server side.

#

I'm not 100% sure why the "other item tweaker" was made -- perhaps with that in mind. I'm not sure. However, if you want your stuff to engage in SP and MP one time a piece -- I use on map load for SP and onGameBoot for MP.

#

Should avoid checksum issues and anticheat + keep the serverside information the same as SP.

#
Events.OnLoad.Add(shopsAndTradersRecipe.addDeedRecipe) 
 if isServer() then Events.OnGameBoot.Add(shopsAndTradersRecipe.addDeedRecipe) end
#

I put my recipe code in shared

fast galleon
#
print("\n***** zxTestEvents: file Loaded *****")
for i, j in pairs(Events) do
    local c = 0
    local limit = 3 --v41.78 keep it above 1 or some init events will be skipped
    local s1,s2 = "\nzxTestEvents: "..i.." [", "/"..limit.."]"
    local function info2(c,...) print(s1..c..s2,...) end
    local function EventPrinter(...)
        c = c + 1

        info2(c,...)
        if c == 1 then
            --
        end


        if c >= limit then j.Remove(EventPrinter) end
    end

    j.Add(EventPrinter)
end
#

you can use something like this to find a common event that triggers for all: SP, Client, Server.

#

this should be used from shared directory

sour island
#

Hmm so you'd just put in the OnLoad and GameBoot events into the table?

#

While I like the idea of automating it to a point -- seems a bit complicated lol

quartz badge
#

is there a way to make a type of zombie spawn in the “Default” spawn pool after a certain amount of days have passed

timber river
sour island
quartz badge
#

is there a way to do it on the distributions xml

sour island
#

Distributions xml?

quartz badge
#

like the file that says where zombies spawn in zones, i meant to say definitions

timber river
#

Hey chuck do you have a way to contact Brita or Arsenal? I'm working on a model for a pistol (Walther P99) that I'd like to just give to them as it appears from the notes in gunfighter that they really don't want people patching into their code 😦

nimble spoke
quartz badge
#

idk what a lot of this means i’ll just have to figure this out

sour island
sour island
quartz badge
#

could you give me an example of how to do this

#

and what file i would do it in

mellow frigate
#

hi, got a problem on one of my mods (SixthSense) I do not understand: for one user at some point, player is null in the following code. anyone knows how this could happen ?

#

for playerIndex = 0, getNumActivePlayers() - 1 do
local player = getSpecificPlayer(playerIndex);

#

this is client side

autumn temple
#

is there any resources to help me learn how to work with custom audio files? since the Modding wiki page for audio doesnt exist?

bronze yoke
earnest juniper
#

Howdy. What language is used for PZ modding?

bronze yoke
#

lua

sour island
viscid drum
#

well, mod actually loads now :S

#

so i made a pen with all 4 colors, but it won't erase. did i do some thing wrong on the tags?

#

Tags = BluePen;Pen;Pencil;RedPen;Erase;Write,

#

just gotta figure out why the model is invisible afterwards

bronze yoke
#

the vanilla item mistakenly uses Erase, but it's hardcoded to accept that item anyway

viscid drum
#

yeah, im trying that now, haha yeah I was going by the eraser tag :S

#

now i gotta fix the model and figure out why its not taking my icon

#

yup, eraser fixed it, now to figure out the model and icon issue

red tiger
sour island
red tiger
sour island
#

Capitalization may differ

viscid drum
#

yeah, the icon i got fixed, there was a space i left in the icon name by mistake

sour island
viscid drum
#

the pen model is something i probably screwed up, i copied the vanilla model and altered the texture

red tiger
#

I rewrote the Icon property description on the Wiki to make more sense.

ancient grail
red tiger
#

PZ API rewrite when?

#

It's full of more than a decade's worth of aged API calls.

red tiger
ancient grail
#

Albion already replied to it didnt read

red tiger
red tiger
ancient grail
#

Its ok cuz she didnt mention the online players thing

bronze yoke
#

it looked like client code

#

if that's server code then yeah, that won't work in multiplayer at all

autumn temple
#

my census is that there are no resources available for working with custom audio?

nimble moon
red tiger
#

A good idea for this channel: First-time posters get sent a msg from a bot with a mega-list of resources and common questions answered.

autumn temple
red tiger
#

Looks like a WIP

#

I've done a lot with the audio side of the game.

autumn temple
#

so there is no resources available to learn how to work with audio SADGE

red tiger
#

I don't know how many of us in here have worked with audio but I'm one of them. I'm at work though.

bronze yoke
#

i'm not really sure what you're looking for when you ask about it

autumn temple
#

how to implement custom audio when using items like VHS tapes or CDs

ancient grail
#

Use true music as reference
Tho its on a different media but pretty much would still apply maybe

red tiger
#

duckling has raised a good point that there's no audio guide.

#

We need one.

#

This is an issue.

autumn temple
#

ya ive tried to look at true music before but got confused

autumn temple
#

I have never used true music before while playing the game but it looks like they use a custom boombox to play the music, which isnt the same as using vanilla TV's and ect

bronze yoke
#

truemusic is really complex, it's not a great place to learn from

fast galleon
#

no video guide either

ancient grail
#

What about animation? Dislaik's guide right

autumn temple
bronze yoke
#

what would a video guide even cover?

autumn temple
#

yestarday I spent hours trying to dig through the games code to figure out how the TV plays audio to see if I can make it pull a different sound file, but I couldnt find anything

timber river
deft peak
#

How hard is it to code animations into Java?

bronze yoke
#

it's not really something you can hook into unless you want to replace the sound completely

autumn temple
#

damn, thats probably why other mods just make new items instead of using vanilla TVs and radios

red tiger
bronze yoke
#

i'm guessing you want something like special voicelines when a certain vhs line plays? i'd attach a function to the OnDeviceText event and use its uuid to match it to a sound

autumn temple
red tiger
#

You can create AudioEmitters from IsoGridSquares and play audio on them.

#

It's deep API that isn't documented.

#

I know this because I went in and modified the living hell out of the sound engine to do some whacky things.

vast palm
bronze yoke
#

you can just use the emitter the radio already uses

red tiger
#

IsoObjects have the API.

vast palm
#

Oh hi Jab

bronze yoke
#

my recent project has been related, so i'm familiar with that specific area

vast palm
#

Chairchu

#

I've been trying to figure out how to explain on my mod's page how people should switch from my mod to not needing my mod lol

#

but I suck at this stuff

sour island
vast palm
#

I think that might have been the other mod

#

that one was crazy messed up in MP

#

he like moved it to the MP side, and it was really messing with checksums

sour island
#

This issue occurred with my own mod -- making doParam calls from shared

vast palm
#

I have yet to run into issues on my own end

#

none that I've noticed anyway =/

bronze yoke
#

i'm surprised to hear that it is in client, i would've expected to hear about issues with that by now

sour island
#

The anticheat may have been adjusted accordingly then. 🤷‍♂️

vast palm
#

hm.. it's possible

sour island
#

Recipe changes should be in shared

vast palm
#

but I do want to eliminate the need for my mod now, after seeing how much grief it's been causing people

sour island
#

I think recipecode is also in shared no?

vast palm
#

I don't think my mod handles recipe changes though

sour island
#

Scripts too*

bronze yoke
#

recipecode is server

sour island
#

Oh?

vast palm
#

I mean this was all just supposed to change the item database so items had different values

#

by the time the mods were enabled locally, it should have matched the server, because it'd all be done before joining

#

I dunno what's going on then

sour island
#

Calling doParam from the client directory doesn't make changes to the serverside afaik too - I also ran into that issue with another mod.

vast palm
#

wouldn't the server do it too?

sour island
#

Or I could be confusing the two -- changes on server didn't work on client

bronze yoke
#

the server doesn't execute the client folder

neon bronze
#

DoParam from clientside doesnt work for the current weapon you hold but when you spawn in a new one it does, i believe

vast palm
#

hm..

bronze yoke
#

doparam never modifies existing items regardless of where you do it

vast palm
#

but wait

sour island
#

Depends on the param

vast palm
#

I remember it always editing items I already owned

bronze yoke
#

although it might modify items when they load again, and some properties are never stored on the instance in the first place

vast palm
#

I remember changing TYPE would completely destroy existing items

sour island
#

If it's not saved it gets loaded from script

#

Type is hard coded to do thst

vast palm
#

but anything else would change properly

#

I never needed to find a new instance of an item to see changes that weren't "Type"

#

then again, I never did extensive testing after build 37

neon bronze
#

It really is a strange thing

sour island
#

I can try to look up why I had to do this

bronze yoke
#

if you were doing it on game boot then most params would apply to existing items because they haven't loaded yet

sour island
#

I recall it being related to my literature mod

vast palm
#

were you using the other mod, where it used onLoad?

#

cause I use on GameBoot

neon bronze
#

But i also think that albion is right: it depends on the param you alter

sour island
#

No I never used the other mod

vast palm
#

ok

neon bronze
#

Cause vanilla has the edit item option but it doesnt list everything for the item that can be altered

sour island
#

Initially I used itemtweaker for vanilla weapons expanded but I adopted a template system using doParam instead

#

My point is that that person may have been trying to resolve the anticheat

#

And I ran into an issue with doParam being on clientside as well

vast palm
#

"This is just a change on the initial callback to apply the changes on each game load.
I did 0 non-regression test so do not use it on your games unless you backed-up your save first."

#

that's what his mod did differently

sour island
#

I can't find where I spoke about the OnLoad vs ongameboot but Im at work

vast palm
#

This?

sour island
#

The last thing I messed with (as of yesterday) was parseScript