#mod_development

1 messages · Page 214 of 1

true nova
#

anyone know the difference between getItemFromType() and getItemFromTypeRecurse()?

lethal dawn
#

...\ProjectZomboid\media\lua\client\Items, there's a SpawnItems.lua file

mystic lava
true nova
#

thats what i was thinking may solve an issue i've been having with the former

mystic lava
#

What file did you see the functions in?

#

Examples of how they're used in vanilla usage might help

frank elbow
#

In theory, the difference would be that getItemFromTypeRecurse is recursive whereas getItemFromType is not. It's true that the former is recursive, but the latter also can be recursive if you pass in true for the last argument (in either the 3- or 5-argument overload)

#

The vanilla code exclusively uses getItemFromType; looks like the "recurse" one is dead code (maybe outdated, maybe just never used)

#

("recursive" in this case meaning "calling itself", which in this context means it'll call itself for inventory containers within the inventory, like bags)

true nova
mystic lava
#

Sorry I don't know more about it, @true nova . Thanks for providing more insight @frank elbow

true nova
#

is there an equivalent to table.unpack that i can use? as it doesn't seem to work

bronze yoke
#

just unpack(t)

true nova
# bronze yoke just ``unpack(t)``

i thought that but it's giving me the error : not enough arguments at the line math.floor(unpack(t))
am i wrong in thinking this should return the smallest value in the table?

somber sinew
#

God, I'm still doing all the bytecod research for Java and decompiling and recompiling PZ.

#

I want to try getting that Storm mod running.

bronze yoke
#

math.floor takes a single number argument and returns that number without the decimal component

#

e.g. floor(5.6) returns 5

true nova
#

nooo i was having a brainfart on that and just copied it from somewhere else always in my own way. thank you

dawn palm
#

it doesnt print anything, or say something (in the event) nvm ty

#

what keybind to go to debug log?

#

I cant exit this shi

fluid onyx
#

Hey there, i've been trying to figure this out aswell. Exact same issue, where other mods use file = media/sounds/thingy/file.wav for various sound types, but can't get it to work. Any updates on this?

#

I've been doing some lurking through the discord and i see quite a lot of complaints how it's impossible to edit sound HouseAlarm unlike all the other sound files. Feels like i hit a landmine when picking which sound file i should try to edit for a first-time PZ modder.

livid badger
#

Hello! Tell me, if I change the title/name of the mod in the workshop.txt and mod.info files, will critical errors appear on the server? I don’t change the ID or anything else, just the title/name.

fluid onyx
#

I'd ask someone else to confirm, though.

livid badger
bright fog
#

Deactivating house alarms is already a thing in the game too

fluid onyx
cloud shell
#

Hello! I'm trying to find a way to allow washing machines to wash dirty rags and leather/denim strips, any advice ? I can't find any lua code for this.

bright fog
#

The main issue I see is finding out if the building the player came in is a house or another type of inside zone

fluid onyx
bright fog
#

wdym pain ?

#

It's easily doable

#

Like I said the only issue is making sure it's a house you are inside

fluid onyx
#

I literally have no idea where to even begin with making custom house alarm code

#

Only thing i know is how to mess with the .bank files and the few sound script .txt files

#

actually

#

I could just replace the house alarm sound from the .bank file itself, but that brings me to another question

bright fog
#

I'm pretty sure you don't need to fuck around with the bank files

#

give me a sec

fluid onyx
#

actually^2, addons can't touch .bank files so one would have to apply the thing manually

#

So outside of personal use, that's not really an option

bright fog
#

It's doable

#

People can manually install files

#

But like I said

#

You don't even have to :)

fluid onyx
#

teach me your ways, coder man

bright fog
#

This mod adds a playable sound and I checked the files out of curiosity

#

It's not a .bank file

#

In fact, it's very easy

fluid onyx
#

hmmmm

bright fog
#

give me a sec I'll tell you what to look for

#

The sounds in .ogg:
ShoutSound\media\sound

The scripts to define the sounds and their characteristics:
ShoutSound\media\scripts

The code:
ShoutSound\media\lua\client

#

The code that plays the sound

line#14
patchClassMetaMethod(zombie.characters.IsoPlayer.class,"Callout",function(Callout)
    return function(...)
        local args = {...}
        if args[2] == nil or args[1]:isCanShout() then

            local dist = 2
            local gender = ""
            local loudness = ""
            local pl = args[1]
            local VoiceKind = ""

            if pl:isSneaking()
            then
                loudness = "whisper"
                dist = 5
            else
                loudness = "shout"
                dist = 40
            end

            if pl:getDescriptor():isFemale()
            then
                gender = "female"
            else
                gender = "male"
            end

            VoiceKind = tostring(loudness.."_"..gender)
            getSoundManager():PlayWorldSound(VoiceKind, pl:getSquare(), 0, 0, 0, false);
            addSound(pl, pl:getX(), pl:getY(), pl:getZ(), dist, 0)
        end
        return Callout(...)
    end
end)
#

And the part that interested you

getSoundManager():PlayWorldSound(VoiceKind, pl:getSquare(), 0, 0, 0, false);
addSound(pl, pl:getX(), pl:getY(), pl:getZ(), dist, 0)
#

Also I'm not coder, in fact I have barely any knowledge in it

#

My ways of doing it is reverse engineering

#

You can find the code to detect when the player is in a building and if it's an already explored building in Cordyceps Spore Zones*

fluid onyx
#

I wonder how the original zomboid house alarm code looks like

bright fog
#

Actually sry nvm

#

It's not Susceptible

#

It's Cordyceps Spore Zone

#

Making an addon for both made me mix them up

bright fog
#

You could probably find it in fact

#

Tho I wouldn't suggest rewriting it

fluid onyx
#

As far as i'm concerned, i'd need some way for the game to tell if a player enters or disturbs a building that's rigged with a house alarm

bright fog
#

CordycepsSporeZones\media\lua\shared

bright fog
#

I literally gave you the answer and mods that use codes to do those functions

#

Go check them out

fluid onyx
#

Still downloading everything

bright fog
#

Those two mods I sent have everything you need to know about for:
-knowing if a player is in a building
-knowing if that building is newly explored
-playing sounds

#

Then go learn about ZombRand() to test chances to play an alarm

#

CSZ even has code that utilize it, everything is in it

bright fog
#

Sadly I don't know much about how servers handle stuff so I have no idea what your issue is

#

Does the bird excrement actually moves from the bird feeder inventory and then disappears ? Or does it tp back in the bird feeder maybe ?

#

Idk much about inventory neither rip

#

Just answering so your message doesn't fall in the void, this tend to happen too much. If you never get an answer maybe try asking in the modding community too

#

Welp that's weird, I hope someone who knows a bit more about this is able to tell you more

#

Maybe linked to the way your item is created in the bird feeder ?
You could maybe also find a mod that does such a transformation like the composters

#

Not too sure I know any sadly, maybe fish farms

#

What did you use to create it ? You found the file with the code for the composter ?

#

What did you base yourself on*

somber sinew
#

Do you guys not decompile the game?

bright fog
somber sinew
#

No, but it's part of the modding guides.

bright fog
#

If you don't need to go deep in the java files, don't

somber sinew
#

It lets you see how they hook everything together.

bright fog
#

I believe it's best if you don't touch much to the java part

somber sinew
#

I'm on the opposite end. I've been java modding the game for myself.

bright fog
somber sinew
#

Right now I'm trying to get Storm up and running again-

#

It's an API to modify the java files through injection like Forge in Minecraft

bright fog
#

right

somber sinew
#

But because everyone's been so against modifying the java files I guess the original devs abandoned it like, a year ago.

bright fog
#

idk much in modding, I started 2 weeks ago lmao

somber sinew
#

Same, I've been rushing hard at learning Java for this reason though.

bright fog
#

3 weeks actually

somber sinew
#

Lua isn't too hard thankfully. Java is the annoying one.

#

So far I've just been taking the game apart and putting it back together again in my environment.

#

One of the big issues so far has been matching bytecode.

somber sinew
bright fog
#

wdym ?

somber sinew
#

Which API tools like Umbrella or one of the other decompilers give you.

#

A library of all the game's definitions which are the 'what this do'.

#

A lot of devs have documented them. Hold on, let me hop on my PC.

#

You wanna get on call and share notes?

bright fog
#

uh no ? I can't really do that rn

somber sinew
#

Oh damn, lmao

#

What are you using to mod?

bright fog
#

IDE ?

somber sinew
#

IDE works. I kinda use both.

bright fog
#

both what ?

somber sinew
#

VSCode.

#

Some guides and mod devs were saying that the .lua Emmycode can be kinda buggy on IDE for modding PZ.

bright fog
#

what's that ?

somber sinew
#

Emmycode is the .lua plugin for IDE that helps you see the definitions easier.

#

Wait are you just looking at it raw?

bright fog
#

Like I'm ngl to you I don't know shit in programming bro so you're speaking chinese to me

#

yes

somber sinew
#

So PZ's interfaces most people hook into is .lua 5.1.

#

Right?

bright fog
#

that's basically what I work with

bright fog
somber sinew
#

That's VSCode not IDE.

bright fog
#

guess I understood wrong what IDE meant then

somber sinew
#

So, VSCode is an interface to look at the code easier. So is IDE for the most part.

bright fog
#

thought IDE meant a type of program nvm then

#

Yeah fuck no I wasn't wrong with it

#

integrated development environment

somber sinew
#

You are, but I was meaning the program.
I thought you were using Intellij IDE.

bright fog
#

People would probably call it Intellij then lmao

#

Not IDE to not missunderstand each others

somber sinew
#

Fair, fair. I just got up I fucked up. lmao

bright fog
#

np

somber sinew
#

Like I said I'm about two weeks in too so I've been cramming everything all at once.

#

Bro it's been so fucking hard though.

#

Like I've barely touched my mods.

#

Just because I've had to do that much studying for stupid shit I wanna do so few other modders are doing.

bright fog
#

My god take some vacations ohfuck

somber sinew
#

I'm trying to hook in on the Java end.

#

And that is a huge can of worms.

bright fog
#

But like, why that need to touch the java ?

somber sinew
#

You don't' but if you hook into the Java you can do way more than with ,lua.

bright fog
#

Do you need to do that for your mod idea ?

somber sinew
#

I can add my own bodyparts, I can add my own weather easier, I can change events around and make new ones.

#

I can directly fix bugs in the game's code as well.

bright fog
#

Can you even download it from the Workshop ?

somber sinew
#

No, that's why I'm fixing Storm.

#

Storm allows me to inject my fixes or changes instead of repackaging the game.

#

That gets around me distributing theirs free.

#

It's just like Minecraft's Forge.

bright fog
#

Okay but like, did you have prior coding experience before ? Because it sounds like you know a fuck ton for no reasons

somber sinew
#

No breaks.

bright fog
#

Take a break ?

somber sinew
#

No, I'm having fuckloads of fun. lol

#

I'm super fucking excited to see what I could do with it.

bright fog
#

Well, gl

somber sinew
#

Because like, imagine the crazy shit modders can do with .lua and java modding.

somber sinew
#

It'll let you click on code you don't know the meaning of and pulls it up in a built in library that tells you what it is and what it hooks into.

bright fog
#

that sure sounds interesting

somber sinew
#

That's how I'm learning the .lua side.

#

So you need Umbrella.

bright fog
#

what's that ?

somber sinew
#

Umbrella is a collection of EmmyLua typings for Project Zomboid's API. This includes:

Candle: The exposed Java API typings.
PZLuaStubs: The Lua API typings.
PZEventStubs: The Events API typings.

bright fog
#

Why the fuck is that not pinned in this fucking channel I swear to god

#

Why even bother make such stuff if new modders can't find it

somber sinew
#

Yeah no shit.

#

Dude I had to google around for days for a bunch of shit like this.

#

This is a huge help for us either way.

#

I'd have no idea what the fuck I was looking at in the code if I didn't have it.

bright fog
#

Well I'll try to install it and see exactly how it works

somber sinew
#

You gotta install it as a library into your existing workspace.
Install the lua server plugin for VSCode.

#

Then go to settings for it.

bright fog
#

Yeah I'm reading through it

somber sinew
#

And under extension settings once you got umbrella installed, add umbrella as a library, yeah.

bright fog
#

I mean, I already guessed that code was terribly written

somber sinew
#

Under extensions, click on the cog by uninstall

#

Once you get to lua by sumneko

bright fog
#

Already got it installed

somber sinew
#

Extension settings

bright fog
#

Yeah I'm in it

somber sinew
#

@ext:sumneko.lua library

#

Up there in the searchbar at the top, just search for library. It'll filter a lot of shit out

bright fog
#

That I guess ?

somber sinew
#

Yep.

#

Do for all three.

bright fog
#

Only got two

somber sinew
#

Alright that works.

bright fog
#

What do I add ?

somber sinew
#

You want to add the folder you have umbrella in.

#

Like that.

bright fog
#

the zip downloaded from github ?

somber sinew
#

Unzip it somewhere and see if it has-

#

Candle Events and Lua in there just to double check.

#

If so and they're full of shit, put it anywhere and then link to the unzipped folder in VSCode

bright fog
#

yea it does

#

I mean

#

The folders are empty

somber sinew
#

You have github downloaded?

bright fog
#

yea

somber sinew
#

You're gonna have to do the commands to download it the other way. That doesn't work.

#

Github is weird.

#

Open Git CMD on your computer

bright fog
#

uuuuuuh

#

How ?

somber sinew
#

This is how a lot of github repositories let you download stuff.

#

Download it and it adds like, git CMD, Git Bash, and one other I forget.

#

Which links up to their website.

bright fog
#

Yeah didn't download it on this computer, I need to do it but I barely even use it

#

Should take a second

somber sinew
#

Yeah, no worries.

#

I had the same problem when I was trying to get umbrella and other stuff.

#

You're just getting fast tracked by me who had to spend ages doing it. lmfao

bright fog
#

How do I open git cmd ?

somber sinew
#

should just be a program you can pull up on windows now

bright fog
#

Doesn't appear

somber sinew
#

Did you install it or just download the file?

bright fog
#

I installed github desktop yes

somber sinew
#

Yeah just making sure.

#

Sorry, gotta ask the simple questions.

bright fog
#

np

somber sinew
#

Okay then it's probably not set up as start menu stuff yet.

bright fog
#

classic windows bullshit

somber sinew
#

It'll be in either program files or program files x86

#

Yep program files

#

C:\Program Files\Git

#

Then it should be git-cmd

#

the .exe

bright fog
#

There's no git folder

somber sinew
#

???

#

The hell?

bright fog
#

The only thing I have is in appdata/local/GitHubDesktop

somber sinew
#

Oh fuck off

#

They have it some other weird ass place.

#

Apparently that's some Git UI and not the git downloader program they built under a completely different web url

#

Uninstall that, my bad.

bright fog
#

It's ok

#

got the git cmd thing

somber sinew
#

Okay cool

bright fog
#

what now ?

somber sinew
#

Hold on making sure I'm correct. Now we have to clone the repository.

#

Here.

somber sinew
#

This is apparently how you download things from git. The way we think is logical to do it is not.

bright fog
#

I just want to download a fucking extension library, why do I need to hack the fucking NASA

somber sinew
#

Instead you have to literally get their cmd interface to direct pull from their site's banks. LMFAO

#

I know that's why it took me ages to figure this shit out.

#

Because it's dumbly overcomplicated.

bright fog
#

Didn't download the files either

somber sinew
#

Now you got this folder right

bright fog
#

yeees I have it but not the freaking files ?

somber sinew
#

Now you update the folder I guess

#

cd "the folder"

bright fog
#

yea

somber sinew
#

Once you got the cd command

#

git submodule update --init --remote

#

Then it should update the folder

bright fog
#

god damn

somber sinew
#

Yeah just downloading zip has fucked up for me.

bright fog
#

Got it

somber sinew
#

There.

#

Now it's a library holy shit

#

Now you can just toss it somewhere and plug it into VSCode to use as a library

#

Then most stuff should have definitions.

#

Whatever doesn't-

#

This is an index of everything.

#

I don't know why this isn't linked either.

bright fog
#

Alright it works thx

somber sinew
#

Sweet, right?

#

This has helped me a lot.

#

Decompiling the game lets you see more.

bright fog
#

I guess it's easier than going through the shitty wiki to understand stuff lmao

somber sinew
#

You can have the decompiled game as a second library.

#

Just to see where the .lua stuff hooks into the .java stuff more closely

somber sinew
bright fog
#

Alright well thanks a lot I guess

somber sinew
#

I'd recommend also downloading a bunch of mods and putting them in a folder to use as examples for coding.

#

So you can see how other modders have done it.

bright fog
#

I already do that

somber sinew
#

Oh sweet.

#

I actually went through the entire workshop one day-

#

Grabbed around a thousand or so.

bright fog
#

Like I said, I reverse engineer everything

somber sinew
#

Same, that's how I've been learning on the .lua end.

bright fog
#

I already use more than a hundred mods and I already know a lot of example to work from

somber sinew
#

What I've been doing for fun is updating old mods then slapping them together in my huge crafting overhaul.

bright fog
#

You have an idea what the unknown means ? I think it means that it doesn't know what the result will be but eh

somber sinew
#

What's the rest of the code?

#

Like, in reference.

bright fog
#
    local visual = zombie:getItemVisuals()
    print("Start of visual update for this zombie")
    print(visual)
    print(visual:size())
    for i = 1, visual:size() do
        local item = visual:get(i-1)
        if item:getItemType() == 'Base:Hat_Fungi' then
            print("Hat_Fungi found")
            print(item)
            print(item:getItemType())
            break
        elseif true then
            
        end
        print("Didn't break for loop")
    end

    print("Done")
#

A part I'm working on

#

Nothing too fancy for now

somber sinew
#

Yeah, not sure. I'd have to research it.

bright fog
#

It works, just I'm curious what the unknown means

somber sinew
#

I'm disassembling on the crafting end for the moment.

#

So if I come across it and figure shit out, I'll let you know.

bright fog
#

👌

somber sinew
#

For now I'll add you. lmao

#

We're in the same headache.

bright fog
#

I mean you gave me a big one but a good one lol

#

I just don't understand why this shit is not in the pinned commands

somber sinew
#

You honestly have to dig through so much shit it's insane.

bright fog
bright fog
somber sinew
#

No idea. I had to find everything by googling and looking through PZ githubs.

#

A lot of people just threw their projects on github and you can go ogle their code.

bright fog
#

I went through so much research to find what things do too, never found anything mentioning these kind of tools

#

Coding is nice and all but getting into it is just pure pain

#

I learned how to code in Python and Matlab in the last three years but nothing like this kind of stuff
It's that moment where I would have loved to get programing courses to understand better how people share stuff, how to handle things or just even better: fucking vocabulary

cloud shell
#

It sure helps but for some stuff you still have to dig deeper, I am a software enginner and I happen to use Lua at work and I'm still trying to find some stuff like the washing machine code

somber sinew
cloud shell
#

That is the next step for me, I just need to find some time

somber sinew
#

You just gotta git bash it though.

#

It's just a fast track to take apart the game.

cloud shell
#

I'll probably go with decompiling locally so I can prepare some script to decompile every time the game updates

somber sinew
cloud shell
#

For the most part the game is really friendly to modders, I'm very pleased with their approach to recipes and events.

#

It is a really fun way to spend some time

wet sundial
#

I'm looking at the recipe script guide on the wiki and i'm trying to use Override:true, in my recipe so the vanilla recipe doesn't show up as well, but it still pops up next to my custom recipe when i right click the item. Am I using the override wrong? How do i replace vanilla recipes with my own custom tweaks?

tacit carbon
#

Tried all files that could work but none of them have info on it

pseudo flame
#

all im saying

#

a weeping angel mod

#

Would make someone very famous

bright fog
bright fog
#

At least making the zombies not move is easy

#

I'd say it's doable in ... 10 lines of code ?

pseudo flame
#

I have super limited coding knowledge but yea i can't image it'd be do bad

bright fog
#

My god would you be surprised

#

The lack of documentation is horrible

pseudo flame
#

Lua 😩

bright fog
#

Lua isn't the issue here in fact

#

The issue is fucking animations and how they work lol

bronze yoke
pseudo flame
bright fog
bronze yoke
#

btw, you don't need to do all the git stuff anymore, you can just download the zip under releases

#

too many people found it too confusing 😅

bright fog
#

I tried downloading it

pseudo flame
#

I've had the itch for zomboids to turn into weeping angel like "only move when you're not looking" for a year after the sprinting mod had a bug for me where it was exactly that

bright fog
#

But it didn't dowload the files

pseudo flame
#

and I just haven't been able to replicate

bronze yoke
#

download from releases, not from the code button

bright fog
#

Yeah I'm trying to find where it is but github is a fucking pain I swear

#

Worse interface ever

#

Ah so you download like the zip basically ?

#

I see alright

#

Good to know

#

@somber sinew

somber sinew
#

ayo

bright fog
#

You don't need all the git cmd thing

bronze yoke
#

it's a lot easier to use git if you're familiar with it because then it'll update itself (i think the version in releases is actually a couple minor changes out of date)

bright fog
#

👌

bright fog
somber sinew
#

I didn't see the releases. lmfao

bronze yoke
#

i've been meaning to change the instructions to mention it

somber sinew
#

I'll see if I can't bully it enough.

tacit carbon
#

That's the only issue I can see happening is entering a garage and the alarm going off

#

Or any other type of no alarm building

bright fog
#

?

#

Yes I already explained all of that

shy hearth
#

Is there an elegant way to run code whenever sandbox options are changed?

#

doesn't seem to be an event for it, which is surprising

bronze yoke
#

somebody was working on an event for it, i don't remember if that was released

shy hearth
#

I see, thanks! I'll search the chat and check if I can dig it up

true nova
#

I'm trying to get all of the thread in the player inventory and get a use count with

local inventory = getSpecificPlayer(player):getInventory()
local threadItems = inventory:getAllTypeRecurse("Base.Thread")
local threadUses = 0
if inventory:containsTypeRecurse("Base.Thread")then
        for _, item in pairs(threadItems)do
            threadUses = threadUses + item:getDrainableUsesInt()
        end
    end

The game gives an error saying threadItems is not a table. Is there something i'm doing wrong?

nova aspen
#

Hey quick question, does anyone know where the default vanilla traits/occupations are located in the game files? Trying to find the lumberjacks unique trait axeman to model off of.

bronze yoke
true nova
cloud shell
# somber sinew https://github.com/quarantin/beautiful-java

This really helped, I got the washing machines working for cleaning dirty rags/bandages. It only works if the player plumbed the machine itself, some restriction for the global object system, but for my mod it is actually a wanted behavior.

somber sinew
sour island
#

Yeah, without decompiling the java, modding takes ages, and you're stuck with trying to remix what others have done.

#

I remember guessing what classes logically make sense to include what I was looking for and Ctrl+Fing around as at the time I was opening one class at a time.

drifting ore
#

I am making a mod that changes parts of the UI including the Main Menu. I have everything else worked out as far as what files to work with, but where do i find the source for the actual game name at the title screen? i cant seem to find that

drifting ore
nova aspen
somber sinew
nova aspen
#

Sorry to perhaps be a little annoying, but does anyone happen to know where the traits are defined in the vanilla game code? I see they're referenced in ProjectZomboid/media/lua/shared/NPC's/MainCreationMethods.lua but I can't seem to find the code that makes up those traits.

bright fog
#

But I have no idea

nova aspen
#

Ah shoot, guess that’ll be my next thing to start looking into haha. Thanks.

somber sinew
#

Decompiler. Still works.

#

If anyone wants to know also- zulu17.30.15-ca-jdk17.0.1-win_x64
This is the JDK Azul Distribution that they're using for PZ.

#

Direct download.

nova aspen
brittle mesa
#

can anyone point me at some documentation about how to set up (any) IDE to play nicely with PZ modding? Getting LUA to recognise the native methods of Java for type hinting etc is the hope.

bronze yoke
#

download from releases and you can point your ide/your lua plugin to it as a library

brittle mesa
#

thanks, I'll give that a shot

#

much appreciated

#

looks very promising, you're a gem 💎

#

yeah, exactly what I was looking for and hoping existed. Worked a charm

bronze yoke
#

glad to help!

dawn palm
#

how would I edit a zombie's model?

#

like how do I change a certains zombie model ingame?

#

example, the only cure mod changes your character midgame when u cut ur arm off

brittle mesa
#

sorry, one more question - is anyone aware of the right way to spawn a movable tile object like a counter?

brittle mesa
#

have (finally) figured out that they're all actually one base item you can spawn in via:
getSpecificPlayer(0):getInventory():AddItem("Moveables.Moveable");

but tweaking the referenced specifics is eluding me

#

got it - for anyone else chasing it:
getSpecificPlayer(0):getInventory():AddItem("Moveables.Moveable"):ReadFromWorldSprite("vegetation_indoor_01_7")

patent holly
#

Tfw you've been working on a mod for months and check the workshop and someone else just published the same thing... unhappy

#

Remarkably similar feeling to getting fired lol

brittle mesa
#

post yours too anyway, no harm in options for people

#

maybe theirs is horribly broken and yours is working superbly

patent holly
#

Lol yeah I'm still gonna publish, but his is tight. The code is impressive, he's definitely seasoned.

My mod is basically a spiritual successor to more builds, but I'm still learning, so the plan was to go ahead and use the context menu, but make a pop-out window for the build 42 rebuild. His already uses a window.

https://steamcommunity.com/sharedfiles/filedetails/?id=3067798182

Some of my systems are a little better imo, and I give the user complete control over crafting costs, Xp gain, and structure health, (plus a ton of other options) but the fact that he uses a window makes my improvements pale in comparison in my eyes.

I'll just have to do better.

muted garnet
#

How can I get an item from the environment or storage, not just from the character's inventory?

patent holly
#

What are you trying to accomplish/what do you mean by "getting an item"?

muted garnet
#

@patent holly here is the code, I need it to get the welding mask not only from the player's inventory, but also from the environment and from the container too

    if self.character:getInventory():getFirstTypeRecurse("WeldingMask") then

    local mask = self.character:getInventory():getFirstTypeRecurse("WeldingMask")

        if not self.character:isEquippedClothing(mask) then
            ISInventoryPaneContextMenu.wearItem(mask, self.character:getPlayerNum())
        end
    end
patent holly
patent holly
#

Np. hope it helps.

coarse sinew
# patent holly Lol yeah I'm still gonna publish, but his is tight. The code is impressive, he's...

code is impressive
probably 50k lines of code that will be hard to maintain, and probably could be reduced much less if I was thinking of modularizing more
he's definitely seasoned
this is actually my first piece of code that works correctly lol

First time I tried to continue More Builds, but generating that tree of thousands of items at each right click made it impossible to play. The project is open souce on github, feel free to make improvements. Those systems you mentioned sound really interesting.

viral halo
#

Hi, i'm new to lua so in the process of picking up the syntax. I'm trying to override ISButton.onMouseUp so as to inject a checked state behaviour. ( Terrible i know, normally I would normally extend ISButton but even that was a headache. ) Anway, i get the below error, as though the context of the onMouseUp method and self is somehow not itself. It can't even print out its own title field. What i'm i doing wrong.

local original_ISButton_onMouseUp = ISButton.onMouseUp
function ISButton:onMouseUp(x,y)    
    original_ISButton_onMouseUp(self, x, y)
    self.toggleSelectedState(self)
end

function ISButton:toggleSelectedState()
    print("ZZTopChecked pressed: " .. self.title )  
    -- print("ZZTopChecked canToggle: " .. toString(self.canToggle) )
    -- if self.canToggle == true then
    --     self.isChecked = not self.isChecked
    --     print("ZZTopChecked " .. self.title )
    --     print("ZZTopChecked " .. tostring(self.isChecked) )

    -- else
    --     print("ZZTopChecked cannot toggle " .. self.title )
    -- end
end

I get the error below.

-----------------------------------------
function: toggleSelectedState -- file: ZZTopCheckBtn.lua line # 16 | MOD: ZZTop Filter
function: onMouseUp -- file: ZZTopCheckBtn.lua line # 12 | MOD: ZZTop Filter.
[20-01-24 15:54:10.870] ERROR: General     , 1705766050870> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in toggleSelectedState at KahluaUtil.fail line:82..
[20-01-24 15:54:10.870] ERROR: General     , 1705766050870> DebugLogStream.printException> Stack trace:.
[20-01-24 15:54:10.871] LOG  : General     , 1705766050871> -----------------------------------------
STACK TRACE
-----------------------------------------
coarse sinew
#
local original_ISButton_onMouseUp = ISButton.onMouseUp

function ISButton:onMouseUp(x, y)
    original_ISButton_onMouseUp(self, x, y)
    self:toggleSelectedState()
end
viral halo
#

i'll double check, but i had that originally. in fact, the toggleSelectedState() method was added as a stab in the dark, i.e. even printing self.title in the onMouseUp override failed with the same message.

#

i'll double check.

#

hmm, that might have worked, i've been chasing my tail because thats what i started with. sigh.

#

@coarse sinew Thanks. all working. So it was caused by a spelling mistake, toString rather than tostring. Need my eyes tested.

#

very simple toggle state.

require "ISUI/ISButton"

function ISButton:enableToggle(canToggle, state)
    self.canToggle = canToggle or false
    self.isChecked = state or false
end

local original_ISButton_onMouseUp = ISButton.onMouseUp
function ISButton:onMouseUp(x,y)    
    if self.canToggle == true then
        self.isChecked = not self.isChecked
    end
    original_ISButton_onMouseUp(self, x, y)
end

local original_ISButton_render = ISButton.render
function ISButton:render()
    if self.canToggle == true then
        if self.isChecked then
            self.textColor = {r=1.0, g=0.0, b=0.0, a=1.0};
        else           
            self.textColor = {r=1.0, g=1.0, b=1.0, a=1.0};
        end
    end
    original_ISButton_render(self)
end
mellow frigate
waxen oar
#

i totally know how to code, just do... uhh turns out, i lied, idk what or howunhappy

viral halo
#

So, i've written a filter mod, removes all items from the inventory pane depending on what filter options you check. The issue I'm having is working out which item field is best to use to perform specific filtering by category. For example logging the following...

local itemCat =  item:getDisplayCategory()
local itemType =  item:getType()

Both of these seem to log very granular named categories and types. I was hoping for a field with a high level category, like Food, Weapon, Ammo, Clothing.
But it seems that the types and categories are a lot more varied, making a simple filter a bit of a pain.

 item: type: LitE type: MagazineCrossword3.
 item: type: LitS type: BookMetalWelding1.
 item: type: ClothAcc type: Belt2.
 item: type: ClothBack type: Bag_Schoolbag.
 item: type: ClothBody type: Tshirt_PoloStripedTINT.
 item: type: ClothFeet type: Shoes_Random.
 item: type: ClothFeet type: Socks_Ankle.
 item: type: ClothLeg type: Shorts_ShortDenim.
 item: type: Cont type: KeyRing.

Is there another item property with simpler naming? Or a definitive list I can reference?
I figure due to the variety of types and categories, i'm going to have to match on something like string.find(categoryOrType, "Cloth") or string.find(categoryOrType, "Lit")

Any ideas?

frank elbow
#

If you search “ClothLeg” in the vanilla code there aren't results, so I'm assuming something else is active

viral halo
#

i have a couple of better mods wich switch up the categories. I think i'm going to use instanceOf(item, "Food") as it looks like thats about as high level i can get without being messed up by other mods changing labels etc.

sour island
#

Type in items case is their module.type

#

It's more of an ID

#

You have category and display category

#

That's about it

#

You can try to get their class type - I forget what that's called - but that would get you clothing, food, weapon, item

viral halo
#

thanks, i think i'm ok with matching using the instanceOf() prop. Can always adjust it later if need be.

rich crest
#

I'm trying to make a simple mod where you dismantle vhs tapes for a single piece of electrical scrap but i cannot figure out why it isnt working (ps this is my first mod and i've basically learned everything by looking at other mods's files)

#

module DismantleVHSTapes
}
recipe Dismantle VHS Tapes
{
destroy VHS/VHS_Retail/VHS_Home,
keep [Recipe.GetItemTypes.Screwdriver],

   Result:ElectronicsScrap,
   Sound:Screwdriver,
   Time:20,
   OnTest:Recipe.OnTest.DismantleElectronics,
   OnGiveXP:Recipe.OnGiveXP.DismantleElectronics,
   OnCreate:Recipe.OnCreate.ElectronicsScrap,
   Category:Electrical,
   AnimNode:Disassemble,
   Prop1:Screwdriver,
   Prop2:Source=1,
fleet bridge
#

Second line bracket is wrong

rocky cave
#

following this tutorial: https://github.com/Konijima/PZ-Libraries

I'm at step C: Decompiling,

When running the setupWorkspace script, I'm given the following error:

3:20:44 PM: Executing 'setGameDirectory'...


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'zombie-hg'.
> Could not create task ':updateZomboidLua'.
> Could not create task ':zomboidVersion'.
> 'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'

bronze yoke
#

i don't recommend following this tutorial, it's very old

#

what are you trying to do? do you want the decompiled java or the lua libraries?

rocky cave
#

im going to need both. Im building an automated hunger games mod to go with the Hunger Games PVP map

#

Do you have a newer tutorial?

Yea, this one seems super old. I'm not a Java developer, so this will be my first Java project. I can't find JDK 17.0.3 anywhere 😛

bronze yoke
rocky cave
#

λ fetzmanjaro zombie-hk → ./BeautifulJava

  • Checking Zomboid version...
    ERROR: java interpreter not found.
#
INTELLIJ=/usr/share/idea
ZOMBOID=~/.local/share/Steam/steamapps/common/ProjectZomboid
#

which version java is it looking for?

#

@bronze yoke

bronze yoke
#

i have no idea, it just worked for me

rocky cave
#

ehh, it's the way my IntelliJ AUR package installs onto the system... I can't find the install directory that beautifuljava is looking for.

#
# Check for java command
#
JAVA="$(grep -i ^java "${CONFIG}" | cut -f2 -d= | xargs | sed "s|^~|${HOME}|")"
if ! [ -f "${JAVA}" ]; then
        JAVA="${INTELLIJ}/jbr/bin/java"
        if ! [ -f "${JAVA}" ]; then
                JAVA="${INTELLIJ}/jbr/Contents/Home/bin/java"
                if ! [ -f "${JAVA}" ]; then
                        config_error "ERROR: java interpreter not found."
                fi
        fi
fi
#

it's looking for ${INTELLIJ}/jbr/Contents/Home/bin/java,

I'm giving it the path to the executable.

INTELLIJ=/usr/share/idea

im using intellij-idea-community-edition AUR package. Any idea where the correct IntelliJ folder would be then?

#

which OS are you using @bronze yoke ? Don't think beautiful will work on arch

bronze yoke
#

i'm on windows

stuck forge
#

I was coming in to ask for exactly what both of you posted, lol

#

Loading single player games takes far too long and I had gone to copy a save from one computer to another only to find that it still wasn't done after 20 minutes

rocky cave
#

that isnt exactly what im talking about but

stuck forge
#

IMO, the map bins should not be separate files. It is absolutely terribly for filesystems and makes loading games take an enternity so I'm considering modding the game to better manage how it stores data

rocky cave
#

IMO, you should learn how to TAR

#

zip or tar your files before transferring... transfer takes 2 seconds.

#

you cant FTP thousands of singular files like that.

stuck forge
#

Well yes, I just wasn't expecting there to be 50,000 individual single files in the save folder

#

I stopped the folder transfer to archive them, but the fact that it even exists like that is absolutely ridiculous

rocky cave
#

it's really not, its just chunked data

#

so, since you're making your new mod

#

how do you expect to iterate across one file?

#

everything being read from one file? You just going to iterate up and down the file until you find what you need or what?

#

for chunked games like this... even minecraft... the data is chunked in one way or another

stuck forge
#

I'm considering using a compressed filesystem potentially.

rocky cave
#

you're just seeing it raw on your filesystem... but seperate files actually keep it super optimized

stuck forge
#

I'm not super convinced that all of these things need to be separate files in the first place, especially if they're fixed size

#

But, it would probably be better to not start out with the idea of reinventing the wheel when I already don't know much about the structure of the objects

blazing sierra
#

hi good night

#

I just need to know where I can find the list of all items by code

dense solstice
rich crest
fleet bridge
#

module DismantleVHSTapes
}

#

should be {

coarse sinew
rich crest
fleet bridge
#
module YOURMODULEHERE
{
  recipe YOUR RECIPE HERE
  {
    ...YOUR RECIPE...
  }
}
rich crest
#

module DismantleVHSTapes
{
recipe Dismantle VHS Tapes
{
Destroy VHS/VHS_Retail/VHS_Home,
keep [Recipe.GetItemTypes.Screwdriver],

   Result:ElectronicsScrap,
   Sound:Screwdriver,
   Time:20,
   OnTest:Recipe.OnTest.DismantleElectronics,
   OnGiveXP:Recipe.OnGiveXP.DismantleElectronics,
   OnCreate:Recipe.OnCreate.ElectronicsScrap,
   Category:Electrical,
   AnimNode:Disassemble,
   Prop1:Screwdriver,
   Prop2:Source=1,
}

Should be fixed right?

fleet bridge
#

missing one more }

#

at the last line

vague raven
#

idk if you have to but usually I import base

fleet bridge
#

its sometimes not necessary

rich crest
#

Allright fixed thanks! (chances are it wont worked since i just winged the lua file but oh well)

vague raven
#

it looks fine, should work

rich crest
#

YEAH IT WORKS!

#

Thanks alot!

#

only on home and retail vhs's for some reason damn

bright fog
rich crest
#

My mod still says unnamed mod no idea how to change it

bright fog
rich crest
#

Name= Dismantle VHS Tapes
id=DismantleVHS
description=Yeah..just dismantle VHS tapes...
poster=poster.png
modversion=1.0
pzversion=41.78.16

#

Not sure what's wrong with it

bright fog
#

The space after Name= ?

rich crest
#

Nah i just changed that to see if maybe that was the problem

#

same thing

#

maybe that?

bright fog
#

That's my mod's info file

id=TLOU_Bloater2
name=The Last of Us Infected - Overhaul 2
description=Makes the experience of The Last of Us Infected even better by adding small features that improve on the mod. Readds the Bloater model from Monkey TLOU Enhanced Experience to the Bloater infected of the TLOU Infected mod by drenindok.
poster=poster.png
authors=SirDoggyJvla
icon=icon.png
tags=Build 41
versionMin=41.0
require=TLOU_Infected

young edge
#

might be the capitalization

bright fog
#

Your issue is probably the capital leter on name

#

Put name not Name

#

What's the format of your mod info file too ?

rich crest
bright fog
rich crest
bright fog
#

Yeah right

rich crest
#

it gives me all the other information so i have no idea whats happening

bright fog
#

Then it's Name your issue

#

You need to put name

#

N --> n

rich crest
#

Yup that seemed to fixed it

#

Thanks!

fleet bridge
bright fog
#

I see

#

So if I just reference new items with item, it wouldn't be necessary ? Unless it's possible to call other items in it

bronze yoke
#

you also don't need to import base if you just reference them as Base.Whatever instead of Whatever

bright fog
#

hmm

tacit carbon
#

anyone knows if there is a lua code to spawn a specific type of zombie in the x, y coordinates I want?

#

most spawn functions I see are for hordes or non specific places like Room spawn

mystic lava
#

I don't know personally but I do know that the cheat menu mods have a zombie brush tool

#

The functions they use might be useful to you

tacit carbon
#

Yeah i know about that, but I want something like that in a Lua code

#

so I can spawn a specific zombie like that tool in a specific place

mystic lava
#

Gotcha

#

Then I'm not much help, I'm sorry

mellow frigate
tacit carbon
mellow frigate
#

require 'Definitions/HairOutfitDefinitions'

local bmOutfitStaticDef = { outfit = "BloodyMary", haircut = "Rachel:100", beard = "None:100", haircutColor = "0.98,0.81,0.01:100" }
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, bmOutfitStaticDef)

tacit carbon
#

I will test that out right now, thank you so much

mellow frigate
#

and you need to create the xml stuff if you use your own outfit and not a vanilla one

tacit carbon
brittle mesa
#

Sorry to interject, but I don't suppose anyone knows how to trigger a player to start crafting a specific recipe via Lua?

#

have tried a few things like player:getKnownRecipes()["SomeRecipeName"].craft() but to no avail, and can't seem to find any similar behavior searching through existing mods or via googling

#

hoping somebody more familiar with the recipe system backend might have some ideas

#

I thought remove grass / remove bush etc might have had a similar call, but they're not using a recipe but manually controlling anim states etc which seems overkill for my purposes versus just triggering an existing recipe craft

mellow frigate
#

look at ISCraftingUI.lua under lua/client/ISUI that's where you'll see how it must be called

brittle mesa
#

thanks - looks like via the RecipeManager might be the go based on those - much appreciated!

drifting ore
#

wouldnt it be cool if the devs or modders made a working train? it would be cool to have like a moving fortress. but to offset it make it so that like fuel gets burned like crazy and its loud as fuck attracting zombies in like a 300 tile radius while its running.
also maybe have it so that the rails sometimes need to be maintained and to work on the locomotive itself you need lvl 10 mechanics and level 6-8 metalworking and maybe even a high level electronics.
i think working near and with trains and train carriages all the time been doing something to me lol

mellow frigate
#

I never worked with trains but I have something like that in mind too.

bright fog
#

While I don't know the pricing, I suggest you propose your services in #modeling or the PZ modding Discord

cloud shell
#

I'm writing a mod to allow washer machines to wash dirty rags/leather and denim strips/bandages, here is what I found so far:

  1. Currently the washing machine code is handled mostly on the Java side, more specifically by the classes IsoClothingWasher and ClothingWasherLogic
  2. The associated Lua events only accounts for: turning the machine on and off (Commands.clothingWasher.toggle) and setting the machine mode for the dryer/washer combo (Commands.comboWasherDryer.setMode).

My current approach:
I'm using the SGlobalObjectSystem to monitor active washing machines every 10 minutes and replace any of those items for their clean variant. There is a limitation where it can only track washing machines that were picked up and re-installed/plumbed by a player (which is no a big problem for me).

It works perfectly in single player however I can't find a way to sync the washing machine container properly on MP. If I log out and back in the washing machine contents were updated successfully.
Anyone knows how to sync the contents of a container that was updated only server-side by a global system ?

brittle mesa
#

don't suppose anyone has any insights into why

local recipe = ScriptManager.instance:getRecipe("SomeAwesomeMod.Some Special Recipe")

would be falling over and failing to retrieve the recipe reference? I've checked the same line of code for default recipes and it works, and reviewed it against other mods that also generate recipe references in this same way.

  • The recipe is defined and valid (and can be crafted via the crafting menu)
  • The name of the recipe matches the recipe declaration and is unique
#

or is there some better way of just getting a reference to a specific recipe?

muted garnet
#

Is there any method to get using in recipe items or keep items? Default recipes

brittle mesa
#

Not sure I follow? The recipe is using both OnCreate: and OnCanPerform: functions but they're essentially stubbed right now. The recipe works if you craft it. Lookup via recipe items wouldn't be ideal for my use case but could possibly work well

errant oriole
#

very minor question
how do you make custom shirts with custom images on them (not custom models, just the base game shirts with custom textures)

#

I want to make a mod that adds a lot of t-shirts to the game with a lot of silly images on them

brittle mesa
#

figured it out - I thought the namespace reference it was using was the one from the modID, but it's actually using whatever you declared in module around the recipes (obvious in retrospect) which weren't a 1:1 match

sleek hull
#

I can't tell if I'm going crazy or not, but getPlayer():getBodyDamage():setOverallBodyHealth(0.5) should set the players HP to 50%, but whenever the code executes it shows the injured moodle for a fraction of a second, then immediately disappears.
Godmode is 100% off, because setting the overall body health in the general debugger lets me change it and it behaves as expected..
Are there any alternatives to setting the overall body health, or am I just tired & tea deprived..?

bronze yoke
#

the overall health is just an average of the bodypart health

#

as soon as the next tick starts it recalculates it and your change is lost

sleek hull
#

The only problem I'm running into in my head with that then, is if I wanted to do 25% of the players HP in damage I can't just iterate through each BodyPart and BodyPart:AddDamage(0.25) because each body part contributes a different amount to the overall health (Right Hand at 0 HP loses ~10% overall health, while Lower Torso at 0 loses near 40%)

#

Overall body health here is at 50% but the body parts are everywhere from 70% to 96% :/

bronze yoke
#

i wonder if AddGeneralHealth with a negative value would work

#

ahh, ReduceGeneralHealth

#

i knew there was something like it but i kept looking for stuff like AddGeneralDamage 😅

sleek hull
#

Seems to have done the trick, much thanks as usual Albion!
I really wish the Javadoc had descriptions for a lot of these functions, I swear half my headaches come from not 100% understanding which functions can do what I'm looking for

bronze yoke
#

eventually we'll do something like that

gilded crescent
#

Is there anyway to check if a vehicle is towing?

autumn sierra
#

if i wanted to add a vanilla item to the loot distribution, would it be correct to identify it as "Base.Object" in table.insert?

#

for example, like table.insert(ProceduralDistributions.list["SurvivalGear'].items, "Base.Dungarees"?

bronze yoke
#

yeah

autumn sierra
#

sick thank you

bronze yoke
#

a couple vanilla script files don't actually use the base module, off the top of my head there's camping, farming, radio

#

but base should cover most

autumn sierra
#

seeing as its a clothing item i think it will, but i will test it

#

thank you

bronze yoke
#

yeah, i haven't ever encountered any clothing that isn't base

muted garnet
#

How can I get item from container and can I get item from floor and container together, floor, this is also a container, right?

silver valve
#

Hello everyone. I resently new about modding and I wanna make my own mod. So I read documents about modding in PZ wiki.net, also analysed other mods and tried to figure out how to make these things. But I couldn't figure it out. Can you guys tell me how to start modding, and also about basic modding tips? I really wanna make one myself!!

mellow frigate
# silver valve Hello everyone. I resently new about modding and I wanna make my own mod. So I r...

Wiki is the right place. You can also start with this video: https://www.youtube.com/watch?v=N6tZujOPnDw

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

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

▶ Play video
tranquil kindle
patent holly
#

This is the way.

viral halo
#

Hi, How do i force a standard component like UIButton to redraw itself?

#

never mind, btn:update() works just fine.

eternal fjord
#

anyone here who works with sounds can tell me how the game determines the material of a fence being climbed? theres only one in the sounds_object script that goes for any fence regardless

patent holly
#

I'm not sure if that particular tile pack is still the one being used by the game tho. But it's definitely linked to the tile property of FenceTypeHigh/Low and the Material

eternal fjord
#

oh damn. thanks anyway

hoary bear
#

Anyone else making Jurassic Park related mods?

patent holly
eternal fjord
# patent holly What was the goal?

im trying to make a simple mod by overlaying a vanilla sound with another sound. im doing everything through scripting so im not sure how to edit the tile properties and integrating that into my mod

patent holly
#

Ah, I see. I'm only my aware of the system because of working with tiles and building mechanics, so I don't think I'll be much help, sorry.

Most of the mod's I see make changes to those sorts of sounds are manually installed soundbank replacements, but I have no idea if it's strictly necessary.

coarse sinew
#

But for some reason you can't set/unset some properties Peepo_Cry

patent holly
#

Lol I almost tagged you because of your IsoFlagType replacer but I wasn't sure it would apply

cloud shell
vital sphinx
#

is there any resource for understanding item/itemContainer manipulation for singleplayer/client/server ?

the code im using seems to be working just fine when testing alone in a hosted steam world, but i do get an error for both the add and remove item from server calls, even tho it seems to work

error:

ERROR: addToItemRemoveSendBuffer

pseudo remove item code:

itemContainer:Remove(theItem);
if (isClient() and not isServer()) then
  itemContainer:removeItemOnServer(theItem);
bright fog
vital sphinx
cloud shell
# vital sphinx is there any resource for understanding item/itemContainer manipulation for sing...

I believe the removeItemOnServer already checks if the call is done from the client on the Java code:

   public void removeItemOnServer(InventoryItem var1) {
      if (GameClient.bClient) {
         if (this.containingItem != null && this.containingItem.getWorldItem() != null) {
            GameClient.instance.addToItemRemoveSendBuffer(this.containingItem.getWorldItem(), this, var1);
         } else {
            GameClient.instance.addToItemRemoveSendBuffer(this.parent, this, var1);
         }
      }

   }

Make sure you are passing an instance of InventoryItem as argument.

bright fog
#

Sry just trolling but I don't know sadly :/

vital sphinx
#

i should test with another client, because it might work fine as is, i just want to have no errors if possible

cloud shell
#

Depending on what you are trying to do you can probably used the timed action ISGrabItemAction or ISInventoryTransferAction

vital sphinx
#

im specifically managing housekey loot on corpse spawn for TooManyHousekeys mod, trying to understand the basics before a bigger mod

cloud shell
#

I am having a lot of trouble myself trying to refresh a container after I add/remove items from a server side script. I might not be able to help much.
But as far as I can see doing this type of chages on the client side should have a lot more support.

#

Basically those timed actions are used for the game code itself for looting/trading/transfering items.

#

I think those are probably what you need.

vital sphinx
#

yes im using a client script that operates onZombieDeath and some other data stuff in onZombieUpdate
all this inventory stuff is for the corpse inventory on death, player isnt directly involved, i dont think i should be using actions

#

but before trying to use the removeItemOnServer/addItemOnServer, all the item code only worked in singleplayer

cloud shell
#

Same with me singleplayer was really easy.

#

How are you finding the key before passing it as argument for removeItemOnServer ?

tranquil reef
#

I haven't modded in a while, the "items" file is extremely long, is it possible I could make a folder for each category of items in there? (EDIT: yes, it worked fine)

#

It has "Katanas" and "Hammers" or whatever, could I have an "Items" folder then txt files in each of those for each type

#

Also if I were to do that would any existing saves be messed up, or since the item IDs will stay the same it'll be fine

vital sphinx
cloud shell
vital sphinx
#

yea yea, im pretty sure everything functions, just havent checked with multiple clients, and i would love to get rid of the error

#

maybe ill let the error be idk

keen jackal
#

Does this code work to make a meal upset the player when consumed? AngerChange = 45,

vital sphinx
#

cause right now i always do itemContainer:Remove, and then try to do itemContainer:removeItemOnServer after that if its a client

#

i see code from searching this thread:

if isClient() then 
item:getContainer():removeItemOnServer(item);
end
item:getContainer():DoRemoveItem(item)
#

this might be the correct way, ill try it now

keen jackal
#
        {
            DisplayCategory            =    Food,
                HungerChange        =    -15,
                Weight                =    1,
                Type                =    Food,
                DaysFresh            =    5,
                DaysTotallyRotten    =    7,
                UnhappyChange        =    32,
                FatigueChange        =    15,
                AngerChange            =    21,
                DisplayName            =    Tazón de Materia Fecal,
                Icon                =    PoopBowl,
            Carbohydrates = 77.56,
            Proteins = 16.04,
            Lipids = 12.58,
            Calories = 498,
            ReplaceOnUse    =   Bowl,
            StaticModel = Bowl,
            EatType = Bowl,
            DangerousUncooked    = TRUE
            WorldStaticModel = BowlSoup_Ground,
        }```
vital sphinx
vital sphinx
keen jackal
#

I think the code that makes the character angry is: UnhappyChange."

vital sphinx
#

i think im doing it right so im just going to ignore the error

#

for now anyway

fast galleon
rocky cave
#

with the OnAddMessage lua event... how can I figure out which player sent the message?

#

Or... how would I go about creating custom commands or chat commands?

frank elbow
dawn palm
#

how do I change a zombie's model? like cut their arm off

hollow current
#

how do you set roughness and height for a texture? or is it only possible to use base color?

rare granite
#

Does anyone know if Mackus103, the developer of MoreBrews, is on this discord?

viral halo
#

So, i renamed my mod, and then activated it again. When i reloaded an existing game with 'continue' the mod wouldn't load.

Is there a specific call back or call i need to make for my mod to become active during an existing game?

#

I can't for the life of me work out why my mod wouldn't load. It override the ISInvemtoryPane.createChildren() method to add a new row of buttons. And it works with a new game, but not a previous game.

undone crag
#

(Standard check like if you call customer service and get asked it you've tried turning it off and on again) Are you sure the mod's enabled for the specific save and not just in the main menu? If it is, any stack trace errors? If you put a print call does it run?

viral halo
#

i just went back and checked, it was indeed not enabled for the previous save.

undone crag
#

:d

viral halo
#

i assumed that when enabling a mod on the main menu, it was just active for the game.

#

lol.

#

turn it off and on again.

nova aspen
#

Does anyone know what type of variable categories is on a weapon? I'm trying to modify some categories on some weapons but I've only succeeded in adding additional categories to the weapons.

undone crag
#

(I don't know ^ btw)

nova aspen
#

No worries - I'm so unfamiliar with lua lol

undone crag
#

Hmhmhm what have you tried? I might have an idea after seeing it.

nova aspen
#

Testing in game with 1000 xp multiplier, you get both long blunt and axe skill when using any of the shovels.

#

Haven't found a mod that just does this already, otherwise I'd copy that code instead haha.

#

It does work for other variables correctly, such as damage, range, and other numeric variables

undone crag
#

Ah, getting the script item template that item instances are based on, and then doing DoParam. I don't know of another way of editing them. Maybe there just so happens to be another method in the online java documentation for the script item class.

#

I think it probably takes a Kahlua array, not a Lua table. There's some method for creating those. Lua tables are made like someTable = {}. Kahlua arrays might be made like someArray = something.something()

robust briar
#

If I have a mod which only needs two tiles made, do I HAVE to put them into a tilepack? Can you just use files to make tiles?

#

The references I see tile wise seem to always reference tiles inside a tile pack

#

I suppose, you kind of need a pack so you can define all the attributes, like is it solid and such

viral halo
mossy karma
#

Has anyone experimented with changing zombie animations and re-importing? I was able to extract the idle animation but lack blender knowledge to change it to something else.

bright fog
#

But importing the base animations is kind of pain ngl

mossy karma
#

Has anyone made a .X converter tool?

bright fog
#

the solution I've found is to use fragmotion

#

Then you just need to export the animation in .fbx when you're done

#

This guide also has templates with good bones and IK links

rocky cave
#

does anyone have any suggestions for where to look for placing fences or furniture?

#

which class should I look in?

Trying to build a fence around a coordinate basically.

#

is there really anyway to "build" the map with the lua? Or does that need to be done with the mapbuilder and loaded as a map?

mellow frigate
#

ProjectZomboid\media\lua\server\BuildingObjects

#

ISBuildingObject.lua

#

or ProjectZomboid\media\lua\client\BuildingObjects\ISUI\ISBuildMenu.lua

#

those will be your entry points

robust briar
tawny loom
#

Where can I find the modding tools to create new Zomboid challenges from the vanilla one

vital sphinx
vital sphinx
#

Im trying to understand why in some cases when using my custom ui menu, the buttons are not interactable. Sometimes it works, sometimes it wont detect mouse on the buttons.
I've been thinking it has something to do with needing to somehow manage joypadData or joyfocus? But it seems all of that is primarily for controller usage

sour island
#

Anyone know if there's a built in way to compare player's locations in MP? I think one of my old mods is running into an issue where the person is out of range of the other person to have an actual XYZ

#

Asking before I reinvent the wheel

bronze yoke
#

mostly it's just to rely on the server for stuff like that if you can

sour island
#

It's for proximity invites

#

💀

#

Going to make a command loop call to pull the locations

#

should work

bronze yoke
#

what proximity are you using that should catch players out of range 😨

sour island
#

Honestly not sure why it breaks - created weird issues

#

The load in range is like 300 right?

#

Seems like the issue was my fault / something to do with the logic gate

#
require "ISUI/UserPanel/ISFactionAddPlayerUI"

local util = require "ProximityInvites - utility"

local ISFactionAddPlayerUI_populateList = ISFactionAddPlayerUI.populateList
function ISFactionAddPlayerUI:populateList()
    ISFactionAddPlayerUI_populateList(self)
    if self.changeOwnership then return end
    for i=1, self.playerList:size() do
        local item = self.playerList.items[i]
        local playerA, playerB = self.player, getPlayerFromUsername(item.username)

        --if not playerB then print("WARNING: proximityInvite can't find: "..item.username) end
        if not item or not item.username or not playerB or (not util.validPlayerToPlayerDistance(playerA, playerB) ) then
            item.tooltip = (item.tooltip and item.tooltip.." " or "") .. getText("IGUI_outOfRange")
        end
    end
end
```This is what I'm changing it to
#

The viable range is now whatever the loading distance would be - which I think is either 150 or 300

bronze yoke
sour island
#

Also worth noting, there's a sandbox option to limit it further

#

I had it checking for true cases - so I think it was causing issues

#

Like people couldn't invite people even when in range - and the player list seem to have alot of dead entries

#

like the size for it made no sense

rocky cave
#

which class is best for creating your own menus with text & buttons?

viral halo
#

UiPanel I believe.

#

Unless you mean context menu. In which case I don’t know.

thick karma
dawn palm
#

how do you change a zombie's settings? such as turning off biting system

dawn palm
#

how to dress a zombie?

#

ingame

#

specifically a zed outfit

fresh cargo
#

So; I made my first mod. Got everything working (just a simple item)
However, after further trying to add more to the mod I seem to have broke something. My Icon no longer works for the item. Is there any reason this could be?

near hull
#

I have a large problem, my mod is basic, just quality of life with recipes, but there are so many errors that I was surprised, I'm not missing commas, brackets or something, the worst thing is that it marks everything Vanilla... All for today.. If anyone experienced something similar, help would be helpful.

viral halo
fresh cargo
#

testimage.png Is placed in textures

hollow current
#

is it possible to make it so that a custom-made item (acts same way as a spice) can be added multiple times to a beverage?

#

apparently I can add it only once to a beverage before the option to add it again is gone. What I want to achieve is add it a maximum of 3 times

viral halo
# fresh cargo So My understanding is Icon = testimage,

Afraid i'm a beginner too with lua and zombie modding, and haven't yet experimented with applying custom textures. What I would say is that without any reference to what your code looks like, or what the error is, its going to be very hard for people to give much advice for your specific issue.

Because I haven't yet setup debug mode, i also referenced the logs from my c:/users/name/Zomboid/Logs folder and something that caught me out is that the logs will be saved in a new file every couple of hours, as such, when checking logs I would sometimes be looking at the wrong [date]-[time]_DebugLog.txt file. I really should have made the effort to turn debug mode on.

One thing you might try is if your writing lua scripts, then add in some print("here") statements to see where your code is/isn't executing.

flat panther
#

I'm trying to make a food item that lets you take one bar each from a pack of five rations after opening it, and when all five portions are taken from the package, it will be deleted (I don't want to bother making an empty one as litter, even if for realism). Where do you think I should go from here?

#

I'd assume it's something like this but that would be cluttered

hollow current
#

not sure if it'll work for food

rocky cave
rare granite
#

Is there a list anywhere of all the sounds available in the game?

rocky cave
rare granite
#

i unpacked the .pack files but a lot of sounds seem to be hidden somewhere else

#

looking specifically for building/crafting sounds

coarse sinew
# rocky cave are we able to place unbreakable fences?

This code creates an unbreakable wall at the player's coordinates, depending on what you want to do with it you can adapt it.

local player = getPlayer()
local x, y, z = player:getX(), player:getY(), player:getZ();
print(x, " ", y, " ", z)
local cell = getWorld():getCell();
local square = cell:getGridSquare(x, y, z);
local wall = IsoThumpable.new(cell, square, "walls_exterior_house_01_16",  false, {})
wall:setName("Wall")
wall:setIsThumpable(false)
square:AddSpecialObject(wall);
wall:transmitCompleteItemToServer();

But there is a mod to make tiles placed with Brush Tool unbreakable: https://steamcommunity.com/sharedfiles/filedetails/?id=3025189998
In that Brushtools you can also see all the tilepacks you have activated in the current world. To see the cheats you need to activate the debug mode.

coarse sinew
rare granite
#

yes, i unpacked them. the crafting sounds dont appear to be in there

#

i was wondering if anyone knew of any other sound banks not in that folder

fresh cargo
flat panther
#

did I accidentally get on the same wavelength with him?

#

but now I'm having a problem with adding models since it just seems to break items now
one time I couldn't spawn a closed package, then I couldn't open it 'cause the opened version is missing

viral halo
# fresh cargo <@459374235123580949> see Icon = This is very similar to the code I'm running. I...

https://theindiestone.com/forums/index.php?/topic/12204-how-to-change-the-texture-and-name-of-a-item/ this post describes some steps to changing an icon that may help. Note the last post, and that you need to name new icons specifically with the prefix “Item_…” I.e “Item_newicon.png” but in the code you only put “newicon.png” .
I didn’t check the date on that post so it might be out of date.

fresh cargo
flat panther
fresh cargo
flat panther
#

o o f

bright fog
#

lmao you broke all your tiles

fresh cargo
muted garnet
#

Tell me please where can I get list of all animmask?

bright fog
muted garnet
slow graniteBOT
#
killershark057 has been warned

Reason: Bad word usage

flint lodge
#

Howdy! This is probibly asked a lot but I am trying to mod hunger, nutrition, calories, the ammount you can eat etc. I'm having trouble finding which variables or stats actually control all that. There are a few other things I would like to mod but that's the first on the list. IF someone can direct me to a list somewhere that would be very appreciated.

covert ermine
#

hi peoples can someone help me make a mod i can only model sadly D:

bright fog
#

You probably looked in the lua codes if I had to guess, but I don't think you'll find it there

flint lodge
#

Something like that yeah. I know just enough code to fumble about with it. But mostly I am looking for ways to tweak the max character stats, if that makes sense.

#

I've been downloading peoples mods for various things and trying to figure out how they do X,Y, and etc XD

bright fog
#

That's the best way to learn rn

#

Maybe you could look at the mods that show your stats in a UI

flint lodge
#

That... is a great idea actually

bright fog
#

Check where they get their data from

#

Go up from there to the source maybe

covert ermine
flint lodge
#

Thanks! I'll do that 🙂

rocky cave
#

where can I find a list of the world objects available in the game to spawn? like walls_exterior_house_01_0 etc? I'm specifically looking for the big ass fences with barb wire on the top

#

there's multiple models for each way it's facing etc. etc. just dunno where to find all these files

outer crypt
#

If you know where it is in the world, load up a game in debug. grab the brush tool and copy the item, I believe it will give you the texture.

#

You could always search through the brush as well and look for the item you want.

outer crypt
#

the first is the green bar fence and the second is the modular stuff at the military blockade

outer crypt
#

I made a program that spits out all the info I need about items in the world. You can see the output log with the tile and textures

#

Does anyone know how generators indoors poison the air/damage the player? I have yet to find the code for it.

rocky cave
fresh cargo
#

Alright, Finally home. Tried to load my mod up and my game freezes.

#

Am I missing something stupid here? If so what is it. This is my first mod I've tried to do, so just kinda learning as I go.

frank elbow
fleet bridge
fresh cargo
#

Thanks; I see that. Also Found my icon issue out

#

Didn't realize you have to name the "textures" with Item_Name

livid badger
#

Hello, I want to get a list of farming objects, but either I'm looking for them in the wrong place or I'm looking for them incorrectly. Please, experienced coders, tell me what I should do.

`For tests I use TimedActions:

require "TimedActions/ISBaseTimedAction"

function isSHFeveryTenMinutes()
for key, value in pairs(CFarmingSystem) do
print(" Key:", key, ", Value:", value)
end
end

Events.EveryTenMinutes.Add(isSHFeveryTenMinutes);`

rocky cave
#

does anyone know how IsoThumpables setName() works?
When creating the wall, I've used setName("prison") before adding it to the square.

When getting the thumpable wall later with square.getThumpableWall(true), and then getName()... it's showing "Wall" as the name.

outer crypt
#

You could always moddata a variable if you need something personal and that can be transmitted multiplayer too.

rocky cave
#

Does anyone know a way to easily get IsoObjects around a player or around a coordinate? Or maybe, a table of all IsoObjects within a cell?

Otherwise, I'm iterating through all possible "close" x,y coords around my target coordinate and checking them for IsoObjects. I feel like their may be a better, more-performant way to do this though

shy hearth
#

this inconsistency has me fit to murder someone

#

i love the zomboid api so much

#

calling nil for the past two hours

rocky cave
#

u should just code roblox i guess

#

😛 \s

shy hearth
#

don't tempt me

rocky cave
#
square:transmitRemoveItemFromSquare(obj);
thumpable:transmitCompleteItemToClients();

more inconsistenicies for u

#

not to be confused with

square.transmitRemoveItemFromSquareOnServer(obj);
#

square:transmitRemoveItemFromSquare(obj);

is for clients, so why not... ToClients???!!

shy hearth
#

on one hand i sympathise with devs building on a project over a decade old

#

on the other hand

#

i want justice

#

swift justice

rocky cave
#

yeaaa

#

im building here because green grass

#

a lot of mods can be made

#

the mods out rn are honestly meh

#

but, it's really understandable. The API is fucking ass.

shy hearth
#

imo zomboid has the best suite of mods bar maybe like

#

rimworld

rocky cave
#

nah

#

jedi knight jedi academy

shy hearth
#

fair, i think that's a priority for upcoming builds

rocky cave
#

project zomboid is more on the level of GTA V's Five M

shy hearth
#

remember reading something about wanting to move to that kind of platform accessibility

rocky cave
#

superj a nky

#

api is actually really hard to mod on

#

anything super advanced is going to cause hella server lag

#

not trying to be a hater in the PZ chat or anything myb

#

but, you're right. this game's api is really difficult to mod with

shy hearth
#

it's an art as much as a science

#

and i cannot draw

cunning canyon
#

high level Lua api question I wanted a sanity check on: Is it fair to say you would never want to bind events in a file that may be required by another file? Since then the hooks would be bound once when loaded and again when the other file requires it? Or does Pz somehow avoid this from happening?

bronze yoke
#

require is less 'run this file now' and more 'ensure this file has already loaded before continuing'

#

if you're using the return value of the file that's cached after the file runs

flint lodge
#

Does anyone know where to find background moodle mechanics and how to edit them properly?

bright fog
bronze yoke
#

no

#

it might let you access a single local variable if the file returns that variable

#

but require doesn't directly expose locals

tropic hedge
#

Hi guys,
What do three Boolean values represent?

if the first boolean is true, then the Event.AddXP(value) function will be triggered, it's correct?

getPlayer():getXp():AddXP(Perks.Cooking, amount, true, false, false)

thank you.

bright fog
frank elbow
#

They are “local to” the file, as in you can use them within that file. You can also return things as file-level (or “module”) returns, to make those available

#

i.e.,


local function onlyUsedHere()
  -- some specific thing that only this file needs
end

local function exported()
  -- something that files that require this might use
end

return { exported = exported }

This is a contrived example to illustrate the point. You can also write it as a member of a table from the start, which is neater & what I prefer:

local module = {}

function module.exported()
  -- available in files that require this
end

return module
#

To clarify how those are accessed, if the above code is in file module.lua:

local module = require 'module'
module.exported()
frank elbow
tropic hedge
# frank elbow First one is as you said, if true it'll trigger `AddXP`. Second one is for wheth...

" In the documentation these are named callLua, doXPBoost, and remote "

Thank you very much. Can you provide me with the link to the document where this is written?

here https://theindiestone.com/zomboidjavadocs/zombie/characters/IsoGameCharacter.XP.html#AddXP(zombie.characters.skills.PerkFactory.Perks, int, boolean, boolean)

public void AddXP(PerkFactory.Perks type,
                  int amount,
                  boolean callLua,
                  boolean addGlobalXp) ```

and here https://zomboid-javadoc.com/41.78/zombie/characters/IsoGameCharacter.XP.html#AddXP(zombie.characters.skills.PerkFactory.Perk,float,boolean,boolean,boolean)

``` AddXP
public void AddXP(PerkFactory.Perk perk,
 float float1,
 boolean boolean1,
 boolean boolean2,
 boolean boolean3) ```
frank elbow
hollow jackal
#

Hello. I am a beginner mod and I would need advice on how to correctly write a link to a trait in another mod. I would need a certain trait to be locked when Trait is selected. However, the locked trait is found in a different mod. And how to correctly write the link to the trait. I am attaching the current picture. Thanks for help.

viral halo
#

Is there a guide on font sizing? I was looking at the ISInventoryPane/Page classes and they have some scaling multipliers and if statements to pick font size for the inventory text. Wasn't sure if someones covered the approach to picking a font size for UI text/button labels etc in a guide. I.e. when to use different font sizes etc etc.

this is the code in ISInventoryPane.lua . I'm wondering what zoom values to pass?

...
local font = getCore():getOptionInventoryFont()
    if font == "Large" then
        o.font = UIFont.Large
    elseif font == "Small" then
        o.font = UIFont.Small
    else
        o.font = UIFont.Medium
    end
    if zoom > 1.5 then
        o.font = UIFont.Large;
    end
    o.fontHgt = getTextManager():getFontFromEnum(o.font):getLineHeight()
    o.itemHgt = math.ceil(math.max(18, o.fontHgt) * o.zoom)
    o.texScale = math.min(32, (o.itemHgt - 2)) / 32
...
granite thistle
#

where can I find the game speed state in a singleplayer save file?

viral halo
#

Also, where do devs find it easiest to save there working files? Given I can there is at least 2 locations to put mods? I’m currently inclined to move my wip files into the initial user/zomboid/workshop/mod-I’d/Content folder. But obviously I’d need to deploy a base mod first. Which leaves the user/zomboid/mods folder for initial development. But then also means having to copy changes everytime. Bit of a headache tbh.

supple valley
#

that also lets you rollback changes

viral halo
#

Hmm not sure I got those directories right, but I think you know what I mean.

#

Yeah I use git already. I was just confused by the fact you can start mods in multiple different locations.

bronze yoke
#

wdym by copying changes? i would not recommend having copies of the mod in more than one location zomboid might load

jagged arch
#
patent holly
#

Whoops, tried to edit my comment and deleted it. I are smort. This is finding what I'm looking for on the current floor, but I need to check one floor down. Any help is appreciated as I'm still learning.

function ISPlumbHelperCursor2:isValid(square)
    local objects = square:getObjects()
    for index=0, objects:size()-1 do
        local object = objects:get(index)
        if object:hasModData() and object:getModData().canBeWaterPiped then
            return true
        end
    end
return false
end
rocky cave
#

get cell with player:getCell() i think is the func

flint lodge
#

I was messing around with Chatgtp to help me with some coding.
I want to make a dialog box appear after the player dies and show all the wounds they have on each body part.
When I run it though, nothing happens. If someone wants to take a look and tell me what I'm doing wrong, it will be appreciated XD

rocky cave
#

im new to lua... been transpiling from typescript but

rocky cave
flint lodge
#

I can try that

rocky cave
#

i guess? idk, think you may need to initialize it with some required parameters.

Also,

flint lodge
#

thanks 😄

rocky cave
#

this is what will spawn it on the UI

flint lodge
#

._.

#

I did not! thank you so much!

rocky cave
#

yea, for stuff like this

#

modding and stuff

flint lodge
#

I will try this out later XD

rocky cave
#

since it is undocumented

#

best thing u can do is download mods from workshop that do something similar to what youre doing

#

and you can view the lua for them in your workshop folder 🙂

#

dialogs and stuff u can easily copy and paste from there.

chatgpt isnt trained on any of these lua files. shes pretty unhelpful with PZ modding

#

gives you completely wrong code

rocky cave
# flint lodge I will try this out later XD

this is typescript, but what was able to spawn something

    const modal = new ISModalDialog(0, 0, 100, 100, "Hunger Games", true, "", "", null, "Hunger Games", "");
    modal.addToUIManager();
#

i want to try to train an AI model on project zomboid codebase & some good mods, would be sick

flint lodge
#

That would 🙂

rocky cave
#

just put it in your vscode project directory

viral notch
#

... creating new function even not connected with vehicle make new horizontals ...
i menage to make MIRROR texture 😂

#

and is Live mirror move vehicle or self and object on it moving along with players xD just not sure how i make it correctly ... tooo many code ahead and now how to flip it 180' xD

muted garnet
#

how can I translate text from .tiles file? I need to translate dismantle item`s name, that consides in .tiles file

vague raven
#

Tiled probably

viral halo
viral halo
slow graniteBOT
#
Rocket Blitz#6277 has been warned

Reason: Bad word usage

halcyon elbow
#

Good afternoon guys, I'm trying to create a mod to change the wallpaper to one from the menu and I don't know where to start

topaz lake
#

You know Braven’s ScreecherZ mod that makes sprinters scream? Well I would love it, for nothing other than my own personal amusement, for someone to give me basic instructions on how to replace ALL zombie screams and growls in their entirety with Daniel Larson’s screaming.

frank elbow
narrow urchin
#

Is it possible to get moving objects (zeds) via server side script? I'm trying to count zombies in the building.
On client side it is rather easy.

patent holly
# rocky cave u can try cell:getGridSquare(x, y, z-1) using coords of ur known square

Got it! May be able to do it better, but this worked

function ISPlumbHelperCursor2:isValid(square)
    local xa, ya, za = self:getSquare2Pos(square)
    local squareA = getCell():getGridSquare(xa, ya, za)
    if not squareA then return false end
    local objects = squareA:getObjects()
    for index=0, objects:size()-1 do
        local object = objects:get(index)
        if object:hasModData() and object:getModData().canBeWaterPiped then
            return true
        end
    end
return false
end

function ISPlumbHelperCursor2:getSquare2Pos(square)
    local x = square:getX()
    local y = square:getY()
    local z = square:getZ()-1

    return x, y, z
end

Thanks for pointing me in the right direction!

#

I was having weird errors before, so now that it's working I can probably integrate the second function into the first, right?

#

Yep, nice.

function ISPlumbHelperCursor2:isValid(square)
    local x,y,z = square:getX(),square:getY(),square:getZ()-1
    local squareA = getCell():getGridSquare(x, y, z)
    if not squareA then return false end
    local objects = squareA:getObjects()
    for index=0, objects:size()-1 do
        local object = objects:get(index)
        if object:hasModData() and object:getModData().canBeWaterPiped then
            return true
        end
    end
return false
end
heady crystal
#

How did you manage that feat of dark magic

viral notch
heady crystal
viral notch
#

🥲

rugged latch
#

Is there any way to have sandbox options as floats? i only ever see integers

#

ah nevermind found it out

muted garnet
# vague raven https://i.imgur.com/r5y0Nt4.png

no, I mean a text file with .tiles, like something_tiledef.tiles, which, as far as I understand, stores data about a specific tile, but if in Lua I would write getText(), then here is a simple UTF-8 file and getText() does not work, and direct translation of the name doesn’t work either

covert venture
#

Good evening everyone!
I'm struggling with a problem I can't quite figure out. I want to (basically), Access a specific player's Map/minimap, add a marker (the round one), and maybe an "annotation". Could someone point me in the right direction in the documentation?
It's not for a friend, it's for me.
( And BTW, the PZ community is the most kind-hearted I've ever known. 😚)

hollow current
covert venture
hollow current
#

soo. client's

#

i think i messed with sth similar before, lemme find it

covert venture
hollow current
#

so, you can get the player's map by simply using ISWorldMap_instance
This is initialised only after the player opens the map for the first time in his session, so when using it you probably want to do
if not ISWorldMap_instance then return end depending on your exact use, or simply manually initialise it (check ISWorldMap.ShowWorldMap line 860)

I haven't really messed with the symbols/annotations before but I'll try to find it for you in a min!

fleet bridge
#

I did something that draws a polygon around a predefined area using scaled annotation symbols. I imagine you could do the same with onservercommand event and executing it for specific players

covert venture
#

I get the idea. But i mis-explained myself. It's fort drawing a "house" marker on the map, a a certain point in time, for exemple. ( SP games )

hollow current
#

no luck on my side unfortunately getting exactly what you need but found getSymbolsAPI() in vanilla script. Maybe running a more thorough search around that can help you. Also lect's solution could be easier! Good luck :)

covert venture
#

I'll work on that, thanks @hollow current for the help. blaww

fleet bridge
viral notch
granite glade
#

Could someone inform me how a weapon mod recognizes the mesh and texture being used? I've currently gotten all of the relevant stats written and apparently working (such as damage, crit, range, sound, etc...), but the weapon doesn't show up in my hand, and when placed showed with the missing textures. Clearly, It's got the mesh in there somewhere. But getting that mesh and most important texture to show is an issue. Thanks in advance for any help.

civic tree
#

anyone knows where the bandit/punk (from the zombie stories) outfits code is located at?

cloud shell
#

Anyone knows if it is possible to change the time for recipes in Lua ?
My idea is to change only the time it takes for a player to craft some existing recipes.

civic tree
zinc pilot
#

Is there a way to simulate a slow\heavy loaded server in a local environment?

bright fog
#

And add loads of zombies maybe

#

Set huge amounts of buildings in fire

zinc pilot
fleet bridge
cloud shell
#

I think I'm getting closer, here is what I tried so far:

function ChangeRecipes()
    local recipes = getAllRecipes()

    for i=0,recipes:size()-1 do
        local recipe = recipes:get(i)
        print(recipe:getName())
        if recipe:getName() == "Rip Clothing" then
            print("Changing Rip Clothing time from " .. recipe["TimeToMake"] .. " to 10")
            recipe["TimeToMake"] = 10
        end
    end
end

Events.OnGameStart.Add(ChangeRecipes)

I can use the getName() normally but I always receive null when trying to access the Float property TimeToMake, I also tried recipe.TimeToMake

#

There is no setter for that property unfortunately

cloud shell
zinc pilot
cloud shell
zinc pilot
true nova
#

if i wanted to have a container that checks it's contents and changes their properties over a certain amount of time i'd have to use Events.Ontick right?

zinc pilot
#

if you need precise timestamps, then OnTick would be the better choice, yeah

true nova
zinc pilot
#

Checks the other Events, you can use EveryOneMinute, EveryTenMinutes, EveryHours and EveryDays

#

the less you check stuff, especially if you need to check multiple items, the better

fleet bridge
cloud shell
#

I tried but it also didn't work, I'm not sure it is possible. As far as I can tell the loop I had returns the same object and also getAllRecipes() comes from the ScriptManager. The problem is the Recipe class itself, it has setters for most properties, but not for TimeToMake, Heat and some others.

#

My first approach was to simply override the Base recipe, but there are 6 recipes called Rip Clothing and override only works for one of them...

fleet bridge
#

and make your recipe named something slightly different

cloud shell
#

Good idea, I can read the time so I can easily find the vanilla ones!

#

Yep, that worked. Thanks!

civic tree
#

anyone knows the location of the code for the outfits for the random zombie stories?

sour island
#

Trying to allow ISMaps to have "pages" to simulate books/pamphlets, anyone got a clue as to why it won't allow addTexture() to work?

#

No errors to speak of

civic tree
#

hey can anyone help? ive been looking for the code (i think its called functions?) for the zombie outfits that are used in some randomized stories, but i cant find the files. pls help

hollow current
#

how do you get the loot pool of foraging in a specific area?

sour island
fleet bridge
fleet bridge
sour island
#

It is on draw textures

#

Maps have an addTexture

#

There's a few cases where 255 is used

#

Not sure if there's a correlation

#

Sucks when something small like this burns my night lol

#

But it is what it is

bright fog
flint lodge
neon bronze
#

You would need to register them in the events list

#

And then trigger them manually

flint lodge
#

Thanks! I'm still learning LUA. I'll look around and see if I can find the events list.