#mod_development
1 messages Ā· Page 91 of 1
ah you're right, there's an overload that uses an empty array
I wonder why his isn't working
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
what's player in this case? 0?
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.
Made some progress on my shaders core mod today.
Backdrop shader for UI as a draw call.
Wow
š¤£
lol but the results are glorious @bronze yoke
lol I haven't been at it nonstop but I have definitely been at it lol
is it possible to make a weapon contain drainable data
oh, it's already existed menu for mp xp
never used it so didn't know, I thought u did that
lul
huh?
unpack() lets you feed a list as arguments
sure
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
yup
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
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
hmm
closing the windows using their close buttons makes them unable to reopen
š¤
What kind of object do you want to overwrite?
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
I think be better to restore panel position after re-open it
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
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
idk how original close button works cos ever I creating my own buttons with :setVisible(false) :removeFromUIManager
idk how well kahlua/java/lua handles garbage collection
same
yeah
function ISDebugPanelBase:close()
self:setVisible(false);
self:removeFromUIManager();
ISDebugPanelBase.instance = nil
end
this is vanilla
but u can don't nil instance and use it again to set visible back and add to ui manager
it's working well
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
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
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?
original function uses only there? u can broke smth if this func uses in some other code
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
@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?
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
yeah i havent gotten that far yet. also working on seeing if i can make a seperate mod for linking lightswitch to lamps in the meantime for player bases
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
i tried seeing if you can set room id on switch light but i couldnt figure it out.
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
what impact does not using setVisible() have with removefromUImanager?
I'm noticing a few of the panels do that
just I'm trying to find any way to turn off in-room light without original light switcher (that was completely removed) and I found that u can't reach in-room light object by lua but java
if creating new light swithcer will work it's amazing for me
also only 2-3 use instantiate - I never looked into how it's different to initialize
removeFromUIMaganager stops any update of panel, just :setVisible(false) won't stop :update() event
by default StashUI only have remove from UI
hmmm
so using it's close button means I have to select the open button twice
probably do to me assuming it's visible
tbh only know difference between :setVisible(false):removeFromUIMaganer and just :setVisible(false)
it will hide panel too? like :removeFromUIMaganer() == :setVisible(false):removeFromUIMaganer()?
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
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
removing it from render would make it not visible by default then
is there a check if something is apart of UImanager?
right but I think :isVisible() will return true
without actual :setVisible(false)
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
always hate this TIS way onClick with a million if "CANCEL" elseif "OPEN" elseif "blablabla"
bruh
could be neater for sure
you technically don't have to do it that way
just call the function in button:new()
yea, Ik
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

sure, no need to create new one when u can use old
he-he
and it will "auto save old position" of panel
I'm going to add it to layouts eventually
cool

why many word when few do trick
hah
pipebomb
hmm
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?
local function close(self)
self:setVisible(false)
self:removeFromUIManager()
end
ISGameStatisticPanel.close = close
any_panel.close = close
for example
same for OnOpenPanel so
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
That's what I do for the cheats

he-he
@sour island I really want #waywo channel for modders and already sent suggestion to blair, aiteron and nasko but even no response
. I see u ultra active here and mb do u know who exactly from tis manage discord server?
what's waywo?
so interesting to see what peoples doing
I dont really see an issue with what's happening right now
there's only usually like 0-3 convos happening here
ĀÆ_(ć)_/ĀÆ
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.
u can use DoParam
it's lua func
yea
myb i meant. need sleep. i'll try it thank you
maybe crazy but doparam work in item also?
any script?
ah good call

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.
oh wow i can use this method to add glucose moddata to food lol
diabetes mod incoming
give admin for urself and there will appear new button on right side admin menu as Ik there's player stats menu
or add some cheat mode like Cheat Menu Rebirth
ideal death is 100 ml of insulin and going to sleep
better than gun suicide mod
hah
lmao
silent death, ahhh
i intend on it being a dynamic trait most likely if i can make it interesting enough
obv death being on both ends
I hope dynamic only for give a trait but not to take it off XD
maybe have option for that lmao
yea
how do I give myself admin? (and sry for asking here... maybe there is a channel better suited for those multiplayer questions??)
/Setaccesslevel name Admin *fixed thanks glytch3r š
š¤£ š¤Ŗ š š š š¤Æ
lmao
1 full bottle bourbon rolls 0.1% chance > now ur pancreas is killing u, sorry
sure #google
i got a randomizer util im gonna use for it lol
he-he
yea #mod_support or #1019767076094758924
but to answer
lua console :
local result = "/setaccesslevel ".. getPlayer():getUsername() .." admin";
SendCommandToServer(string.format(result))
using chat:
/setaccesslevel yourusername admin
many thanks!!!
btw @jaunty marten if you wanted to test out/use/contribute https://github.com/ChuckTheSheep/pz-modding-community
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
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
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).
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
I've heard about this servercommand thing but have no clue how to use it properly in my situation
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
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
what type of item are you working with?
Pipebomb
Maybe try #other_games or #general_chat ?
Dunno whether it's the best option available (it's what I'd think to use, but I'm no expert), but you pretty much just add an event listener for commands on the server & client and call a method to trigger updates
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
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...
thanks i already implemented that
Would be totally fine for me using the globalMod data instead but I simply do not know how this works. And no, the client does not have to send any info to server. It is just server info to client.
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.
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
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
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,
}```
how do I do this, adding an event listener and call a method for triggering updates?
I already found some info on eventlisteners here https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774 but I have no idea what all the parameters stand for and where I have to put it into my code...
yeah, I already saw, cool idea
btw u stroing ur random value not in moddata
u just store it in gametime object
it will removed after reload
correct is
local data = GameTime:getInstance():getModData()
whooops! Yep, you are right. code must be as you write. Just a typo.
@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
Anyone knows mod that does that?
So i can look up
What to do
Is your script entry for PipeBomb wihtin module Base { your entry here } ??
it is
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
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?
here is my code example:
one question where is directory with vanilla pz events ?
I use the pz wiki as a reference: https://pzwiki.net/wiki/Modding:Lua_Events
thanks im trying to find function that would help me with sounds
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??
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...
oh good old memories
it works?
i just have to know how to replace sound
and for that i going for any mod that changes sound
I added a sound myself by following that video
lets see then
one thing
?
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
well for this moment this one doesn't
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?
No unless you have permission, the mod is labeled "freeforall"
But if you are going to this and run on singleplayer go ahead
Darkmode pls
nope
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"
š„¹
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.
It doesnāt matter
Shit still donāt work
I surender
Im gonna take nap for an hour
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?
PZ on its own does not support JSON files. You'd either need to adapt a pre-existing Lua Parser or use Lua with loadstring(..).
I got it working somehow, there was a plugin or sth that allowed me to do that
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
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.
Much appreciated, thanks
I prefer JSON over Lua tables.
anyone know how i would go about getting a list of items that are in an object a player is holding?
:getContainer():getItems() mb?
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
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
getPrimaryHandItem() and getSecondaryHandItem() look as if they return the inventory item the player is holding in the respective hand. can then try to apply getItems() as @jaunty marten wrote
see here: https://zomboid-javadoc.com/41.65/zombie/characters/IsoGameCharacter.html#getPrimaryHandItem()
Javadoc Project Zomboid Modding API declaration: package: zombie.characters, class: IsoGameCharacter
if getItems() does not work directly, you could also try getInventory():getItems() instead
Old and third-party docs. Use https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#getPrimaryHandItem()
declaration: package: zombie.characters, class: IsoGameCharacter
(Official & partially documented)
Also 41.77
thx for hint!
he asked about get items from object that player hold so I think he already know how to get item in hands he-he. btw u holding the item not container so may be first :getContainer() and after it :getItems() (I'm not sure 100% but it's common logic of pz)
so official or third-party? 
ah ok. but for the part with :getContainer(), I would also try getInventory() if getContainer() doesn't work (as I mentioned earlier...)
Official if the game's version is closer to current.
or u meant created by third-party and published by official?
yeah
zomboid-javadoc.com is third-party and rendered from compiled sources.
it's why I got confused by ur words
yea yea yea
I saw different sites
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)
ah
then it make sense yea
oki
that seems like a smart thing for me to hold onto
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. =)
search bar even disabled
We should make a scrapper that builds into an in-game editor lol.
Have JavaDocs in-game hahaha
hey, is there a way to wait until a variable has been initialized?
even windows command line is powerful but pz command line is real command line hah
u can check event for ur variable here https://pzwiki.net/wiki/Modding:Lua_Events
if u mean thing like ZombieRadio, GlobalModData and etc
Yeah, a global var used for online stuff
I could use a OnTick event basically, right?
sure
thanks
absolutely

Writing OpenGL boilerplate code ATM. 
@red tiger u didn't even give favicon 


"Function over Form"

another dumb question

is there a way to pass a variable to an event without using global vars?
local foo = "bar"
-- ..
wdym?
I mean, OnTick passes numberTicks
is there a way to add another parameter?
nope, it's precreated event
You can fire your own sub-event and put in params that way.
for what do u need it?
Events.OnTick.Add(function()
triggerEvent('OnMyTick', ..);
end);
oh interesting
that's what I wanted to know
thanks
(Fixed typ0)
You can fire OnTick event in OnTick event and put in new params.
he-he
You could look for the params but Jesus calm down Satan.
(I won't)
Hahah mixing / poisoning existing API.
@zinc pilot
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.
Custom shaders for basically every object?
Any that I implement.
My modified copy of the UI engine has shading support now.
Also UI is 100% cached draw calls on the main thread.
stop talking, go work on web engine feature 


Oh this is for that.
How else am I going to get backdrop-filter: blur(4px)?
Also border-radius: 4px
I already waiting for 1 day and can't wait anymore 
to prevent stutters?
I see that RadialMenu.java has drawPolygon() methods for circles.. Wish they'd share the love in UIElement
To prevent issues with multi-threading Lua.
I have really limited knowledge about this kind of stuff, sorry for stupid questions
it's fine 
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.
How long have you been up working on this if I may ask? Sounds like such an hassle
This? Time-wise a year. Hours? Around 200 for these API.
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. =)
so if I'm understanding correctly, you've basically redone a lot of their rendering pipeline
Actually I didn't do much. Their render library is huge. I am adding on useful tools to let modders take control of certain unexposed API and also mine to help simplify that process.
The biggest being shader uniform values being modifiable at runtime through Lua.
hot reloading of shaders?
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
to be fair I didn't even know you could apply custom shaders on zomboid
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.
yeah, i've messed with custom shaders but there just isn't a lot you can do with them without that mod
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
what do you mean by you cannot modify their values? Like, you can't get values from the game?
You can't push values to the shader when ran.
my experience with shaders is limited only with reshade flavour of HLSL, so not much
you can't pass any information from the game to the shader
so basically useless as is
you can only use information vanilla already passes, and things that can run entirely within the shader
this mod is published?
Not really. It's useless for modders.
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
I'm near a mini-fridge and heard it through my earphones.. Thought I had PZ open and idling in a house.
Hahaha
now I'm really curious, are you gonna release the code somewhere?
I'll release API documentation. The code I write is closed source due to the nature of how IP laws operate with compiled code and modifying the game's code.
makes sense
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
really curious nonetheless :p
Leaving for an hour or two but before I do this is what my current demo code shows @zinc pilot
still can't figure out how to configure what's written in a paper, would appreciate it if someone has an idea!
This is the backdrop shader working.
basically I am trying to have a piece of paper spawn with something specific written in it
java mod?
really really nice, wow
or do you hook into stuff previously unused in lua
it was good idea lads
shaders done with GLSL?
Yes, purely for utility on rendering and other tools.
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!
I needed this before
Wasnt able to find solution
New question, when is transmitModData actually necessary?
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
that's the thing I'm not sure I understand
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?
every client has moddata on everything, they just don't get synchronised automatically
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?
does anyone know a mod that makes you see injuries when u hover over your " bandage" there used to be one but its gone
that should work
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?
i have a mod that relies on the server setting and using moddata on all the players
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
you set the moddata on the object and then transmitmoddata on that object and it should be available to all clients and the server
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?
yeah
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?
sounds like the transmit command is messed up in some way
can you show the code around that?
shouldn't it be only player:transmitModData()?
yeah that's it
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
u the author of only cure?
in the OnEveryMinute section
cool mod man
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
just fixing it
mhh
ow was it abandoned?
and like
mostly abandoned
if player wasn't a valid player object somehow we would be seeing a lot more problems
fairly broken
so i'm not really sure why that's happening
just to be sure
I should be able to have tables inside tables in a modData table, right?
yeah
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?
player can't transmit mod data? I did some time ago some test, but never get the mod data on the other side
getPlayer() shouldn't return anything on the server so it's fine
the function will just return
the error spam is coming from the server though
not the clients
I would expect to see that error on a client
welcome to the club
Oh well, anyway I used the traditional way
same but it stinks of work around
if there is a better way to do it, I wanna be able to
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 š
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?
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
Depending on what this information is it may be better to store it on the server
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?
What error?
on the server
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.
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
How you send moddata?
Because it will not work. TransmitModData require that object must be in square.Objects list. Player not in this list
oh nice, so it's what @sour island was saying before
Code?
so there is no way to transmit mod data from players object, right?
I figured it out @tame mulch but thanks so much. I needed to call DoTooltip.
I mean, not directly
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
You can use globalmoddata and client-server commands
You worked on Aquatsar, right? @tame mulch
Yep, some time ago. Now I am not working on it
and is that updated automatically between players?
Yes, if you will set it correctly
mh is there any example in the wiki? I've never heard of it
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
Oooh. I am not sure if exist tutorial for this. Some mods use GlobalModData
This code makes it so opening doors is still possible while jogging or sprinting on gamepad
@zinc pilot What exactly you want to do
With Aquatsar installed, your jogging and sprinting normally blocks door-opening, even when no water is around.
I want player 1 to read a modData from another player
@thick karma Ask IBrRus in his discord
I've been using client-server commands for now
for what?
but I was under the impression there's a better way
Cool, I'll try to find it.
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
Ok. I will try do example for you
you're amazing, thanks
@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
thanks man
i wonder if i can make it actually do a drag down
is ModData an already declared global var?
Yep
perfect, thanks
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?
Is it better to use discord or read the forums if I'm trying to learn how to mod ?
Thanks!
@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
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
fair enough that it prolly best
Best part is anyone can contribute to the wiki
oh well, easy add! thanks good sir
my post is full... im not using nitro
gotcha. no idea what limits are there. haha didn't even know nitro gave you more length
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
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
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);
yea i was trying to use NUMPAD_4 for awhile there and realized....
Send me guides you fond along the way ill add it here since i can always edit the msgs i added as place holder
sounds good
Or you can edit the msg you sent in the midle and add the link there
#mod_development message
This one
kk
There's github pages - not sure how they work yet
Seems like a webpage or glorified readMe
they are lol
But it could look a bit nicer with images and cleaner linking than the wiki
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
Imagine if we have more access as moders over an official website page like about guides that the community wrote
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
Everyone has editing access on the wiki afaik
yea i just need to make time to do and not only talk about it š
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
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
Ill help u
Says person who always type with missing letters
just a random question how can i combine mod traits with mine?
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
The bow and arrow mod
i all was credit the author
Ye should still send a msg atleast š
anyone know if it's possible to impose a level requirement on an items usage?
What do you item usage? What item
i think durability
i was trying with doparam but i dont actually think it's valid parameter
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
𤯠good idea thank you
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
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'
Thats better idea
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
it might not stop players from right clicking the item to read it actually, you'd have to check how to limit that
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
that's not quite how vanilla works
it's based on what level your skill is, not which books you've read
i couldnt use the concept from checking book prerequisites and just change that to getSkillTrained or w/e?
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
yea i'm looking at some UI stuff showing kinda how it works
if you do it that way make sure the character has lines specific to the reason they can't read
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
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
being very new to coding in general, this saves me a ton of time and yet another example i can learn from. thanks!
just to be clear Starlit.sayRandomLine isn't a vanilla function, i was just showing the structure of how these work
yea lol all good
felt weird to be writing the same 'pick a random line' code all over the place lol
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.
Sandbox are easy u just need the syntax
Im not using desktop i could have sent u a snippet
hard to test this since i have to run around. but i have been looking for it lol
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
U just need to tp on one location to test
Open debug cheats and tick lootzed
Right click on the container icon to show lootzed panel
usually distributions are parsed to the java before sandbox options even load
So.u cant do sanbox for these types of things?
you can, you have to make it re-read the distribution tables
different event?
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
Whats itempickerjava.parse
they just said it parses the table i think
What if u call that during the game using debug
it's the method that pulls the distribution tables into the item picker
i think that's fine
it just pulls the tables again
Ahhh makes sense now
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
Sorta like a refresh if incase you modofied stuff
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```
wait so i could tie this to initsandboxvars or whatever that is and it would refresh the values without restart?
have your ui class keep an instance field that points to the instance, and refuse to create itself if one already exists
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
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
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
chuck just solved that earlier today i think
and posted the fix
where it wont open after x
!

hrmm... not actually seeing anything relating to the X close on an ISCollapsableWindow.... am I blind?
looking
whatever function that x button calls, make that go MyUI.instance = nil
i dont think it was that exact usage also is why you cant find that
say what
hrmm.... extend my own ISCOllapsableWindow perhaps?
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
here is the convo also around it. im sure albion will get you tho
#mod_development message
Buzzed modding session? Buzzed modding session.
I wonder what will happen with getPlayer() = nil

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
yeah, it needs to be its own derived class for this to work
Terrifying..
i'm afraid modding ui is very manual in pz
ok, yea that makes sense now, thanks ^_^
Which is why modding UI in PZ is a task.
which is why only one of my mods has a ui element LOL
=)))
šļø š šļø
rip
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. =(
Generally I don't get many comments - a few of them were the same guy representing a server asking to use stuff.
if i wake up to more than one or two notifications i'm starting my day worried
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 
it's annoying to have to be tech support and stuff, but a lot of the comments i get are just very nice too
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
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. =(
So you have the files execute depending on version?
Oh you could totally do this.
I know, but that seems like a pain lol
Self version-control saves lives.
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
Solid ideas, good for a first time mod. š
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 I guess the accuracy of the translation may depend on the amount of data available for each language. (try not to hijack mod support š )
so true lol
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
anyone help?
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 š
i'm glad that worked out!
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
i'm not sure i understand what you mean
not 100% how item spawn weights work
when you say spawn weights do you mean the spawn chance? that's just per container
yea weights i meant chance
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
gotcha just per container period
I have no idea what any of this means lol
I was just following daddy dirkies tutorials
each 1x1 cell is 300x300 pixels
Ye
that is same measurement of coord location in game
so those coords you posted are pretty far into the map
thank you also again lol
lets goto mapping
But how can they be anywhere in the map? Shouldnāt the max possible coords be x300 y300?
I only have one cell
I never understood how to use extend rcon commands
Did you allow?
Wdym
Run the world without the vehicle mod
Travel the whole world install the mod
And use #mod_support next time š goodluck
Ye this is 100% #mapping related
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.
Mod pack steals subs
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
they don't want the server to restart because of mod updates, so they create a mod pack to halt the update š
I'd revise my statement to say I prefer it being unlisted to keep the clutter on the workshop down too
that's also why I don't care lol - they're basically asking for more work on their end
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..
If they give credit it's more advertising than anything eitherway
i posted it there.. i thought it would go here sorry.. and that dosnt quite help hahaha ty though
Yeah im also guilty of this back then.. when i was only doing mods for our server but now i know modders perspective so we didnt make modpacks anymore
Howcome it didnt help? Thats exactly what we did when my code failed
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 
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
ahmm anyone knows how create a small simple input text box
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.
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:
You check by launching
Host: -nosteam -debug
Client: -nosteam
Try creating xml files of the hitreaction
Or use lua
OnZombieUpdate event
you mean my question??
ok. so start parameter -nosteam in steam will make it so that I am just client when entering game?
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
many thanks! ultra useful! does this also works for playing via the host button or do I need a dedicated server?
Think it was ISTextBox something like that
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)
that's 1 type of mag. that's all you are trying to remove? you will probably have to add each magazine i'd guess to stop them all
no i just didnt want to post the code for all of them
but this mag still shows up as well so im wondering if im doing something wrong
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??
i went with using buttons instead
š i think the textbox could also be set to accept numbers only if it ever is needed
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()?
When filling a container with items, it's how many times the game will loop through the item table.
if not isClient() then
Also can check that is not isServer()
I am not sure that this is will work in MP because you not send ModData changes to clients
@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
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);
hi š

Is there a way to modify existing world items such as doors and fences?
I'm not talking about craftable ones
What you want to do with them?
@tame mulch @zinc pilot I was wondering about that too. Making tall wooden fences destructible by zombies for example
making every kind of fence thumpable
exactly, I was thinking mostly of metal fences though
Yep thnx i added this to my guide list
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
I've used /n for line breaks in translation unless I'm hallucinating. It's parsed through the translator object.
ugh that sucks
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
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
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
The randomized content is doable -- do you need the items to be in specific points?
You mean spawn locations?
Yes
yeah that works, though the real reason i wanted to use long strings is to break up some long text into separate lines for readability
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
i suppose i just leave it for now
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 š¤
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
if u will use json then u can't use getText function to get translated version of ur text from shared/Translate/...
only if u will use text_id in ur json and after getText(text_id)
aaaah right I didn't even think of translations
but then u can just use lua table but not json
me and @hollow current have similar issues i think wrt translation
If you use the same event as I do you can check against the items type and use the related functions to change its contents. Since the item exists somewhere you can pull the area around it for info unless you want to make a table of coordinates.
but idk if they're exactly the same
what's your issue?
Hmm yea that event could definitely work
What is the event? Might have to note it somewhere
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
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
---@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)
Is it possible to have multiple JSON files, like english_text.json spanish_text.json, etc, and then in the mod you firsthand check what language the player uses, and based on that, you decide which json to pick from?
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
Hmm the function should be local, but the table I use to cross check application is .setLiterature that prevents it from being reapplied needlessly.
but tbh that sounds like a better option if possible
it's bad way cos u already have way to have translated texts with shared/Translate/...
maybe i will
idk why u trying all ways to use json
Are TV channels translated? I never checked
when there's already exist easy way
yes i believe so
live and living (don't remember correct name) is translated
the translation keys are all generated with some tool and then referenced in the radio xml file
each separate line is translated
anyhow, thanks so much for help guys. Much appreciated!
each with randomly generated keys
Ah yeah, to generate dynamic radio messages would probably require some tricks
