#mod_development

1 messages ยท Page 210 of 1

sour island
#

I never implemented a matrix myself, so I'll be learning too ๐Ÿ˜…

rich void
#

I don't, even know what a matrix is

sour island
#

Multi dimensional array/list

#

Afaik Lua doesn't support/have it ready to go - but as with all things Lua, everything is a table

sour island
#

Is having thousands of zones a likely scenario?

rich void
#

Absolutely

#

I currently have 450 though

#

But worst case scenario

sour island
#

I'm thinking you could store them under their cell

#

It would eliminate your 2hr thing

rich void
#

Break it into seperate tables, and on the getnearbyzones function we just combine the ones we need

sour island
#

X/Y / 300 = cell

rich void
sour island
#

zones[cell].zones would be the sublist

#

Problem is zones might exceed a cell

#

Under my API you can make a zone thousands of tiles wide lol

rich void
#

How are you storing the data of a "zone" then?

sour island
#

x1, y1, x2, y2

#

With additional data

#

But that is the bare minimum needed

#

Right now it's just stored under zoneType

rich void
#

Alright yeah I do same I was just wondering if you'd done some wizardry

drifting ore
#

could someone please guide me on this? it's raising 1 error when spawning and the condition it's not set at all, maybe i'm using wrong getType()?

function onPlayerSpawn(player)
    local inventory = player:getInventory()
    
    for i = 0, inventory:size() - 1 do
        local item = inventory:getItem(i)

        if item:getType() == "HuntingKnife" then
            item:setCondition(5)
            break
        end
    end
end

Events.OnCreatePlayer.Add(onPlayerSpawn)```
rich void
drifting ore
#

it does? did you debug it?

rich void
#

So you could consider tying it to an onplayerupdate function and removing the event after it's complete so it only runs once when the player is properly available

rich void
drifting ore
#

OnPlayerUpdate, are you sure to call stuff there?

rich void
#

Yes but make sure you remove the event straight after calling it

drifting ore
#

hmm, i'll try it out, but the tick rate should be pretty high, so...

rich void
#

Otherwise you're gonna be setting the condition of that knife every tick

drifting ore
#

ahh, i see, right, that's Remove right?

rich void
#

Events.OnPlayerUpdate.Remove(onPlayerSpawn)

#

Yeah bro, should work fine

#

Functions can kill their own events I think

drifting ore
#

yup, i don't think it's the best way, but i'll try it out to see if works under that, ty ๐Ÿ™‚

rich void
drifting ore
#

oky, fully trusting ig ๐Ÿ˜›

rich void
#

The annoying thing is OnNewGame works fine, but it's only called when you make a new character 2_sick

rich void
# sour island Right now it's just stored under zoneType

I forgot to say as well, class work on Game Night bro, it is the definitive mod for playing cards by a long shot, had a full night playing black jack with some friends in 100 rads bar and after getting the muscle memory down somewhat it's seriously next level

#

And the whole thing works amazingly for chess too, and I'm a massive fan of chess outside of Zomboid so just made my dreams come true

fleet bridge
drifting ore
#

well, the error is gone, but the condition still being not set

function onPlayerSpawn(player)
    local inventory = player:getInventory()

    for i = 0, inventory:size() - 1 do
        local item = inventory:getItem(i)

        if item:getType() == "Base.HuntingKnife" then
            item:setCondition(5)
            break
        end
    end
end

Events.OnPlayerUpdate.Add(onPlayerSpawn)
Events.OnPlayerUpdate.Remove(onPlayerSpawn)``` any ideas? i've changed `HuntingKnife` to `Base.HuntingKnife` but still..
fleet bridge
#

getType will return if its a weapon or toolweapon

#

its the type

#

if you do print(item)

rich void
#

do getFullType()

fleet bridge
#

you might see its already Base.HuntingKnife?

drifting ore
#

hm, inside the game the "edit option" says "Weapon Type: Base.HuntingKnife" i think

rich void
#

afaik Type = without prefix
fullType is with the prefix included

drifting ore
#

and the condition it's an int with value 10, idk why isn't a float i'm confused af tbh

#

setCondition expects a float right? so passing 5 it's not correct or it's rounded and handled in the instruction?

fleet bridge
#

yes, getFullType() will return you the Module.Item

drifting ore
#

if not getType what function should i look for in the docs?

#

okay, thanks! i'll try it out to see if matches

rich void
#

might aswell throw a print(item:getFullType) to ensure you're getting what you're expecting ๐Ÿ™‚

drifting ore
#

brb ๐Ÿš€

rich void
#

Yo francies

#

I think I got it

drifting ore
#

ye? i think OnPlayerUpdate it's not the event i'm looking for :c

rich void
#

function onPlayerSpawn(player)
    local inventory = player:getInventory()
    local it = inventory:getItems()

    for i = 0, it:size() - 1 do
        local item = inventory:get(i)

        if item:getType() == "Base.HuntingKnife" then
            item:setCondition(5)
            break
        end
    end
end

Events.OnPlayerUpdate.Add(onPlayerSpawn)
Events.OnPlayerUpdate.Remove(onPlayerSpawn)

drifting ore
#

get() from the inventory array?

rich void
#

I would also do this but I might be wrong

function onPlayerSpawn(player)
    local inventory = player:getInventory()
    local it = inventory:getItems()

    for i = 0, it:size() - 1 do
        local item = inventory:get(i)

        if item:getType() == "Base.HuntingKnife" then
            item:setCondition(5)
            Events.OnPlayerUpdate.Remove(onPlayerSpawn)
            break
        end
    end
end

Events.OnPlayerUpdate.Add(onPlayerSpawn)

drifting ore
#

hm, okay i'll give it a try why not seems pretty legit, the first snippet

rich void
drifting ore
#

XDDDDDDDDDDDDDD fallen from my chair

quiet plank
rich void
sour island
#

Helps deal with cards.

sour island
timber thicket
#

I don't really have much interest in doing it tbh but the idea is fun so I shared in case anyone else would like to

fleet bridge
sour island
#

Like overlapping zones?

fleet bridge
#

overlapping, or perhaps you want a square nested inside a larger square

sour island
#

And you're asking if my zones API can do that?

fleet bridge
#

sort of, just wondering how you deal with it since its all input by the end user

sour island
#

Implementation for zone mechanics are handled by the other mod using the zones - otherwise cross checking across all the zones is usually the go-to

#

Player/object x/y > x/y1 and < x/y2, etc

#

If true do thing

#

I think my zombie zones mod expects there to be 1 zone only

#

The API itself doesn't dictate checking locations

drifting ore
#

is there any way to obtain the steam id of an user via a console command? sorry if this doesn't goes here ;c

rich void
drifting ore
#

there's no stack generated, that's the weird thingy

#

the last non critical refers to a warn

rich void
#

Are the prints for the item coming through?

#

if you added them

#

If you did the event remove as you had before, like outside of the function, I imagine that when initialized as event remove is at the bottom of the script, the code won't even run

#

So best to check this first

drifting ore
#

didn't add the debug printing line c:

#

i'll try to move it before breaking the loop as you did

drifting ore
# rich void What's the stack trace?
STACK TRACE
-----------------------------------------
function: onPlayerSpawn -- file: ProjectZeroTraits.lua line # 22 | MOD: ProjectZeroProfessions.
[18-12-23 13:34:50.084] LOG  : General     , 1702917290084> Object tried to call nil in onPlayerSpawn.```
```lua
-- Line 22
local item = inventory:get(i)```
#

i'll try to call getItem instead, i'm pretty confused XD

rich void
#
local item = it:get(i)
#

I think I said inventory:get before

#
function onPlayerSpawn(player)
    local inventory = player:getInventory()
    local it = inventory:getItems()

    for i = 0, it:size() - 1 do
        local item = it:get(i)

        if item:getFullType() == "Base.HuntingKnife" then
            item:setCondition(5)
            Events.OnPlayerUpdate.Remove(onPlayerSpawn)
            break
        end
    end
end

Events.OnPlayerUpdate.Add(onPlayerSpawn)

drifting ore
#

& that's why you shouldn't do quick cp

rich void
#

Presuming that Events.OnPlayerUpdate.Remove(onPlayerSpawn) didn't cause you any issues

#

This should work ๐Ÿ™

drifting ore
#

XD, nope it didn't

rich void
#

Perfect

#

So sorry for the fuck up mate

#

I actually have faith in this now ^

#

Run it back and lemme know

drifting ore
#

hahh okay there's no problem wtf? thanks for helping me :3

rich void
drifting ore
#

everyone got typos, don't worry XD

drifting ore
#

mission passed

fleet bridge
rich void
#

So for a single tick the moment player object is properly available and loaded into the server ๐Ÿ‘

drifting ore
#

any approach on how to achieve disabling certain traits when others are picked? i.e: "advanced hunter" gives you "herbalist" so you can't pick that trait anymore

quiet plank
drifting ore
#

thanks!

quiet plank
#

Though, I'm a sadist, so if they don't directly conflict (like agoraphobia and claustraphobia or strong and feeble), I'll leave them and let someone waste their points. LOL

karmic siren
#

Guys, do you know any Brasilian PZ MOD dev, taking jobs?

sour island
karmic siren
#

Actually no. But as BRL (Brazilian currency) is over 5x times back to USDโ€ฆ this makes foreign DEVs looks overpriced ๐Ÿ˜ข

#

But we can talk, ofc and find a middle ground if you want

sour island
#

I'm not available for work myself, but I help manage a discord for commissions and community projects.

#

If your idea appeals to someone they may do it for something reasonable for you - but that limits the pool of people.

karmic siren
sour island
#

Depending on the idea, you could even attempt to make it. ๐Ÿคทโ€โ™‚๏ธ

rugged latch
#

yo so, is there a way toooo

#

intentionally desync something from the server?

#

like make a lamp post only client side?

#

i dont need an explanation just a yes or no, before i attempt the impossible

#

if its impossible

rugged latch
#

awesome

#

all i needed to hear

frail escarp
#

how do i make a clothes mod?

#

like i need just the script for the item

#

okay i found the scrips but im looking to make masks

#

like bandannas

rain shard
#

Does anyone know the hotkey to bring up the Lua Console in debug mode?

undone tapir
#

~

rain shard
drifting ore
#

Question, With Sandbox options, Now i have basic knowledge how to use them in a mod, But how do i add Sandbox options into a items value like Happiness say i set it too 15 happiness each time they maybe eat this items, but the player wants to change the food item Happiness to something different?

open drum
open drum
hidden jungle
#

while translating my mod i just noticed that if i put an existing crafting tab like "Tailoring" it will add the recipes to the already existing tab. but if the language is changed then it instead makes a new crafting tab called Tailoring in english and puts them there.
how do i make zomboid translate text in the Recipes.txt file? or just in general make the tab work properly.

arctic fiber
#

does anyone know where I can access the file that handles discord bot for discord integration on dedicated server?

#

or is it not accessible?

patent holly
drifting ore
#

hi, do anyone know how to achieve using special characters from Spanish language, i.e รก รฉ รญ รณ รบ to be displayed in the UI strings?
edit: encoding with utf-8 w/o byte order mask it's not working for me ๐Ÿ˜ฆ

drifting ore
#

thanks!

nova socket
#

Anyone knows where the server time is stored? Killed all saved data besides players.db and it seems like its elsewhere. Checked out <servername>.db but found only

sqlite> .tables
bannedid   bannedip   tickets    userlog    whitelist

So nothing related to timestamp of server.
Want to wipe out server but keep players thus I cannot just use ResetID

nova socket
#

I'll check again but as I told I killed everything but players.db

errant sable
#

Ok, can anyone clarify for me about creating Scrollable UI components.
From what I can gather, it looks like if a component is "Scrollable" it must manage the drawing / rendering of its child elements itself... is this the case?

#

Bueller... Bueller....Bueller.......

sour island
errant sable
sour island
#

The drawing and rendering is automatically handled if the child is added.

errant sable
#

That is not what I asked at all

#

The rendering of elements in general is automatically handed, yes. You add something as a child to something else, it renders... however I am speaking about scrolling and Clipping

#

If you want to have a 'scrollbar' and want the scrollable region to be clipped, the Element which is the container for the scrollbar, must manage the rendering itself (so it seems)

sour island
#

The rendering and stenciling (the vanilla term) of child elements of a scrolling element should automatically be handled.

errant sable
#

or rather, if you want clipping, looks like you need to manage it yourself

errant sable
sour island
#

There's only 2 types of scrolling elements. Or you can build your own, which I did with errorMag.

#

What example are you seeing?

errant sable
#

Forget scrolling for a minute. Can you provide an example where clipping is "automatigically managed" by the element?

#

because I see every single UI element that uses it, handling it iself in its prerender and render fuctions

sour island
#

It's only handled for scrolling elements

errant sable
sour island
#

otherwise you'd need to call stenciling

errant sable
sour island
#

function ISScrollingListBox:prerender() has calls to stenciling

errant sable
#

Yup... but does it ALSO have to then render the child elements itself...

#

every example I see implies yes, it does

sour island
#

Can you provide a gif/screenshot of what you're seeing?

#

You also have to call self:clearStencilRect() after defining the stencil.

errant sable
#

In my UI, or in the code?

sour island
#

The UI in action.

errant sable
sour island
#

Are you asking if you need to run stenciling on each of the children?

errant sable
#
self:setStencilRect(stencilX, stencilY, stencilX2 - stencilX, stencilY2 - stencilY)

    local y = 0;
    local alt = false;

--    if self.selected ~= -1 and self.selected < 1 then
--        self.selected = 1
    if self.selected ~= -1 and self.selected > #self.items then
        self.selected = #self.items
    end

    local altBg = self.altBgColor

    self.listHeight = 0;
     local i = 1;
     for k, v in ipairs(self.items) do
        if not v.height then v.height = self.itemheight end -- compatibililty

         if alt and altBg then
            self:drawRect(0, y, self:getWidth(), v.height-1, altBg.r, altBg.g, altBg.b, altBg.a);
         else

         end
         v.index = i;
         local y2 = self:doDrawItem(y, v, alt);
         self.listHeight = y2;
         v.height = y2 - y
         y = y2

         alt = not alt;
         i = i + 1;
        
     end

    self:setScrollHeight((y));
    self:clearStencilRect();
    if self.doRepaintStencil then
        self:repaintStencilRect(stencilX, stencilY, stencilX2 - stencilX, stencilY2 - stencilY)
    end
#

This is the scrollable list box. You can see it is manually drawing the child elements

#

If you do not do this, nothing gets clipped

#

So simply adding something as a child , and then in prerender doing the stencil calls, does nothing

#

You must, in prerender, make the stencil call, render the elements yourself manually, then call clearStencil

sour island
#

Those are drawn rectangles - so not exactly ui elements.

errant sable
#

local y2 = self:doDrawItem(y, v, alt);

#

doDrawItem renders the child elements

#

notice its looping through self.items

sour island
#

Those aren't children elements actually, they're just drawing shapes and textures

#

children are held in the children list and are their own UI elements

errant sable
#

NO

sour island
#

Ok

errant sable
#
function ISScrollingListBox:addItem(name, item)
    local i = {}
    i.text=name;
    i.item=item;
    i.tooltip = nil;
    i.itemindex = self.count + 1;
    i.height = self.itemheight
    table.insert(self.items, i);
    self.count = self.count + 1;
    self:setScrollHeight(self:getScrollHeight()+i.height);
    return i;
end
#

The scrollable list box does not make a child element for each item, it manages its list of what the items are, then draws them itself

sour island
#

Yes?

errant sable
# sour island .

There are no child elements in a scrolling list box.... that is my point

#

there are no child elements in ANYTHING that does clipping

#

You must manually render anything you want clipped, between the call to setStencil and clearStencil

#

It has "chidlren" or items, but no child UI elements

#

It does not automagically manage and handle the rendering of clipping in any way

errant sable
sour island
#

I believe you mentioned them as children - so I was trying to clarify. Apologies if that's not something you meant.

errant sable
#

Yeah, terminology... the root of all evil, lol

sour island
#

But I do believe prerender/stenciling should apply to anything drawn onto an uiElement as well as children elements being attached. I can test.

errant sable
#

My issue is, this essentially means I need to make any elements I want "clippable" to have their own Draw function, and then have the scrollable container manually manage the clipping and drawing

errant sable
sour island
#

You're correct

errant sable
#

๐Ÿ˜ข

sour island
#

the bottom buttons are children of the window and not being stenciled

errant sable
#

So annoying, I need to write my own Scrollable Component, and make everything have its own Draw functions so I can clip things....

#

This is why their is an absurd over-reliance on the ScrollableList UI component throughout the entire UI, because nothing actually supports scrolling or clipping besides it

sour island
#

This is why I probably thought it did:

function ISUIElement:clampStencilRectToParent(x, y, w, h)
    if self.javaObject == nil then
        self:instantiate()
    end
    if self.parent then
        local absX,absY = self:getAbsoluteX(),self:getAbsoluteY()
        local stencilX,stencilY = x,y
        local stencilX2,stencilY2 = x+w,y+h
        if self.parent:isVScrollBarVisible() then
            stencilX2 = math.min(stencilX2, self.parent.width - self.parent.vscroll.width)
        end
        stencilX = self.javaObject:clampToParentX(absX + stencilX) - absX
        stencilX2 = self.javaObject:clampToParentX(absX + stencilX2) - absX
        stencilY = self.javaObject:clampToParentY(absY + stencilY) - absY
        stencilY2 = self.javaObject:clampToParentY(absY + stencilY2) - absY
        self:setStencilRect(stencilX, stencilY, stencilX2 - stencilX, stencilY2 - stencilY)
        return stencilX,stencilY,stencilX2-stencilX,stencilY2-stencilY
    end
    self.javaObject:setStencilRect(x, y, w, h)
    return x,y,w,h
end
errant sable
#

Yeah, it implies its supposed to work with the entire nested UI component thing

sour island
errant sable
#

but it doesnt, lol

sour island
#

Only used in combo boxes - which I think are drop downs?

errant sable
#

Yea, they are drop downs

#

and what I think its doing is say the combo is in a panel, it makes sure the combos drop down doesnt overflow its outter panel by adjsuting the clipping rect I think

sour island
#

You could just drop those calls into your UI - or are you concerned with the overhead?

errant sable
#

They dont actually do anything

#

Well im sure they do, but in terms of if you are trying to clip things which are children ui components, it has no impact

#

This is what I was working on, redoing the trait selection screen, and I wanted a nice grid container with scrolling

#

Each trait entry is its own actual UI Element, and they are a child of an ISPanel component

#

In order to fix it, I need to make a custom Panel component (to handle the calls to set and clear the clipping) and then I need to make the Trait UI elements have a draw function, which renders them, instead of using any of the built in rendering

#

I literally might as well rewrite / write my own base UIElement class that actually properly does scrolling and clipping with nested child elements.

sour island
#

Looking at the clipping thing myself now, and it does appear to not want to play nicely

#

What I did with gameNight was actually only use 1 UI element

#

everything else is textures and I interpret what's being selected based on where the textures are expected to be

errant sable
#

I could do that, but I am working on a complete UI overhaul with someone, and so we will have multiple spots where we want scrolling and clipping of various different elements. Going the route you did and like ScrollableList is ok for one or two things, but I have no idea how many different layouts things in a scrollable container we might end up with

sour island
#

You can also add these to a scrolling list already no?

errant sable
sour island
#

I think you can kind of determine that using drawItem

errant sable
#

I wanted grid, left to right, top to bottom

sour island
#

I also made my own for gamenight using textures only - the additional benefit is alot more friendly on performance

errant sable
#
function ISScrollingListBox:doDrawItem(y, item, alt)
#

The signature only gets the Y, item, and alt ๐Ÿ˜ฆ

sour island
errant sable
#

I mean I guess Y kinda gives me its order, and then I could check size, and calculate that all in the draw funciton

#

Yeah, I could do that. I feel like the better option is just to make a better base UIElement

sour island
#

This window is I think 3 elements, close button, inner box and the main window

errant sable
#

Like it sucks, dont want to write it, but in the long run I think it will be worth it

#

Because really I want to be able to throw "anything" in a scrollable area, and have it "just work"

sour island
#

You can extend the scrolling list and modify it as needed too

errant sable
#

dont want to have to write spahgetti code to wire it up to "act right"

sour island
#

Using the derive functions the vanilla shows

#

you basically borrow the template for scrolling list, and make your own

errant sable
#

Yea... Like I said, it is doable. I just dont like the methodology.

sour island
#

I still can't seem to get children to stencil even when called

#

I'm probably doing something wrong

errant sable
#

Ill make a new base UIElement, derive everythign from that, and call it a day, lol

errant sable
#

I suspect they are using an older openGL version (which makes sense for a 10 year old game)

#

and stencil is something that appies till you remove it... and in a UI this can be a pain in the ass. It is common for a UI system to pop the old stencil off before it renders its element

#

However, most UI systems have a way to control this as well, so it DOESNT happen, so you can do nested stuff like this

sour island
#

there we go

errant sable
#

You got it clipping child elements?

sour island
#

Yeah

#

the close button and + are children of the main window

#

probably related to how I wrote the element

#

but I call the stencil in prerender and clear stencil at the end of render

errant sable
#

interesting... so what is different here than in your other test that didnt work?

sour island
#
    self:setStencilRect(0, 0, 100, self.height)
    local children = self:getChildren()
    for ID,child in pairs(children) do child:setStencilRect(0, 0, 100, self.height) end
    self:clearStencilRect()
    local children = self:getChildren()
    for ID,child in pairs(children) do child:clearStencilRect() end
#

I had it under prerender or render entirely

#

seemed to ignore children

errant sable
#

oh shit

#

your setting the stencil on each child

sour island
#

yeah lol

#

I tried using the other thing I found and it did fuck all

errant sable
#

yeah, i mean if this works, awesome

sour island
#

My guess is children get their renders and prerenders called after the parent

errant sable
#

I would have liked something like
self:setStencilRect()

self:clearStencilRect()

and it cascaded on its own, but if this works, awesome

sour island
#

The math for the stencil needs to be adjusted for children's positions I think

errant sable
#

Well this is awesome, means I do not need to write a whole new base UIElement, I can jsut write a new base "ScrollablePanel"

#

Thank you for your intrest and assistance, saved me from remaking the wheel tonight

sour island
#

No problem, and it does appear weird

errant sable
#

It is wierd, lol. I was about at my wits end with it.

sour island
#

I am noticing issues with the stencils at 0/0

errant sable
#

Yeah I had some wierd issues where trying to use the stencil turnd random things black all over the screen. I just assumed I was doing something wrong at the time, and probably was.

sour island
#

Seems like it's using the stencil applied to the children for the parent

#

I think calling on the children may not be necessary after all - may just need to separate the stencil and clear

errant sable
#

could be... setStencilRect is probably just a pass through function on all elements calling down to the openGL function to set a stencil

#

it doesnt actually care what its on

cedar kraken
#

Quick questionโ€ฆ whatโ€™s a stencil, child/children, and parent in a coding context?

errant sable
#

We are speaking about UI. So say you have UIElement A. You can add another UIElement to it via :addChild() so now UIElement B is a child of UIElement A

#

UIElement A is the Parent of UIElement B

#

a stencil, is essentially a mask. You are saying only draw within the region specified

sour island
#

yep confirmed

#

drawstecil in prerender and clear it in render

errant sable
#

Well... hold on

#

Do you have additional UI elements that should render that are not IN that window/panel?

#

Like ELement A (that panel) pre render - stencil is set.
If there are other elements that appear after it, wont their prerender be called also, and be impacted by the stencil?

sour island
#

The close button and +

errant sable
#

and wont it also impact the render pass of any elements "before it" in whatever list its in as well?

sour island
#

Are children elements - and I'm only calling stencil on the parent

errant sable
#

Yeah, but do you have another element on "the same level" as the parent, but after it?

#

I feel like setting the stencil in prerender, will cause "overflow" into elements on the same "level" as that element

sour island
#

Not sure what you mean about same level - visually or?

errant sable
#

Ill find out in a minute, but was just asking if you had tried it

sour island
#

The box inside the element is a rect

#

The two buttons are child elements

errant sable
#

ok
UIManager
|-------Element A
|---------------Close Button
|-------Element B

#

Element A in its pre-render calls setStencil

sour island
#

I would need to check

errant sable
#

This works for Close button, but I am wondering abotu what happens to Element B

sour island
#

Whatever the parent is should impact - if it's not a child you'll need to call stencil on it too I guess?

errant sable
#

Im gonna find out here soon, im not sure that is the case, unless it calls pre-render and render for an element, before it goes onto the next

sour island
#

Making stuff children usually locks up how they can behave I found.

errant sable
#

ElementA.prerender
ElementA.render

vs

ElementA.prerender
ElementB.prerender
ElementA.render

Is what im wondering about

sour island
#

Like if you add a child that's not inside the bounds of a parent you can't click on it

errant sable
#

Nod, yeah im not talking about another child, but rather something with the same parent as the main panel we are calling setStencil in

#

Gonna find out in a minute

#

ARG, the tutorial needs a damn confirmation button. Just accidently clicked on that

#

So close, yet so far

#

For some reason its not clipping the text...

#

It clips the button BGs now, but not the text

#

And setting the clipping in prerender and clearing it in render does not impact Elements which are hieracically "next to" the main panel, which is good, it was what I was worried about

nimble badger
# errant sable

I have no clue how coding in zomboid works but this looks really good!, how did you call the images for each "Child"(Im refering to each box), just wondering

errant sable
#

the image for a trait is a property on the trait object

nimble badger
errant sable
sour island
#

Is the text drawn in prerender or render?

errant sable
errant sable
#

The titles are not rendering... just the descriptions

#

The descriptions use the RichTextPanel

#

So i bet something with it (because it also uses clipping) is interfering

sour island
#

Maybe it's parent-prerender, child-prerender, parent-render, child-render?

#

Are the rich text panels children?

errant sable
errant sable
#

but I am pretty sure its because they set their own stencil as well because they do scrolling. So it is probably over-ridding the currently set stencil

#

I can get rid of them and just make my own function to split the text. I only used the richTextPanel because it "automagically" handled that. I dont actually need the scrolling and clipping of it

sour island
#

True

errant sable
#

man, thanks a million

sour island
#

No worries ๐Ÿ‘

#

I'm slowly learning to like UI

#

It's pretty versatile

#

So each box is its own UI element?

errant sable
# sour island No worries ๐Ÿ‘

Yeah, the PZ UI is not awful, not the worst I have seen for sure. I however have spent the last year working on the UI System for my game making it "perfect" to work with... everything is jsut so easy... that switching to anything else is like torture

nimble badger
# sour island No worries ๐Ÿ‘

You both probably are geniuses with lua and brushes, unbelievable!, And I aspire to just make a simple detect on hit for zombies for explosions haha

errant sable
sour island
#

And the main window is scrolling?

#

Hmm

nimble badger
errant sable
nimble badger
errant sable
errant sable
nimble badger
#

3d or 2d cause if its 3d that is just...

errant sable
nimble badger
errant sable
#

It is designed with procedural generation in mind as well, which most engines barely consider if at all

#

Unity has long standing bugs with procedural generation of meshes causing memory leaks, since like FOREVER

nimble badger
errant sable
nimble badger
#

And if it has Ai paths .... we are seing the next red dead redemption on its works

sour island
errant sable
errant sable
sour island
#

You're basically all but using a scrolling list* - would just need a little TLC to adapt it to have columns

errant sable
sour island
#

May have some performance improvements using less elements too

errant sable
#

A real nice customizable base scrolling panel

nimble badger
errant sable
sour island
#

For the card search window I calculate scrolled values and do some math based on texture sizes

errant sable
nimble badger
errant sable
errant sable
sour island
#

I'm more worried about mods that add a couple dozen extra traits

errant sable
#

Yeah, the entire thing is gonna go through testing. I am developing this with a couple other people (dont want to mention who as the main person hasnt mentioned it themselves as far as I know yet).

#

So well make sure to get mods that add a metric ton of traits, and everything else

sturdy salmon
#

Good night. Consultation. I'm trying to add refrigerators with freezers into the game, using assets that already exist currently. However, I can't use the ISWoodenContainer, because I wouldn't have both. You could have the freezer or the refrigerator, but not both at the same time. I don't know if I will have to create a new object, inheriting from one that already exists, or I don't know how to add that double functionality.

#

If I pick it up and place it, it creates fine. The problem is creating it initially.

#

It is as if they were 2 boxes, one on top of the other, or one inside the other, and one acts as a refrigerator and the other as a freezer.

#

I can add only 1, not both.

fast galleon
errant sable
sturdy salmon
#

Yes, right son. In fact, when you pick up the game object and place it, it is added as it should be. The problem is adding it the first time. My idea is to use a context menu, like the one in carpentry, and add several objects, whose assets already exist, because I am going to use the vanilla ones for now.

sturdy salmon
#

I want to add, all kinds of tiles, starting with the vanilla ones. Televisions, refrigerators, freezers, etc.

fast galleon
sturdy salmon
#

Ovens, washing machines, dryers.

sturdy salmon
#

Is there a mod that uses it?

#

How to see an example of the implementation.

fast galleon
#

It is used in vanilla ISMoveableSpriteProps.lua when you place a moveable.

sturdy salmon
#

Anyway, the problem is not placing it in the world. I am being able to do that. What I cannot do is make it fulfill both functions simultaneously, that is, refrigerator and freezer at the same time. I can only make it fulfill 1 of the 2. And if I pick it up and put it back, then it restarts and then both functionalities appear.

#

Anyway, I'm going to check it out.

#

๐Ÿ™‚

sturdy salmon
#

Nice.

#

Thanks.

arctic fiber
#

So I want to do something with the discord integration and so after browsing through the files I managed to find the class that handles the DiscordBot for discord integration, I also saw the classes that handles the message for the chat in game, so the question is if I decompile and edit it then compile again, will it cause a problem to the game?

arctic fiber
#

do you know the version of their jdk?

drifting ore
rugged latch
#

this just adds a perk level

#

the integer is how many perk levels it adds

#

welllll

drifting ore
#

okay, thanks for the info! could i ask what func does the boosting thingy?

rugged latch
#

let me check rq just to make sure

drifting ore
#

like when you read a book, i.e

rugged latch
#

AddXp right there

#

so youd have to get the player, get the xp object, and then add xp to it

#

like this

drifting ore
#

and that's the addition to the perk exp gain when achieved, right? thanks <3!

rugged latch
#

that adds the amount of xp you tell it to, if you wanted to like multiply how much xp you gained from a skill, you would have to check whenever the player gains xp and add an extra amount based on how much they got

#

buttt if you dont need that then yes that should work just fine

red whale
#

hey guys, is it possible to get all the saved players from a multiplayer server?

#

if yes, how should I do that on a proper way?

#

should I read up the save files?

#

I've found getAllSavedPlayers but its deprecated and it seems like it does not work in a mp environment

arctic fiber
#

player.db

#

you can find it on Zomboid/saves/multiplayer/servernamehere

nimble badger
#

Hellos, 2 quick questions, how can I code a lua file that 1 detects the weapon in the players hand and 2 checks if a zombie was hit by a bullet and 3 creates an explosion. Im also having issues understanding how I can add a separate magazine attachment for animations. Thanks

neon bronze
#

OnHit Event

nova socket
#

Can anyone deny or confirm (better with link to thread somewhere) that Zomboid has some sort of issues with some AMD hardware?

nova socket
rugged latch
#

oops

nova socket
#

I might also be wrong but I think its not int either its float/double or something.

rugged latch
#

really?

#

i assumed this is for when adding traits

#

or giving traits xp

#

i use this same thing and thats what it does

#

weird that they give it diff functionality with same name

#

waitttt

#

let me check rq lol

bronze yoke
#

it is an int, there are preset multipliers and you give an index of the multiplier you want

nova socket
#

It's a method of trait, part of traits factory. So if you have some trait like "Big Guy" that you can choose from creation list. addXPBoost(Perks.Strength, 1) will add % boost to strength when its picked

#

trait:addXPBoost(perk, int)

#

its not getXp() method

rugged latch
#

yea it does also give you a skill level too

bronze yoke
#

1 = x4, 2 = x5, 3+ = x6 (generally, some perks are weird)

rugged latch
#

ye forgot to mention the xp boost

#

my bad

rugged latch
#

what if i just wanted to add

#

25 boost

#

is that not an option?

bronze yoke
#

nope

rugged latch
#

wow

#

bummer

#

good to know tho

nova socket
#

you kinda can

#

but not through trait thou

rugged latch
#

if there is a will theres a way, i was just wondering if there was built in stuff.

nova socket
#

But its like.. plain value, number I believe can be float/double

#

But its also wonky

bronze yoke
#

that's just because you've gotten that from a luadoc

#

lua has no distinct number types

#

java does and calling a method will convert to the correct one, in this case an int

nova socket
#

I mean yeah, some do some don't depends on whats under the box as you said.

#

so setPerkBoost is also rounded to int then?

bronze yoke
#

yeah

nova socket
#

oh well

nova socket
bronze yoke
#

didn't know typescript used a number type too, but same idea applies

cinder oyster
#

hey so i was thinking of making a mod where on spawn you get like medallion, which youll be able to wear, and after a bunch of differant kill milestones, it will be upgraded and maybe give u effects like after 5k kills you wont get stressed anymore, or another could be after 7k you can move while aiming and your accuracy won't be decreased (this is an idea from the insurgent mod, where the run and gun trait lets you walk around without losing accuracy while aiming).

#

I made a melee weapon mod a while back, and im proud of it, but this would probably be my magnum opus, so i figured itd be worth asking if anyone would wanna use it. I dont know if i want to pour a bunch of time into a mod that most people will just find useless

#

the other thing is that I wanted to ask if it was possible to have a 3d model be emmisive (im not talking abt a tile, im talking about like an item or a wearable) without just smashing your fps down

#

my idea with the emmisive or animated model, is that the medalion will light up, and pulse like a heartbeat, depending on how close you are to reaching a milestone.

#

another idea i had, was instead of just a medallion, you could get a slash or a sling, and after getting kill milestones, or acheivements, you could get patches or medallion, which might be more feasible for someone who knows so little abt modding to begin with

fleet bridge
#

And I played a lot on a desktop 5600 with no issue

hollow current
heady crystal
#

โ˜๏ธ

#

Balance. Always.

#

I have made various mods that practically nobody uses but hell if I loved making them

sour island
#

Good stuff on the thursdoid

#

Glad weapons are being fleshed out more away from "broken"

neon bronze
#

I loved the name

#

โ€œProcedural weapon damageโ€

sour island
#

Maybe I'll be able to make my weapon combo mod a reality now ๐Ÿ˜…

neon bronze
#

I hope they can make it so that you could add new attributes yourself to weapons

#

Like they did with sharpness for spears

fast galleon
#

not as catchy as quantum AI but it works

neon bronze
#

Yea we just need to sneak in ai and chatgpt and every product manager will love it

errant sable
errant sable
#

Putting "AI" and "ChatGPT" arbitrarily into produts is a sure fire way to guarentee I will no longer be using them, or a paying customer.

#

THat is the same kind of absurd mentality that sees us putting computers in everything, and non-sense like clocks on vacuums.

cedar kraken
#

Is the Cook hobby and occupation trait still broken in vanilla?

arctic fiber
#

Helloo, I want to add something on the Discord Bot that the discord integration handles I want to add extra features and edit the message it sends, I found the class that handles this but do I need to decompile all the files and recode it? or can I specifically just edit the class that I Want and is it not illegal(didn't read the terms and conditions)?

astral fog
#

I was wanting to have an item function only work during the day time. Any advice on how to go about this? I have been reading code from a few weather mods but the amount of variables can be confusing. I came across these classes that could possibly help with this problem.

getDayLightStrength

getNightStrength

getGlobalLightIntensity

I am new to scripting and lua language but I'm getting there SLOWLY.. which of these would y'all use to achieve this? Is there another method that I should try? Thanks ๐Ÿ˜Š

astral fog
sour island
#

He did, also other super popular mods including the #1 spot for most popular of all time ๐Ÿ˜…

mellow frigate
rugged coyote
#

Hello, could someone tell me if in-game item distributions and the ability to spawn an as admin separate lists? I'm not seeing the item in item viewer and I'm not seeing any stack trace exceptions in my console.txt thank you

mellow frigate
rugged coyote
#

It is a simple food item, not a movable object. Perhaps I made an error in the distribution lua file. Thank you.

sour island
arctic fiber
#

i don't need to decompile the other class?

errant sable
#

How do you get the Invetory Icon for an item? I thought it would be getIcon but its displaying nothing for everything

#

To answer my own question in-case it helps someone in the future

    local icon = item.item:getIcon()
    if item.item:getIconsForTexture() and not item.item:getIconsForTexture():isEmpty() then
        icon = item.item:getIconsForTexture():get(0)
    end
errant sable
sour island
#

uh seems like in your case it may be item.item

errant sable
#

Oh no, the code there was just an example I had found in the vanilla files... in my code its just item

#

Was a little more to it. The response from getIconsForTexture():get(0) is a string, and to ge tthe texture, you need to combine it with Item_ so getTexture("Item_" .. icon)

      local icon = item:getIcon()
      
      if item:getIconsForTexture() and not item:getIconsForTexture():isEmpty() then
          icon = item:getIconsForTexture():get(0)
      end
      if icon then
          self:drawTextureScaledAspect(getTexture("Item_" .. icon), 10, yPosition, 32, 32, 1, 1, 1, 1)
          yPosition = yPosition + 34
      end
mortal ridge
#

does anyone know where i could find resources for making custom occupations? google hasnt given me much helpful stuff

arctic fiber
#

any idea how I can edit it? I decompiled it on intellij IDEA but I can't write on it even tho it is set as writable

heady crystal
#

Or... worse. Looks at hive mind

#

But I look up to you and Tcherno. Love your mods, I use many

mortal ridge
hollow current
mortal ridge
arctic fiber
clever spruce
#

How would I go about directing one mod to read another mods files?

#

I'm trying to see if, with very little knowledge on the subject but a decent mind to figure things out as I go, add compatability between two mods via a third patch mod. Thus, I'm thinking I can simply add the file structure of the mod whos compatability i'm trying to add to the
require ('xxxx')
line and the required sprite / entity to the second
require ('xxxx')
line?

the below is the raw data from the mod I'm trying to copy a line from to add compat to.

    return
end

require 'MetalDrum/SMetalDrumGlobalObject'
local _, _, barrelCols = unpack(require 'ValidDrums')```
drifting ore
#

open the file with a relative path reference, iterate the lines and extract what you want, i'd try that process imo, may be wrong, just trying to help ^__^

rigid willow
#

Hey, I'm making my first clothing mod and I'm having some trouble adding it to the zombie outfits, the model works in player and in player zombie but, when i add it to an outfit the spawned zombie spawns naked. I also copy pasted some outfit from the base game and it also appears naked, is there some any other file than clothing.xml to edit? Thank you very much

clever spruce
#

not really understanding what all that means tho.

clever spruce
#

I'm new to lua.

#

entirely new.

#

w<

#

some of those terms don't make sense to me, as in I don't know what they mean.

fast galleon
#

๐Ÿชฆthis might be too hard for you then

clever spruce
#

๐Ÿ˜

hollow current
# clever spruce could I get that in captain dummy talk?

He means basically open the file using the code, loop over the lines, and then extract what you want if I am not mistaken, although I am having trouble understanding what is it exactly you want to do/what for. Maybe there's a better approach to it

hollow current
bronze yoke
#

could you explain clearer what you are trying to do?

fast galleon
#

Lua is mostly tables and that is rather flexible. However if you need to change local variables then you may need to overwrite some files.

drifting ore
#

honestly, why do you bother into fixing other people code?

#

if you really want to learn, start by building something from scratch, on the basics and/or trying to figure out how a simple mod script works, then try to implement some of the logic into your own mod script

#

there are many ways on how could you, but what you trying to do it's not a target for someone who doesn't know lua basics, so...

#

on topic: extracting the lines from the file, just give you plain text i assume you'll need to figure out how to make that into actual functions or variables to be called/intercepted

jaunty moat
#

Do any of you know where i can find the files for the Map Order/Mod Order? i found them for SP but cant find them for MP

hollow current
#

Would someone be able to point me to a resource that explains how to create a new event? I am attempting to create my first framework which would be based on vehicle damages

bronze yoke
#

LuaEventManager.AddEvent("MyEventName")
triggerEvent("MyEventName", ...)

#

imo events from lua is a bit redundant (why go lua -> java -> lua) but the overhead hasn't seemed like much from my testing and it's pretty simple to set up

hollow current
#

oh. I thought it'd be more complex but that looks easier than I anticipated. Thanks!

rugged latch
#

shizzzz i was making my own everything for "custom events" lol

#

just never thought to see if you could add new ones i assumed you couldnt

#

huh

bronze yoke
#

you still should

#

using vanilla event system is just going lua -> java -> lua

#

there's no need for that overhead

rugged latch
#

yea i do guess your right

#

ill lose the prettyness a bit

#

but its for the greater good

bronze yoke
#

however in my experiments with rewriting vanilla lua-only events i didn't see as much of a performance gain as i expected

errant sable
#

and even then... the gain would be minimal

bronze yoke
#

yeah i tested the highest performance impact ones and it still wasn't that significant

#

most of the impactful events don't come from lua to begin with

#

so they weren't part of the scope

errant sable
#

Nod, makes sense

bronze yoke
#

(though i did optimise those a little too)

#

but the logic isn't really that difficult to reimplement so if you can be bothered to do it i recommend it

errant sable
#

Oh yeah, I have been using my own custom event dispatches for the same reason as marley, just didnt know you could hook into the main system like that, lol

#

plus it seems silly to use a global event system, for events on a component based architecture, unless it needs to be a global event

fast galleon
errant sable
#

For instance, there is no reason any of my UIPanels which emit events when certain things happen within the panel should use the global event system. If you want to be aware of an event which took place on the panel, subscribe to the event on the panel.

fast galleon
#

it's your choice if you want to add a global interface or not

digital linden
#

how to replace moodles?

errant sable
#

If i put .md files in my lua directory for my mod what will happen?

  1. Nothing it will ignore them
  2. The game will crap its pants and throw errors?
  3. It wont crap its pants, but it will in some messed up way try to load them
  4. something else
#

I would like to provide .md files next to each lua file which contains relevant helpful information for interfacing and usage of the code in the specified lua file

fleet bridge
#

Hi, I'm trying to use context:removeOptionByName() and it doesn't seem to work for a particular item, but it works for everything else.

#

Doesn't seem to want to remove the options - any idea why?

errant sable
fast galleon
fleet bridge
#

Thanks for responding though ๐Ÿ™‚

#

-_- there's a space after Grab

#

lmao

bronze yoke
#

you should try and find the translation strings instead of hardcoding the text

#

otherwise your mod will only work in english

fleet bridge
#

good point

#

good call, thank you for that albion

digital linden
#

how to replace moodles?

digital linden
thick karma
livid badger
#

friends, who can tell me an example/reference for spawning a simple tree?

fervent steeple
#

Hey guys, was just working on my first mod and am trying to make a "dressing" type item that will act as a poultice and increase healing speed. Does anyone know how I could go about implementing that since it's not just a normal option?

tawdry solar
#

what does this line of code in a tshirt decal mean?

tawny olive
#

not sure if this is the right channell, but I was looking foward to make a radio transmission mod. What that is is to modify some pieces of news and make it so that instead of being 1993, it is based in 2005. How do I changed the broadcast transcripts?

winter bolt
tawdry solar
#

thanks

upper bane
#

i am not sure where i went wrong, it was working before i uploaded it to the steam workshop so i can only assume i made a mistake with the folder setup somehow? ๐Ÿค”

#

contextually all the mod does is add in a ```CardiologistBaseGameCharacterDetails = {}
CardiologistBaseGameCharacterDetails.DoProfessions = function()

local cardiologist = ProfessionFactory.addProfession("cardiologist", getText("UI_prof_cardiologist"), "prof_Cardiologist", 2, getText("UI_profdesc_cardiologist"))
cardiologist:addXPBoost(Perks.Doctor, 2)
cardiologist:addXPBoost(Perks.Fitness, 1)
cardiologist:addXPBoost(Perks.Sprinting, 1)

local profList = ProfessionFactory.getProfessions()
for i=1,profList:size() do
    local prof = profList:get(i-1)
    BaseGameCharacterDetails.SetProfessionDescription(prof)
end

end

Events.OnGameBoot.Add(CardiologistBaseGameCharacterDetails.DoProfessions);``` profession so i am not quite sure why it isn't showing up in the profession list like it did when i was testing the mod in the mods folder

hollow current
upper bane
hollow current
#

would you happen to be subbed to it by any chance on the steam workshop?

upper bane
#

yeah i figured i would switch on over to the steam workshop version since i was finished

hollow current
#

Try to unsub from the steam version and then check if your local version is still working as it is expected to

upper bane
#

well i feel like i was hallucinating now as it doesn't seem to work even though as far as i am aware i have undone the changes to the folders required to publish it on the workshop

#

fixed it ๐Ÿฅณ made the mistake of somehow getting rid of the media folder when transitioning over to the new folder format to upload to the workshop

#

honestly not sure how i managed to so that but all's well now though it has occured to me now the heart should be whiter i think

calm shale
#

is there any mods with a half life HEV suit?

polar schooner
#

super new to blender and modeling, does anyone know why my baby's first sword model would show up as a cube in game?

polar schooner
#

i had a hidden cube in my outliner... i've got a lot to learn

errant sable
uneven ore
#

Heya, How do i make the Players Hp capped at 50% hp?

arctic fiber
#

anyone knows if pz uses JDA or Discord4j as an api for the Discord Bot Integration or they use something else?

stark spade
#

Hello, I want to see the character penalty Moodle code based on Vanilla Payne level, but I couldn't find it, do I need to decompile Java?
We found penalties for additional activities such as fitness, but we couldn't find any penalty-related codes for character capabilities (ex: accuracy, probability of falling).

arctic fiber
stark spade
ionic shale
#

any modders that do work?

#

dm i have questions

unique veldt
#

So how could one start working on a radio mod

#

Adding a station and text

hollow current
merry fjord
#

hi does anyone know how to add a new perk bonus to an existing occupation? even a mod I can refer from is welcome.

fast galleon
merry fjord
#

Do i need to redeclare all the professions or can I just do below as an example

local function burglarOverride()
local burglar = ProfessionFactory.getProfession("burglar")
burglar:addXPBoost(Perks.YourPerkHere, 2)

end

Events.OnGameBoot.Add(burglarOverride);

fast galleon
#

no you do not to redeclare the other professions, unless you name your file as the vanilla file

merry fjord
#

Thank you so much!

merry fjord
#

local vanilla_DoProfessions = BaseGameCharacterDetails.DoProfessions
BaseGameCharacterDetails.DoProfessions = function()
vanilla_DoProfessions()

local engineer = ProfessionFactory.getProfession("engineer")
engineer:addXPBoost(Perks.Lightfoot, 10)
engineer:setCost(-10)

end

Events.OnGameBoot.Remove(vanilla_DoProfessions)
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoProfessions)

So I did something this, on a unique lua filename but it won't work. (Just a sample to see if it's working)
Do i need to declare something else?

Thanks for additional guidance

fast galleon
#

if you don't see the light foot perk on the right side or the cost change then add prints and verify that the file or mod are added correctly.

#

this should work if you call it after you make the changes BaseGameCharacterDetails.SetProfessionDescription(engineer)

merry fjord
#

Ohhh yeah that was missing thanks a lot Berry

merry fjord
#

didn't work for me so I just redeclare the profession changes like SOTO did and it worked for me. For some reason, the getProfession won't work from my end, i think

slender cargo
#

Anyone got a video or guide of some sort on making and publishing a melee weapon? Wanted to make a mod as a Christmas gift for a buddy with just the one weapon + a craft for it

thick karma
#

I generally just get pulled into certain passion projects based on what I really want to see in the game.

ionic shale
#

Just wanting server specific shit and fixes

#

not sure where to look tbh

thick karma
sharp stratus
#

Is there a mod that lets you run over zombies without getting slowed down?

hollow current
#

How do you go about refreshing a UI? I am using the following approach:

function MyUI:onOptionMouseDown(button, x, y)
    if button.internal == "CLOSE" then
        self:setVisible(false);
        self:removeFromUIManager();
    elseif button.internal == "LEFT_ARROW" then
        -- Update the visible range to show the previous set of buttons
        visibleRangeStart = math.max(visibleRangeStart - 10, 1)
        visibleRangeEnd = math.min(visibleRangeEnd - 10, #self.skillTrees)

        -- Refresh the panel with the updated visible range
        self:refresh()
    elseif button.internal == "RIGHT_ARROW" then
        visibleRangeStart = math.min(visibleRangeStart + 10, #self.skillTrees - 9)
        visibleRangeEnd = math.min(visibleRangeEnd + 10, #self.skillTrees)

        -- Refresh the panel with the updated visible range
        self:refresh()
    end
end```, but this is throwing an error. I could try destroy it and and show it again, but feels like a dirty approach, assuming there's a better way/function I am not aware of
drifting ore
#

what's the error?

hollow current
#

at the self:refresh() line

drifting ore
#

are you sure the class got that method?

hollow current
#

that's what I initially thought, as per the vanilla files, but I believe i was mistaken

#

i can't find the relevant UI class on the zomboid docs either

bronze yoke
#

what exactly are you trying to refresh?

hollow current
#

the current UI panel shown to player

bronze yoke
#

visually you shouldn't need to, the game redraws the ui every ui tick anyway (tired)

bronze yoke
#

it's a lua class, you won't find it on the javadocs

bronze yoke
#

yeah, if your ui is showing it is being rendered every tick

drifting ore
#

from UIManager.java

public static void update() {
      if (!bSuspend) {
         if (!toRemove.isEmpty()) {
            UI.removeAll(toRemove);
         }

         toRemove.clear();
         if (!toAdd.isEmpty()) {
            UI.addAll(toAdd);
         }
...```
hollow current
#

hmm I must be doing something wrong then. I have the panel elements dynamic in myUI:create based on certain variables defined outside the scope of create. When a user clicks a button, those variables update, so supposedly, the panel should update as well, but that doesn't happen unless I close it and re-open it

hollow current
#

looks so

drifting ore
#

try self:update() instead of self:refresh()

bronze yoke
#

what does your render function look like?

hollow current
bronze yoke
#

where are these visibleRangeStart visibleRangeEnd variables actually being used then?

hollow current
bronze yoke
#

you'll need to push the new variables to the objects then, create is only called when initially creating the ui (usually at game start or when opening it)

hollow current
#

what about render? Is that what is being actually called every tick?

bronze yoke
#

i'm guessing since your render is empty what you're actually displaying is a child element created in the create() right?

hollow current
#

yup

bronze yoke
#

so you need to update that object's property directly rather than visibleRangeStart/End

hollow current
#

I see. I will try that, thanks!

versed eagle
#

Hey guys, not sure if this is the right chanel to ask this, but is there a more up to date post on how to make vehicles? I've followed Ringo's post to the T and I've managed to get the model to spawn, but it's just a shadow. My guess is that either I didn't compile the model correctly, which I can't find any info on, or I didn't set the code up properly for the model.

I also noticed two things, every one else is using a "models_X" folder instead of "models" and secondly the link for the ply to pz converter doesn't work. I was told I can just use an FBX file instead, but that doesn't give me a txt file which the guide claims I'll need. Any help would be greatly appreciated, or if this isn't the right place to ask these questions, a point in the right direction would be awesome

arctic fiber
#

I'm planning to add extra features the Discord bot on pz that handles discrod integration but when I checked it the api it used is outdated, if I use an updated api and change what needs to be change will I still be able to recompile it then plug it in without any problems?

worthy terrace
#

General question, is is possible to get multiple players โ€œStatesโ€ and โ€œHistoryโ€ of actions? Also, can a mod connect to the internet? I have an idea for a really fun mod, that generates user stories, based on playersโ€™ actions and history, using ChatGPT. Thoughts? Kinda want to set expectations before I dive in. Iโ€™ve done mods for MC, Factorio, Valheim, etc.. but never dabbled in PZ

nocturne swift
#

Question regarding vehicle settings... maybe someone knows what this is and how the values affect
offRoadEfficiency = 1.1 - does it work? I increased/decreased it, didnโ€™t notice the difference
engineRepairLevel = 5, - I have no idea what this is
gearRatioCount = 4, - if itโ€™s the number of gears (from the name) what does it affect?
isSmallVehicle = false, - does it affect anything?
I figured out the other settings ๐Ÿ™‚

UPD. although there seems to be an effect from offRoadEfficiency , with low values the car drives better off-road

tame mulch
nocturne swift
#

Can you tell me how you did the overlay on top of the snow? I have a similar problem)

granite moss
worthy terrace
bronze yoke
#

the game doesn't record a history of any of this, you'd have to record it yourself

worthy terrace
#

Yeh I realize Iโ€™ll have to capture it, more concerned if Mods have a limitation on network access.

bronze yoke
#

i doubt you'll be able to get the game to communicate with chatgpt

sour island
#

The game does log alot of stuff actually - but for something this detailed you'd need to add more logged events.

#

Also the only way to have the game interact with outside programs is to rely on text files.

#

Game can output to a text, and have a 3rd party program read it and output to another - for the game to grab.

mellow frigate
bronze yoke
#

oh, i don't mean that chatgpt can't do it, i mean the zomboid can't do it natively

worthy terrace
sour island
#

That's the only way to go about it with the standard modding APIs

#

I'm sure there's other possibilities using Java

nimble badger
#

whats the event for checking the players current weapon?

fleet bridge
#

There's an event for equipping something on primary and secondary

#

But it's not specific to weapons

mellow frigate
sour island
#

Seems like there needs clarification on event vs function

nimble badger
# mellow frigate You can use OnPlayerUpdate to check anything on the player.

Right... how do I point to the change in primary weapon then?, I'm just trying to make the game create an object on the position where the opposing zomboid was hit by the bullet, idk exactly about the code but basically along the lines of: Events.OnPlayerUpdate, check (primary weapon name and if its equipped), then wait for: onhit, then spawn pipebomb on x,y

nimble badger
errant sable
# worthy terrace So Iโ€™m thinking of feeding some data to GPT. Player movement, actions, position ...

For what purpose? Also, how do yo uplan on distributing the external application you would need to run to make this possible? Does steam let you incldue compiled applications? Are you gonna just provide the source and make people compile it? I know I would absolutely NOT put my openAI key into any mod from the steamworkshop, ever, for any reason, but most certainly not a compiled program to which I can not see the source

outer crypt
#

got an odd issue, if I use addItem to put the item in a player inventory its fine, but if I put it in a container with addItem and pick it up the item disappears. If I put the items from the container on the ground first and then pick them up they are fine... containerObject:getItemContainer():AddItem(musicItem)
player:getInventory():AddItem(musicItem)

#

is there some sort of item sync a server needs after the add item? or maybe a container sync?

#

This actually happens on all my mods and I drop into the player to avoid it

errant sable
outer crypt
#

I'll take a look and see, in the debugger it logs the moves as normal and it moves into the inventory and then right after evaporates with no logged changes made

errant sable
outer crypt
#

hilariously enough it shows the movement of items

#

and the movement logs look identical

errant sable
#

and what exactly is that telling you.....

outer crypt
#

nothing, lol

errant sable
#

so, the debugger isnt telling you jack

#

I would recommend looking in the vanilla files to see how the game handles it. If i knew myself I would point you in a better direction, but I have not had to work with containers yet.

#

though... i bet I can answer it after a single quick search

#

what is the value / wht are you passing to addItem()

uneven ore
#

Anyone here know how to cap a players HP?

rugged latch
#

jsut check if it goes above the cap and then set it to the cap

uneven ore
outer crypt
#

in the starting items file of the vanilla game the AddItem calls look identical to what I am doing and I see no server or calls to sync

#

machine:getContainer():AddItem("FunctionalAppliances.FATheaterPopcorn")

#

player:getInventory():AddItem("FunctionalAppliances.FATheaterPopcorn")

#

both of those lines load into the world, but the container version will not stay unless I drop them on the ground first.

errant sable
outer crypt
errant sable
#
    local newVendItem = self.object:getContainer():AddItem(items[ZombRand(#items)+1]);
    if isClient() then
        self.object:getContainer():addItemOnServer(newVendItem);
    end
outer crypt
#

oh...

#

so there is a difference

#

the server needs the into

errant sable
#

I guess. I figured this out by mucking with other mods that created items and added t hings to inventory

outer crypt
#

okay I see you load the additem as a value and then server load the value

errant sable
#

And apparently this function is not something you would of found in the vanill lua files, a quick search of the vanilla files does not return a hit for it at all

outer crypt
#

wow...

#

but addItemOnServer() is in the database

#

Thank you, I will play with this.

errant sable
#

yeah, it exists, just apparently nothing in the vanilla lua calls it. I am guessing most of the item MP management code may be java side?

#

oh, here is the other thought that may matter

#

WHO is creating the item getting added to the container. In my mod, the item is getiting created by the client, not the server. Which is why the client has to send this. Most spawning code im betting happens server side, which is why it wouldnt have to do this...(is my guess)

uneven ore
errant sable
outer crypt
errant sable
worthy terrace
# errant sable For what purpose? Also, how do yo uplan on distributing the external application...

Purpose includes one singular thing... A passion for coding and tinkering. I am very aware of the intricacies of software publishing. It would likely be a program that takes an API key, IF someone wanted to run it. There would have to be some other configuration as well, such as file/network access information etc.. so that the middle-ware can connect to the server and read the logs or whatever I come up with. Ultimately, the plan isn't really to deploy it to anyone else, it'd probably be something that lives on my server alone, as I'm not sure anyone else would have any real interest in it.

#

Totally open source as well. Cause malware is a thing, and I'm not about that life.

errant sable
#

But when you are your own target audience,well then it doesnt matter, lol

worthy terrace
#

Lol Early in my dev days, I was suckered by "The next big thing" so many times... so many unfinished ideas lmao

#

PZ seems fairly straightforward to mod however, compared to the likes of stuff like Valheim or KSP

errant sable
#

If i just had more clones....

worthy terrace
#

hehe

#

I think the thing that's gonna hold me up with this however, is the context limit

errant sable
#

Yeah, the hardest part about PZ modding has been lua itself. I avoided lua like a crack head with an std until now (lua being the crackhead with an std, not me, lol)

worthy terrace
#

LUA makes me want to cry haha

errant sable
#

Its not a bad language, but its syntactical styling feels like it tries to be different merely for the sake of being different

#

If it wasnt for the fact it originated in brazil, I would swear it was made by hipsters of the era

livid badger
#

friends, Iโ€™m making a small mod for farming, but due to the overabundance of plants, the context menu is very large, tell me a reference so that I can at least arrange the plants by category.

Workshop ID: 3050914195

modern hamlet
#

Hi, How can I tell if a character is in a vehicle and how can I get them out of the vehicle via lua?

sour island
#

kind of depends what you want logged tho

#

simply tapping into timed actions you can basically track an entire player's life - you can also have movement logged periodically

#

I assume if you feed this into chatGPT it can determine who was where doing what

#

If you're familiar with chatGPT enough - I have a request

drifting ore
#

hi there, could someone tell me what's guid, an unique id but i can't figure what's the reference, guild? idk
[26-12-23 11:34:53.089] LOG : Network , 1703601293088> 5.065.979> [26-12-23 11:34:53.088] > ConnectionManager: [RakNet] "disconnection-notification" connection: guid=653021950328...

#

game unique id? i don't really know, who knows? idk man, idk...

sour island
hollow current
#

there's also :isSeatedInVehicle

#

you can call ISVehicleMenu.onExit(playerObj) to make the player exit the vehicle, which is the same as if the player tried exiting the vehicle. You can also call the timed action directly, or "eject" him out of the vehicle, but depending on your exact need, this may not be the recommended way considering the former function handles the logic to automatically switch seats and do other stuff if needed

granite moss
worthy terrace
hollow current
tranquil kindle
#

Hello, is anyone familiar with Clothing.xml? I have an issue where im creating own zombie outfit and all my custom clothes work on it, but when i try to add vanila items by GUID's they do not appear on zombies for some reason?

violet cliff
#

Anyone know of a good video that would give a rundown on how to create a situation based mod? To be more specific, I want to take a specific part of the existing map, redesign it some, limit the player to just that area, and then make it a selectable challenge when starting a new game.

errant sable
outer crypt
#

I have a function that is called when the client connects with OnCreatePlayer, the function goes through but the server acts like it doesn't hear the request of the sendClientCommands it sends. Later I call the same function and it works flawlessly. I am guessing that this is too early for the server to get word from the client. Is there another event that is called later that might work? I'd rather not drop it into the tick to check but I could do that...

#

TMRadioClient.UpdatePlaylistFromServer = function()
print("client sending request for terminal playlist from the server")
sendClientCommand("TMRadio", "UpdatePlaylistTerminalA", {request = true})
sendClientCommand("TMRadio", "UpdatePlaylistTerminalB", {request = true})
end

Events.OnCreatePlayer.Add(TMRadioClient.UpdatePlaylistFromServer)

bronze yoke
#

you can't send client commands until the second tick tired

outer crypt
#

okay that makes sense and this is before that.

bronze yoke
#

it's frustrating to work around as there isn't really a convenient event for it

outer crypt
#

yep, its to sync a playlist to the client from the server, so I am pulling a tick for the audio anyways. I will set a flag for it to run once and then not again.

#

delay it out a few ticks, thank you

worthy terrace
#

Can you just cache the command in first tick then process on the second?

outer crypt
#

I have a tick running anyways, so I dropped it in there with a variable to run once only.

#

worked like a charm

dry chasm
outer crypt
bronze yoke
#

keep in mind that removing events during the event process causes difficult to diagnose bugs

#

the game loops forwards through event listeners so unless the listener removing the event is the last one, one will be dropped for that call only

#

it's usually fine or at least unnoticeable on OnTick but it's something to keep in mind

sour island
worthy terrace
#

Sent you a DM @sour island

junior mason
#

๐Ÿ‘‹ Hey y'all. I'm brand new to modding, how should I go about decompiling and setting up/using a workspace? Everything I've tried so far has been outdated.

bronze yoke
junior mason
#

I'll give beautiful-java a try, thanks!
How is umbrella meant to be used?

clever spruce
#

anyone know what you have to change in a mods files to change the name listed in the manager? I know how to change the ID, but the name!!! THE NAME!??!

#

nvm

#

figured it out

#

it wasn't taking for some reason when I changed the name line in the mod.info file.

drifting ore
#

heyy!
if i select a log file by listing the directory (the last, by creation date), is there a chance that the game will create another log file while the server is online and my tasks will get stuck on an outdated file that's not the one being written in real time? i don't know the conditions the game uses for creating log files, that's why i'm asking ๐Ÿ˜Š i've assumed (perhaps wrongly) that they're generated on every server startup, correct? but maybe there's another conditions i don't know about, so...

drifting ore
#

a server restart count as a launch or will hook to the last log created on same date, different time? thanks โค๏ธ *

#

go it!, thanks Alree :3

grave mirage
#

Hello people, does anyone know where i can find appliances_cooking_01_24? That should be the model for the microwave, I am trying to create a mod that adds an electric heater and i cannot make it placeable so i'd like to find those appliances and copy somehow the attributes of the microwave. Please tag me in response, thanks in advance!

drifting ore
# grave mirage Hello people, does anyone know where i can find appliances_cooking_01_24? That s...
// 41.78
public class Moveable extends InventoryItem {
   protected String worldSprite = "";
   private boolean isLight = false;
   private boolean lightUseBattery = false;
   private boolean lightHasBattery = false;
   private String lightBulbItem = "Base.LightBulb";
   private float lightPower = 0.0F;
   private float lightDelta = 2.5E-4F;
   private float lightR = 1.0F;
   private float lightG = 1.0F;
   private float lightB = 1.0F;
   private boolean isMultiGridAnchor = false;
   private IsoSpriteGrid spriteGrid;
   private String customNameFull = "Moveable Object";
   private String movableFullName = "Moveable Object";
   protected boolean canBeDroppedOnFloor = false;
   private boolean hasReadWorldSprite = false;
   protected String customItem = null;
   
   //   ...

   public boolean CanBeDroppedOnFloor() {
      if (this.worldSprite != null && this.spriteGrid != null) {
         IsoSprite var1 = IsoSpriteManager.instance.getSprite(this.worldSprite);
         PropertyContainer var2 = var1.getProperties();
         return this.canBeDroppedOnFloor || !var2.Is("ForceSingleItem");
      } else {
         return this.canBeDroppedOnFloor;
      }
   }
}```
grave mirage
#

It will take a bit to understant it completely but i will try it, thank you!

#

Btw. Where did u find it?

mellow frigate
# grave mirage Btw. Where did u find it?

you can see all PZ code source once you decompiled it. The best way I know of is https://github.com/quarantin/beautiful-java/tree/main but you can also use my old guide that's a bit easier to use https://steamcommunity.com/sharedfiles/filedetails/?id=2748451514

GitHub

This is a tool to help reverse-engineering Java code. It's meant to help with reversing the source code from the game Project Zomboid. - GitHub - quarantin/beautiful-java: This is a tool to...

This step by step guide should make it easy to access java code and therefore increase your modding capability and speed....

late hound
errant sable
#

Is there an event for when the game boots up, but after all the lua files are loaded and any 'top level' / 'initial code' they have is run?

bronze yoke
#

OnGameBoot is the closest thing i can think of

mellow frigate
errant sable
errant sable
errant sable
mellow frigate
errant sable
#

Color me not surprised.

errant sable
drifting ore
#

then you don't want something to hook when the games boots up, be more clear XD

errant sable
#

Is there an event for when the game boots up, but after all the lua files are loaded and any 'top level' / 'initial code' they have is run?
Pretty sure I was specific... perhaps next time read the entire thing?

drifting ore
#

hook to OnGameStart then? that's not when the game boots up ^__^

bronze yoke
#

that's pretty much what that event is for, what's unsuitable about it? you said it was too early, what do you need it to run after?

drifting ore
#

ye, like i'm not helping any other ppl that doesn't tell what's trying to do, annoying af

errant sable
errant sable
mellow frigate
hollow current
#

is it possible to make a UI panel horizontally scrollable?

drifting ore
#

i think's not, i've never seen before an horizontal scroll bar either on the vanilla game/mod

#

actually this a good question for finn, i won't tag him tho

#

but you can make it rezisable, that's for sure hehe

hollow current
errant sable
hollow current
#

Resizeable isn't really something "suitable" for the idea here unfortunately

drifting ore
#

what about pressing the button and realoding another serie of buttons maybe?

#

i mean, the next > button will trigger another menu rendering, maybe that's possible and easier idk just commenting XD

#

btw good looking ui

hollow current
#

That's actually what it currently does, for the skill tree buttons. I am planning to add below them the actual skills/perks to be picked. In case the tree is too big, I want to make it possible to scroll horizontally, but if not possible, I might settle for a similar solution of < > buttons

hollow current
errant sable
# hollow current That's actually what it currently does, for the skill tree buttons. I am plannin...

Again. It is possible. Though I am not sure it is possible "out of the box" with the default panel.
From the ISScrollBar.lua file, indicating the ScrollBar component supports horizontal use.


function ISScrollBar:refresh()
    if self.vertical then
        local sh = self.parent:getScrollHeight();

        if(sh > self.parent:getScrollAreaHeight()) then

            --print(-self.parent:getYScroll());
            --print(sh - self.parent:getHeight());
            if -self.parent:getYScroll() > sh - self.parent:getScrollAreaHeight() then
                self.parent:setYScroll(-(sh - self.parent:getScrollAreaHeight()));
            end
        end
    else
        local sw = self.parent:getScrollWidth()
        if sw > self.parent:getScrollAreaWidth() then
            if -self.parent:getXScroll() > sw - self.parent:getScrollAreaWidth() then
                self.parent:setXScroll(-(sw - self.parent:getScrollAreaWidth()))
            end
        end
    end
end
hollow current
thick prawn
#

Anyone here I can commission for a mod possibly a few?

sour island
hidden phoenix
#

Hello, I want to make a mod that edits an existing vehicle mod, specifically to lower the spawn rate of the car. I don't have any experience with modding in general, but I want to try it myself if possible

worthy terrace
#

Anyone know of any way, either command or not, to check all characters on the server connected or not?

sour island
#

So it depends what you're trying to do - the approach changes.

worthy terrace
#

I found a mod that already does it. So there is a way lol. I just need to know how many people are still alive lol. Currently the only way I'm aware of is by using players but that only checks connected players, not offline players.

lucid palm
#

hayo, im new here. I would like to start making mods since i love this game so much, where should i start_

#

?

vague raven
#

Check out modding tutorials on youtube and join the unofficial modding discord.

wise igloo
#

would anyone like to perhaps have a peak at something im working on and tell me where ive messed up? im trying to make an outfit for zombies but despite following a tutorial i found online, and checking with another outfit mod to see if id structured everything correctly i still cant get the item to appear in the item menu, honestly no clue what ive done wrong, it could be real obvious who knows

pale inlet
#

hi what's the minimum value you can use on the spawnlist lua?

#

for a vehicle specifically the lowest number i see is 1, is that a percentage? If so I'm assuming I can go into decimals?

opal pier
#

Guys, the only thing that makes the item disappear from the current save in the game is changing its name in the script or is there something else that I need to be careful not to change after the mod is launched?

bronze yoke
#

don't change its Type

opal pier
#

ooh thanks, i didn't know, that's a valuable tip.

rugged latch
#

im hoping its just a syntax or spelling thing im not seeing lol

bronze yoke
#

it's a static method

rugged latch
#

oh

#

yep

#

that would do it

#

missed that part lol

#

thanks

mental vigil
#

Hello everyone ! I'm getting started on the Project Zomboid modding, and was wondering if there was a way to make some inheritance between items or recipes with the script system

mental vigil
#

Perfect, thank you !

errant sable
#

Anyone have any references or guides they know of that deals with playing music files? Spent the last two hours spinning my wheels here.

fast galleon
#

It makes a sound script and it plays it.

errant sable
#

Not a sound (though maybe that is the route i need to go) but music

#

For instance. I have some main menu screens. I want to StopMusic() the music the game plays, and then play my own music on these screens

fast galleon
#

it plays mp3, ogg not sure what is different in your case.

errant sable
#

however :StopMusic() is not stopping the music, and playMusic and PlayMusic also seem to do nothing...

fast galleon
#

ah I see

errant sable
#

So if I trigger my music like a sound, it will just play over the annoying main menu music, and youll hear both

fast galleon
#

This might be handled by MainScreen.lua and it uses playUISound.

I know I have seen the code for this somewhere but can't remember where.

errant sable
fast galleon
#

You said stop music doesn't work, it's fair to assume it could be ui sound.

errant sable
#

I thought maybe the same thing when you mentioned it, so i looked at all the stuff it was playing with playUISound

fast galleon
#

have you tried printing everything? print music and the clip.

errant sable
#

I have tried everything and a bag of chips

fast galleon
errant sable
#

half the problem is I am not even sure PlayMusic and StopMusic are entirely valid functions anymore... they are each used in exactly 1 place in all of the lua files, and I can not be certain those sections are even called ny something

#

I have also stumbled across forum posts indicating that at some point there was a method to play music that worked, and then some update broke that.

#

Then there is the fact the default music is stored in fmod sound banks... which makes me wonder if my music needs to be in a sound bank also... but there is like zero documentation on any of it

#

and then of course there searching for anything related to music brings up the True Music mod, but from a couple things I have read I got the impression it also does not use the music system, as I read a comment by one user about how they turn off the ingame music so they can hear their true music clearly

remote ivy
#

Hey guys! Is there any mods for npcs that is compatible for multiplayer?

errant sable
#

Well, the main screen music is definately 'music' setting the music volume in the options adjusts it, and if i setMusicVolume to 0 it also silences it....

merry fjord
#

anyone know how this works? I was trying something using RadiatedZones function and I was hoping to integrate to Bus Tickets, but it won't let me get the file even though I defined the folder or the mod ID as the one on the "RadiatedZones" part

local reader = getModFileReader("RadiatedZones", "media/coordinates.txt", false)

merry fjord
#

Please ignore, I was able to make it work ๐Ÿซถ

hoary flax
#

hi, could someone recommend a script or package to monitor for mod updates and schedule a restart? i'm looking for something I can run on a linux host, i did find one or two windows solutions. thx

sour island
#

This should let you set up services - includes a check mod updates + restart

#

Haven't ever used Linux tho ๐Ÿคทโ€โ™‚๏ธ

#

Windows based hosts are more than fine if you're paying for a Linux service

hoary flax
#

cool, thanks. i read the docs on this earlier but i couldnt find reference to the mod checking and i didnt look at the code

sour island
#

checkmods Check mod updates

hoary flax
#

eagle eyes

sour island
#

I assume if the update is found it will auto restart - but I'm not sure

#

For windows you can just use Udderly-Up-To-Date and a BAT restart on quit script

mental vigil
#

Hiya. Is there a mod loading shenanigan that prioritise the local mods before the Workshop mods ?

I'm trying to work on a mod that require Hydrocraft, but I don't seem to have access to Hydrocraft stuff

tawdry solar
#

how do i add a description to an item?

severe patrol
#

I've seen a lot of mods that involve collectibles and cards and such, but I've been thinking of an idea of a card game you can collect and battle.

But instead of Pokรฉmon or other spoofs where the copyright is already gray, the card game I am thinking of would be standalone PJZ content. In other words, it could eventually become a real part of the game (a mini-game window inside the game itself to escape the horrors for a bit of extra fun).

As I don't know if something like that has already been attempted and I'm not a modder, I'm more than happy to share the concept to someone who likes it and can use it. If anyone's interested, let me know.

Sorry for wall.

severe patrol
#

That looks intriguing and I could see this card game idea integrating into that.

#

Idk why but it makes me chuckle that for whatever reason, those two humans behind Spiffo look utterly miserable

sour island
tawdry solar
#

anyone know the line that addsa description?

sour island
#

Big update to SRJ out now ๐Ÿ˜„

#

Hopefully I tested enough ๐Ÿ˜ตโ€๐Ÿ’ซ

humble oriole
#

@sour island hey man, can I pack skill journal? This is the second time one of your updates have royal screwed us.

humble oriole
#

Iโ€™ll move us to Eveโ€™s version, ๐Ÿ‘

sour island
#

Not familiar with that, good luck

sour island
#

Indeed

severe patrol
#

That's interesting to stumble across that skill journal mod. I literally had an idea for something like that. I was going to suggest crafting a Last Will and Testament for passing skills to new characters at the creation screen, but they have to take that deceased characters surname or something like that.

I really should check the workshop... lol

junior blaze
#

helllo, got question. is it easier or faster to make a mod about making glue and its recipe? i just want to make a homemde glue with salt, flour and water.

#

but the mods glue are unrealistic.

#

bone glue or zombie glue.

#

also makes the game less challenging cuz zombies and bones are everywhere

undone crag
#

Making glue out of zombies is realistic though innit?

#

Also wut iz the question?//.. Easier or faster than what? Or easier than fast? Or faster than easy?

upbeat spindle
#

Any lua wizards out here? I'm thinking on making the following:

Whenever season changes, change all given sprites to some other given sprite. Depending on the season, also add stuff to the container associated to the sprite. I.e. a fruit tree simulator.

What I have after 2hrs of googling so far is something crude, and my lua-patience is running low to the point where I hate the whole language, send help:

    local Season = ClimateManager.getInstance():getSeason()    

    -- if Spring
    if Season == 1 then
            -- do stuff
    end

    -- if Summer (values 2 and 3)
    if Season == 2 then
        for i=sq:getObjects():size(),1,-1 do -- how tf do i access all squares
            o = sq:getObjects():get(i-1)
            if o:getSprite() and (o:getSprite():getName() , "CUSTOM APPEL TREE SPRING SKIN TILESHEET COORDINATE GOES HERE") then
                self:setSpriteName("CUSTOM APPEL TREE SUMER SKIN TILESHEET COORDINATE GOES HERE")  
                -- how tf to make this self refer to the appletree
                -- how tf do i edit container contents via this
            end
        end
    end

    if Season == 3 then
        -- do stuff
    end

    -- if Autumn (4)
    if Season == 4 then
            -- do stuff
    end

    -- if Winter (5)
    if Season == 5 then
            -- do stuff
    end

end

Events.OnClimateTick.Add(TestApples)```
#

idc if you even steal the idea and make it a mod yourself, all i want is a working appletree :-D

mental vigil
#

I can't answer the container edition, as I don't know very well the lua code of the game atm, but basically, what you need for the self is to make an appletree class and put the TestApples() method on it

shell thorn
#

Pls help! anyone know where i can find file location of this Ham Radio? thanks a lot

mental vigil
#

@upbeat spindle

AppleTree = {health = 100, <insert whatever properties you find relevant here>}

function AppleTree:new(health)
    local self = setmetatable({}, AppleTree);
    self.health = health;
    return self;
end

local function AppleTree:TestApples(ClimateManager)
    local Season = ClimateManager.getInstance():getSeason()    

    -- if Spring
    if Season == 1 then
            -- do stuff
    end

    -- if Summer (values 2 and 3)
    if Season == 2 then
        for i=sq:getObjects():size(),1,-1 do -- how tf do i access all squares
            o = sq:getObjects():get(i-1)
            if o:getSprite() and (o:getSprite():getName() , "CUSTOM APPEL TREE SPRING SKIN TILESHEET COORDINATE GOES HERE") then
                self:setSpriteName("CUSTOM APPEL TREE SUMER SKIN TILESHEET COORDINATE GOES HERE")  
                -- how tf to make this self refer to the appletree
                -- how tf do i edit container contents via this
            end
        end
    end

    if Season == 3 then
        -- do stuff
    end

    -- if Autumn (4)
    if Season == 4 then
            -- do stuff
    end

    -- if Winter (5)
    if Season == 5 then
            -- do stuff
    end

end

tree = AppleTree:new(100);

Events.OnClimateTick.Add(tree:TestApples);```
#

It's been a really long time I've done Lua, so I might get the syntax completely wrong, but I think this is a correct approach

upbeat spindle
#

ooh! Thanks a plenty!

#

Is there a meaning to the health-value that I am missing?

For context: I'm not intending to connect this to any farming mechanics etc., where I've seen other mentions to health values. I'll make it so that in the tile-editor there is a set of 4 different trees that also have container sizes (and are tagged as trees so they can be chopped), and then ideally use the script to pick the correct seasonal variant, and spawn apples in it whenever autumn starts.

#

To me this reads that "tree = AppleTree:new(100)" creates one individual representation of this class, whereas I'd need the script to find every appletree in the map. So perhaps using the syntax "self:setSpriteName" is a wrong approach from me, and I should instead use something like

"for each Tile in EntireMap:
If Tile Is AppleTree:

Tile:changeSpriteToSeasonallyAppropriateVariant
Tile:editContainer

end
end"

drifting ore
hardy rose
#

So, just doing some minor feasability probing, hopefully someone more familiar with the code structure around crafting can answer;

Would it be possible to create a mod that implements CDDA's system for tool use in crafting? i.e. tools have stats instead of hardcoded recipe uses in many cases?

A pipe wrench is decently flat and heavy, so I could use it to pound nails into a baseball bat but probably not anything precise like assembling furniture. So it'd have

wrenching 5
hammering 1

#

and recipes would have stat requirements instead of a list of which kinds of hammers specifically will work

mental vigil
mental vigil
upbeat spindle
sour island
sour island
hardy rose
#

My vision is just two lines of text, like "Requires: Tool with cutting of at least one

Your highest tool [icon] has [x] cutting"

sour island
#

It's doable, to hide UI elements. But alot of UI systems are not written in a way to make slight tweaks.

#

So I wouldn't be able to confirm.

hardy rose
#

maybe hide the existing tools section of recipes, and overlay it with either a new window or a button to show a new window?

sour island
#

You could hide the recipe

#

And just have it available in context menus

hardy rose
#

I'll look more into it, thanks for your insight. This at least seems moderately doable, so I won't be wasting my time either way

sour island
#

Recipes have variable/parameters in their script that calls on Lua functions

#

That's where you'd dictate script checks for items

mental vigil
#

I like the idea, but wouldn't be requiring doing the whole crafting system ?

#

Or can we modify the source of a recipe dynamically ?

eternal fjord
#

hello hello. is it possible to create a sound effect that's attached to the player for certain events like, for example, killing a zombie?

cedar kraken
#

I'm getting myself a bit out of a burnout mixed with depression and I'm finally giving myself the push to dig deep into making mods... at last. My goal is to get my boots mod done before the end of my winter break, which I have around another week left of.