#mod_development

1 messages Ā· Page 91 of 1

jaunty marten
#

I tried and it's working

sour island
#

ah you're right, there's an overload that uses an empty array

#

I wonder why his isn't working

jaunty marten
#

I have empty gas, 50% gas and empty bottle, 50% water bottle

#

same function as and u

print(getPlayer():getInventory():getAllEvalRecurse(function(item)
    -- our item can store fue, but doesn't have fuel right now
    if item:hasTag("EmptyPetrol") and not item:isBroken() then
        return true
    end
    -- or our item can store fuel and is not full
    if item:hasTag("Petrol") and not item:isBroken() and instanceof(item, "DrainableComboItem") and item:getUsedDelta() < 1 then
        return true
    end
    return false
end))
#

it works

humble oriole
#

it's crazy that it won't work from the file

sour island
#

what's player in this case? 0?

humble oriole
#

oh yea, it's just me since I'm the only one on

#

createMenuEntries = function(player, context, worldobjects, test)

#

I thought about wrapping into the ISWorldObjectContextMenu but I want to use my own ISTakeFuel because the vanilla one has the gas station pump sound.

#

I decided the best way is to just interact with the item:hasTag like they're doing it so I can write my own ISTakeFuel because I don't want to use set/getPipedFuelAmount(). I want the context menu entry to be a submenu instead of the a main option like it is in vanilla

#

Specifically in the instance of interacting with my item, of course. I just want to be consistent.

red tiger
#

Made some progress on my shaders core mod today.

#

Backdrop shader for UI as a draw call.

ancient grail
#

Wow

thick karma
#

🤣

thick karma
#

lol but the results are glorious @bronze yoke

#

lol I haven't been at it nonstop but I have definitely been at it lol

jaunty marten
# red tiger

for complete there need add/remove mult buttons

ancient grail
#

is it possible to make a weapon contain drainable data

jaunty marten
#

lul

jaunty marten
sour island
#

unpack() lets you feed a list as arguments

jaunty marten
#

sure

sour island
#

so I can provide some arguments within a function and pack the rest of them with a list

#

I'd have to calc x/y for each use otherwise

jaunty marten
# sour island

btw mb will be new for u as and unpacked table as args

function test(a, b, c, d)
print(a, b, c, d)
end
--same
function test(...)
print(...)
end
#

this cool thing too

function test(...)
  local table_of_args = {...}
end
sour island
#

yes, I do this for fingerPrint

#

where I do ```lua
test(...)
print(x, y, ...)
end

#

currently making every window off debug open next to the debug panel and open/close from the menu button

#

the normal close buttons are still present - but I found it really nice to have that behavior when messing with cheat menu and adding aiteron's vehicle menu

sour island
#

hmm

#

closing the windows using their close buttons makes them unable to reopen

#

šŸ¤”

grim rose
#

hello guys i have question to you

#

how do i overwritte vanilla objects?

thick karma
#

What kind of object do you want to overwrite?

sour island
#

finally figured out the quirks of the UI

#

some of the UI uses instantiate while others don't

#

isoRegionWindow and zombiePopulationWindow close() doesn't clear their instances, just removes it from UImanager

#

that was a pain to sift through

#

also modified the isoObject modData viewer to scale to it's not massive

jaunty marten
# sour island

I think be better to restore panel position after re-open it

sour island
#

as in save them?

#

I agree, will look into it

jaunty marten
#

if u will just :setVisible(false) and :removeFromUIManager() after it u can open it as :setVisible(true) and :addToUIManager()

#

not creating new one

#

just hide

sour island
#

I believe the vanilla behavior creates new ones

#

I originally just had it to hide

#

but using the in-window close buttons breaks it

#

and many of their close() sets instance to nil as well

#

Might be something worth looking into for the community patch

#

as I imagine if every UI element does this - it could add up

jaunty marten
#

idk how original close button works cos ever I creating my own buttons with :setVisible(false) :removeFromUIManager

sour island
#

idk how well kahlua/java/lua handles garbage collection

jaunty marten
#

yeah

sour island
#
function ISDebugPanelBase:close()
    self:setVisible(false);
    self:removeFromUIManager();
    ISDebugPanelBase.instance = nil
end
#

this is vanilla

jaunty marten
#

ah

#

yea

sour island
#

by setting instance to nil it fucks up the reopen

#

creates a new one

jaunty marten
#

but u can don't nil instance and use it again to set visible back and add to ui manager

#

it's working well

sour island
#

I'd have to overwrite all the debug windows

#

lol

#

I don't mind doing it, but ugh

jaunty marten
#

u can just create u own button, use default button as base and just replace onclick function

#

and replace default close buttons there by ur own

sour island
#

they all call close() I can just overwrite the original function

#

these are also debug UI stuff - so I'm hoping the vanilla stuff doesn't do this

drifting ore
#

Hi want to ask, is it possible to use 3d models on another mods and skin on my mods, then create new item in my mod?

jaunty marten
#

original function uses only there? u can broke smth if this func uses in some other code

sour island
#

yes, the close() is only used for each window

#

there's a close for their derive'd classes but the sub-class close doesnt call on it

#

not sure why as the close()'s are basically identical

#
function ISPlayerStatsUI.OnOpenPanel()
    if ISPlayerStatsUI.instance then
        ISPlayerStatsUI.instance:close()
    end
    local x = getCore():getScreenWidth() / 2 - (800 / 2);
    local y = getCore():getScreenHeight() / 2 - (800 / 2);
    local ui = ISPlayerStatsUI:new(x,y,800,800, getPlayer(), getPlayer())
    ui:initialise();
    ui:addToUIManager();
    ui:setVisible(true);
end
jaunty marten
#

@drifting ore hey, I saw on workshop ur mod Lightswitch Electrician and checked it but there's no any lua files with function to connect light switches with in-room light. basically pz automatically link them when u creating new light switch object in room?

sour island
#

I overwrote this

#

almost all of the panels do this

#

hides the old one then creates a new one

#

I'll check the close() to avoid this

drifting ore
jaunty marten
# sour island ```lua function ISPlayerStatsUI.OnOpenPanel() if ISPlayerStatsUI.instance th...

u can just do this way

function ISPlayerStatsUI.OnOpenPanel()
    if ISPlayerStatsUI.instance then
        ISPlayerStatsUI.instance:addToUIManager();
        ISPlayerStatsUI.instance:setVisible(true);
        return
    end
    local x = getCore():getScreenWidth() / 2 - (800 / 2);
    local y = getCore():getScreenHeight() / 2 - (800 / 2);
    local ui = ISPlayerStatsUI:new(x,y,800,800, getPlayer(), getPlayer())
    ui:initialise();
    ui:addToUIManager();
    ui:setVisible(true);
end
drifting ore
#

i tried seeing if you can set room id on switch light but i couldnt figure it out.

sour island
#

I'm feeding it into my genericOnOpenPanel

#

that's how my behavior looks

drifting ore
#

didnt care if it saved. just wanted to see if it would set the roomdef.id

#

also teaching myself about how to use sandboxvars in scripts

#

well more like reading lol

sour island
#

what impact does not using setVisible() have with removefromUImanager?

#

I'm noticing a few of the panels do that

jaunty marten
#

if creating new light swithcer will work it's amazing for me

sour island
#

also only 2-3 use instantiate - I never looked into how it's different to initialize

jaunty marten
sour island
#

by default StashUI only have remove from UI

jaunty marten
#

hmmm

sour island
#

so using it's close button means I have to select the open button twice

#

probably do to me assuming it's visible

jaunty marten
#

tbh only know difference between :setVisible(false):removeFromUIMaganer and just :setVisible(false)

jaunty marten
sour island
#

remove seems to hide it, but I think internally it's visible flag is true

#

which is why selecting to open it doesn't work the first time

#

very odd but interesting behavior

#

I would add setvisible false to removefromUI

#

but idk what kind of ramifications that might have

#

would be safer to overwrite the individual UI elements that are written inconsistently

jaunty marten
#

seems removeFromUIManager removes it from order to update, render and any interactions

#

setVisible just hide it and changes the flag

#
  • calling idk what is that xd
#

never seen it

sour island
#

removing it from render would make it not visible by default then

#

is there a check if something is apart of UImanager?

jaunty marten
#

without actual :setVisible(false)

sour island
#

I'm hoping I can use OR to catch these weird cases

#

stashUI for example would require tapping into it's cancel button

#
local StashDebug_onClick = StashDebug.onClick
function StashDebug:onClick(button)
    if button.internal == "CANCEL" then self:setVisible(false) end
    StashDebug_onClick(self, button)
end

šŸ¤·ā€ā™‚ļø

#

guess this works

#

hate it tho

#

this is vanilla

function StashDebug:onClick(button)
    if button.internal == "CANCEL" then
--        self:setVisible(false);
        self:removeFromUIManager();
    end
``` the setvisible is commented out for some reason
#

it's on-open panel also just uses add to UI

jaunty marten
#

bruh

sour island
#

could be neater for sure

#

you technically don't have to do it that way

#

just call the function in button:new()

jaunty marten
#

just when checking some file see this and idk what's button do and need to check internal string and after it search this one in elseif

jaunty marten
#

and it will "auto save old position" of panel

sour island
#

I'm going to add it to layouts eventually

jaunty marten
#

cool

sour island
#

that's why I wanted to push them all through the same function

#

hate copy pasting

jaunty marten
sour island
#

why many word when few do trick

jaunty marten
#

hah

grim rose
sour island
#

I'm just going to overwrite close() within open

#

fuck this lol

#

is there a proper syntax to overwrite an instancing function with a local one?

jaunty marten
#
local function close(self)
  self:setVisible(false)
  self:removeFromUIManager()
end
ISGameStatisticPanel.close = close
any_panel.close = close
#

for example

#

same for OnOpenPanel so

sour island
#

ah, I was about to try that

#

didn't have the (self)

jaunty marten
#

u even can create table to simply add panel class in it and iterate them with changing funcs in a loop

#

of course only if all funcs are have to be same

sour island
#

That's what I do for the cheats

jaunty marten
sour island
#

Nice, it works

#

don't have to overwrite 6 buttons anymore lol

jaunty marten
#

he-he

#

@sour island I really want #waywo channel for modders and already sent suggestion to blair, aiteron and nasko but even no response unhappy. I see u ultra active here and mb do u know who exactly from tis manage discord server?

sour island
#

what's waywo?

jaunty marten
#

"what are you working on"

sour island
#

ah

#

šŸ¤” perhaps #threads could be used somehow?

jaunty marten
#

so interesting to see what peoples doing

sour island
#

I dont really see an issue with what's happening right now

#

there's only usually like 0-3 convos happening here

jaunty marten
#

ĀÆ_(惄)_/ĀÆ

drifting ore
#

anyone know if i call a sandboxvar option into a script as a function, if LuaGrab or LuaCreate or another option for grabbing it? trying to use sandboxvar for changing recipe item amounts, change page size of book. seems like this is all possible but i'm struggling to find the way.

jaunty marten
#

u can use DoParam

drifting ore
#

that works direct in script for sandboxvar tho?

#

or i mean function

jaunty marten
#

it's lua func

drifting ore
#

yea

#

myb i meant. need sleep. i'll try it thank you

#

maybe crazy but doparam work in item also?

#

any script?

jaunty marten
#

sure

#

check ItemTweaker mod

drifting ore
#

ah good call

jaunty marten
small topaz
#

hey! I am playtesting one of my mod in multiplayer via the host button in debug mode. Is there a way to change my players stats via the debug menu (e.g. cooking skill, farming skill etc.)?? All those options are currently greyed out for me.

drifting ore
#

oh wow i can use this method to add glucose moddata to food lol

#

diabetes mod incoming

jaunty marten
#

or add some cheat mode like Cheat Menu Rebirth

jaunty marten
drifting ore
#

i already did all the icons and models lol

jaunty marten
#

ideal death is 100 ml of insulin and going to sleep

#

better than gun suicide mod

#

hah

drifting ore
#

lmao

jaunty marten
#

silent death, ahhh

drifting ore
#

i intend on it being a dynamic trait most likely if i can make it interesting enough

#

obv death being on both ends

jaunty marten
#

I hope dynamic only for give a trait but not to take it off XD

drifting ore
#

maybe have option for that lmao

jaunty marten
#

yea

small topaz
drifting ore
#

/Setaccesslevel name Admin *fixed thanks glytch3r šŸ˜›

thick karma
#

🤣 🤪 😭 😃 😭 🤯

drifting ore
#

lmao

jaunty marten
#

1 full bottle bourbon rolls 0.1% chance > now ur pancreas is killing u, sorry

drifting ore
#

i got a randomizer util im gonna use for it lol

jaunty marten
#

he-he

drifting ore
#

some good mathing i hope

#

good with numbers not amazing with math lol

ancient grail
sour island
#

planned goals are three mods within a workshop release - a general patch, a set of frameworks/libraries, and the debug tools

#

will eventually roll it out to a github organization so it's not directly under me

grim rose
#

Sorry guys to ask this again but today im busy beee

#

and i lost track when someone offered help

#

im trying to replace model of vanilla item

#

anybody would help?

#

well as i can count i counted on myself

#

and well to overdrive texture you only need to rename texture to same thing

small topaz
#

Still trying to figure out how I can make data stored and generated in server accessible to client. We already chatted a bit about this some days ago but I haven't been able to really understand what I need to do. So I ask again.

I made a minimal code example so I can explain what I precisely want to do. On severs side, I store a random value in GameTime's modData. How can the clients access this (I want it to be accessible for all clients)?? Also cool if there is a better approach not using GameTime (I just did it this way to have smth to start with).

neon bronze
#

you'd have to send a servercommand to the client(s)

#

i think

#

im not too sure, i havent messed around with them too much

small topaz
#

I've heard about this servercommand thing but have no clue how to use it properly in my situation

burnt vapor
#

hey all, I know this isn't a mod but I was making my own game inspired by project zombiod, I was wondering how would I create a system to group rooms together? I already have isometric walls and all but I cant seem to figure out how to group rooms together...

#

how did project zombiod do it?

#

that is what im really asking

#

so I understand the concept

sullen bobcat
#

Stupid Question. Im having issues with adding items to the Foraging loot pool. Any chance anyone can have a quick look at the code and sanity check it? I think im just missing something basic but I have no idea on it

small topaz
grim rose
#

Pipebomb

frank elbow
#

Or just an event listener on the client, I suppose, if it won't need to communicate back

#

Global mod data is what was thinking of when typing that (& what I'd use) oops, but the above applies to that too

small topaz
# grim rose Pipebomb

the script.txt entry has an attribute called WorldStaticModel which refers to the 3d object of the item. you could try changing it via item:DoParam("WorldStaticModel = MyNewObject_Ground") But for this thing to work, it is necessary that you already created the 3d object and brought this properly into game...

grim rose
#

thanks i already implemented that

small topaz
small topaz
# grim rose thanks i already implemented that

have you already defined the model script for Neco_arc? If not, you might have a look at the vanilla file media/scripts/models_items.txt. In this file, mesh refers to the actual 3d object.

grim rose
#

yes i do just above ITEM

#

for now its bit janky as this model is only used as placeholder from my previous mod

#
    {
        mesh = FUMOTH_default_cocard_low,
            texture = FUMOTH_cirno_fumo,
            scale = 0.004,
    }```

now i fixed it so it loads corectly
small topaz
# grim rose yes i do just above ITEM

have you tried putting the mesh into a folder media/models_X/WorldItems instead and then using mesh = WorldItems/NECO_Items ?? At least, this is the structure the vanilla game uses in this case

grim rose
#

oh thanks i forgot that i setted up this folder putted model there and gave it wrong path

#
    {
        mesh = WorldItems/FUMOTH_default_cocard_low,
            texture = FUMOTH_cirno_fumo,
            scale = 0.004,
    }```
small topaz
jaunty marten
jaunty marten
#

u just store it in gametime object

#

it will removed after reload

#

correct is

local data = GameTime:getInstance():getModData()
small topaz
ancient grail
#

@jaunty marten oh vishnya i had an idea.. maybe the object is deleted when you remove the light switch but its not just refreshed on your screen

grim rose
#

I did not overwritte it

#

It added new item

grim rose
#

So i can look up

#

What to do

small topaz
grim rose
#

but i see my mistake

#

i wrote

#

BASE

#

not

#

Base

#

But now i get error

#

game not lunching severity type erorr

#

...

#

as i just edited it]

#

i fixed it

#

Bruhhh

#

allright so it "works"

#

now sounds

small topaz
#

I am currently playing around with the event OnReceiveGlobalModData I use it on client side and try to access global moddata which has been stored on server. On client, I use the command ModData.request(key) to trigger the event. PZ Wiki and other sources say that the event has as one paramter a lua table containing the global mod data. However, for me, this table is empty on client side (although it is non-empty on server side). Any ideas what I am doing wrong here?

grim rose
grim rose
#

thanks im trying to find function that would help me with sounds

small topaz
#

oh... or can I simply access the global mod data in client by local data = ModData.get("myUniqueKey") ?? So not necessary to use ModData.request and the event??

thick karma
# grim rose pipebomb

I'm not sure on the details of pipe bombs, but this video will help a lot in adding a new item modeled after another... I see no reason you couldn't use its technique to make a custom bomb. https://m.youtube.com/watch?v=N6tZujOPnDw

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

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

ā–¶ Play video
grim rose
#

it works?

#

i just have to know how to replace sound

#

and for that i going for any mod that changes sound

thick karma
#

The sound is part of that tutorial

#

And that part works

grim rose
#

oh yea

#

i forgot

thick karma
#

I added a sound myself by following that video

grim rose
#

lets see then

grim rose
thick karma
#

?

grim rose
#

weapons follow bit diffrent sound file

#

so i have to look at his glock tutorial

thick karma
#

Oh idk anything about that but you could play a sound OnWeaponHit if the handweapon is right

#

Any smallish ogg sound should work for that afaik

grim rose
vestal geode
#

Anyone know the issue of getting nil from server/ClientCommands.getThumpable() for some wallType (north/west) objects when trying to plaster them?

#

It will work after a server restart, so it seems something is wrong with transmitting those objects to the server?

ancient grail
ancient grail
grim rose
#

im having big issues with sounds

#

can some one help me?

#
{    
    imports
    {
        NECO,
    }
    

    sound PipeBombThrow
    {
        category = Item,
        clip
        {
            event = Weapon/Throwable/PipeBomb/Throw,
            /*file = media/sound/NecoArcThrow.ogg,*/
        }
    }
    sound PipeBombExplode
    {
        category = Item,
        clip
        {
            event = Weapon/Throwable/PipeBomb/Explode,
            /*file = media/sound/NecoArcExplode.ogg,*/
        }
    }
    sound PipeBombEquip
    {
        category = Item,
        clip
        {
            event = Weapon/Throwable/PipeBomb/Equip,
            /*file = media/sound/NecoArcEquip.ogg,*/
        }
    }```
#

i don't know how to change that vanilla pipebomb has custom sound

#

that doesn't come from events/blaablaablaaa

#

i think i found dumbest way to fix this temporary

#

i just overwritten explosion.ogg

#

okay i given up

#

nothing fucking works

#

dumb overwritting nope

#

bashing head and changing some random things

#

nope

#

typo:

#

i named directory "sounds" not "sound"

#

🄹

red tiger
#

Hmm.. Time to write a responsive tech demo with UI shading.

#

One thing that I feel is sort of funny is how that UIFont is used for selection of fonts while AngelCodeFont could be passed and made way easier for people to integrate their custom fonts with say ISUElement's API.

grim rose
#

Shit still don’t work

#

I surender

#

Im gonna take nap for an hour

hollow current
#

How viable would it be to make a mod where a piece of paper would spawn with a random content written on it (the content will be picked randomly from a .json)

#

Is it possible to configure the written content of a paper while spawning it?

red tiger
hollow current
#

someone helped me with it before, I can handle the json part

#

got it saved somewhere on my pc

#

Anyhow, assuming I have a string loaded from the .json

red tiger
#

I modified this JSON parser to support PZ's Kahlua.

#

(There were calls to non-implemented Lua global API)

#

That should save you the trouble.

hollow current
#

Much appreciated, thanks

red tiger
#

I prefer JSON over Lua tables.

hollow current
#

I find JSON very easy to handle to be honest

#

or at least, much efficient

faint jewel
#

anyone know how i would go about getting a list of items that are in an object a player is holding?

jaunty marten
#

like for an common object

#

ah, btw I'm not sure it will can returns any item cos in vanilla pz u even can't pickup container if any item in it

#

with some debug mode u can pickup it without this condition but it will be emptied

faint jewel
#

no what i want to do is have an item in my hand (backpack etc) and be able to place all its items in a tile

small topaz
#

if getItems() does not work directly, you could also try getInventory():getItems() instead

faint jewel
#

hmmmm

#

so the item might not be in their hand when it tries to place the tile.

red tiger
#

(Official & partially documented)

#

Also 41.77

jaunty marten
jaunty marten
small topaz
red tiger
#

Official if the game's version is closer to current.

jaunty marten
#

or u meant created by third-party and published by official?

red tiger
#

I mean that the pz.com link is official.

jaunty marten
#

yeah

red tiger
jaunty marten
#

it's why I got confused by ur words

jaunty marten
#

I saw different sites

red tiger
#

It used to be the one to go to because before the recent JavaDocs compile, the official one was as old as 2015.

#

(If you look at the HTML for the root JavaDocs page, you'll see the comment showing the time that it was compiled)

jaunty marten
#

then it make sense yea

#

oki

red tiger
#

I also grep'd the current JavaDocs as an offline site copy.

bronze yoke
#

that seems like a smart thing for me to hold onto

red tiger
#

This'll be useful for people with spotty Internet connections or other uses.

#

I'd give the grep command but it would mean a lot of heavy traffic for the site which is bad.

#

So this copy will do. =)

jaunty marten
red tiger
#

Huh?

#

Must be an imperfect copy?

jaunty marten
#

search bar even disabled

red tiger
#

Could pick those resources up on the official site.

#

6 files? Not that bad. :D

jaunty marten
#

XD

#

yea

#

good idea

red tiger
#

We should make a scrapper that builds into an in-game editor lol.

#

Have JavaDocs in-game hahaha

jaunty marten
#

first need in-game editor

#

current editor is not editor

zinc pilot
#

hey, is there a way to wait until a variable has been initialized?

jaunty marten
#

even windows command line is powerful but pz command line is real command line hah

jaunty marten
#

if u mean thing like ZombieRadio, GlobalModData and etc

zinc pilot
#

Yeah, a global var used for online stuff

#

I could use a OnTick event basically, right?

jaunty marten
#

sure

zinc pilot
#

thanks

jaunty marten
#

don't forget to remove it after u got one

#

hah

zinc pilot
#

absolutely

jaunty marten
red tiger
#

Writing OpenGL boilerplate code ATM. drunk

jaunty marten
#

@red tiger u didn't even give favicon unhappyunhappyunhappy

jaunty marten
red tiger
#

Cleanup then release it as a ZIP.

#

We could sneak in our own favicon

zinc pilot
#

another dumb question

jaunty marten
zinc pilot
#

is there a way to pass a variable to an event without using global vars?

red tiger
#
local foo = "bar"
-- ..
zinc pilot
#

I mean, OnTick passes numberTicks

zinc pilot
#

is there a way to add another parameter?

jaunty marten
#

nope, it's precreated event

red tiger
#

You can fire your own sub-event and put in params that way.

jaunty marten
#

for what do u need it?

red tiger
#
Events.OnTick.Add(function() 
  triggerEvent('OnMyTick', ..);
end);
zinc pilot
#

that's what I wanted to know

#

thanks

red tiger
#

(Fixed typ0)

jaunty marten
#

You can fire OnTick event in OnTick event and put in new params.

red tiger
#

Hahaha nooo

#

That's so bad tho

jaunty marten
#

he-he

zinc pilot
#

now I'm curious tho

#

how?

red tiger
#

You could look for the params but Jesus calm down Satan.

zinc pilot
#

(I won't)

red tiger
#

Hahah mixing / poisoning existing API.

red tiger
#

Having fun extending on my Shader API to work with both render methods for TIS's render engine on both the main thread and render thread.

#

So basically all the modder needs to do is set a variable to a "ShaderProfile" object and that object is then applied at render time or cached render calls.

zinc pilot
red tiger
zinc pilot
#

well shit

#

nice

red tiger
#

My modified copy of the UI engine has shading support now.

#

Also UI is 100% cached draw calls on the main thread.

jaunty marten
#

stop talking, go work on web engine feature drunkdrunkdrunk

red tiger
#

Oh this is for that.

#

How else am I going to get backdrop-filter: blur(4px)?

#

Also border-radius: 4px

jaunty marten
#

I already waiting for 1 day and can't wait anymore angry

zinc pilot
red tiger
#

I see that RadialMenu.java has drawPolygon() methods for circles.. Wish they'd share the love in UIElement

red tiger
zinc pilot
#

I have really limited knowledge about this kind of stuff, sorry for stupid questions

jaunty marten
#

it's fine spiffo

red tiger
#

These.. are advanced questions that helps clarify some really deep and unknown stuff about the game's core engines.

#

Some taking me a couple hundred hours going through decompiled code to understand. :D

#

So yeah helpful.

#

Not dumb.

zinc pilot
#

How long have you been up working on this if I may ask? Sounds like such an hassle

red tiger
#

This? Time-wise a year. Hours? Around 200 for these API.

zinc pilot
#

jesus

#

makes sense

red tiger
#

It's for a content mod I'm writing. I figured since I don't have the time to finish that ATM I'd release the tools I built for the mod to work. =)

zinc pilot
#

so if I'm understanding correctly, you've basically redone a lot of their rendering pipeline

red tiger
#

The biggest being shader uniform values being modifiable at runtime through Lua.

zinc pilot
#

hot reloading of shaders?

red tiger
#

hot-reloading can be a thing yeah. I modified the base class for shaders to have that. I added a global call reloadShaders() so I can actually debug / test.

#

xD

zinc pilot
#

to be fair I didn't even know you could apply custom shaders on zomboid

red tiger
#

You can without modifying the core game's code. The problem with that is that you can only modify what shaders the game uses and you cannot modify their values.

bronze yoke
#

yeah, i've messed with custom shaders but there just isn't a lot you can do with them without that mod

red tiger
#

Being able to extend on modding support with Shaders might simply be a very low priority item (If TIS even considers this a future feature)

#

But I kind of wanted it.. right now. xD

zinc pilot
red tiger
zinc pilot
#

my experience with shaders is limited only with reshade flavour of HLSL, so not much

bronze yoke
#

you can't pass any information from the game to the shader

zinc pilot
bronze yoke
#

you can only use information vanilla already passes, and things that can run entirely within the shader

lunar shard
#

this mod is published?

red tiger
bronze yoke
#

at the moment the only use i've been able to get out of them is letting vehicle parts support transparent textures, since that only needs to access the texture

red tiger
#

I'm near a mini-fridge and heard it through my earphones.. Thought I had PZ open and idling in a house.

#

Hahaha

zinc pilot
#

now I'm really curious, are you gonna release the code somewhere?

red tiger
sand harbor
#

is there way to set engine quality/loudness to anything besides 100? I've only seen stuff do it with SendClientCommand (the debug option) and I don't know where that goes

zinc pilot
#

really curious nonetheless :p

red tiger
#

Leaving for an hour or two but before I do this is what my current demo code shows @zinc pilot

hollow current
#

still can't figure out how to configure what's written in a paper, would appreciate it if someone has an idea!

red tiger
#

This is the backdrop shader working.

hollow current
#

basically I am trying to have a piece of paper spawn with something specific written in it

weak sierra
#

java mod?

weak sierra
#

or do you hook into stuff previously unused in lua

grim rose
zinc pilot
#

shaders done with GLSL?

red tiger
weak sierra
#

nod

#

nice work

grim rose
#

everything works

red tiger
#

I intend to release it soon. It'll be a collection of tools so that it can omnibus other needed things and people can grab it from one source.

#

The project is called "Crowbar".

#

Just like I did with ModelLoader back in 2014, this intends to be tools to improve the game's quality of life via additional API and modding tools.

#

Cya guys. bbl. Thanks for input on the progress!

ancient grail
#

Wasnt able to find solution

zinc pilot
#

New question, when is transmitModData actually necessary?

bronze yoke
#

technically not necessary if you don't need other clients to know about it, but i would transmit it anyway

#

if another mod changes the moddata from another client and transmits it, the local moddata is overwritten - better to just keep everything synchronised

zinc pilot
#

I was under the impression that modData is local only

#

like, you can't access modData stuff of player 1 on player 2 client

#

or am i missing something?

bronze yoke
#

every client has moddata on everything, they just don't get synchronised automatically

zinc pilot
#

so in theory I should be able to have two different clients and get each modData on every client, correct?

#
local player1 = getPlayer()
local other_player = ...

player1:getModData()

other_player:getModData()

#

to be more precise

#

this should work, no?

drifting ore
#

does anyone know a mod that makes you see injuries when u hover over your " bandage" there used to be one but its gone

bronze yoke
#

that should work

zinc pilot
#

mhhhhhhhh

#

I've been working for a bit on a continuation of the only cure and everytime I tried to get modData from another client it failed

#

I would get only nil from them

#

I managed to workaround it by sending data to the server and then back to the client

#

are you sure about this?

bronze yoke
#

i have a mod that relies on the server setting and using moddata on all the players

zinc pilot
#

I'm really confused... If I use transmitModData I should have every other modData from other players then, correct?

#

wait... there was some error since the og dev added a transmitModData in an EveryOneMinute function and it just errored it out

bronze yoke
#

you set the moddata on the object and then transmitmoddata on that object and it should be available to all clients and the server

zinc pilot
#

maybe it was overwriting other players mod data with nil because of that

#

if that's the case, holy shit I've been workarounding it since forever

#

just to be sure, I should be able to update modData via transmitModData in an event, right?

bronze yoke
#

yeah

zinc pilot
#

well shit

#

time to hunt it down then

#

thanks

#

receiveObjectModData: index=-1 is invalid x,y,z=8208,11601,0

#

that's what I get from Events.EveryOneMinute

#

any idea?

bronze yoke
#

sounds like the transmit command is messed up in some way

#

can you show the code around that?

zinc pilot
#

shouldn't it be only player:transmitModData()?

bronze yoke
#

yeah that's it

zinc pilot
#

    local player = getPlayer()
    -- To prevent errors during loading
    if player == nil then
        return
    end

    local toc_data = player:getModData().TOC

    if toc_data ~= nil then
        TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
        TheOnlyCure.UpdatePlayerHealth(player, toc_data.Limbs)
    end

    player:transmitModData()

end```
#

in the og mod player:transmitModData() was spammed fairly frequently in every function

ancient grail
zinc pilot
#

in the OnEveryMinute section

ancient grail
#

cool mod man

bronze yoke
#

index -1 implies to me that it isn't actually finding the player object when it sends it, or something

#

but this looks fine to me

zinc pilot
ancient grail
#

ow was it abandoned?

bronze yoke
#

and like

zinc pilot
bronze yoke
#

if player wasn't a valid player object somehow we would be seeing a lot more problems

zinc pilot
#

fairly broken

bronze yoke
#

so i'm not really sure why that's happening

zinc pilot
#

I should be able to have tables inside tables in a modData table, right?

bronze yoke
#

yeah

zinc pilot
#

or is there some kind of limitation

#

mh

#

I guess transmitModData isn't coded in lua, right?

#

so I can't even access it from the debugger

#

wait, shit

#

it's sending it from the server

#

I'm an idiot

#

I should make so that only clients can send it, right?

ruby urchin
#

player can't transmit mod data? I did some time ago some test, but never get the mod data on the other side

bronze yoke
#

getPlayer() shouldn't return anything on the server so it's fine

#

the function will just return

zinc pilot
#

the error spam is coming from the server though

#

not the clients

#

I would expect to see that error on a client

ruby urchin
#

Oh well, anyway I used the traditional way

zinc pilot
#

same but it stinks of work around

#

if there is a better way to do it, I wanna be able to

bronze yoke
#

now that i'm thinking about it... i think my mod that i was talking about earlier found the exact same problem...

#

my memory really isn't very good šŸ˜…

zinc pilot
#

even without that, I wanna be able to fix this error

#

I think even the og dev asked about it here

#

ok, so it's sending it correctly from the clients but receiveObjectModData fails

#

mh could it be that you can't send empty tables inside tables?

sour island
#

If I recall isoPlayers have some kind of problem with their references that doesn't impact other isoObjects using trasnmitModdata - afaik there isn't a purposeful limitation placed with their modData so it's probably an unintentional behavior šŸ¤·ā€ā™‚ļø

#

IsoZombie has a similar limitation (unless it was changed) theirs can't save across session

#

If you REALLY need to transmit the modData you can use client/server commands

#

As those pass to the correct player

zinc pilot
#

so like I was doing before then

#

gotcha

#

good to know

sour island
#

Depending on what this information is it may be better to store it on the server

zinc pilot
#

now just to be sure, I'm getting the same error even with this


        Limbs = {
            Right_Hand = {},
            Right_LowerArm = {},
            Right_UpperArm = {},

            Left_Hand = {},
            Left_LowerArm = {},
            Left_UpperArm = {},
            is_other_bodypart_infected = false
        },
        Prosthesis = {
            WoodenHook = {
                Right_Hand = {},
                Right_LowerArm = {},
                Right_UpperArm = {},

                Left_Hand = {},
                Left_LowerArm = {},
                Left_UpperArm = {},
            },
            MetalHook = {
                Right_Hand = {},
                Right_LowerArm = {},
                Right_UpperArm = {},

                Left_Hand = {},
                Left_LowerArm = {},
                Left_UpperArm = {},
            },
            MetalHand = {
                Right_Hand = {},
                Right_LowerArm = {},
                Right_UpperArm = {},

                Left_Hand = {},
                Left_LowerArm = {},
                Left_UpperArm = {},
            },
            Accepted_Prosthesis = {}

        },
        Generic = {test = false},
    }```
#

This should be acceptable by transmitModData or am I missing something?

thick karma
#

Anyone know how to move this tooltip to the right properly? I thought I had it working but I restarted and it is not working so clearly I am using the wrong function or using the right function at the wrong time... If anyone else who knows ISToolTipInv could be all, "Oh, yeah, that files a mess, but you need to do this..." that would be great.

zinc pilot
#

I've basically gut everything out and left only the init and the updates (with just a print in them) and I'm still getting the error

#

I even tried having the modData with only a boolean

#

and I still get the errror

#

pretty sure there is something wrong with transmitModData inside Events

tame mulch
zinc pilot
#

player:transmitModData

#

I check before if player is nil

tame mulch
zinc pilot
zinc pilot
#

so there is no way to transmit mod data from players object, right?

thick karma
#

I figured it out @tame mulch but thanks so much. I needed to call DoTooltip.

zinc pilot
#

I mean, not directly

thick karma
#

And I need to change the position in the middle of a vanilla function

#

meaning it needs overwritten

#

BUT

#

Wait

#

I do have something more important for you

tame mulch
thick karma
#

You worked on Aquatsar, right? @tame mulch

tame mulch
zinc pilot
tame mulch
zinc pilot
#

mh is there any example in the wiki? I've never heard of it

thick karma
#

Do you know anyone who is? Or would you be willing to add this udpate?

    WGS = WGS or {} -- Doesn't really matter to me how this function gets made.
    WGS.isWaterAhead = function(player)

        local waterDirectlyAhead = false
        local direction = player:getForwardDirection()
        local x = player:getX() + direction:getX()
        local y = player:getY() + direction:getY()
        local location = player:getSquare()
        local destination = getCell():getGridSquare(x, y, player:getZ())
        if location and destination and 
           destination:Is(IsoFlagType.water) and 
           not location:Is(IsoFlagType.water) and 
           not location:isWallTo(destination) and 
           not location:isWindowTo(destination) then 
            return true
        end 

    end

    function fastSwimJoypad(joypadData, joypadButton)
        -- print(joypadData.player)
        if joypadButton == Joypad.BButton then
            local player = getSpecificPlayer(joypadData.player)
            local dir = player:getForwardDirection()
            local x = player:getX() + dir:getX()
            local y = player:getY() + dir:getY()
            local sq = player:getSquare()
            local sqDir = getCell():getGridSquare(x, y, player:getZ())
            if sq and sqDir and 
                    sqDir:Is(IsoFlagType.water) and 
                    not sq:Is(IsoFlagType.water) and 
                    not sq:isWallTo(sqDir) and 
                    not sq:isWindowTo(sqDir) then 
                player:setX(x)
                player:setY(y)
            end 
        end
    end

    function ISButtonPrompt:getBestAButtonAction(direction)

        WGS.originalGetBestAButtonAction(self, direction)
        
        local player = getSpecificPlayer(self.player)
    
        local boat = ISBoatMenu.getBoatInside(player)
    
        if boat then
            if boat:getPartById("InCabin" .. string.sub(boat:getPartForSeatContainer(boat:getSeat(player)):getId(), 5)) then
                self:setAPrompt(nil, nil, nil)
            else
                self:setAPrompt(getText("IGUI_ExitBoat"), self.cmdExitBoat, player)
            end
            return
        end
        boat = ISBoatMenu.getBoatToInteractWith(player)
        if boat then
            self:setAPrompt(getText("IGUI_EnterBoat"), self.cmdEnterBoat, player, boat)
            return
        end
    
        if (player:isSprinting() or player:isRunning()) and player:getSquare() and 
               not player:getSquare():Is(IsoFlagType.water) and WGS.isWaterAhead(player) then
            self:setAPrompt(getText("IGUI_JumpInWater"), fastSwimJoypad, Joypad.BButton, nil, nil)
            return
        end

    end
tame mulch
thick karma
#

This code makes it so opening doors is still possible while jogging or sprinting on gamepad

tame mulch
#

@zinc pilot What exactly you want to do

thick karma
#

With Aquatsar installed, your jogging and sprinting normally blocks door-opening, even when no water is around.

zinc pilot
tame mulch
#

@thick karma Ask IBrRus in his discord

zinc pilot
#

I've been using client-server commands for now

zinc pilot
#

but I was under the impression there's a better way

thick karma
#

Cool, I'll try to find it.

zinc pilot
# tame mulch for what?

I'm fixing up the only cure, the amputation mod, I need mod data from another player to set the correct variables when I'm amputating a limb or stuff like that

tame mulch
zinc pilot
#

you're amazing, thanks

tame mulch
#

@zinc pilot

-- Client part

function OC_OnReceiveGlobalModData(key, modData)
    if modData then
        ModData.remove(key)
        ModData.add(key, modData)
    end
end
Events.OnReceiveGlobalModData.Add(OC_OnReceiveGlobalModData)

function OC_OnConnected()
    ModData.request("OC_PLAYER_DATA")
end
Events.OnConnected.Add(OC_OnConnected)


-- Client Usage

...
if ModData.get("OC_PLAYER_DATA")[anotherPlayer:getUsername()] ~= nil then
    local anotherPlayerData = ModData.get("OC_PLAYER_DATA")[anotherPlayer:getUsername()]
    if anotherPlayerData.L_arm == ... 
    ...
end
...

...
if PLAYER_CHANGED_ARM then
    sendClientCommand(playerObj, 'OC', 'ChangePlayerState', { L_arm = "NONE", ... } )
end
...


-- Server part

OC_Commands = {}

function OC_OnInitGlobalModData()
    ModData.getOrCreate("OC_PLAYER_DATA")
end
Events.OnInitGlobalModData.Add(OC_OnInitGlobalModData)

OC_Commands.OnClientCommand = function(module, command, playerObj, args)
    if module == 'OC' and OC_Commands[command] then
        OC_Commands[command](playerObj, args)
    end
end
Events.OnClientCommand.Add(OC_Commands.OnClientCommand)

OC_Commands.ChangePlayerState = function(playerObj, args)
    ModData.get("OC_PLAYER_DATA")[playerObj:getUsername()] = args
    ModData.transmit("OC_PLAYER_DATA")
end
zinc pilot
#

thanks man

zinc pilot
tame mulch
zinc pilot
#

perfect, thanks

stable light
#

Hypothetically speaking. If I wanted to have a custom mod developed for the game and was willing to pay to have something made (be it, it would be a little while before I decide to do this). What would be the best way to find someone willing to do this?

zinc pilot
#

got it working, you're amazing @tame mulch

#

thanks again

grim lynx
#

Is it better to use discord or read the forums if I'm trying to learn how to mod ?

drifting ore
#

@ancient grail should edit that post to add this also and someone should pin it. all those links together is literally almost everything you'd need to get going from no knowledge.
https://rentry.co/BluesModClues

#

some is redundant info but every single link i went to had something the other didnt lol

sour island
#

The stance atm is that anything useful should go on the wiki page for modding help - and a link to that can be pinned.

#

I like the look of rentry tho ngl

drifting ore
#

fair enough that it prolly best

sour island
#

Best part is anyone can contribute to the wiki

drifting ore
#

oh well, easy add! thanks good sir

ancient grail
drifting ore
#

gotcha. no idea what limits are there. haha didn't even know nitro gave you more length

ancient grail
#

We could re create the post tho

#

Mod Learning Materials

``
PzWiki:
https://pzwiki.net/wiki/Modding

Lua events:
https://pzwiki.net/wiki/Modding:Lua_Events

Mod permissions:
https://theindiestone.com/forums/index.php?/topic/2530-mod-permissions/

Fenris guide:
https://github.com/FWolfe/Zomboid-Modding-Guide

Dislaiks guide:
https://steamcommunity.com/id/Dislaik/myworkshopfiles/?section=guides

https://projectzomboid.com/modding/index-files/index-1.html

Konijimas guide:
https://gist.github.com/Konijima/7e6bd1adb6f69444e7b620965a611b74

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

Mr bounty guide:
https://github.com/MrBounty/PZ-Mod---Doc

Recipe and item variables:
https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/

Lua:
https://www.lua.org/pil/contents.html

Server client commands:
https://github.com/RangerSimple/ProjZomb-Guides

Mapping and tiles:
https://youtube.com/@daddydirkiedirk119

Loot distrib:
#mapping message

Clothing masks:
#modeling message

DoParam:
#mod_development message

Item full type:
#mod_development message

Mod Testing:
#mod_development message

Startup Param:
https://pzwiki.net/wiki/Startup_parameters

Vehicle modding:
https://theindiestone.com/forums/index.php?/topic/24408-how-to-create-new-vehicle-mods/

Clothing mod:
https://steamlists.com/project-zomboid-how-create-a-clothing-mod-41-60/

Authentic peach guide:
https://theindiestone.com/forums/index.php?/topic/49385-do-not-delete-luascript-files-from-your-mod-some-modding-guidelines/#comment-342943

tag system:
https://theindiestone.com/forums/index.php?/topic/53019-details-on-the-improved-modding-tag-system-in-4169/
``

#

.
azak's wordzed guide:
[#mod_development message](/guild/136501320340209664/channel/232196827577974784/)

Javadocs:
https://rentry.co/BluesModClues

MusicMan's SandBox Guide:
[#mod_development message](/guild/136501320340209664/channel/232196827577974784/)

Vanilla Sandbox
https://theindiestone.com/forums/index.php?/topic/20771-sandboxvarslua-file-explanation/

Albion: OnPlayerGetDamage event
[#mod_development message](/guild/136501320340209664/channel/232196827577974784/)

Albion: Hook Guide
https://github.com/demiurgeQuantified/PZ-events-guide/blob/main/Hooks.md

#

.
Vehicle modding:
https://theindiestone.com/forums/index.php?/topic/24408-how-to-create-new-vehicle-mods/

Vehicle modding:
https://theindiestone.com/forums/index.php?/topic/28633-complete-vehicle-modding-tutorial/

Vehicle skins modding:
https://theindiestone.com/forums/index.php?/topic/24278-how-to-edit-vehicle-skins/

Mod install:
https://pzwiki.net/wiki/Modding#How_to_install/play_mods

Tile properties https://pzwiki.net/wiki/Tile_Properties

Chucks guide:( object types and flags)
[#mod_development message](/guild/136501320340209664/channel/232196827577974784/)

Check serverclient game mode:
[#mod_development message](/guild/136501320340209664/channel/232196827577974784/)

#

.

#

Anything else you guys want me to add?
Ill update my bookmarked msg link to this

drifting ore
#

oh nice. this is good. i honestly have a hard time going thru that wiki atm. needs a facelift big time. I may attempt

#

atm feels like im doing a puzzle with all pieces upside down

ancient grail
#
function GlytchMenu2.press(key)

    if (key==199) then --home
    --GlytchMenu2.openPanel()
    return key
    end
    
    if key == getCore():getKey("Pause") then
    print('do stuff here')
    return key
    end
end



Events.OnKeyPressed.Add(GlytchMenu2.press);

drifting ore
#

yea i was trying to use NUMPAD_4 for awhile there and realized....

ancient grail
drifting ore
#

sounds good

ancient grail
#

Or you can edit the msg you sent in the midle and add the link there

drifting ore
#

kk

sour island
#

There's github pages - not sure how they work yet

#

Seems like a webpage or glorified readMe

drifting ore
#

they are lol

sour island
#

But it could look a bit nicer with images and cleaner linking than the wiki

drifting ore
#

also more clear direction on what is what. right now it has only a few specific directions and the rest are just grouped into one group

#

it would be nicer to see script stuff in one area, lua stuff in another etc

#

kinda like how mapping is atm even tho thats not great also..

#

anyway i write training manuals and do corporate training so this kinda stuff is right up my alley. if i have time I will attempt

ancient grail
drifting ore
#

and yes my grammer is a thousand times better after a good proof read. LOL

#

btw I hope noone takes my words offensively. really appreciate everything so many have done. i should really state this

sour island
#

Everyone has editing access on the wiki afaik

drifting ore
#

yea i just need to make time to do and not only talk about it šŸ˜„

sour island
#

And they're always looking for help

#

No worries either way, free time is precious

bronze yoke
#

the wiki page seems fine to me, probably needs to be organised a little but the bigger problem isn't that the resources aren't accessible but that the resources don't exist

drifting ore
#

yea it's got a LOT. only organization yea thats really it just grouping and a little formatting. i really honestly could maybe do it soon

#

says person too lazy to use shift key when typing šŸ˜›

#

this entire community is one of the best around. from company to devs to people

ancient grail
drifting ore
#

just a random question how can i combine mod traits with mine?

ancient grail
#

And then ill be the one to answer šŸ˜‚ lol
What trait mod u looking to use?
You should always ask permission
Otherwise just require the mod and credit the author

drifting ore
#

i all was credit the author

ancient grail
#

Ye should still send a msg atleast šŸ™‚

drifting ore
#

anyone know if it's possible to impose a level requirement on an items usage?

ancient grail
drifting ore
#

a book from my lightswitch mod

#

i can impose crafting req but wondered about item

drifting ore
#

i was trying with doparam but i dont actually think it's valid parameter

bronze yoke
#

for a book you'd probably want to gate the timed action somehow

#

or override the context menu to tell you you can't read it, that's probably better

drifting ore
#

🤯 good idea thank you

ancient grail
#

Ow ok you should probably remove its read context menu . By hookong on to the vanilla and do oncreate function to give the benefits with ontest checking your level

bronze yoke
#

i'd have the book work completely normally, just have the option disabled and have a tooltip saying 'you need to be a higher level in whatever'

ancient grail
#

Thats better idea

drifting ore
#

thank you both. this is perfect haha. was hoping. love item restrictions over craftin because it makes more sense that you don't understand a book in an RP scenario, than learned it but cant craft

bronze yoke
#

it might not stop players from right clicking the item to read it actually, you'd have to check how to limit that

ancient grail
#

How does vanilla do it

#

Like u have to read book vol 1

#

Then 2

#

Then so on

#

Yeah just look for that contextmenu for read and jist hook there. Best approach ithink

bronze yoke
#

that's not quite how vanilla works

#

it's based on what level your skill is, not which books you've read

drifting ore
#

i couldnt use the concept from checking book prerequisites and just change that to getSkillTrained or w/e?

bronze yoke
#

vanilla just has your character go 'i don't understand...' and cancel the timed action

#

it's pretty easy to copy if you want to do it that way

drifting ore
#

yea i'm looking at some UI stuff showing kinda how it works

bronze yoke
#

if you do it that way make sure the character has lines specific to the reason they can't read

drifting ore
#

thank you for the suggestion i really like this method i think the best. gonna see how to implement it here and i'll report back in case anyone else wants to do the same in the future

bronze yoke
#
local old_isValid = ISReadABook.isValid

function ISReadABook:isValid()
    if Literacy.PlayerHasReadBook(self.character, self.item) or self.character:getAlreadyReadBook():contains(self.item:getFullType()) then
        Starlit.sayRandomLine(self.character, {'IGUI_PlayerText_AlreadyRead', 'IGUI_PlayerText_AlreadyRead2'})
        return false
    end
end
```here's how one of my mods does it
drifting ore
#

being very new to coding in general, this saves me a ton of time and yet another example i can learn from. thanks!

bronze yoke
#

just to be clear Starlit.sayRandomLine isn't a vanilla function, i was just showing the structure of how these work

drifting ore
#

yea lol all good

bronze yoke
#

felt weird to be writing the same 'pick a random line' code all over the place lol

drifting ore
#

i have most of the basics of what im looking at in most code and i will use find in files on the decomplied luadoc if i see something i dont understand its function

#

thank you for the clarity i've prolly been spending like 8+ hours a day learning this stuff lol

#

super excited to add fully customizable sandbox options also.

ancient grail
#

Sandbox are easy u just need the syntax

#

Im not using desktop i could have sent u a snippet

drifting ore
#

hard to test this since i have to run around. but i have been looking for it lol

bronze yoke
#

you need to get a bit fancier for sandbox option distributions

#

this code will run when the game boots, which is usually before sandbox options are set... it varies sometimes so it can be really annoying to debug

ancient grail
drifting ore
#

ohhh yea

#

i completely forgot about that tool

bronze yoke
#

usually distributions are parsed to the java before sandbox options even load

ancient grail
bronze yoke
#

you can, you have to make it re-read the distribution tables

drifting ore
#

different event?

ancient grail
#

Nice atleast theres a workaround

#

OnPostMergeDistribution or something like that

bronze yoke
#
local function HandleDistributions()
    if SandboxVars.Literacy.WantGunBooks then
        table.insert(ProceduralDistributions['list']['BookstoreBooks'].items, 'Literacy.BookAiming')
        table.insert(ProceduralDistributions['list']['BookstoreBooks'].items, 0.5)
    end

    ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(HandleDistributions)
```here's a super stripped down example from one of my mods
#

this runs (afaik) as early as it can after sandbox options load, and after it runs ItemPickerJava.Parse() which makes the java re-read the table

drifting ore
#

oh this is super efficient with an actual failsafe

#

okay thank you yet again

ancient grail
#

Whats itempickerjava.parse

drifting ore
#

they just said it parses the table i think

ancient grail
#

What if u call that during the game using debug

bronze yoke
#

it's the method that pulls the distribution tables into the item picker

#

i think that's fine

#

it just pulls the tables again

ancient grail
#

Ahhh makes sense now

bronze yoke
#

it doesn't read them directly from lua so if you make changes to the tables they won't be reflected until you call that method

ancient grail
#

Sorta like a refresh if incase you modofied stuff

rustic grove
#

if I add a window to the UI Manager, to prevent duplicates how do I check if that window already exists?

function onCustomUIKeyPressed(key)
    if key == 21 then
        local myUI = MyUI:new()
        myUI:initialise();
        myUI:addToUIManager();
    end
end```
drifting ore
#

wait so i could tie this to initsandboxvars or whatever that is and it would refresh the values without restart?

bronze yoke
#

basically add to the new() method MyUI.instance = self (or o, i forget the exact syntax), and nil it during whichever method destroys the ui

rustic grove
#

ok, but if I use say an ISCollapsableWindow, then how would I destroy/reassign that field if the X button is pressed?

#

shoulda asked that to begin with I suppose lol

ancient grail
#

I would just close the first one then reopen another if i can make it that it dont goves off error if its trying to close nil

drifting ore
#

chuck just solved that earlier today i think

#

and posted the fix

#

where it wont open after x

rustic grove
#

!

ancient grail
rustic grove
#

hrmm... not actually seeing anything relating to the X close on an ISCollapsableWindow.... am I blind?

drifting ore
#

looking

bronze yoke
drifting ore
#

i dont think it was that exact usage also is why you cant find that

rustic grove
#

hrmm.... extend my own ISCOllapsableWindow perhaps?

proper folio
#

trying to make my first custom map test which is just a 300x300 basic cell with a house but Im getting errors when trying to start a game
ERROR: General , 1674435819529> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: can't create player at x,y,z=11702,6896,0 because the square is null at IsoWorld.init line:2799.
ERROR: General , 1674435819529> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: can't create player at x,y,z=11702,6896,0 because the square is null
im confused about the coordinates because my map is only 300x300 but it shows x,y,z=11702,6896,0
not quite sure what that means lol

drifting ore
red tiger
#

Buzzed modding session? Buzzed modding session.

proper folio
#

(posted in #mapping too cause I was unsure where to post)

ancient grail
#

I wonder what will happen with getPlayer() = nil
zombie

bronze yoke
#

nothing

#

you overwrite your reference to the player with a reference to nil, and you never saved the reference to a variable so it doesn't do anything at all

bronze yoke
bronze yoke
#

i'm afraid modding ui is very manual in pz

rustic grove
red tiger
bronze yoke
#

which is why only one of my mods has a ui element LOL

red tiger
#

=)))

sour island
#

šŸ‘ļø šŸ‘„ šŸ‘ļø

red tiger
#

I'm glad that my stuff is so old that I don't get any new messages.

#

I usually feel like if I get messages from people asking me about my content uploads that means I failed.. since my stuff is to help make stuff easier. =(

sour island
#

Generally I don't get many comments - a few of them were the same guy representing a server asking to use stuff.

bronze yoke
#

if i wake up to more than one or two notifications i'm starting my day worried

sour island
#

I get an influx whenever there's an update - if I messed up it's over 10+

#

5ish or so is just people telling me to update at a time better suited to their personal time zone drunk

bronze yoke
#

it's annoying to have to be tech support and stuff, but a lot of the comments i get are just very nice too

sour island
#

The pleasant ones are always nice

#

I was on the fence about dropping steam comments, cause most people can't be bothered to report stuff

#

but the cost/benefit quickly dropped lol

red tiger
#

This is why when I write content mods I'm writing a config file to load only version-specific code so people don't go insane when I upload a new version.

#

i've seen way too much grief over subtle version updates. =(

sour island
#

So you have the files execute depending on version?

red tiger
#

Oh you could totally do this.

sour island
#

I know, but that seems like a pain lol

red tiger
#

Self version-control saves lives.

warm flame
#

Mod idea for MP: False floor tile. Can store X amount of shit and is an undetectable container unless you have foraging X+ or are the person who made it. Can only craft 1 per floor per building

#

Another one for MP: Hotwire Blocker. A vehicle upgrade that makes the car impossible to hotwire. Require mechanics and/or electrical X+ to install

sour island
#

Solid ideas, good for a first time mod. šŸ‘

plucky pollen
#

hey everyone.. i have this vehicle mod.. but i want to make it so it does not spawn anywhere on the map basically making it a admin spawn only as I want it to be a limited # on map only... how would i do this?

#

like would it just be setting this spawnChance = 2 to 0?

drifting ore
cosmic condor
#

@drifting ore I guess the accuracy of the translation may depend on the amount of data available for each language. (try not to hijack mod support šŸ˜† )

drifting ore
#

so true lol

cosmic condor
#

context is where most failures occur in machine translation

#

translators nowadays use machine translation as a pre-translation tool and then do some post-editing

drifting ore
#

yes its saying you can't spawn somewhere where there isn't map

#

so your spawn coords maybe are bad?

#

did you set the lots for being added to vanilla? or standalone

#

those coords tell me probably meant for vanilla implement

#

the way coords work is pretty much 1 pixel of map = 1 unit

#

so if your map is at 3x3 your spawn coords will be within x900-x1200, y900-y1200 (i think i did that right) lol

#

people in mapping will still be able to help you better than here though for the most part outside of reading that error maybe

#

@vast nacelle not sure if you figured this out also but seems like might work for you in your issue with MP sandbox issue with distributions
#mod_development message

I noticed it when looking for a solution for myself

#

oh and Thank you @bronze yoke it works perfect and so simple

#

and yes im fixing the translation for that šŸ˜„

bronze yoke
#

i'm glad that worked out!

drifting ore
#

im also starting to believe that spawn weights are based on not only the total weights average of all items of that type vs item, but also only being considered for the chunk you are actually in that loads, or worse the specific roomdef itself is considered only when spawning items

#

i always assumed item spawn weights were a global thing but i'm assuming the way the game works as is, is not true

bronze yoke
#

i'm not sure i understand what you mean

drifting ore
#

not 100% how item spawn weights work

bronze yoke
#

when you say spawn weights do you mean the spawn chance? that's just per container

drifting ore
#

yea weights i meant chance

bronze yoke
#

it's not as complicated as many people (myself included) first assume, for example each BookstoreBooks has a 0.023...% chance of spawning your item

#

it doesn't consider how many are already in the world or anything like that

drifting ore
#

gotcha just per container period

proper folio
#

I was just following daddy dirkies tutorials

drifting ore
#

each 1x1 cell is 300x300 pixels

proper folio
#

Ye

drifting ore
#

that is same measurement of coord location in game

#

so those coords you posted are pretty far into the map

drifting ore
#

lets goto mapping

proper folio
#

But how can they be anywhere in the map? Shouldn’t the max possible coords be x300 y300?

#

I only have one cell

drifting ore
ancient grail
ancient grail
ancient grail
sour island
# ancient grail Did you allow?

I usually do, as long as the pack is unlisted. He mentioned editing the code - which as per the license I chose requires changes to be made available.

ancient grail
#

Mod pack steals subs

sour island
#

personal opinion: That's why I usually ask the packs be unlisted, and that is not really something you can stop either way + subs don't mean much

cosmic condor
#

they don't want the server to restart because of mod updates, so they create a mod pack to halt the update šŸ˜…

sour island
#

I'd revise my statement to say I prefer it being unlisted to keep the clutter on the workshop down too

sour island
ancient grail
#

I respect that. At first i feel the same. But some people who hjre for commission looks at these stuff . Rarely but atleast it sorta matter on my perspective..

sour island
#

If they give credit it's more advertising than anything eitherway

plucky pollen
ancient grail
ancient grail
cosmic condor
#

I've seen some people ask a mod developer refrain from updating their mod on a weekend, as that is when their players are at its peak stressed

ancient grail
#
    local vehiclesToDelete = {
        ["Base.SmallCar"] = true,
        ["Base.SmallCar02"] = true,
        ["Base.CarTaxi"] = true,        


        ["Base.ModernCar02"] = true,

        ["Base.SportsCar"] = true,
        ["Base.CarLuxury"] = true,        
        ["Base.OffRoad"] = true,
        ["Base.ModernCar"] = true
    }
    
        for key, value in pairs(VehicleZoneDistribution) do
            for vehicle, data in pairs(value.vehicles) do
                if vehiclesToDelete[vehicle] then
                    value.vehicles[vehicle] = nil
                end
            end
        end

This is the code that dodnt work

#

Well i think this is half of it o cant find the other half

ancient grail
#

ahmm anyone knows how create a small simple input text box

azure rivet
#

Hello.
I see that there is a setting in the animation events that are "ZombieHitReaction", can someone send me a reference that explains them, I tried to implement some but it doesn't seem to change anything.

small topaz
#

I am still working on sending data from server to client and now I have found smth which works fine for me when I play alone via the host button. My question is whether this will also work when other players are around. Maybe anyone an idea? Here is a minimal code example:

ancient grail
#

You check by launching
Host: -nosteam -debug
Client: -nosteam

ancient grail
#

Or use lua
OnZombieUpdate event

small topaz
ancient grail
#

for both of you

#

since you need test if it can be seen by other players

small topaz
ancient grail
#

no the thing im telling you will let you open 2 diffrent instances of the game

#

you can use one as host and another or more as client

#

just change the username for each instance

#

this wil allow you to test MP features and you dont have to bother friends or run mods on a live server to test

small topaz
neon bronze
drifting ore
#

so im trying to remove all the magazines from the base game distribution and they still keep coming up. Is there anything besides this code i have to include in my patch? ```require "Items/ItemPicker"
require 'Items/Distributions'
require 'Items/ProceduralDistributions'
require 'Items/SuburbsDistributions'
require 'Vehicles/VehicleDistributions'

---Base Game

RemoveItemFromDistribution(Distributions[1], "Base.MechanicMag1", nil, true);
RemoveItemFromDistribution(SuburbsDistributions, "Base.MechanicMag1", nil, true);
RemoveItemFromDistribution(VehicleDistributions, "Base.MechanicMag1", nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, "Base.MechanicMag1", nil, true)

drifting ore
drifting ore
#

but this mag still shows up as well so im wondering if im doing something wrong

small topaz
#

I am currently trying to get into modding of item spawn rates (want to change the rate for a vanilla item). I think I already know some of the coding required but I do not yet know the meaning of all those parameters in the distribution table. Here is a vanilla example:

#

what does "rolls=4" means what is the meaning of all those integers? Probably smth about the probability to find them there??

ancient grail
neon bronze
#

šŸ‘ i think the textbox could also be set to accept numbers only if it ever is needed

ancient grail
#

I need to give my client a debug code to modify sandbox settings on single player is it possible?

#

I have an idea
To fix my prob. How do i check if its running single player?
isClient()?

silk hemlock
tame mulch
tame mulch
# small topaz

I am not sure that this is will work in MP because you not send ModData changes to clients

odd notch
#

@heady crystal to touch on what i mentioned in that comment,

function DebugContextMenu.OnWindowLock(worldobjects, window)
    window:setIsLocked(not window:isLocked())
end

this is the debug onwindowlock function. it's a simple boolean swapparooni. if you made a timed action like you have with your other prying stuff, then instead of setting the door's islocked, setting the window's, pow. :)

#
CSServer.PryDoorOpen = function(priableObject, playerObj)
    if not priableObject then return; end
    --window check
    if instanceof(priableObject, "IsoWindow") then
        priableObject:setIsLocked(false)
    else
        priableObject:setLockedByKey(false)
    end
    
    --playerObj:getMapKnowledge():setKnownBlockedDoor(self.priableObject, self.door:isLocked())

    local doubleDoorObjects = buildUtil.getDoubleDoorObjects(priableObject)

    for i=1,#doubleDoorObjects do
        local object = doubleDoorObjects[i]
        object:setLockedByKey(false)
    end

    local garageDoorObjects = buildUtil.getGarageDoorObjects(priableObject)

    for i=1,#garageDoorObjects do
        local object = garageDoorObjects[i]
        object:setLockedByKey(false)
    end

    ISTimedActionQueue.add(ISOpenCloseDoor:new(playerObj, priableObject, 0));
    BravensUtilsO1.TryPlaySoundClip(playerObj, "BreakBarricadePlank") 
end

something like this in your CSServer.lua perhaps

ancient grail
# tame mulch ```lua if not isClient() then ``` Also can check that is not isServer()

yep thats exactly what i did
i just forgot to post here that i figured it out sorry

function ArcherMenu1.press(key)
    --if (key==201) then --pgup 
    local kc = SandboxVars.Archer.Key or 51
    if (key==kc) then --comma
    local isNonAdminAllowed = SandboxVars.Archer.Toggle 
        if isNonAdminAllowed or (getCore():getDebug() or isAdmin()) or not isClient() then
            ArcherMenu1.openPanel()
        end
    return key
    end
end
Events.OnKeyPressed.Add(ArcherMenu1.press);


odd notch
zinc pilot
#

Is there a way to modify existing world items such as doors and fences?

#

I'm not talking about craftable ones

tame mulch
jovial harness
#

@tame mulch @zinc pilot I was wondering about that too. Making tall wooden fences destructible by zombies for example

zinc pilot
zinc pilot
ancient grail
high cloak
#

does anyone know if translation files are parsed as lua? i ask because i'm wondering if they can accept multi-line strings with double square brackets

sour island
hollow current
#

Maybe there is a solution to create a custom item and be able to configure its contents?

#

still though, I am not sure how'd that be possible

sour island
#

I don't see why it'd be impossible

#

Just depends on what your end goal would be

#

For 'Named Literature' I set a modData on viewing objects if one isn't set

#

I also use an unsaved list to hold references to objects already edited

hollow current
#

im trying to spawn paper/paper-like items around the world, each with its own written content, which is picked randomly from a set of pre-written stuff in the mod

sour island
#

The randomized content is doable -- do you need the items to be in specific points?

sour island
#

Yes

high cloak
hollow current
#

ye, places where it'd be logical for the paper to spawn considering its contents. The content is supposed to be lore, written by the citizens of Knox County pre-apocalypse or when the apocalypse started.

For example, if the content of the paper contains a paragraph written from the PoV of a kid who whose parents locked him in a room to protect himself, I want the paper to spawn in a room in a house

#

That's why I thought about using JSON

high cloak
#

i suppose i just leave it for now

sour island
#

You could create a copy of the paper item and decide it's contents depending on its surroundings - if you don't want it to apply to all paper

#

For named lit I just use Base.Books and it changes the title, icon, tootips, and applies dynamic stat changes

#

Cant change the moddle yet as its tied to script - but I've asked if that can be considered šŸ¤ž

hollow current
#

well the two main problems right now are

#

1- How do you change what is written in a paper in the first place, from code
2- How do you check the paper's surroundings

sour island
#

The event I use is the rendering for container contents

#

Applies changes once

jaunty marten
#

only if u will use text_id in ur json and after getText(text_id)

hollow current
#

aaaah right I didn't even think of translations

jaunty marten
#

but then u can just use lua table but not json

high cloak
#

me and @hollow current have similar issues i think wrt translation

sour island
high cloak
#

but idk if they're exactly the same

hollow current
#

What is the event? Might have to note it somewhere

jaunty marten
#

I already started same idea mod in a while before but dropped cos thought will brain-fuck to mind about texts and translated ones for it

high cloak
#

im making a dynamic tv channel where messages are picked randomly as basically interchangeable flavor text but it is difficult to work out how the translation should look for that

#

so i have all of the random messages stuffed in one key separated with a symbol and then i pick a random segment from that

#

but it's hard to edit or see unfortunately

sour island
#
---@param ItemContainer ItemContainer
function namedLiteratureContainerScan(ItemContainer)
    if not ItemContainer then return end
    local items = ItemContainer:getItems()
    for iteration=0, items:size()-1 do
        ---@type InventoryItem
        local item = items:get(iteration)

        if item and namedLit.StackableTypes[item:getFullType()] and (not namedLit.setLiterature[item]) then
            namedLit.applyTitle(item)
            --[DEBUG]] print("--n:"..item:getName().."  dn:"..item:getDisplayName().."  t:"..item:getType().."  ft:"..item:getFullType().."  c:"..item:getCategory())
        end
    end
end

---@param ItemContainer ItemContainer
function namedLiteratureOnFillContainer(_, _, ItemContainer)
    namedLiteratureContainerScan(ItemContainer)
end
Events.OnFillContainer.Add(namedLiteratureOnFillContainer)
hollow current
high cloak
#

that is possible im sure if i can check what language is active but i guess i felt like i should use the same thing all mods use for sake of parity

sour island
#

Hmm the function should be local, but the table I use to cross check application is .setLiterature that prevents it from being reapplied needlessly.

high cloak
#

but tbh that sounds like a better option if possible

jaunty marten
high cloak
#

maybe i will

jaunty marten
#

idk why u trying all ways to use json

sour island
#

Are TV channels translated? I never checked

jaunty marten
#

when there's already exist easy way

high cloak
#

yes i believe so

jaunty marten
high cloak
#

the translation keys are all generated with some tool and then referenced in the radio xml file

#

each separate line is translated

hollow current
#

anyhow, thanks so much for help guys. Much appreciated!

high cloak
#

each with randomly generated keys

sour island
#

Ah yeah, to generate dynamic radio messages would probably require some tricks