#mod_development

1 messages · Page 264 of 1

bright fog
#

Perhaps I should

night iron
#

@bronze yoke do you know how to get a characters skill level inside the onCreate handler?

#

i mean the 3rd argument of the event seems to be the user/player/character right?

#

function ImprovisedTool.OnCreate.Salvage(items, result, character)

#

getCharacterTraits ?

bronze yoke
#

use character:getPerkLevel(Perks.PerkName)

#

not all match their displayed names

night iron
#

ha! thanks!

#

i assume Woodwork is carpentry right? which is does carfting pair to?

#

MetalWelding would be metalworking?

bronze yoke
#

yeah

#

keep in mind the structure for these is *really* weird so perk categories show up here too

night iron
#

so what is crafting?

bronze yoke
#

for some reason perk categories (such as crafting, passive, etc) are represented as actual perks that can gain xp (though there's no code that actually does that)

night iron
#

does this sort of dictionary construct work in lua?

local woodMaterials = {
    ['Base.Twigs'] = true,
    ['Base.TreeBranch'] = true
}

function getIngredientGroups(items)
    local metal = false;
    local wood = false;
    local cloth = false;

    for i = 0, items:size() - 1 do
        local item = items:get(i);
        local type = item:getFullType();

        if string.find(type, 'Metal') then metal = true end;

        if string.find(type, 'Wood') or woodMaterials[type] then wood = true end;
    end
end
bronze yoke
#

yeah!

night iron
#

cool thanks

#

and is this how you handle function that return multiple values?
local metal, wood, cloth = getIngredientGroups(items)

bronze yoke
#

yeah

night iron
#

kk thanks

night iron
#

right now i'm using it to check witch ingredient groups were used to create the item

#
function getIngredientGroups(items)
    local metal = false;
    local wood = false;
    local cloth = false;

    for i = 0, items:size() - 1 do
        local item = items:get(i);
        local type = item:getFullType();

        if string.find(type, 'Metal') then metal = true end;

        if string.find(type, 'Wood') or woodMaterials[type] then wood = true end;

        if clothMaterials[type] then cloth = true end;
    end

    return metal, wood, cloth;
end
#

@bright fog ^^

bright fog
#

There's no point using it

#

Also don't make your function global

#

Make it local, unless it's a crafting function referenced in a script file

night iron
#

how do i do a function local just preceed it with local or do i assing it to a local var?

#

as for the ; i'm on team cant stand fault tolerance in interpreters / compilers if ; is part of the language as the end of statement character i will use it

#

btw are require paths relative to the client / shared / server folder or to the file they are used on?

bright fog
night iron
#

to each their own i find it lazzy

bright fog
night iron
#

kk thanks

robust briar
#

Hey y'all,

so I have a problem I am unsure how to fix with animations which play from a timedaction.

I have an animation where the held item needs to stay still while both hands are moving. In the actual animation, I have the prop2 field set to a static position. It does not move throughout the animation at all. In the animNode xml, I have tried both defining a bone weight 1 for all of Dummy01, and defining all the bones (including prop2) individually.

In single player and on my own screen, everything works perfect. It looks great. But in multiplayer, the prop is attached to the hand and not the prop2 spot and as the hand move the prop moves around as the hand does.

Anyone have any idea how I can approach this? My guess is there is something about it being another player that is causing the prop to not attach properly in the animation.

bright fog
#

I find that surprising

#

Bcs that somehow means the game doesn't follow proper prop bones if seen another player run the animation ?

robust briar
#

Whats also realllly weird, is with non-steam server, the animation is correct

#

with a steam server, the prop flails around in the hand

#

which makes it really hard for me to debug locally, as I can't run a steam server with two client connected on my machine

bright fog
#

wdym by a Steam server

#

Host ?

#

Don't use host for MP tests

#

It doesn't act the same as a dedicated server

robust briar
#

Ahh.. let me try with dedicated non-steam server

#

one sec

night iron
#

is there an easy way to change my new item to show the condition bar like in the shovel here?

night iron
#

is it in the item def?

bright fog
#

It's what Susceptible does with its filters

#

I'm not sure

#

Check out Susceptible and its filters, and how they show durability

night iron
night iron
#

oh

night iron
night iron
#

def seems pretty neutral
item GasmaskFilter
{
DisplayCategory = Accessory,
Weight = 1.0,
Type = Normal,
DisplayName = Gas Mask Filter,
Icon = GasmaskFilter,
WorldStaticModel = GasmaskFilter,
}

robust briar
# bright fog It doesn't act the same as a dedicated server

So, I just tested with a nonsteam dedicated server, and the animations also all worked as expected. I did change a bunch of stuff so I am launching to a steam server now to test there. The last time I tested this, it worked everywhere but steam-enabled multiplayer servers

bright fog
night iron
#

yep looks like they are overriding ISInventoryPane

night iron
#

how can i use that width value in my code?

    local test = item:getTexture();
    print('--==--==> ' .. tostring(test));
#

tried test.w, test.getWidth, test[w] these all return nil

coarse sinew
#
test:getWidth()
robust briar
night iron
robust briar
#

both using dedicated server.

robust briar
#

So, you can launch PZ, or the PZ dedicated server with all the steam related stuff disabled.

bright fog
#

That's fucked

robust briar
#

oh, misunderstood the what

bright fog
#

Get that to the modding discord please

#

Maybe someone has an idea why

robust briar
#

Heading over there

bronze yoke
#

lua has never required or expected you to use it, it's just there to make it easier for c developers

#

my guidance on it is use it if you think it makes your code easier to read

bronze yoke
#

i used to use it to separate multiple statements on one line

#

(but then i just stopped doing that entirely anyway so i don't use it anymore)

bright fog
#

That would be the main use I find of it

round notch
#

Are the events in LuaEventManager.java referencing lua scripts? If so where doth one find said scripts drunk

bronze yoke
#

media/lua/

round notch
#

...long day 🤣

#

Cheers

wispy wharf
#

anyone think they can make a mod to add moon knight's costume?

steep vortex
#

What unit of time is referenced in a recipe script?

bronze yoke
#

scales with day length

steep vortex
#

Thanks

pure hollow
#

still need help finding where the logic for the generators are

bronze yoke
#

they're all java

pure hollow
#

there goes my idea for mars survival with oxygen generators..

pastel terrace
#

Hey all, I'm trying to "tag" zombies with an ID that I can recognize so that I know the id of the zombie even after it re-renders.
I tried something like:

    -- Check for modData ModData
    local modData = target:getModData()

    -- add a unique ID and assign it
    if not modData.zombieUniqueID then
        modData.zombieUniqueID = generateUniqueID(target)
        print("Assigned new unique ID to zombie: " .. modData.zombieUniqueID)
    else
        print("Zombie already has a unique ID: " .. modData.zombieUniqueID)
    end

And then I use a local array to keep track of these generated IDs, and execute a function each few ticks that affects the tagged zombie.

But I just can't get it to work.
Any help or tips are very much appreciated.

bronze yoke
#

zombie moddata is not cleared when a zombie is recycled

#

nor is it actually saved into the save file

#

so you can't use it for storing a unique identifier like this (or really much at all)

#

you can use a zombie's persistent outfit id (getPersistentOutfitID()) to track a zombie

pastel terrace
bronze yoke
#

index page doesn't look up to date, i'd stick to the individual class pages

pastel terrace
#

I think something might be wrong with my approach though. I save a zombie to an array like:
zArray[target:getPersistentOutfitID()] = { zombie = target, tickCounter = 0 }

And to call I define a function that's added to Events.OnTick.Add(onGameTick);
where

local zombie = data.zombie
 -- Check if the zombie still exists and hasn't been removed
   if zombie and not zombie:isDead() then
     zombie:setCanWalk(true)
     -- etc call function from Class IsoZombie

Maybe this is not the way lol. New to LUA.

bronze yoke
#

the zombie object will always exist, the game doesn't ever(?) delete them, it recycles them into a pool and reuses them for new zombies

#

for many reasons like this doing stuff with zombies is always awkward

pastel terrace
#

I see. Thing is the code works so long as I can see the zombie and I'm in precense of it.
It's when I go out of the reality bubble that, when I come back, the code iterating over the array keeps running, but it's not affecting the zombie anymore.

#

It's how I noticed that if I had, say zArray[12] being executed on, when I left, came back and targetted the zed, it would add a new entry like zArray[15] and just iterate over the new object and the old one.

#

Even though it was the same zed. This was using getID() which seemingly changes even for the same zombie lol

bronze yoke
#

as soon as that zombie leaves the bubble, it gets recycled into the zombie pool, when you return that zombie object is mostly likely being used for a different zombie or sitting idly in the pool waiting until more zombies are needed

#

so keeping a reference to a zombie object doesn't really guarantee you'll have a reference to that specific zombie as we understand it

crisp flicker
#

you would have to rewrite how the game manages the zombie population

pastel terrace
#

Gotcha. Figured it would end out being something out of scope

bronze yoke
#

you can check every zombie's persistent outfit id for the one you want - i suppose you could hold onto the zombie object until that changes, assuming it gets reset when recycled

pastel terrace
#

Yeah just tried it an not working anyway, even though getPersistentOutfitID() does indeed return a unique and repeateable ID.

pastel terrace
bronze yoke
#

loop through getCell():getZombieList()

crisp flicker
#

also does anyone know of any lua docs like rust's tutorial, maybe something a bit more in depth and user friendly, because the lua manual iis complicated for anyone who hasnt gone through CS,
"The type table implements associative arrays, that is, arrays that can have as indices not only numbers, but any Lua value except nil and NaN. (Not a Number is a special floating-point value used by the IEEE 754 standard to represent undefined numerical results, such as 0/0.) Tables can be heterogeneous; that is, they can contain values of all types (except nil). Any key associated to the value nil is not considered part of the table. Conversely, any key that is not part of a table has an associated value nil." I get that it's a struct and all but it's a bit much

bronze yoke
#

it looks like they do reset their persistent outfit ids, so i guess what you can do is keep a reference to the zombie object, check its outfit id, if it's not the one it used to have then scan the zombie list for that id - but to be honest this seems like you'd still end up having to scan most of the time anyway so it might be simpler + just as cheap to always scan the zombie list for the right id

bronze yoke
#

programming in lua is what you'd usually be guided towards

crisp flicker
#

yeah I just got to that

#

dunno how I didnt see that

lofty frigate
#

I also have a different idea but the goal is to get the zombies to attack each other, I don't think I'll get it, I don't know much

royal pawn
pastel terrace
#

How feasible would it be to mod in a way to drag live zombies around?

pastel terrace
onyx valve
#

Hello, good day, I am trying to make weapons from other mods (for the moment VFE) not be affected by the RecoilDelay that I have in my mod and it works for the weapons that respawn but not for the weapons that I have already looted, do you have any idea if can that be solved? This is the code.

oak light
#

how can I play a sound in this game which can attract zombies? I made an alarm trap but the sound only can be heard by the player

royal pawn
oak light
royal pawn
#

it's the audio file trigger innit?

oak light
#

yep, I use my own audio file

royal pawn
#

zombies dont care about audio files. They dont have a real hearing, gotta trigger them with events

oak light
#

and I want to trigger the alarm audio once the player step on the tile

#

Are those events coded in Java file? I can not find them in lua

royal pawn
#

well there are ways to trigger them with lua

#

just search for shouts, house alarms, car alarm, honks etc

oak light
#

thanks🫡

night iron
#

Morning peeps!

oak light
#

I am using this for shout, it still does not attracting zombies🥲
SayShout
public void SayShout(String string)

bright fog
oak light
#

it works, but only showed on the screen, no sound played

bright fog
#

That's what I'm telling you

#

You found the function which writes the text

oak light
bright fog
#

Perhaps the sound creation is NOT in that same function, and instead is called at the same time as this function

#

Look in the java, where your shoot function is called

oak light
#

So which one is the real shouts in this game, I found several functions

bright fog
#

And you will possibly find the same thing that creates the sound too

oak light
bright fog
#

Or even in the lua, that could be possible

oak light
#

I think the triggering of the house alarm is in the Java file, not sure about this

bright fog
#

why do you care about the house alarm

#

You want to make the player shout ?

#

And you want to create the sound which alerts zombies when shouting ?

oak light
#

just make some noise like the noise maker which can attract zombie hord

bright fog
#

(also it should literally just be addSound)

#

addSound will not play an actual sound, but it will attract zombies

oak light
#

Thanks!!!

#

So which one should I use for?

bright fog
#

GlobalObject I believe
You just use it this way:

addSound(...)
#

Let me bring up the code from my mod that creates a sound and attracts zombies

bright fog
# oak light So which one should I use for?
        local emitter = getWorld():getFreeEmitter()
        local square = door:getSquare()
        emitter:playSoundImpl("DoorCreek"..tostring(ZombRand(1,16)),square)
        local radius = SandboxVars.CheckUpstairs.Radius + 1
        addSound(nil, square:getX(), square:getY(), square:getZ(), radius, radius)
oak light
#

Thanks a lot, I'll try this

bright fog
#

👌

onyx valve
bright fog
#

It's due to existing items not taking on script item changes

#

Overall I wouldn't suggest making a patch for that, the patch is a new save

grizzled fulcrum
#

saying that to the people who have hardcore 1y saves rip

grizzled fulcrum
#

You would want to put the second loop with the player part in maybe OnGameStart or OnCreatePlayer
actually no, DoParam wont exist for InventoryItem

grizzled fulcrum
# bright fog 1y ?

1 year, like old saves that people refuse to migrate to newer ones because they really want their old stuff

bright fog
#

1 year ?

#

Ah yea

grizzled fulcrum
#

correct

bright fog
#

I mean yeah sadly it's part of modding

#

It's why I wouldn't suggest a patch if it's not 100% needed. Like some mods could modify the type of an item or add a tag to it which would make old items obsolete or break the mod, then yeah sure make a patch when updating your mod so players don't ever get a problem with that

#

But overall if that will not implode your mod on updating, I don't think it's worth the trouble

grizzled fulcrum
#

I usually just put a sandbox option for these people like "Migrate Existing Save" where if you tick it, it runs code once that does the thing it needs to. But I still have to figure out if it's possible to modify containers that are not loaded by the client due to load distance for one of my mods

bright fog
#

If things are not loaded you simply can't access them

#

And sadly I don't think it's even possible to

  • get containers interacted with by the player
  • load specific squares to access anything on the square
grizzled fulcrum
#

So I assume the world loading at the start when you load the save or join a server is just loading the squares around the client player?

bright fog
#

Would be insanely costly to load a save else

#

Imagine the game loading the entire map lmao

grizzled fulcrum
#

true, but no operations at all to do anything remotely like that is weird

bright fog
#

It's already INSANELY heavy to load the map xD

grizzled fulcrum
#

I'll benchmark save loading in a while, just busy fixing stuff on an already existing mod that showed up

bright fog
grizzled fulcrum
#

I know it does some sort of caching but I just don't know what

ancient grail
bright fog
#

wdym by caching ?

#

cache what ?

ancient grail
#

i believe thats the chunk thats loaded

bright fog
#

It's the squares

#

I don't think it uses chunks does it ? Maybe it does I don't remember

ancient grail
#

im actually tellibg this to @grizzled fulcrum
cuz i know you know this

bright fog
#

👌

#

ik yea

ancient grail
#

ive also tried that container thing tho

grizzled fulcrum
#

is that to demonstrate that it caches the cell that the player loads?

ancient grail
#

no luck

searched all possible functions i could find

grizzled fulcrum
#

or do you mean the two combined

bright fog
ancient grail
#

if only its not dependent on the players posiion

since theres also camera object right
like force load it hacky way

ancient grail
#

ah sorry

#

nope squares but not container sadly

bright fog
#

Currently loaded or not

ancient grail
#

closest thing is
but not exactly what you want

Events.ReuseGridsquare.Add(ReuseGridsquare)

maybe theres a bin? na...

#

since id changes after restart that shouldnt be possible

ancient grail
grizzled fulcrum
#

I was thinking of OnContainerUpdate, sorry, you are right in that there is no apparent event for it

ancient grail
#

what you trying to do?

grizzled fulcrum
ancient grail
#

global objects act differently

maybe turning containers into global objects could achieve this maybe?

#

like oven

grizzled fulcrum
#

Though I am thinking, it's definitely possible to keep the "memory" of previously-loaded now-unloaded squares (in the scope of Java, not lua)

ancient grail
#

or freezerw

grizzled fulcrum
#

Like I wonder if we could still keep the squares loaded per-se but just not do any real operations on them

ancient grail
grizzled fulcrum
#

kinda like ghost/placeholder squares that keep their memory, so when you need to reference what was last in the square when it was "unloaded"/turned into ghost square, we could just refer to the memory of the square

grizzled fulcrum
#

of course it's very very very hypothetical and obtuse

ancient grail
grizzled fulcrum
#

or something like that

ancient grail
#

you might need to look at how its unloaded

grizzled fulcrum
ancient grail
#

when pao and i worked on the mortar mod
we explored this

like tested distance when a client can fire the explode function

it doesnt do it when square isnt loaded

but when another player is there
it works
this is cuz the explode function is sent to server

grizzled fulcrum
#

Maybe if all clients had to load other clients' squares (assuming it's performant enough to do so), this would solve any race-conditions of the square memory theory where the square is loaded by a client and updated but the memory isn't updated

ancient grail
#

so what determines loaded square is presence of player

so what if we can create dummy player or something
tho im sure thats not possible cuz thats basically recreating another player instance with a new client shared server load thing for it

grizzled fulcrum
#

I think it would be straight up just easier to manually call something like loadGridSquare(IsoGridSquare)

#

assuming it would be exposed in Lua 😦

#

I think for my Lua implementation I am just going to expose everything but some very specific things

#

or just ditch the sandbox entirely, but I feel skeptical about that

#

I don't know yet, I see other games do Lua imeplemations pretty well so I have to study them some more before I can make good judgements

ancient grail
grizzled fulcrum
#

I don't have any cool wacky new zombie code stuff to share, im just doing a java mod to improve the game, thats my goal

#

I don't want to really boast publicly about what's on my todo list just incase I fuck up and somehow become unable to do it, but I've got about 3-4 months to do some stuff

#

I haven't even started the majority of it yet because I have to fix two mods I've already published as one randomly broke out of nowhere and another one isn't even fully released yet

young edge
#

Hang in there

subtle flume
#

yeah

night iron
#

anyone here knows what self.joyselection stands for in vanilla ISInventoryPane:renderdetails ?

bright fog
grizzled fulcrum
# subtle flume yeah

Just casually responds to a 5 year old message with no context or anything 😭

night iron
# bright fog did you check where it's used ?

it's used in the vanilla ISInventoryPane:renderdetails as i mentioned -.- just can't figure out what that actually is from reading that code. It's related to rendring the characters inventory panel

bright fog
night iron
#

a simple 'i don't know' is a good answer here @bright fog... the reason why i'm asking is because i'm trying to avoid having to read through thousands of lines of code after i've already spent quite sometime trying to understand what that is.

This is what typically is done in an professional environment between peers

bright fog
#

This searches for the term within all the lua files of the game, and you can eliminate some of these which are not linked to setting joyselection

night iron
#

are you seriously trying to teach a veteran programmer how to search source code? .... you know what forget i even asked

bright fog
#

Bcs I don't see it written anywhere, so don't act like a jerk because I'm trying to teach someone how to find what they are looking for, and me making the mistake of not knowning that you are a " veteran programmer"

steep stump
night iron
#

I'm actually rewriting that feature because it's near unreadable and almost impossible to mod without overloading the entire thing

buoyant wave
#

for the people that have a deeper understanding of zomboid modding i was wondering how zombie data is stored as i was wondering if it would be theortically possible to have a script that could detect what a zombie wearing when it kills a player

grizzled fulcrum
buoyant wave
bright fog
#

No need to use the pID

#

Simply do zombie:getVisuals()

grizzled fulcrum
# night iron anyone here knows what `self.joyselection` stands for in vanilla `ISInventoryPan...

it was literally one search and I found the answer, jvla is right!
you can't possibly use the notion that you are a veteran programmer (which was unknown at the time) to disprove why you can't search code properly and then proceed to not be able to search code properly.

look at where self.joyselection is being assigned. if you still can't find it, no offense but you're not a veteran programmer (whatever that means)

bright fog
#

On the killer zombie, and it gives out the zombie clothing

sonic bloom
#

Heya, so I am curious. How do you create a mod to change the zomboid music main menu and such?

sonic bloom
#

Thank you!

buoyant wave
#

welp time to properly learn lua and work on that script

bright fog
#

The hardest part might be getting the zombie that killed the player tbf

#

Simply bcs this does not give the killer

buoyant wave
#

and the main issue is i need to know which zombie killed the player so i can cross refrence the zombie is wearing when the player dies

bright fog
#

yup

#

player:getClosestZombieDist()

#

Perhaps

#

Not reliable tho

buoyant wave
#

i'll try that for now while i learn how to actually code

#

quick question what program do you reccomend for a beginner when attempting to write and learn code in lua?

#

i've had a few people reccomend notepad++

bright fog
#

The reason is that we have an addon that allows auto completion of code

#

And easily detecting quirks in your code

#

It's called Umbrella

#
  • ctrl + shift + P when in VSCode
  • Open addon manager
  • Search for "Umbrella"
  • Install and activated
sonic bloom
#

Did anyone here create this mod? -> https://youtu.be/WyOFQfXvVBM
I wanted to ask if they could help me out to change the main menu with this theme but keep the rest, like an alternate version -> https://youtu.be/aPgy33lqyRU?si=Ej4JdIH1M_JGusQj

This mod uses edited clips of music from RE4R and JJBA.

When this mod is enabled it will change the menu background, loading screen, and death song when you die in game.

Workshop ID: 2974221035
Mod ID: enhancedmenu

▶ Play video
civic tree
#

@runic siren so

runic siren
#

hi.

civic tree
#

you go to your mods workshop page

#

and scroll down a little

#

i got it in spanish but

#

its those 2 options under eliminate

#

itll open a list thing search thing idk

#

you can take it from there its pretty intuitive

runic siren
#

badass, tysm

grizzled fulcrum
quiet rain
#

Hey everyone. I'm having an issue with deleting vehicles through code in a server. In singleplayer it works fine, but multiplayer is where I'm getting the issues.

First I'm using some code to grab specific vehicle IDs from the cell, then I'm running

vehicle:removeFromWorld()
vehicle:permanentlyRemove()

This removes the vehicles, but it spawns them back in. Considering this is run serverside (lua/server), what could cause it to not sync the deletion?

bronze yoke
#

what actually triggers the code? putting it in the server folder doesn't mean it runs serverside

#

object respawning after deletion usually means it happened clientside

quiet rain
#

I have a code on client side that checks whether a button is pressed, quick lazy method, that then runs a servercommand whose function is in the server folder.

bronze yoke
#

definitely a server command and not a client command?

quiet rain
#

sendServerCommand

bronze yoke
#

they're named after the sender, if the client calls sendServerCommand nothing happens

ancient grail
pastel terrace
#

Is it theoretically possible to make a zombie friendly towards the player and have it follow you around?

#

I know there's a flag that's like zombie:setUseless(true) or something of the sort, but I'm not sure if that works.

inland steppe
#

Whatup, I have pretty much completed my EHE submod and I wanted to ask some questions regarding testing

#

Most of my tests have been SP in debug mode. I wanted to ask, is hosting a game via the Host option functionally the same as a dedicated server?

#

Or should I be testing all three: SP, Hosting, and dedicated?

dull moss
#

Afaik hosting from main menu is identical to dedicated EXCEPT that you gotta find a friend who can test stuff for you

#

Cuz if you host and you play alone i think it's not exactly the same

#

might be wrong

inland steppe
#

I ask because it's just a ton of effort to configure the dedicated server and would also fuck our save i think

dull moss
#

make new one with only your mod

#

and ask 1 fren to hop on and test stuff

inland steppe
#

I can just grab the save and put it back later, just time consuming

dull moss
#

just make new server?

#

takes like 3 min

inland steppe
#

yeah, cool, will be easy then. i just run two non-steam instances of zomboid to test hosting

bronze yoke
#

it's pretty much the same

#

you don't technically even need a second client unless you're specifically testing if things synchronise between players

dull moss
#

oh cool

inland steppe
#

i'm fairly confident my scripts work, i copied vanilla code for syncing the IsoTraps

#

i think thats the only thing i had to worry about

dull moss
#

Albion to the rescue as always pepe_love

inland steppe
#

the mod is 80% just new EHE presets, 20% additional functions

#

so it should just work

dull moss
#

Kpog new submod for EHE

inland steppe
#

BUT, some features are inherently destructive so I'm trying to be absolutely certain lmao

dull moss
#

Will it work with military drop?

inland steppe
#

afaik it works with everything?

#

You can peep it while it's in testing phase, if you want

dull moss
#

I havent looked at military drop code but it says it overwrites some stuff from EHE

#

so idk

inland steppe
#

my tests have been focused on making sure the functions work, but I've tested with 400+ mods loaded included the military drop and no errors so far

#

yes, same as mine. just has to be loaded after

dull moss
#

pog

inland steppe
#

i should probably note that

dull moss
#

big W

inland steppe
#

feel free to look at it or test it, i'm coordinating a testing run with some friends so we can try to make sure everything works

#

it's super time consuming and fast-forwarding time is bad for the heatmap

#

so i havent been able to fully sign off

dull moss
#

I won't but ty for invite. Havent played PZ in a while and probably going into your usual 4-month break from PZ cycle xdd

#

Im just chilling here every now and then

inland steppe
#

all g word

dull moss
#

I might or might not got addicted to Starsector

inland steppe
#

honestly i could probably just make it public but people can get instakilled by this shit so i need to test more

#

also wrestling with the EHE scheduler but i can't change any of that

dull moss
#

btw when going public, better republishing mod instead of making it public

#

better for algorithm

inland steppe
#

neat

bronze yoke
# dull moss

just another case of developers not knowing what load order does lol

dull moss
#

Also true

bronze yoke
#

i might try and write something up about it soon because it's starting to irritate me how confidently wrong 99% of the community is about it

grizzled fulcrum
bronze yoke
#

it's more what it affects

#

e.g. it not affecting the order in which lua files load whatsoever

#

a lot of advice i see surrounding load order doesn't actually make sense, and overall it rarely matters and changing it will rarely solve conflicts whereas the general conception seems to be that it's extremely important?

#

for example advice to always put library mods near the start of your load order doesn't mean anything because as pure lua mods they aren't affected by load order whatsoever

#

(except for file overrides)

inland steppe
#

never have given load order a thought with 400+ mods loaded. only thing where order mattered was maps

bronze yoke
#

yeah, it does matter for maps but it's quite intuitive there anyway

#

i also don't know what the load order interactions might be for tile mods

#

the only thing mod load order does outside of maps (and potentially tiles?) is resolve file conflicts, if multiple mods contain the same filepath the file from the mod latest in the load order is used

#

for lua files this can be significant (though in 99% of cases this means the mod is badly made to begin with) but for anything else it'll almost never cause a game breaking issue

#

i'm not sure of the order in which scripts load actually

ashen mist
#

Heya folks, I have question

#

How would one go about changing the protective regions of equipment?

#

I'm working on something for a server I'm in, and it requires tweaking some armor values, which is easy enough, but there's some overlap and I need to add shin coverage to an item that only covers the thighs and groin

winter bolt
#

apparently these are all the ones you can put for it

    LongJacket,
    Trousers,
    ShortsShort,
    Shirt,
    ShirtLongSleeves,
    ShirtNoSleeves,
    Jumper,
    JumperNoSleeves,
    Shoes,
    FullHelmet,
    Apron,
    Bag,
    Hands,
    Head,
    Neck,
    UpperBody,
    LowerBody,
    LowerLegs,
    UpperLegs,
    LowerArms,
    UpperArms,
    Groin;```
ashen mist
#

but thank you regardless

winter bolt
#

im pretty sure you can also add multiple if you separate them with ; like "LowerArms;LowerLegs,"

ashen mist
#

(i was just cheering to myself when it worked)

bronze yoke
#

something curious i didn't know is that file names that begin with template_ always load before other files

pastel terrace
ancient grail
bronze yoke
#

it doesn't look like it gets reset when the zombie is recycled

#

that's likely why

ancient grail
ancient grail
thick karma
pine patio
#

Is there a way to make a modded evolved recipe allow vanilla ingredients? I've been reading the code and the only way I found to do it was to add my modded recipe in the vanilla item parameters

bronze yoke
#

you can use DoParam in a lua script to add your item to its evolved recipe list

#
local item = ScriptManager.instance:getItem("ModuleName.ItemName")
if item then
    item:DoParam("EvolvedRecipe = MyEvolvedRecipe:5")
end
pine patio
bronze yoke
#

this is a special case where it won't overwrite

pine patio
steep vortex
#

Are there any good tutorials for making timed actions?

#

Or alternatively, what's a good example in the vanilla files to reverse engineer?

lunar anchor
#

does anyone know if there are any mods for filibuster rhymes' used cars that basically lets you select which vehicles spawn and which don't from it (as in i want to disable some vehicles from the pack)

#

(i know its not really a mod development related question but i figured this is probably the best place to ask)

onyx valve
#

Hi,good day, i have a question, is it necessary to make a .lua file or something like that to be able to test my mod in multiplayer?

bronze yoke
#

no

onyx valve
#

And if I want to test it on a server or host, I don't need to do anything?

#

sorry for so many questions jajj

steep vortex
#

How do you check the item in a player's hand?
Had tried
if playerObj:getPrimaryHandItem() == "Necronomicon" then
But that doesn't seem to do it

steep vortex
steep vortex
#

Did it

onyx valve
#

I uploaded it to the workshop but when I subscribed and wanted to test it in multiplayer, with me being the host, it told me "The server stopped during the launch (NormalTermination)", am I doing something wrong?

steep vortex
#

What would be the best way to access dead bodies on the floor in a timed action?
Wanna use a random body's mod data at the end of the action

Ahh. getplayer():getsquare() and square:getDeadBodys() might be the solution

Does anyone know if it's possible to make zombies rot via script? Like, advance to the stage where it's a skeleton on the ground, as well as checking for whether or not said zombie is a skeleton?

inland steppe
#

damn, so I finally got around to testing my ehe submod while hosting. the bombs, smokes, and firebombs are showing up, but no explosion sounds or lights are emitted for players or for the host. just the explosion itself and the fire

unkempt wadi
#

Hello! Community translations are ending this build but the developers said that we can keep doing them but as a mod. How can I create a mod exclusively for translations? I have never made a mod.

onyx valve
#

just for test

#

in mp jeje

bright fog
#

You should be able to figure out the rest

unkempt wadi
#

Ok, then it's no different of what I have been doing. Then, how could I upload it to Steam, for example?

ashen mist
#

I need a little help with my thumbnail

#

See, I tried making it this screenshot

#

but whenever I uploaded the mod, it got set to a default indie stone one

#

oh! i got it now

#

i dont got it

#

i even made sure it was 256x256

#

it's in the spot it should be

#

restarting the game worked

bright fog
#

Make sure it's in your Workshop mod folder, as preview

night iron
#

Anyone around with experience and a deep understanding on the vanilla ISInventoryPane ? trying to wrap my mind around why renderdetails is executed twice per tick once by the prerender with the doDrag set to false and another by the render with doDrag set to true ::scratch head confused::

#

nvm i think i finaly managed to test it and it seems the prerender (doDrag set to false) renders the normal inventory while the render (doDrag set to true) only renders the items being dragged?

ancient grail
#

is there a function to remove an items container property?
like disable it?
something like setInventoryContainer()

ancient grail
bright fog
#

Bcs zombies are recycled when they are unloaded

#

From death or unloading an area with the zombie

#

Now you see the source of all my madness

ancient grail
#

so we have to setUseless false before they die ?

#

damn

bright fog
#

No persistent and unique data is ever possible

bright fog
#

Let's hope they make a better system for zombie identification in b42

ancient grail
#

such a waste...

bright fog
#

yup

bright fog
#

Literally my entire Zomboid Forge framework is flawed and everything I worked on was to count act this single problem of zombie identification. And I still have so many problems with that today

#

It's impossible to make a zombie truly unique rn

#

And to reliably identify unique zombies

ancient grail
#

OnZombieSpawn event please

bright fog
#

Zombies need unique IDs that's it

ancient grail
bright fog
#

Give zombies unique IDs and all your problems are fixed

ancient grail
#

and maybe allow us to create custom states

or atleast sync the setVars

bright fog
#

Give every zombies a unique 16 bit ID and we are fucking saved

ancient grail
#

that would make everything easier and better synced

bright fog
#

You can already do that

ancient grail
#

yes but like i said would make it easier
hehe

#

lazier

bright fog
#

The problem is that the zombies, even with a 16 bits ID would have a problem

#

16 bits is not enough

#

That's 65536 zombies

ancient grail
#

oh btw i had this idea

setWalkSpeed can be
1 to 5
or sprint1 to sprint5
or crawl1 to crawl3 right?

this syncs right?

bright fog
#

The problem is that how tf do you even store so many IDs, bcs 65k zombies is nothing

ancient grail
#

when you set it
i believe its synced? not 100% sure

so my idea is to create custom walktypes

bright fog
#

What for

ancient grail
#

to make em unique in terms of custom animations

so i would need to setVar and sync
and have various bool for behavior and animation

maybe doing the walktype would already make them unique

bright fog
#

That doesn't work

#

Zombie gets recycled, it's variables follow

#

Thus get shuffled

ancient grail
#

like my current check is based on outfit
but i still need sub bools
for other checks like if its doing custom behavior

ancient grail
bright fog
#

It's not reset I believe

#

But not sure, it might be eset

bright fog
#

A restart = a reload

#

Unloading an area

#

Zombie gets recycled

ancient grail
onyx valve
sand parcel
#

I'm making a mod that modifies farming_vegetableconf timeToGrow for each plant, and it works great on a SP game but for some reason doesn't work in MP? I'm thinking that it could be file structure (I have the .lua script under /lua/server/Farming)

keen quarry
#

hello, is there any file-format description for MAP_###_###.bin (from within the save folder) ?
i found some C# utility on github (https://github.com/blind-coder/pz-mapmap), but after brief look into the code it seems my saves look a bit different (checked reading of first bytes)

(is this channel the best for this question?)

bronze yoke
#

the format changes a lot, the last release on this repository was about two years before the game's last update so i wouldn't be surprised if it's a bit off

noble shell
#

hello hello. Can anyone please provide me with the clarification for getPlayer() function with splitscreen? I know it has been asked here before, but I'm still quite confused how it works.

bronze yoke
#

in splitscreen getPlayer() returns the most recently added player

#

getSpecificPlayer(index) can be used instead, where index is a number from 0 to 3, which will get the player in that number slot

#

if you want your mod to work in splitscreen, you should avoid usages of both functions as much as possible and pass around player objects between functions (this is also just better for performance and is better code style anyway)

noble shell
#

I see. Thank you so much spiffo

#

how about something more specific like overriding and adding another slice in the existing radial menu? Is that something do-able for the added spliscreen players?

bronze yoke
#

pretty much anything should be possible

noble shell
#

okay. Thank you for your help!

neon hamlet
#

hi sorry what's the icon size ?

#

For items n' what not

hollow lodge
neon hamlet
#

ty cap'n

thick karma
#

Thought it grabbed player 1 haha

bronze yoke
#

i think it might technically be 'the highest active player slot' and not necessarily the most recently added? but yeah it's almost never player 1 in splitscreen

thick karma
#

Whooooooa

#

Hmmm well shit

#

Now I know thanks as always lol

bronze yoke
#

iirc it's an artifact of how they use that internally, when they're doing player updates they just change which one IsoPlayer.instance points to (i guess to make a transition from pre-splitscreen code easier) so when lua gets around to running it'll still be pointing to the last one

bright fog
next vine
#

i mean its just a little dump question but how can i get in the translation the german ä ü and ö to work ?

bright fog
#

Encoding

ancient grail
#

how do you even do split screen

ancient grail
next vine
tranquil kindle
bronze yoke
ancient grail
#

i see

topaz tangle
#

Someday, the Cessna 172 will be made

hollow lodge
untold turtle
#

So I have a couple mods that contain clothing items, few zombies. I was looking at making mod options where you can adjust their spawn rates rates in the world for users that use my mods.

I have no idea how to go about doing that though, anyone able to help me or got any examples I can follow?

#

please @ me if you respond to this ^^

candid sonnet
#

can someone point me to the method that returns pixels on the frame buffer? not familiar with opengl at all. Need to manipulate or store individual pixels on the canvas

pine patio
untold turtle
coral root
#

Hello, I would like to ask if I create an API that connects to the web and sends it to my server, is it possible to do something like add items to players? Through the website, if someone has done it before, can I have a guide?

ancient grail
#

anyone knows if theres a vanilla way to fetch whatever movingObject the player is aiming at?

cuz i had to do this
i wish theres a better way

function PsychoZedMod.isTarg(pl, targ)
    local fov = 45
    local plX, plY = pl:getX(), pl:getY()
    local targX, targY = targ:getX(), targ:getY()

    local targDirX = targX - plX
    local targDirY = targY - plY

    --print(pl:getDotWithForwardDirection(targ:getX(), targ:getY()))
    --local fVec = pl:getForwardDirection()

     local aimAngle = pl:getLookAngleRadians()

    --local angle = pl:getDirectionAngle()
    local angle = math.atan2(targDirY, targDirX)

    local angleDiff = math.abs(aimAngle - angle)


    if angleDiff > math.pi then
        angleDiff = 2 * math.pi - angleDiff
    end

    local fovInRadians = math.rad(fov) / 2

    --print(angleDiff)
    --print(fovInRadians)

    --print(angle)

    return angleDiff <= fovInRadians
end
noble shell
noble shell
chrome veldt
#

Hello, do you guys know if it's possible to turn off/on a room light without toggling the light switch? I've been trying for hours but can't find anything that works..

grizzled fulcrum
grizzled fulcrum
#

You might be able to loop through building's lights and set call light:setActive(false)

#

actually that's for all the lights in the building, one sec

#

IsoRoom.roomLights

#

so something like player:getSquare():getRoom() and then somehow get roomLights field or maybe you can do

local player = getPlayer()
local sq = player:getSquare()
local room = sq:getRoom()

local switches = room:getLightSwitches()
for i = 1, switches:size() do
    local switch = switches:get(i - 1) --[[@as IsoLightSwitch]]
    -- Do stuff with switch here, or even the source below

    local lights = switch:getLights()
    for j = 1, lights:size() do
        local light - lights:get(j - 1) --[[@as IsoLightSource]]
        -- Do stuff with source here
    end
end
#

If you're talking about from a game perspective and not modding, nope

sonic bloom
#

Can someone help me on how to install a mod on Zomboid? I created a map spawnpoint for project zomboid but I am stuck on how to implement it on the game.

chrome veldt
#

@grizzled fulcrum I tried that. light:setActive(true/false) does not seem to do anything

spiral egret
#

If I start "ISReadABook.start", am I able to cancel the reading action if a check i run after doesn't pass? I've tried ISBaseTimedAction.stop(self), self.character:setReading(false), ISReadABook:stop() but i cant seem to stop the action ayakaconfused_Zekzekyll

grizzled fulcrum
#

idk why that wouldn't be working for you

#

usually you dont start it yourself, you add it to the TimedActionQueue which starts it

#

but stopping should literally just be one call I think

spiral egret
#

maybe my character really likes reading

grizzled fulcrum
#

If it is your action, instead of calling stop after (which depending on what you do might only get executed after the action is completed/stopped naturally)

bronze yoke
#

are you trying to cancel it *within* the start function? that probably wouldn't work

grizzled fulcrum
#

you can put it in update function of the action

spiral egret
#

thanks for the insight guys

bronze yoke
#

they support an isValidStart() function for this usecase, if it doesn't return true the action won't actually start

#

you can use isValid() the same way to check every tick instead of only at the start of the action if needed

spiral egret
#
function ISReadABook:start(...)
    
    -- Nutritionist Trait
    if self.item:getFullType() == "Base.NutritionistMag" then
        print("Nutrition Magazine found.")
        if not CheckIfCanRead() then
            self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 0.55, 0.55, 0.55, UIFont.Dialogue, 0, "default")
            return originalReadStart(self, ...)
        end
        
        local traits = self.character:getTraits()

        -- Add the Nutritionist trait if the character doesn't have it
        if not traits:contains("Nutritionist") then
            traits:add("Nutritionist")
        -- Remove the trait if sandbox option to remove is enabled
        elseif SandboxVars.GydeTraitMags.ReadRemove == true then
            traits:remove("Nutritionist")
        end
    end

return originalReadStart(self, ...)
end

This is how the script currently is

#

i'm thinking i call self:stop() or ISReadABook:stop() like aoqia said in another function outside to cancel it maybe?

grizzled fulcrum
bronze yoke
#

by the way, this may be nitpicking but it might make more sense to add traits in perform() than in start()

spiral egret
#

no worries, i highly appreciate the feedback

#

i got into pz modding 2 days ago

#

been digging around a lot to try and learn this

bronze yoke
#

are you behind the trait magazine mod that came out yesterday? i was really impressed by the art

spiral egret
#

yes, i'm very honoured to hear that

neon hamlet
#

Chat, I clearly messed up somewhere along the way. Anyone know how this happens? I've done the XML's correctly afaik and the Items aren't using the proper icon either.

bronze yoke
#

a very common cause of icon woes is not knowing that it prefixes whatever name you give it with Item_

#

e.g. Icon = MyIcon looks for Item_MyIcon.png

neon hamlet
#

oooh

broken lake
neon hamlet
#

now time to figure out why the models aren't working :ryan:

neon hamlet
sonic bloom
tranquil kindle
chrome veldt
spiral egret
# bronze yoke try something like:```lua local old_isValidStart = ISReadABook.isValidStart ISR...

rahhhh i've been trying for an hour but i just can't seem to get this to work

function ISReadABook:isValidStart()
    -- Burglar Trait
    if self.item:getFullType() == "Base.BurglarMag" then
        print("Burglar Magazine found.")
        if not CheckIfCanRead() then
            print("GydeTraitMagazines: Not valid start.")
            self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 1, 1, 0.55, UIFont.Dialogue, 0, "default")
            return false
        else
            local traits = self.character:getTraits()

            if not traits:contains("Burglar") then
                traits:add("Burglar")
                -- Check if sandbox option to remove is enabled.
            elseif SandboxVars.GydeTraitMags.ReadRemove == true then
                traits:remove("Burglar")
            end
        end
    end
    return old_isValidStart(self)
end

I've tried return old_isValidStart(self) and return old_isValidStart and old_isValidStart() or true but in-game the reading starts regardless ayakaconfused_Zekzekyll ayakaconfused_Zekzekyll

#

am i missing something

#

it's also not running my debug prints

bright fog
bronze yoke
#

the reason for return old_isValidStart and old_isValidStart() or true was because ISReadABook doesn't usually actually have one - but now that i look it actually inherits one from the base object so return old_isValidStart() is fine

#

oh and self should be in there, looks like you caught that though

#

i usually ignore inheritance with timed actions because the game usually does too but this is a case where it actually works

spiral egret
# bright fog Did you verify `CheckIfCanRead()` gives what it's supposed to?
function CheckIfCanRead()
    local hasReadRestriction = false

    if SandboxVars.GydeTraitMags.DaysBeforeRead ~= 0 then
        hasReadRestriction = true
    end

    -- Get player survival time
    local player = getPlayer();
    local hoursSurvived = player:getHoursSurvived()
    local daysSurvived = hoursSurvived / 24

    -- Checks if player can read magazine
    if hasReadRestriction and daysSurvived < SandboxVars.GydeTraitMags.DaysBeforeRead then
        print("Gyde Trait Magazines: Read restriction check failed. Days: " .. daysSurvived)
        print("Gyde Trait Magazines: Days Required: " .. SandboxVars.GydeTraitMags.DaysBeforeRead)
        return false;
    else
        print("Gyde Trait Magazines: Read restriction check passed. Days: " .. daysSurvived)
        print("Gyde Trait Magazines: Days Required: " .. SandboxVars.GydeTraitMags.DaysBeforeRead)
        return true;
    end
end

This is the check function, it should return correctly and it was working before i tried implementing the ValidStart function

#

validstart seems to be the ideal way for me to check if the read should start but for some reason it just wont work for me

bronze yoke
#

if you add a print outside of your if statement does it print?

bright fog
#

yea

#

Try printing some values and parts of your code, to see which parts run and which don't

spiral egret
#

will do

bright fog
#

(just please make sure to remove your prints at the end of development)

spiral egret
#

okay so nothing gets printed at all when using ISReadABook:isValidStart(), but it's fine when i use ISReadABook.start(...)

#

I dont see isValidStart in ISReadABook.lua and I only have require "TimedActions/ISReadABook" in my script, do I need to call any other requirements?

bronze yoke
#

no, requiring vanilla files actually does nothing at all

#

it's sort of a mass hallucination by the community 😭

spiral egret
bronze yoke
#

ISReadABook doesn't usually have an isValidStart but you can see it defined in ISBaseTimedAction which it inherits from

spiral egret
#

ah i see

#

if that's the case i have no idea why it's not making anything work

#

the most confusing thing is why my print statements arent running at all

bronze yoke
#

yeah, it's like you're not modifying the function at all

#

or the function never runs in the first place though i can't see why that would be the case

neon hamlet
#

Hey Chat, so to confirm. A model needs like ... a proper texture, right? Like this and not a material - image texture

spiral egret
bronze yoke
#

yeah, if i remember even the vanilla ones have that bug

spiral egret
#

progress at least

#

id really like to know why validstart doesnt work though

bronze yoke
#

isValidStart was a very recent addition (if you don't count the two years the game has gone without an update) so it's not used everywhere it should be

#

i'll get ingame and try and see if i can get it to work

spiral egret
#

i super appreciate the effort

#

its like 7am here and ive been trying to get this to work all night

bronze yoke
#

take care of your health!! modding is secondary

spiral egret
#

its cool im used to it cuz my school is programming too

#

napped in the evening too

bronze yoke
#

ah... i gave it a try and i see the issue

#

for whatever reason it's only called if the action was queued after another one, if you just start the action on its own it doesn't get called

spiral egret
#

wow how did you figure it out so fast?

#

thats crazy cool

bronze yoke
#

i looked for where it gets called and it kinda looked like that might be the case so i just put function ISReadABook:isValidStart() print("isValidStart called"); return true end in the lua console and it only printed on a queued action

spiral egret
#

dangg

#

i guess ill just have to deal with the double character:Say for now then

#

or i try the other method of cancelling the read

spiral egret
#

OKAY, i managed to get my message to show only once with this ultra scuffed check

        if not CheckIfCanRead() then
            if not self.hasDisplayedMessage then
                self.character:Say(getText("IGUI_PlayerText_CantReadYet"), 0.55, 0.55, 0.55, UIFont.Dialogue, 0, "default")
                self.hasDisplayedMessage = true
            end
            return false
        else

If there is anything i should look out for with this method or if this implementation is bad please let me know
happy with the progress for now so im heading to bed.

@bronze yoke thanks again for the help tonight really really appreciate it spiffo

bronze yoke
#

looks good!! i'm not sure if you saw but i dmed you about a bug i noticed with your mod

spiral egret
#

ohhh my bad i didn't see the notif

chrome veldt
#

@grizzled fulcrum using
light:setActive(true/false, false, true)
works but still plays the sound.

When I set the second parameter to true like
light:setActive(true/false, true, true)
it does not switch the light on/off.

From the documentation, the 3 params are:
active, setActiveBoolOnly and ignoreSwitchCheck. Where did you get the use_switch from?

grizzled fulcrum
#

I just looked at the function's Java code and basically named them myself (I couldn't really think of good names)

#

Those param args sound correct

#

It might not be possible to switch the light without playing the sound (for the light switch specifically)_

#

you could just maybe call light:switchLight(true/false)

#

but then you have to manually call syncIsoObject (can you get a UdpConnection??)

#

maybe like

light:switchLight(true)
light:syncIsoObject(false, 1, nil)

but I think the syncIsoObject wont work because the second param needs a byte

#

If you can get ahold of the IsoLightSource like I was talking about before, you can just set that to false like light:setActive(true)

chrome veldt
#

I got it to work. I decompiled the javaCode and saw the switchLight function being used within setActive. I used this one and it worked

grizzled fulcrum
#

nice

chrome veldt
#

But I don't know if it'd work in multiplayer

#

Thanks for your help!

bronze yoke
#

at worst, you can just use commands to get all the clients to do it

plain gyro
#

hello, i want to make a mod but am pretty clueless on it, ive read some tutorials but am still pretty confused. can anyone help?

#

unfortunately i also play on mac, so im not too sure how much of it i can do on my computer

onyx valve
#

Can I post a finished mod here?

bright fog
onyx valve
#

Thanks

bright fog
#

Or give some intel on your idea

plain gyro
#

i enjoy the nomad playstyle so i wanna build a overland thing

#

earthroamer sx would be cool but anything like that

#

the mobile motorhome mod, but like smaller and realistic textures

onyx valve
grizzled fable
#

Hey guys, how to spawn a specific item in the world in random places but not in the city? like not on road tiles but only on dirt and grass?

gaunt quiver
#

Hey, can anyone tell me how to change the number of uses of the item? For example, salt, pepper. And also the durability of the weapon.

grizzled fulcrum
#

There are two main ways, you either overwrite the original item in the item script by defining the exact same item in whatever module it is in, and then changing the params there, or you can patch it by calling DoParam on the Item at say OnGameBoot

slender yacht
#

hey guys, got a question. I made a weapon for PZ but it needs 2 models. One Model for when it is equipped and one for when it is on the belt. It just looks off when its on the belt. How can I do that

dusk saddle
#

Howdy, folks. Does anybody know how the GetItemTypes function works in recipe? What file are they stored in, I've been trying to get one recipe for scrapping and figured it'd be the best course of action

grizzled fulcrum
#

It's the same like the others, under Recipe.GetItemTypes global table

#

So like

function Recipe.GetItemTypes.BlahBlah(script_items)
    script_items:addAll(script_manager:getItemsTag("TestItemTag")
end
#

So it basically gets all the items with the tag "TestItemTag" and that is what it will use for the item types

dusk saddle
#

Oh okay, so essentially it uses the tag system. I had it partially right haha

grizzled fulcrum
#

Well I chose to, you don't have to

#

it can be basically anything to select an item, but I use tags because it's pretty easy for inventory code

dusk saddle
#

I have the tags already added to the plushies, so it'd be fairly simple to do. I presume the base game does it in a similar way, given pencils and pens have the tag 'write'?

grizzled fulcrum
#

Like for example if I had 10 types of wood, I'd give them a Wood tag so I can get all items from an inventory with the Wood tag pretty easily

grizzled fulcrum
#
function Recipe.GetItemTypes.Write(scriptItems)
    scriptItems:addAll(getScriptManager():getItemsTag("Write"))
    addExistingItemType(scriptItems, "BluePen")
    addExistingItemType(scriptItems, "Crayons")
    addExistingItemType(scriptItems, "Pen")
    addExistingItemType(scriptItems, "Pencil")
    addExistingItemType(scriptItems, "RedPen")
end
dusk saddle
#

Awesome! Thank you a ton!

gaunt quiver
dusk saddle
#

One other question I suppose I shall propose is how to allow a drainable item that is the result of a recipe not full, for instance when ripping a shirt and you may get 1-2 units of thread back. Should I just cross-reference that lua bit from PZ's recipecode file?

grizzled fulcrum
#

You can make lua tables with params in them and just loop through those doing DoParam on each value

#

idk what you mean tho

grizzled fulcrum
#

like ```lua
function Recipe.OnCreate.ClaimVehicle(
sources,
result,
character,
item,
isPrimaryHandItem,
isSecondaryHandItem)
-- do stuff here with the item
end

#

So you could set the amount of uses, or something else similarly

onyx valve
dusk saddle
#

Hmm, I'll check into that. Any suggestions on where to look for it in a similar usage? I'm still trying to learn lua haha

gaunt quiver
night iron
#

Hey hey fellow modders, either of you knows if we can get this damage value through an item's methods? something along the lines of item:getDamage()?

#

been trying to locate where this is currently being rendered but without much luck

#

got as deep as ISToolTipInv but i cant see anything there that would produce this value 😕

night iron
#

yep that looks like what i need thanks @tranquil kindle

#

this seems to be taken from some sort of public api documentation though, mind telling me where i can this?

tranquil kindle
night iron
#

thanks

#

is it safe to assume that getProjectileCount() and getClipSize() are the current and max values for a gun loaded ammunition values?

#

nvm getProjectileCount() seems to be how many bullets are fired each shoot?

tranquil kindle
night iron
#

looking to emulate that current/max shown on equipped guns on the side bar

#

for shotguns the getClipSize actualy comes out at 0 even though it shows 6 on the side bar

#

:/

tranquil kindle
night iron
#

oh wait of course i was only looking at the methods for the HandWeapon, ther's also the inherited methods 😊

#

thanks @tranquil kindle

#

instance:getCurrentAmmoCount() and instance:getMaxAmmo() seems to achive exactly what i want for all guns 🙂

slender yacht
tranquil kindle
# slender yacht anyone got an Idea about my problem there? Can't figure it out after hours of se...

You cannot have 2 separate models for it, unless you make lua function to check if player has equiped that weapon and then replaces it with one you want displayed. You can mess with diffrent "AttachmentType" for it, but other than that it would include making new location for your weapon to be displayed on, which then will work only on clothing you edit to provide that attachment point (quite annoying to make and not worth it)

slender yacht
tranquil kindle
#

Not really.

ancient grail
#

magazine isnt attachment

slender yacht
#

yeah I'll just read into that. At least I got a lead now ;D

ionic jolt
#

i am trying to add more songs into project zomboid. about half of the songs i added work, all files are routed correctly for all of them, and all songs are currently in mp3 format. however, the half of the songs that dont work bring up errors that they cant find a sound file, although i have clearly defined the file as in the rest. anybody know how to fix?

#

some .mp3 file names that work have parenthesis, hyphens, and some other symbols, so ive eliminated those from possible issues. some of the file names have commas in them, which may be causing issues, but not all of the non-working titles have commas

grizzled fulcrum
#

I don't know if this would be much of an issue as I've seen it been used interchangably, but maybe try converting specifically the CassetteGimmeBackMyBullets.mp3 to ogg and then load the game and see if you get the same error

#

It seems odd because it only sets the sound file string to either specifically ogg or wav?

#

But then again, it is also working with mp3 just fine you say, so it's very weird to find the actual issue

ionic jolt
#

i converted "The Presidents of the United States of America - Peaches (Official Audio).mp3" to .ogg and changed file name under the sound CassetteMillionsOfPeaches and still couldnt find it

grizzled fulcrum
#

huh

#

Just to be sure, make sure they are in the root folder of media/sound and that it isn't in a subfolder

ionic jolt
#

i am working off another music mod as a template, as ive never made a zomboid mod before, so all music is in media/yourMusic/TCBoombox/

grizzled fulcrum
#

I assume you know about file extensions, some people don't so I'll still mention it; files can be named like song.mp3.flac without knowing because Windows by default hides these extensions.

#

But I doubt this is the issue in your case.

ionic jolt
#

yeah, i have file extensions shown on, and actually converted from mp3 to ogg when trying to resolve that, didnt just rename file extension

grizzled fulcrum
#

Maybe the other music mod manually loads these files. In your case, it isn't.

#

So put them in media/sound just for the time being and if you get the same error still please lmk

ionic jolt
#

alright

grizzled fulcrum
#

I can't say I've seen TCBoombox folder before, are you planning to add more songs to the boombox specifically or just the game in general?

ionic jolt
#

i am trying to add more cassettes into the game that are played through car or boombox

#

i also use true music and some other music mods, but true music is what i edited and am working off of as a template

ionic jolt
#

sound CassetteMillionsOfPeaches
{
category = True Music,
master = Ambient,
clip
{
file = media/sound/The Presidents of the United States of America - Peaches (Official Audio).mp3,
distanceMax = 75
}
}

grizzled fulcrum
#

I honestly don't know much more about sound stuff enough to figure out why

#

I've never gotten that issue ever before because it just works somehow

#

oh 😮

#

comma after distanceMax

#

you need commas after every line except for lines with braces on them and definitions (like sound mysound doesn tneed comma)

#

so basically a comma after every param

ionic jolt
#

sound CassetteThreeLittleBirds
{
category = True Music,
master = Ambient,
clip
{
file = media/yourMusic/TCBoombox/BOB MARLEY THREE LITTLE BIRDS.mp3,
distanceMax = 75
}
}

#

this song works however

#

but i will still try that and see if it fixes it

grizzled fulcrum
#

I am going to chalk that up to the comma thing

#

sometimes scripts can act weird when you dont have commas

#

I don't know why and I don't know how but it just happens

bronze yoke
grizzled fulcrum
#

oh thats why they use the soundbanks right?

bronze yoke
#

yeah, not every vanilla sound is in them yet but every new sound is, presumably by the time the sound rework is done nothing will be loose anymore

ionic jolt
#

comma added, error persists

bronze yoke
#

add the comma to every sound script if you haven't

#

the entire file will stop reading as soon as it hits one missed comma

#

so everything below that will not load, even if it is fine

ionic jolt
#

heres to hoping

coarse sinew
#

Or maybe try following the tutorial on the True Music mod page.

ionic jolt
#

music for the end of the world was the mod i was working off, and it seems sometime along the way i deleted the commas after distancemax

bronze yoke
#

hey i work on that

ionic jolt
#

well then by default you did some fine work

drifting ore
#

Hello! I'm trying to replace Base.CreditCard with my mod item. Everything works: texture, weight, category, and so on. But for some reason DisplayName is not working. It doesn't show up in the game. Why?

ionic jolt
#

this error persists, ive compared my code to the code of the mod im using as template, and all is seemingly identical, besides where i changed name and file name obviously

bronze yoke
#

only items without translations will actually use it

ionic jolt
#

all songs after line 189 in the file with the sounds dont work, but some songs before line 189 also dont work

drifting ore
#

could this be related to the fact that I am replacing Base.CreditCard?

bronze yoke
#

yes, the vanilla translation will be used

drifting ore
#

can I be "on top" of it, as it happens with the textures of my subject?

bronze yoke
#

to my knowledge translations from mods should take priority over vanilla translations but it's not something i have much experience with

drifting ore
grizzled fable
#

Hey guys, how to spawn a specific item in the world in random places but not in the city? like not on road tiles but only on dirt and grass?

night iron
#

is there any sort of util we can use to get an item name, at runtime, from is 'class name' like Base.Bullets44 without instantiating it?

bronze yoke
#

getItemNameFromFullType(fullType)

night iron
ionic jolt
#

@grizzled fulcrum @bronze yoke thank you both for the help, i learned a little about project zomboid modding and fixed some other errors while trying to find to root cause. apparantly, i was missing an opening bracket, and everything after that in the file was not executed

grizzled fulcrum
#

yippeeeeeeee

night iron
#

progress being done 😄

void spindle
#

What is consired the best backpack in auntethic z mod? Also, im curious since militafy backpack is so rare is it better when upgraded?

#

I have a ton of guestions since i onluly recently started usibg mods... and reedit is not full of ibfo regarding mods...

tranquil kindle
grizzled fulcrum
#

you may want to ask in a different channel like #pz_b42_chat as this channel is for creating mods

#

LOL yes

tranquil kindle
#

Not that we want to make you move/force you or anything. Its just better for both worlds i belive.

grizzled fulcrum
#

yeah most people dont look at this chat often unless theyre a mod creator

tranquil kindle
#

I haven't played PZ in around 500 hours of my playtimepain

#

Its only modding

grizzled fulcrum
#

I spend more time developing mods than actually playing the game

#

yeppp

tranquil kindle
#

Exacly

grizzled fulcrum
#

I have about 250 hours logged on the game not including the time I spend in the batch file for development, and I'd say only 50 hours or less are on actual gameplay

tranquil kindle
#

"I think this game could really use X... wait, i can just make mod that does X."

main pasture
#

is it possible to create an item with InventoryItem class (unextended)? when I try to use type "normal" it just becomes ComboItem

bronze yoke
#

no

main pasture
#

or is there a way to access values of the InventoryItem class that have no getter method, from the extended class?

bronze yoke
#

also no :(

main pasture
spiral egret
#

anyone know the distribution name for this living room low shelf?

#

unsure which one it was in the list and couldnt find low shelf anywhere

tranquil kindle
spiral egret
#

ah amazing, thanks!

tranquil kindle
#

Some containers can have multiple distributions assigned to them (most famous for me at least are armory in Military Base above prison)

spiral egret
#

ah i see

calm mason
#

hey! new here
where can I get basic moddiing document?

inland steppe
#

You guys have documents?

frank elbow
tranquil kindle
#

Ah... Forgot to renew my modding license

calm mason
calm mason
#

I am currently using reinforcement learning to train an intelligent AI agent within the context of the Project Zomboid game, aiming to teach it how to survive in the game world. However, the official documentation for the game is extremely disorganized, leaving me unclear about how to properly create mods and write correct Lua scripts.

I would like to ask: what is the simplest way to retrieve character status information from the game (e.g., health, condition, environment data) and control the character to perform actions like moving, dodging, and interacting with objects? My framework is largely inspired by AlphaStar (https://deepmind.google/discover/blog/alphastar-mastering-the-real-time-strategy-game-starcraft-ii/). Is there anyone familiar with Lua scripting who would be interested in collaborating on this idea?

bright fog
#

This might interest you

#

Also, there is a project by @red tiger called Pythoid that allows you to use Python in PZ

#

This might interest you too

calm mason
#

Thank you 🙏

bright fog
#

You might also want to check the modding Discord

calm mason
drifting ore
#

tell me, where is the database of players stored on the server with which some people implement Discord bots and display statistics about players and online on the server?

wind solstice
#

Looking for someone to make a mod for me i can pay you 25 dollars

night iron
#

anyone around that knows how this stencil concept used by the ui actually works regarding it's coordinates when using something like setStencilRect ? i understand it takes 2 pairs of x,y values but are these absolute values as in x and y for top left corner on the screen and x and y for the bottom right corner or is it relative to the panel the method belongs to.... and is the second pair coordenates or dimensions applied to the first pair?

bronze yoke
#

i've never seen a ui render method that doesn't co-ordinates relative to the object

night iron
#

trying to clip the second field here, this is drawn from the character inventory while dragging items and follows the mouse xy... now when trying to stencil it i just can't get it to work... namely the entire text i'm trying to clip just goes away

#

for the 2 first arguments i tried passing the mouse X and mouse Y, the same i use to draw the black background and for the 2 other arguments i tried a combination of mouseX/Y + width/height, just width/height .... nothing works

#

and this is a example snipet of what i'm using code wise:

    local left = positionX;
    local top = positionY;
    local right = positionX + panel.column4;
    local bottom = positionY + height;

    panel:setStencilRect(left, top, right, bottom);
    panel:drawText(name, positionX + panel.column2 + gap, positionY + gap, 0.7, 0.7, 0.7, alpha, panel.font);
    panel:clearStencilRect();
    panel:repaintStencilRect(left, top, right, bottom);
    panel:suspendStencil();
#

nvm i think one of my tests i must have forgotten to reload or reloaded the wrong script.... it seems to work now, with: mouseX, mouseY, width, height

drifting ore
# grizzled fulcrum players.db

the information there is encrypted in byte code. How can this be fixed? Are there any examples of work with what I need?

grizzled fulcrum
#

I am like 99% sure it's a SQLite database, you should just be able to open it

#

same with vehicles.db

bronze yoke
#

it is, but the majority of the actual player data is just a binary

grizzled fulcrum
#

what\

#

like in binary, or a binary

#

either of which is weird, why would you just store it in the db like normal?

bronze yoke
#

take a look at the data field in that database

grizzled fulcrum
#

I see, wth

#

It seemingly just stores the player inventory and stuff right? *and skills

#

Is it safe to create moodles on client? I am using MoodleFactory (moodle api)

#

I suspect I will need to create them on both client and server, I don't know why I have it in the client, but these kinds of things I am never sure about

#

I feel as if it's pretty hard to learn client/server for this game, especially when you get told a lot of stuff is on the client only but then you learn otherwise. It's a very weird situation

#

it seems MoodleFactory global isn't available from the server anyway (table is nil) but I put my trait creation on shared too so hopefully it will work

#

Ok I put moodle creation on the client and trait creation in shared and it works like a dream!

bronze yoke
#

you don't need to create moodles on the server, they're just ui elements

grizzled fulcrum
#

oh

#

I assumed they had some data that syncs to the server

bronze yoke
#

keep in mind that names like 'moodle *api*' can be misleading, the game does not have any support for modding moodles in any way, moodle mods are complete reimplementations of moodles

grizzled fulcrum
#

I guess that makes sense considering the vanilla ones are hardcoded

#

and I don't even do state calculations based on the moodle anyway lol

#

It literally just acts as a visible element on screen like you say, so that makes more sense when I think about it

bronze yoke
#

the game does actually use them for calculations but i think they're all client side

grizzled fulcrum
#

why cant we do --- @cast self.field Class raaaaaaaaa

#

only thing I can think of is store the field in a local and cast that stupid way

dry chasm
grizzled fulcrum
#

yep, it still doesn't like it when I access fields from on e class

#

It's InventoryItem|IsoObject

#

It still doesn't likey when I call say obj:Use()

#

so I have to cast it, it doesn't matter that much though 😄

dry chasm
grizzled fulcrum
#

thats what I do

local water_obj = self.water_obj
if instanceof(self.water_obj, "IsoObject") then
    --- @cast water_obj IsoObject
    ISTakeWaterAction.SendTakeWaterCommand(self.character, water_obj, 1)
else
    --- @cast water_obj InventoryItem
    water_obj:Use()
end
#

I just had to make it a separate variable beacuse otehrwise it'd say that self.water_obj wasn't a valid variable or something like that

dry chasm
#

oh!

gloomy temple
#

i was wondering if someone can help me with the true music mod. the music works fine with both vinyl and cassette but the vinyl covers aren't showing up i did what the creator said but im still having trouble

frank elbow
#

I think this is not very attractive, but it is possible

#

Especially since it'd be a mess of type intersections if you want the other fields to stick around

dry chasm
frank elbow
dry chasm
#

actually, just searched through PZ Modding Community posts, albion aoqia mentioned inline casts, which could be used.
self.water_obj--[[@as InventoryItem]]:Use() bit hard to read potentially, but seems to work when only doing one liner?
And when doing more than just "a single call, or field access", making it a local first like aoqia did isn't bad either, since one'll save up on further table access and re-getting the field constantly.
Actually, that mention from albion was actually aoqia's back then 😅, albion just continued on the conversation, my bad.

dry chasm
grizzled fulcrum
#

true, I just didnt want to inline cast it because I like parity between my code

#

and all the other parts where I couldn't use inline casts I used normal cast

calm mason
random escarp
#

is Vector3 broken? .x .y .z all return nil, tostring returns a vector2, there are no "getX()" or "x()" methods

#

trying to retrieve the z value of SwipeStatePlayer.getBoneWorldPos(obj, "Bip01_Head", Vector3.new()) so I won't even be able to hack it out of tostring

bronze yoke
#

use the getters

#

you can't access fields without a whole bunch of bullshit

random escarp
#

there are no getters

bronze yoke
random escarp
#

badass, thanks

neon hamlet
#

Does anyone have a list of all the bones on a player model? At this point I think not having a bone number in my attachments is the issue

topaz tangle
#

I’m cooking

drifting ore
bronze yoke
#

it's the game's raw character save data so it's not really in a specific parsable format, you'd have to analyse the game's save/load functions to make sense of it

night iron
#

is there a way to get an unpublished mod still in development enabled in game? i tried moving the files between the installation mods folder and the steam workshop folder but i can't seem to get it to show on the mods list >\

bright fog
night iron
bright fog
#

C:\Users\ ......\Zomboid

#

This is the path for the mods and workshop folder

night iron
#

steamapps\workshop\content\108600
steamapps\common\ProjectZomboid\mods

bright fog
#

Yeah that's wrong

#

C:\Users\utilisateur\Zomboid\Workshop

#

This is my path for example

night iron
#

ha it had to be the 3rd option that i completely forgot about he he thanks

bright fog
#

👌

#

I suggest using the /Workshop folder

#

The reason is that if you put your mod in /mods, you'll have to copy it in /workshop too (check the templates tho, the folder structure is a little bit different, requires a bit more steps in /workshop)

#

And having multiple copies of your mods will fuck you up, make sure to never sub to your mod on the workshop as both your local and workshop versions fuses together when they have the same mod ID

#

Which you shouldn't change

night iron
#

yep i was trying to figure out how to solve that, pretty sure i my previous attempt mods i had on the workshop folder under the user folder wasn't showing in the list either but i probebly messed something up then

#

going to try it again

#

yep that worked perfectly thanks!

bright fog
#

👌

calm mason
#

@magic eagle

feral lion
#

Is there anybody who can fix a mod for money?

magic eagle
#

Hi everyone! I'm currently working on training NPCs using reinforcement learning and am encountering issues with extracting local game data. The mod I'm developing seems to lack permission to read and write data from my computer in local mode, particularly when trying to store player state data in real time in a local database. Has anyone experienced a similar issue or have any advice on how to resolve this (specifically for extracting data to store locally)? Any guidance would be greatly appreciated!

Thanks!

feral lion
#

I found a battleroyale mod, everything works, but the PVP Off delay feature

magic eagle
bright fog
night iron
#

is it possible to embed an image contained in my mod file structure in the workshop description? i'm assuming on the workshop.txt...

bright fog
#

It should allow you to do waaayyy more than currently what's available in PZ

bright fog
#

Do it from the mod page directly

#

Or the edit tool when posting a mod

night iron
#

assuming the file is on the same folder as the workshop.txt what is the sysntaxe to emebed it on the description then?

bright fog
#

In the modding Discord I made a guide on Steam embed

bright fog
#

Or Steam ?

night iron
#

mod description

#

for steam

bright fog
#

So in-game ?

#

Ah steam

night iron
#

err no

bright fog
#

Yeah steam is classic embed

#

Let me link you my guide

#

A sec

#

(God)

night iron
#

is it markdown style ?

bright fog
#

Join the moddong Discord here

ancient grail
feral lion
#

What can be wrong in this code? Its a battleroyal mod which have a "PVP Forced Off Delay" works like at the start of the round it forces PVP off, but it not working.

ancient grail
random escarp
#

it’s the F11 lua debugging panel that appears after an error, you can select the variables on the left to get methods and fields

night iron
#

there's an entity relationship diagram in the screenshots to make a bit easier to understand where and what can be overridden

minor ravine
#

If you guys need mod test i can test it

night iron
#

wana give it a go at the one i posted earlier @crystal terrace ?

crystal terrace
night iron
#

ops wrong person mentioned he he, sorry about that

#

@minor ravine ^^

crystal terrace
#

no worries all good

hard terrace
#

Hello! I've been told someone called Braven is working on a train mod. Is this true??

mellow frigate
feral lion
#

I tried with 300 @mellow frigate and with a new world.

#

Also im would like to run with 2700s (45minute) the whole royale is 3 hour. final ray is 15 minutes. It doesnt have any rest time because I dont need it at all.

#

Sadly the characters can hit eachother

#

Am I right that disabled safety system?

#

And i ticked PVP on in the server base settings

night iron
#

is it possible to define a modules requires another one on the workshop.txt file? i know we can do this on the mod.info for the in game mods managers but i'm looking for the equivalent for the steam mod page... or does this have to done manually on their site?

feral lion
bright fog
#

Write the necessary stuf and that's it

#

the workshop.txt file is not something normalized by Steam, it's PZ dev who made it to pick up some info you write in it

#

Technically you don't even have to use the in-game uploader and can use outside uploaders

buoyant bear
#

Does anyone do mod commissions? I need a mod done for me that uses the Radial Menu API as a required mod!

mellow frigate
feral lion
#

How much time it takes Tcherno? Thank you.

feral lion
#

@mellow frigate i saw the update, testing it now!

#

you are so fast man 😄 hope it works

#

okey we tested it and i put 300 second, now started with nonPVP but after 8 minutes its still nonPVP

#

as we see it starts in nonPVP which is good, but doesnt turn on the PVP mode after 300 sec

mellow frigate
#

this lets time to people to join

feral lion
#

circle starts right now at the server start

#

yea i understand

#

we joined the server

#

and waited 8 minute

#

and still in nonPVP

#

but now i restarted my whole game

#

trying with 30 sec

#

this way when i join it needs to be PVP

mellow frigate
#

are you sure you modified the values in the pending server sandbox vars ?

feral lion
#

i create the server from the game

#

its a non dedicated-one

#

i edited it now to "30"

#

30 seconds means, when my friend join to the server it already expired. so it turns on PVP.