#mod_development
1 messages ยท Page 65 of 1
When an item is created it copies from the script item and becomes its own instance
SKIZOT
i knew it math.atan2()
aint seent you in a minute!
Currently just pop my head in once in a while
i see that.
random idea, add dungeons: can be done now, but will shine when we get basements
Shouldnt the basements be procedurally generated?
Yeah, and you get one that acts like dungeon with levels or something.
Make a DnD style mod for pz with procedurally generated basements
Ooo sounds cool, are you going to make it??
doubt
Maybe When their code for the generation drops, it would be interesting to see how they do it
From what theyve said the basements themselves arent randomly generated but instead picked from a bunch of prefabs
Where are the professions defined?
media\lua\shared\NPCs\MainCreationMethods.lua
I could have sworn there was a video about map making tools that used prefab/generation -- specifically that you could make any sized house and assign the entire house or each room a profile and it would try to fit stuff inside with some logic. I can't find the video anytime I recall it.
not at all :( you can replicate the behaviour with your own programming but when i had a look nothing at all about vanilla meta events was exposed to lua
Tbh there isn't really much to them
And I think Konijima made an API to replicate them
You can use the sound emitters from fmod.
i imagine this has long since been done, but has anybody looked into radio stations ie. editing transcripts, changing times, making their own?
Taking a look at making a custom JSX factory for ISUI Lua API for PipeWrench.
Basically using React, but with PZ UI. x)
how do i create a table containing a pair like this?
VaultTileList = VaultTileList or {}
table.insert(VaultTileList, {close = 'krp_glytch3r_safe_0', open = 'krp_glytch3r_safe_1'})
print(VaultTileList[1][close])
i need to create a table that every entry holds 2 sprite datas close and open
this i snot working
i think im doing it wrong
or the only way to get is thru pairs loop?
ahh i think i need do do the pair twice for outer and inner table right
VaultTileList = {}
table.insert(VaultTileList, {close = 'krp_glytch3r_safe_0', open = 'krp_glytch3r_safe_1'})
for k, v in pairs(VaultTileList) do
print("k: ", k, " v: ", v)
for i, s in pairs(v) do
print("i: ", i, " s: ", s)
end
end
got it
issue here is you didnt put close in quotes
print(VaultTileList[1]["close"])
and here should be ipairs on the first loop
pointless to iterate on the second when you already know it can only be open or close
ahhh nice thnx
ipairs is for iterating indexes aka 1,2,3,... and pairs is for key values
VaultTileList = {}
table.insert(VaultTileList, {close = 'krp_glytch3r_safe_0', open = 'krp_glytch3r_safe_1'})
for _,s in ipairs(VaultTileList) do
for k, v in pairs(s) do
print("k: ", k, " v: ", v)
end
end
how do i create an if statement that asks if "krp_glytch3r_safe_0" is part of the table
without iterating?
what do you mean
if the table contains the value?
if you know itll always be for close you can do
VaultTileList[1]["close"] == "krp_glytch3r_safe_0"
other than this not really any way with your approach
wwoops needed to iterate after all.. but thnx i got it
for i = 1, #VaultTileList do
local closeTile = VaultTileList[i]["close"]
if closeTile then
return true
end
end
this will return true all the time, based on what you said the structure of the table would be, is that really what you want?
if you explain what youre trying to achieve we could help you have a better data structure
i want to change the sprite
once i right click on the obj
function getOpenSprite(sprite)
for i = 1, #VaultTileList do
local closeTile = VaultTileList[i]["close"]
if closeTile == sprite then
return VaultTileList[i]["open"]
end
end
end
function checkCloseSprite(sprite)
for i = 1, #VaultTileList do
local closeTile = VaultTileList[i]["close"]
if not closeTile then
return false
end
end
end
do i need to create checker functions anyways heres the whole code atm
more context
function TileNameContext.ContextMenu(player, context, objects, test)
-- if not (isDebugEnabled() or isAdmin()) then return end
local sq = nil
for i,v in ipairs(objects) do
local square = v:getSquare();
if square and sq == nil then
sq = square
end
if instanceof(v, "IsoObject") and checkCloseSprite(v) then
--print(v:hasModData()) --check if has moddata
context:addOption("Show tile name", v, (function()
local closeTile = v:getSprite():getName()
print(closeTile)
getOpenSprite(closeTile)
end))
end
end
end
Events.OnFillWorldObjectContextMenu.Add(TileNameContext.ContextMenu);
this is working for now
im just asking if i need to simplify ๐ i havent added the change sprite
If you upload your code as a file, it shrinks the wall of code to a few lines in the chat.
well, my main otr ui has a function to generate jobs based on the location you opened the ui from. the problem is, it wont generate for your CURRENT town on the first try, it will generate from the last one until you tell it to generate again.
if there was a "onOpenUI()" i'd be set.
I'm ok with walls of code, as long as they're formatted, this is a programming channel
not sure since youre using that api but should be quite trivial
can you send me the code for it
me?
aye
Make sure it'd minified Lua code.
why not just have
VaultTileList = {close = "krp_glytch3r_safe_0", open = "krp_glytch3r_safe_1"}
your checkCloseSprite function returns "false" if you have an entry in your VaultTileList with no close key, or nil otherwise, I can't really tell what this code is supposed to be doing
cuz i will insert more
yey it works
now i need to do the reverse and close it lol
why more?
imean to the table
yes but why more
there are more open and closed pairs
baffled at how this works, did you change the code after you posted it?
elaborate a bit more
looks like he wants to open/close safes by swapping their textures, safes can face different ways so they have different textures
function TileNameContext.ContextMenu(player, context, objects, test)
local sq = nil
for i,v in ipairs(objects) do
local square = v:getSquare();
if square and sq == nil then
sq = square
end
if instanceof(v, "IsoObject") and checkCloseSprite(v) then
context:addOption("Show tile name", v, (function()
local closeTile = v:getSprite():getName()
print(closeTile)
local openSprite = getOpenSprite(closeTile)
v:setSprite(openSprite)
v:getSprite():setName(openSprite)
v:transmitUpdatedSpriteToServer();
v:transmitUpdatedSpriteToClients();
end))
end
end
end
Events.OnFillWorldObjectContextMenu.Add(TileNameContext.ContextMenu);
i get that but im trying to get the full picture to make a better data structure
is your checkCloseSprite function the same as you posted, there is no way that works?
it works its not returning error and when i right click it ands a context menu and when i click that menu it changes the sprite apearance
but it just returns false or nil all the time? that if statement should never fire
ow sorry i added return true
function checkCloseSprite(sprite)
for i = 1, #VaultTileList do
local closeTile = VaultTileList[i]["close"]
if not closeTile then
return false
end
end
return true
end
when you mentioned it
๐
even i f i change its sprite its still the same isobject right?
ok, so now checkCloseSprite returns false if you have an entry with no close, or true otherwise, so its probably always returning true
yes, if not closeTile will be true if VaultTileList[i].close doesn't exist or contains false, in which case your function will return false. Any other situation will return true
i know this isn't strictly modding content, but i feel this would be heavily appreciated by many people here, this little meme:
PZ is a confusing mess sometimes but we love it
to make things easier on yourself, and to remove the need for iterating, I would do something like this:
local VaultLookup = {}
local function invertTable(tbl)
local output = {}
for k,v in pairs(tbl) do
output[v] = k
end
return output
end
local closed = {
["safe_closed_N"] = "safe_opened_N",
["safe_closed_S"] = "safe_opened_S",
["safe_closed_E"] = "safe_opened_E",
["safe_closed_W"] = "safe_opened_W"}
local opened = invertTable(closed)
function VaultLookup.checkClosedSprite(sprite)
--returns true or false instead of a texture name or nil, could just use getOpenedSprite
return VaultLookup.getOpenedSprite(sprite) and true or false
end
function VaultLookup.checkOpenedSprite(sprite)
return VaultLookup.getClosedSprite(sprite) and true or false
end
function VaultLookup.getOpenedSprite(closedSprite)
return closed[closedSprite]
end
function VaultLookup.getClosedSprite(openedSprite)
return opened[openedSprite]
end
function VaultLookup.addSprites(closedSprite, openedSprite)
if not (closedSprite and openedSprite) then return end
closed[closedSprite] = openedSprite
opened[openedSprite] = closedSprite
end
return VaultLookup
or something like that
@ancient grail
obviously you'd have to put real texture names in there
Dictionary quick indexes my beloved
lua is so fast with string comparisons and table access its the only way to go, lol
But i have lots of vault sprites
Will it still work? Idont get how u connected the two tables?
Aslong as the index matches is that how u did it?
they aren't connected, they don't need to be
yes, all they do is relate closed sprites to open sprites in one table, and vice versa in the other
I assumed you'd want to get closed sprites from open ones even though you haven't shown any code doing that yet
by using the names of the textures as keys, you can find them instantaneously, and also use them to get the other texture if you use those as values
the checkCloseSprite function I wrote explicitly returns a true or false, but you could use if getOpenSprite(sprite) then in the same places as if checkCloseSprite(sprite) then thanks to how lua handles truth
as for constructing the tables, if you have lots and lots of sprites you may want to find a way to automate it, but if there is only a couple dozen or so it should be fairly easy to do by hand. You could even just do one by hand and then let a function create the other one by inverting it
like this
function invertTable(tbl)
local output = {}
for k,v in pairs(tbl) do
output[v] = k
end
return output
end
Heres the code
To get the other part of pair
Amazing
Does somebody know some event when a player leaves a game?
OnDisconnect
also work for SP?
probably not
@ruby urchin Someone posted this the other day https://paste.sr.ht/~ckyb/99d2d134360d355f33ceecf255b971f6b1d03624
OnDisconnect looks like the only hope and I'm not any more optimistic than albion about it, although it might work
You could hook the function that quits the game in the Options menu but I think Alt + F4 and crashing would bypass @ruby urchin
Make a periodic tick function to check?
Out of curiosity, what are you hoping to do when the client quits the game? @ruby urchin
depends on what you're doing of course, but you could check on load if whatever you meant to do on exit was successful
Could use ModData to track whether the close function fired when the player last left the game (not sure if this would allow you to capture what you're trying to capture)
save entities info into a json file
OnSave works to SP apparently
Are entities a technical object in this game or are you using that word literally?
What kind of entity's info are you trying to save?
oh if it doesn't matter if the player didn't disconnect you can just do that
Idk "entities" in this game
Yeah game uses OnSave when you quit, that would definitely store what you wanted to store, it would just store it frequently, so if the process of saving is long enough to slow down the game, hooking the quit function directly might be better.
(I'm still unclear how much info / how many entities we're discussing)
is about the mod about dogs that I'm working on, I need to save his info to make persistent on a game
Yeah, dont worry, just basic info
Like 20-30 max? Fewer?
Oh yeah you could routinely OnSave that I would expect no issues
I tried OnDisconnect, but it had no effect on SP
i meant that if your code doesn't actually hinge on the player leaving the game, you can use onsave
Sounds like it doesn't @bronze yoke
i only suggested ondisconnect because i thought that was an important part of it
In servers with PvP, is there a way to opt out (outside of roleplay)?
Or can anyone with PvP on kill everyone?
Is there any event for when the player first picks up an item?
If you can cancel damage I'd imagine there would be an event that fires.
But maybe I'm thinking Minecraft logic.
there is an event when a player takes damage, and it tells you what kind of damage it is, but I don't think it will tell you who did it if its a zombie or player. Could be wrong though I haven't looked at it in a bit
is there an event for when the player goes to sleep? i cant find anything on the lua events page
they can kill everyone
Interesting thanks
that's one of the main reasons my server is gated
'cuz anyone can come in and start killing random people with no rp
For sure
Anyone know the function off the top that makes your player enter hostile mode?
/ checks whether you are in hostile mode actually
(really I need the latter)
does the moodle modifier not work unless you do something first?
im trying to change my fatigue to max but the slider bar wont move
oh nvm god mode stops you from modifying some of them
im trying to figure out how to detect when the player goes to sleep
there is no sleep-based event on the lua events page that i can find
IsoPlayer has a public boolean called "Asleep" and a getter called ".isAsleep()"
can somebody remind me how to set a float, trying to remove my weird comparison of if multiplier - xmultiplier > 1e-7 then
So i tried checking those every 10 minutes... but they only check positive when the game loads, strangely enough
so how on earth can you detect when a player sleeps
in my mod directory people use the isAsleep on the player object
oh wait a minute
aaaaaaaaaaaaaaaa fucking lua!!!!!!!!!!!!!
what is with obj.method() and obj:method() anyway?
here it's kahlua
if it's static you do class.method, otherwise you do obj:method
ok
hmm it seems that the game always thinks the player "wakes up" when they get created
oh no, im just an idiot
any idea on how to get the character's first and last name?
getForname() and getSurname() always seem to return "Bob" and "Smith"
even though the character has a different name
getPlayer():getDescriptor():getForename()
getPlayer():getDescriptor():getSurname()
getPlayer():getUsername()
getPlayer():getDisplayName()
@modern dune
๐ซก
Check that .lua file that governs the sleep functions . I believe its just 1 lua file. And a few parts of it on the worldcontext
like the source lua file? where can i find that?
Wow i just noticed your katana @bronze yoke
Youre a specialist now
Media lua
Looking for the code that is responsible for PvP zones when a player enters one etc. Found the code for adding zones here: media\lua\client\ISUI\AdminPanel\ISPvpZonePanel.lua, although cannot find the code that handles if a player enters the zone.
Searched all of media for "pvp" in every file but could not find anything remotely close to what I'm looking for.
I'm having an "Oh God.." moment right now.
hey guys, got a question for you. Making a compatibility patch for something, I've done the actual patching bit, just trying to work out the best way to implement it. basically making the cereals added by More Cereals to recognise milks added by other mods. Now, in my existing save, if I make the one file I have in the scripts folder the same name as his, all the cereals I had in my invtory/containers near me disappear, and I'd need to find new ones. Is there a way to avoid doing this so its save game friendly?
Starring at my code and going "I could implement CSS and JSX for reactive Project Zomboid UI."
I... I might want to do that.
Is there any easy way to make an ISTextEntryBox submit on Enter and cancel on Escape?
Or is keyboard utterly locked while you're focused on it?
I think that lock is in UIManager, right?
Idk
There's a focus check for keyboard stuff IIRC.
Does anyone else think that the UI to add mods is very uncomfortable?
@hollow delta https://steamcommunity.com/sharedfiles/filedetails/?id=2889964195 Yes.
thats the one, fixes everything. My only gripe is there is no link to the workshop pages in the server version of the mod manager
lol.
and i wish server and singleplayer presets were shared
๐ญ No...
AFK writing my own Lua UI alternative.
if i set mods for my server, i then i have to go enable all my mods to change the sandbox options
It's perfect, the only problem it has is that it doesn't work for server presets
(or gamepads ๐ญ)
Is there anywhere in vanilla where pressing "enter" submits some text?
Oh the chat
Duh
Let me see how chat does it
since I've gotten a few DM's now about how getOpenedSprite(sprite) and true or false works, I figure I'll do a mini tutorial right here and meow
Lua's and and or operators allow you to use operands other than the booleans true and false.
The rules for it are very simple, nil and false are false, and everything else is true. Everything, including 0, -1, {} and the string "false"
Lua's and and or are also short-circuiting. What this means is that it will only evaluate the minimum amount of operands required (evaluated left to right) to find the solution.
true or waitOneHour()
false and waitOneHour()
both evaluate immediately instead of an hour from now, because the first operand is all that's needed
The main peculiarity of Lua's boolean comparators is that they don't evaluate to true or false, but instead return the last operand they had to look at
0 or x => 0
nil or x => x
nil and x => nil
0 and x => x
so, to go back to the question, getOpenedSprite(sprite) and true or false is meant to convert the returned value from getOpenedSprite(sprite) to an explicit boolean value
getOpenedSprite(sprite) returns either a string, or nil, which would then evaluate thusly
"sprite" and true or false => true or false => true
nil and true or false => nil or false => false
thank you for coming to my Tedx talk
Steam guides & GitHub Gists / Wiki pages.
Will be useful for linking people when asked.
I also wish I it had an option for switching between a local and workshop version of a mod.
I hearby release that tutorial under MIT license if they want to set something like that up, lmao
Couldn't you version-control your mod internally?
Load a config lua file in the cache dir and then load the right code based on that?
Why exactly are you adding "or false" at all? If everything evaluates to true or false or nil or false, and nil evaluates as false anyway, then isn't true equivalent to true or false and nil equivalent to nil or false for purposes of boolean logic? And thus doesn't resolving to either true or nil cover the necessary circumstances (without attaching or false)?
sure, but the point was to get explicit true or false.
getOpenedSprite(sprite)
would work just as well, don't need the and true either
sometimes you want actual booleans, especially if you're going to be providing the output to a java object that expects it, for example
Got it makes sense now I didn't understand you needed the boolean for some reason outside of Lua logic
I don't think he needed it for that in this particular instance, but if I give someone a code snippet I figure its good form to make it work in the majority of cases. So functions that start with things like check or is I typically convert to booleans to be safe
or false is still redundant, getOpenedSprite(sprite) and true returns true or false to begin with
mmm.. love that !! syntax.
nope, nil and true evaluates to nil
this stupid language
lol
Now you know why I do what I do to get away from Lua. ๐
The arrays trigger me in lua.
honestly once you have a handle on it you can do neat stuff, I don't mind lua at all
That's like trying to code with two fingers on each hand.. you'll get over that.. eventually.
no i still don't understand that
Lua is fine but not meant to be used at this scale.
not at all, you can do stuff in lua very quickly and elegantly that you can't do in more restrictive languages, there is no handicap here
but ya, there are some challenges in modding in a different language than the main game for sure
Scalability is my biggest concern in our environment here.
That's my main push for using something like Typescript for say UI models.
๐คทโโ๏ธ thats just a different layer of abstraction on the same thing, doesn't really gain anything
Lua works just fine.. until you can't remember your own design 100% and change something accidentally or reuse a variable name and cause unknown collisions when performing certain actions down the road.
Lua expects me to keep all of this in my head and be perfect when doing scaled designs. That's my issue. It is different.
Doing Lua by itself is great for like 95% of the work here if I'm only considering the issue of scalability. ๐
can you give an example of a scalability issue
Sure. ISUI.
its written fairly OO compared to most of it, seems like the least offender in that category. It is a little jank though
Each subsequent derive of say the ISUIElement class hosts (In the current code), some overlapping, reused fields that do different things. There's also the issue of deprecated code that isn't called that could otherwise be pruned using strict interfaces.
A lot of it is old mouse event functions.
the way i get around this is by not writing ui because i hate it
lol
Also, clarity on things like what Joypad objects actually store and what they do.
That's a huge one for me.
I have the same response to UI in pretty much any game I've ever modded, its always a fustercluck
docs are definitely lacking. Until they added actual variable names to the method signatures on the javadoc it was less than useless. now its just useless
I'm not going to tell you to change your ways or what not. I was serious enough to invest passively over 8 months to try to fix this issue for when I develop mods for PZ.
some comments in the lua wouldn't hurt neither
i think the javadoc is pretty useful
if you don't have the code on hand, sure
it's just one part of a greater process
I'm glad that it was recently updated. I also used wget to download it for offline use.
I use intellij so method signatures, the only thing the javadoc provides, autofill
I'm also for third-party documentation.. which I still need to smooth some edges on my tool for my works.
the javadoc is still far more searchable
This topic of mod discussion is actually pretty much what I obsess over so I thought I'd give you my full take on it.
๐
Oh and I want this stuff too. This removes countless time doing lookups.
ya, emmylua does that for my own code, since I write the annotations, but only has the same kinda basic signatures the javadocs have otherwise, for the lua stuff
I'll never get used to the Lua environment since by default it doesn't have error prompts prior to running code.
In a way that's less process which is good for what Lua is meant to do: Be a small-scale script solution for C / everything else that hooks into Lua or emulates Lua.
I simply just don't make mistakes
LOL
How difficult is it to get into making mods? No experience here, just know some coding, and I was wondering how difficult it would be to make a mod that added a disassemble action for corpses that would generate a new item, e.g. "bones", and add new recipes like "cooking bones into glue" and "crafting glue and ripped sheets into duct tape". Does this mod already exist? If not, are there any close examples I could work off of?
there is a zombie to glue mod, and a different mod that does bones to glue, but crafting duct tape I think only exists as a profession perk atm
none of those things are terribly hard to implement, as pz mods go
Awesome, thank you, are those mods available on github or something so I could look at the code? Or could I just open up the mod if I have it from steam workshop? Guess I'll go look into it haha
all the mods on the workshop are lua based, which is not compiled and is human readable. I think there is a tool somewhere to pull down mods without steam itself, but otherwise you can just find the mods on the workshop, subscribe to them, then open them from your workshop folder
Oh and if you want to code mods with Typescript, that's an option as well.
Excellent, thank you guys!
No problem and good luck. Feel free to ask questions in here.
Gotcha
Going AFK for the day. Cya guys. Fun convos.
Bad hair day?!
Was using the Improved Hair Menu mod and suddenly scissors weren't registering. Thought it might be the mod so turned it off. Still can't cut hair. Can anyone tell me if this is a bug in game or a result of the mod?
I tested ALT+F4 with OnSave and worked as expected
but not on crash
Oh wow v cool! Thanks for the info
I actually... Did not expect that. Haha working was unexpected.
alt-f4 doesn't force programs to close like a lot of people assume
i imagine if you use super-f4 it won't be able to handle that
I am actually aware it's not forceful because I have grumpily encountered games that did not properly follow Windows protocol for what Alt F4 is supposed to do even a little damn bit. ๐พ
But I was suspicious about things being saved right on Alt F4 in Zomboid.
IIRC it is a forced close by default, but as a dev you can choose to handle it yourself. Been a while since I've written a window handler so I'm not sure if I'm misremembering
java also just does whatever it likes, of course
I've been working on an ISUI abstraction that makes UI a bit more intuitive.
Adds some features like object grouping, grid views, and a couple other goodies, in addition to trying to document and clean up a lot of redundant functions.
Modeling it a bit after a GTK/QT4 workflow, and playing around with half-baked damage tracking to prevent re-rendering every tick unnecessarily.
Also on topic of documentation, I spent an hour earlier today writing a working markdown output template for ldoc.
The plan is to iterate over all the media/lua files, generate whatever documentation is available, including modules, functions, params, and potential returns, and having some sort of linkage between them.
This will kind of build on top of that event list I generated yesterday, linking events to lua docs, and providing searching for the lua docs
Please include a simpler and more object oriented way of sending input to a window through a textBox when hitting enter key because vanilla way is a gd mess lol. Also maybe some in-game keyboard integration because that is priceless.
What do you mean by "sending input to a window through a textbox"? Do you mean sending input to a second window from a textbox in the first window?
An in-game keyboard would be neat, it shouldn't be too bad once the grid layouts are implemented.
This isn't the channel for that. Search for "server mods" in #1019767076094758924 , and make a post there if you're still having issues.
Here is a thread from the 'search' function that might help: #1035459530869461044 message
There already IS an in-game keyboard, using it in my own mod, just often unused in vanilla zomboid
By sending input to a window via textbox, I mean call the submit function of a panel based on hitting enter in the box WITHOUT knowing the exact instance variable that will be used to encapsulate it.
In vanilla ISChat you'll see what I mean. When you hit enter it calls ISChat:onCommandEntered which might lead you to believe that it can simply access its own onCommandEntered function through a self call, but nay (!), the onCommandEntered function of ISChat has to access ISChat.instance instead of self because the necessary info doesn't get passed to its own function.
Meaning if you have four separate instances of some ISChat equivalent... No obv way to resolve which when you land in their function
My workaround is to just check which instance is visible and operate on that but it is nontrivial and annoying lol not smooth and silky
Ah, I see what you mean. I'll play with a joypad when I'm closer to buttoning up the ui framework.
I'll keep the textbox onCommandEntered event in mind when I'm going through my next phase of the ui stuff. First phase is just a QOL class, so instead of doing o = ISPanelJoypad:new(...) directly you do o = CkyUI:new(ISPanelJoypad, ...), which will override some of the functions of the root class, exposing new functionality that still calls the base class functions as needed.
First focusing on ease of use and documentation, then fixing bugs/issues (like the onCommandEntered event), then rendering/tick performance, then eventually decrufting, better events, and a few other things.
My aim is to at least get the first part (qol + docs) done sometime this week, open source it with a todo/issue list, and eventually work on the other features. That way if anyone wants to contribute, they can help out.
Is there a way to prevent random underwear from spawning in addition to an outfit defined in clothing.xml? Something like <m_Pants>false</m_Pants> but for underwear. The swimsuits are defined as underwear, but so are separate random UnderwearTop and UnderwearBottom clothing items, so I'm getting briefs and bras over bikinis and swimsuits...
This snippet got my gears spinning for some sort of in-game unit testing framework.
I might draft up a document on a design for some in-game testing framework that could be used for regression testing, and potential mod compatibility checking/testing.
media/lua/tests/{client,server,shared}/... to define a testing environment an actions (eg. spawn player, add item to ground nearby, player picks up item, check if item is in inventory) with a media/scripts/tests/{scenario}.txt that defines some environment (eg. coordinates, modids, initial game state, sandbox seed/options, etc)
FYI vanilla ingame keyboard (which already works for gamepad) is ISOnScreenKeyboard. Already pretty nice, but if you can make it more automatically a part of entering stuff in a textbox for gamepad users, that would be noticed.
Oh yeah, my plan is to refactor a lot of the base ISUI to handle joypads, eventually having the mod override the base ISUI class for vanilla UI (hopefully seamlessly). Mod UIs might be doable, but that'll require more testing. Might be a separate option disabled by deafult.
Interestingly, it looks like this was disabled at some point in BodyLocations.lua but commented out.
So I know that if files named the same in different mods, during game load one of them will overwrite another. Is it the case for stuff like sandbox-options.txt and translations? Cuz I'm looking at my console atm and see a lot of overwrites
no
is that a special case?
the translator runs through every mod directory manually
the same must be true of sandbox-options.txt and perks.txt, and maybe some others
I see
Kind of concerning I have to ask this once and a while lol
"I'm running 878 mods and your mod broke my save, downvote"
Don't worry about it Chuck
You did an amazing job in a way
You should have a feature where the character just scribbles in the book, with text stating "I never learned how to write..."
Don't let these peeps bother you
On my first mod, Left Click Redux, someone was complaining my mod broke their ability to attack.
They had the weapon in their left hand.

It doesnt bother me lol, I just feel bad* for the guy
whoops left off the end cause my doorbell rang
I get that, I like to do what I can to help users. It bothered me a bit early in my modding career though.
Definitely care a lot less now, too many users to satisfy them all.
Yeah, Ive taken to conditioning and training commenters.
a little bit of preparation can mitigate alot of comments
Tempted to take it all on github and have issues templated
But then you'll get people who don't bother at all
Yea for real, I've gotten in the habit of downloading the top mods for the area i'm modding and ensuring compatibility in advance
oh, I just meant telling people how to report errors
Ah lol
trying to compat mods is kind of hard to predict
your time is probably better off just enjoying the modding and catching issues as they come in
I have 1 rule, I don't know your mod exists. But I'll go the long way through the code if I have too to have no impact on the end result as far as other mods can tell
Main issue with github is having to make Yet Another Account โข
I've learned from working open-source for a long time that it's best to work at your own pace. If someone wants to prioritize a bug fix, they can submit a patch or pay for the work. Burnout sucks
i tend to only go as far as 'if other mods are written with compatibility in mind, it will be compatible with this', and only add specific mod compatibility when someone complains (and if it seems worth my time)
Most of my mods so far are QoL stuff, I don't mind doing some work on being highly compatible.
some modders will write their mods in weird ways that i couldn't possibly account for, and it's just not really my problem...
Doesn't mean i'm not swearing at the monitor when someone raw bulldozes a function though.
omg yeah, my literacy mod wasn't working with CDDA reading because it straight up removes multiple functions from the reading timed action
there's a few reading mods that do that for some reason
I've taken to forcing those mods to load first using require
handling timed actions can be daunting for first time modders I imagine
that timed action seems to be very popular for modding, so naturally it has a lot of mods that will break things
I think reading is one of those game mechanics that there isn't really a way around not "sucking"
people get impatient and want it done faster/differently lol
Idk if there's even a better way to do it tbh
yeah, even i don't think my mod really makes it much better as a part of the game as a whole
'sit still for a long period of time so that grinding becomes viable' is hard for me to justify
One of those lesser evils tbh
I've definitely seen worse mechanics
QTE arrows to ensure people aren't AFK on some games
lmao, a mod to turn reading into an endless QTE that lets you read as fast as you can play DDR on your keyboard
LOOL
I kinda wish skills had more of a sort of logarithmic increase to them. Like, instead of integer level multipliers, they could scale, from 1->2 - so it would be more like every 10 steps 1, 1, 1.1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.7, 1.9, 2.0.
Level-locked items (like construction) could be altered similar to maintenance, so the higher level the more chance of successfully constructing in addition to having stronger construction.
Whats the proper require for a script located at lua/server/FILENAME
require 'filename'
Keep running into it not existing yet
not existing yet? that's half of what require is for
Hmm, maybe I just need to wait for game load
I doubt the mod i testing now will ever release, but im disabling basically all the normal game functions
The format should be after server/client/shared AND be in the same directory
It gets weirder regarding shared
Ah, the back half of the and is probably my issue
Yeah, the game is loaded in segments afaik, depending on SP or MP the setup looks/works differently
Yep that was it
I wasn't taking this particularly seriously so I went slack on the folders
Didn't realize it was literally required
I forget which folder is loaded first
But you could just get lucky and not need a require
shared -> client -> server, i think
Sounds about right
ya, thats right
not being able to require across folders has bit me a few times, but usually its easy to account for
you can always require from shared as far as i can tell
Does anyone have any idea at all about this? I'm tearing my hair out, I swear I've chased ten different threads and I just can't figure it out. There's nothing in clothing.xml, no limiter in UnderwearDefinition, etc. and yet somehow there is a default Swimmer zombie outfit that surely must deal with this problem somehow.
as in require a file from the shared folder? ya, thats probably because it is loaded first
Same logic has gotta apply for the Strip Club zombies w/ bunnysuits, etc. -- those are treated as "Underwear" too, but as far as I can tell they aren't being overridden by Top/Bottom underwear items.
is there a language i can add to my mod to make it translate to english by default if it is missing a translation
that's the default behaviour
oh okay. thanks
are you sure the swimmer outfit does deal with it?
Anybody got a working modpack I can use?
i messed around with this for a bit and i can't find any code about it, and spawning swimmers with the horde manager had many of them wearing underwear
hey all this might be a little bit of a dumb question but uhm. how does one add a context menu option to fire off a timed action? i tried to figure it out on my own but i've hit a brick wall and i'm not sure why context:addOption's returning a null type index ...
could you show the code you're using?
yeah just gotta redact some stuff gimme a sec
Hmm. It's possible I just somehow got really "lucky" with my spawn testing of the swimmers; I didn't try very hard since I assumed they worked. Makes me feel better if they don't handle it...I still wanna fix it, but at least I know I'm not missing some obvious solution.
local function myactionaction(playerObj)
ISTimedActionQueue.add(ISmyaction:new(playerObj))
end
local function myactioncontextmenu(player, context)
local playerObj = getSpecificPlayer(player)
option = context:addOption(getText("UI_myaction"), playerObj, myactionaction(playerObj));
end
Events.OnFillWorldObjectContextMenu.Add(LMMain.myactioncontextmenu);```
i'm probably missing something obv
try
local function myactionaction(playerObj)
ISTimedActionQueue.add(ISmyaction:new(playerObj))
end
local function myactioncontextmenu(player, context)
local playerObj = getSpecificPlayer(player)
local option = context:addOption(getText("UI_myaction"), playerObj, myactionaction);
end
Events.OnFillWorldObjectContextMenu.Add(LMMain.myactioncontextmenu);
will do, thanks
Related question, did the strip club get deactivated in some past update? The outfits are still around in clothing.xml but it looks like the zone is gone from ZombiesZoneDefinition. I'm not getting any zombie strippers to spawn in there no matter how many I plunk down.
...I swear this mod isn't what it sounds like.
when you write myactionaction(playerObj), you're calling the function and passing the return value, which is nil as your function doesn't return anything; to pass a reference to the function you just use myactionaction with no ()s
ohh i was just going off my python knowledge that it absolutely needeed to have a passed variable that makes sense yeah
the context menu calls the function when the player clicks on the context option, for now we're just telling it which function we want it to call
sadly still an attempt to index a nil value :(
null*
im gonna try a full restart but darn
thanks for the help tho
there is no zombie zone definition for that area, they spawn the strippers in by the room name "stripclub"
I've seen mods reference that room in their own ZZD files but I can't find any reference to the space in vanilla. Are those spawns determined somewhere other than the ZZD file?
it's java
no luck still an attempted index of a non-table (null) :\
which line does the error point to?
#11 now, which makes sense since it's the event trigger, but there's no index on that line
LMMain.myactioncontextmenu is a table index
oh i see
i'll try w/o the lmmain. and see if that changes the outcome but i sorta doubt
LMMain isn't defined anywhere in what you showed, and the function isn't called LMMain.myactioncontextmenu, is that a mistake you made cleaning up the specific names in the code to show or...?
anybody else getting a normal termination error when trying to use brita's weapons/armor?
i was just referencing the name of the file itself (LMMain.lua) but now that i think about that it doesn't make sense
It's defined as RBStripclub, which should be exposed to Lua
that was it im a little bit of a dumdum
thanks for the help
Thanks! Yeah, I'm not having any trouble spawning my own stuff in there, at this point I'm just trying to figure out why I can't get them to show up in vanilla! XD
Does anyone know how to get the X or Y limit of the map?
idk what i did but when i add my mod it gets stuck on a blank main menu background image
there was for some reason a shortcut to my mod folder within the folder, so i removed that but it still happened. so now im revalidating my files
figured it out. caused by something in my exclusive traits
Does anyone know if there's a mod to light fires with just friction or something?
Isn't it possible to make a Drill Plank in vanilla?
Yeah, you can just use the drill plank option and a sturdy stick to light fires ๐
ooooooooooooooooooooooooooo
I see
I've always seen that recipe but never understood what it was lol
Thank you ๐
You're welcome ๐
@astral dune
bro wasnt able to make your code work so i had to device something else.. i did the sprite odd even thing i told you about
TileNameContext = {}
local VaultTiles = VaultTiles or {}
local VaultTileList = {}
for i = 0, 21 do
if i % 2 == 0 then
table.insert(VaultTileList, {close='krp_glytch3r_safe_'..i, open='krp_glytch3r_safe_'..i+1})
end
end
local c = 0
for i = 1, #VaultTileList do
c=c+1
print(c..': close: '.. VaultTileList[i]['close'] ..' open: '.. VaultTileList[i]['open'] )
end
function getKey(table, value)
for key, val in pairs(table) do
if val['open'] == value then
return VaultTileList[key]['close']
end
if val['close'] == value then
return VaultTileList[key]['open']
end
end
return nil
end
print('') --adds bunch of spaces for clarity
print('')
--to test, you can test this using any lua console since it doesnt really used any pz related stuff
print('convert odd# open to close '.. getKey(VaultTileList, 'krp_glytch3r_safe_5')) --should return krp_glytch3r_safe_4
print('convert even# close to open '.. getKey(VaultTileList, 'krp_glytch3r_safe_8')) --should return krp_glytch3r_safe_9
but big thanks tho i learned alot still
problem with what i did is i wont be able to havbe anyone else add to the thing
this is how i use to view the table entries
local c = 0
for i = 1, #VaultTileList do
c=c+1
print(c..': close: '.. VaultTileList[i]['close'] ..' open: '.. VaultTileList[i]['open'] )
end
now i only need the function to set hidden the contents like how padlock does it
Unless your vaults are isoThumpable, then you can just use the vanilla locking system I rhink
its an isoobject
idk how to set it to thumpable using tilezila
Same, perhaps ask #mapping
But the code I provided works
I use it for Shops, and in that mod you can turn any isoObject into a shop
i dont know how to add that to my code tho ill try when i reach a dead end ๐ i thinkk i might have found it..
thnx alot...
๐
Have you reached out to the already existing mod authors?
Are you able to add a custom radio station with custom text and mark the player when they listened to it?
You can add custom radios stuff - the rest is handled by the system
There is a tool for it I believe
Do you know what that is?
I know you can add music but I want one with like talking
Trying to find it but my phone isnt getting enough data
does the following code always equal n if n is less than 256?
final int n2 = (int)Math.floor(n - Math.floor(n / 256.0f) * 256.0);
need someone to clarify if I'm missing some floor or other Java math behavior, or maybe some behavior with the casting going on here, but from what I can tell my understanding is right
Surprised that it isn't 255.0. Usually is for these kinds of lines of code.
Still can't find it but I promise there's an editor -- I know there's one in game for debugging -- I'm not sure if you can add onto stuff there.
It looks like one of those RGB clamps.
Actually now that I think about it the tool might be integrated into the game
usually only when dealing with indices, if you have a base of 1 it's 256 (256 values in total, but typically you have to account for index 0)
I was thinking about converting to normalized OpenGL color values.
so either 0-255 or 1-256
Yeah.
yeah, RGB's lowest value is 0 so definitely
I don't think n would be more than itself there, given that it would subtract less than n if n has 0.0 to 0.999999... more than a whole int.
Too early in the morning to even PEMDAS.
in this case that code actually relates to erosion - n is the seed value passed in, and they vary from 16 to 64 to 128 etc.
so in every case, that code is actually redundant - because it'll return the input value (n) for every possible seed
i even wrote a quick test in java to make sure i wasn't losing my mind but nah it's correct
PZ has quite a bit of scaffolding in their code.
I mentioned this yesterday with ISUI code.
might report it, could genuinely be a bug. all that'd need removed is the Math.floor in the middle for it to work
Honestly all it looks like to me is it needs to be floored... and that's it.
or, "work" I guess - I still have yet to determine the effects of the value in general since it gets mixed in with a bunch of others
it's already floored - the result of the division is floored to 0 every time, since every value of n passed is smaller than the divisor
Don't rule out that this is probably trying to round the lower decimal values on the number.
Just a lingering thought.
Oh. Multiply a decimal value by 100 then round it then divide it by 100.
Unless I'm misreading the line in my head since I haven't looked at it in like 10 min.
maybe, not sure. take another look - it's flooring n / 256
But the int at the front of the assignment would remove that.
the int at the front is just an unnecessary cast, isn't it?
You ok buddy?
correction, this isn't entirely correct - Math.floor returns a double, but it still rounds to the nearest integer, so it's just a type conversion (does Java not have implicit conversion for instances like that? weird)
Erosion was originally made in Lua exclusively. Whenever the mod got hired on to the TIS team, they rewrote it in Java.
yeah. i thought about asking turbo about it, but I don't want to bother him until I'm more certain that it's unintentional
he's the one who wrote both of them
If you know something that very likely would improve on their work, I'd hardly call it bothering.
I've reported critical zero-day security exploits in the past that've been patched. ๐
Finding ways to help improve the game for others is what makes modding fun.
any recommendations for where to learn lua?
I want to learn modding this game I have some experience with programming
but not a programmer
I don't know the most current guides that people throw around in here. I am a programmer for the Typescript environment for modding PZ so if you are familiar with that, this might be for you.
Otherwise there's some guides out there that helps you with setting up a modding environment for Lua modding.
(Wishing there would be some bot commands for showing links to these guides here)
hack the planet! hack the planet!
It's going to be freaking hilarious when I start writing PZ UI in TS React. xD
Wish that PZ had shaders for UI. All they'd need to do is enable the shader for it during the render pass. ๐ฆ Would open up a ton of options like possibly backdrop-filters such as frosted glass for UIs.
One can dream...
experience with what
you can do it with prerendered images
Not if you want to sample the buffered frame behind the UI.
simple programs like vba that can calculate complex data
but I think I can learn it though I am good at figuring it out I just wanted a direction
regarding where to start learning because I never learned lua
or heard*
Dug up a screenshot from when I modded the Java code to make a working UI shader. I didn't get the game's frame buffer to sample though. ๐ฆ This is me manipulating the vec4 color from the frag shader to be more red.
Can't ask people to patch their games so I can do fancy UI stuffs though..
There are pins but yeah, that'd be nice
I'd be using them all the time to help people here. ๐
There used to be a blue role, workshop mechanic?
Konijima had it IIRC.
He helped get PipeWrench on the PZWiki but IDK what they could do here.
Yeah Konijima has that role.
I'd be down for the role if it's still a thing
Are adding commands something built into discord?
Or would one need to edit/modify/configure a bot?
I think that it's a little easier to do commands now in Discord. (Recalling something about integration for simple commands with Discord itself)
If you have a function that needs to run on an event like OnInitGlobalModData, should you also remove it from that event so it's garbage collected?
For events that I only need fired once (say on startup or a loaded game), I would assign the function to a variable and call to remove the event inside of the event function itself.
local func = function(..)
-- ..
Events.OnSomeEvent.Remove(func)
end
Events.OnSomeEvent.Add(func)
So it's preferable to remove the functions you need to run once on load, right?
I actually don't know. It'd depend on the nature of the event. There isn't much overhead from a Lua event.
It's stored internally as a LuaClosure in an ArrayList.
what's the purpose of the func = nil line?
I've had issues in the past in multiple languages of a self-reference inside of it's own declaration / initialization.
It was out of habit.
But that was in compiled languages like Java so it might not be needed.
it's not needed in lua
in PZ it fails if you do
local myfunc = function() ... end
but works if you do
local function myfunction()... end
and intellij also catches that, so must be a Lua thing
Awesome. Editing my code..
that's interesting to keep in mind for other languages
Yeah so think about how the language has to calculate and initialize the variable to assign. If you try to call it before it assigns from itself, things get weird.
I recycled objects in a mod before - didn't seem to mstter
Hi all, is there a lua solution to read a textfile or a database on my hd with a mod ?
There's a file reader/writer but it only points to specific locations
you want getModFileReader(string modid, string filename, boolean createIfNull)
no the lua folder one definitely works
For me it throws errors related to L's capitalization
Can be read but not written tho
one of my mods writes some statistics to a json there
If stuff needs to be pinned it should be posted on the pz wiki page which is pinned, and anyone can edit and contribute to.
We used to pin stuff, and then we had so much stuff pinned that nobody could find it, and people were asking for stuff to be pinned that was already pinned regularly.
We had so many pins that the pinned posts became unsuable, and that is why people are encouraged to post stuff to the wiki instead.
Fair enough
Who's in charge of the discord stuff? In relation to adding a !intro command or something
Could even link to the wiki
why not pin a meta pin with pins ๐ค
nasko is the one to talk to for that stuff.
Suggestion: Discord forum controlled by trusted people to author posts for resources, guides and tools. (But then the Wiki already solves that)
If there would be a portal for this content here, I think that would be the best method.
A bot with keyword tags to then post something in the channel for those resources would also be good and prevent things like pinned post spam.
blair... did you ever see my update to your carry mod?
I wonder if the #thread could be used
gotta write a bot
I've written bots before, but surely there's a simple keyword message
There's some in pzchat for memes lol
discord only has auto moderation
and commands triggered by keywords are highly discouraged
i wonder???
?
probably the guy in Skizot's mod with the cat hat
I think the commands added like !sporfo are via a bot then
like i said have to make a bot
I saw a lua with a rabbit function
and those kinds of commands shouldnt be made
Out of curiosity, how come?
they require message content intent which is very very discouraged by discord
requires a manual review application to pass to get access to the intent for large bots
thats too bad, I'm sorry to hear that.
What you typically see on other Discord channels (e.g. Enigmatica for the Enigmatica modpacks for Minecraft) is you have a command, e.g. !tip and then a password for the tip. !tip export textures would give texture info for example.
I think the new bot API lets you make /-based commands with preview and auto-complete and all.
Nah man its all cool. Its porbably cuz its too complicated for me to make it work. Atleast i found a way to do it
And i really learned alot. Im gona learn your return boolean technique thing
Ahmm if i have an item thats moveable and i added moddata to its script
If i place it will it still hold that moddata?
moveables typically transfer data on pickup / place
Thnx another Q
Is it possible to hide my sprites from the tilepicker
Cuz i cant find a way to convert it into thumpable. And i really cant comprehend chuck's code
So i think ill have to make it item only and thrn as the place/build it will convert into thumpable
My code intercepts when items get transfered or try to be
All you have to change is the validStoreObject(mapObject) function to be what you need
The rest should remain the same
I basically took the UI/item related events with locked containers and copied the results with a different condition check
intellisense cracks me tf up sometimes
With my mod that edits Metalworker profession - some people state that after they die they can't see any other profession but the one I edited... I tried replicating the issue by adding some mods that tweak/add professions but with no luck... What might cause that on their part?
๐
If you can't replicate the issue with just your mod you can try to ask them what mods they use.
if I had to guess, they're using the profession framework (if that's still a thing) and there's a conflict where it's overwriting the professions factory functions. iirc that framework uses some stuff like that to remove the base professions and re-implements them using the framework
Yeah I asked, but I usually won't get any second replies ๐
AHh, thanks, I'll try that too.
(that framework was made with good intentions, but if it's that incompatible with mods that don't use it then it's a bad implementation imo)
not even sure if that's the case though, but yeah def worth testing out
whats the name of your mods lua file
Its unique if that's what you are asking.
the framework doesnt remove the base professions and reimplement them, nor is it incompatible with mods that dont use it.
when it overwrites the vanilla factory functions it insures it calls the vanilla one (or w/e overwrite another mod did)
They said other professions got removed after they died and tried doing a new character on the same save.
it isnt whats the file name
if i was going to guess on the issue, the problem is the vanilla function was overwritten without calling the original vanilla one, and only includes the changes in the function - not the full original content:
the vanilla function is stuck into a OnGameBoot event (if i remember right) before another mod can overwrite it
when the player dies and restarts the function is called (but not necessarily the original one)
well if fenris says it calls any overwrite then it wont be file name
that's fair, it's been well over a year since I've used it - I'm pretty fuzzy on the details, I just remembered the "nuke all the vanilla professions" option
yep as i guessed
But why can't I replicate it and the problem exists only on some people? Also, how should I fix it?
local original_doprofessions = BaseGameCharacterDetails.DoProfessions -- copy the original
BaseGameCharacterDetails.DoProfessions = function()
original_doprofessions() -- call the original
-- now do the stuff
end
Events.OnGameBoot.Remove(original_doprofessions)
Events.OnGameBoot.Add(BaseGameCharacterDetails.DoProfessions)
Thank you. I'll try. I'm pretty noob at actual coding.
shouldnt they also remove the original
Ahhhh crud. I thought there was masking API for UIElements.. Basically not rendering overflow of children elements being possible.
ok, is overwriting neccessary? can't you just add a single profession with your own function?
Not rendering of children can be done with stencil
Oh shit you're right.
I didn't notice those methods.
Yeah that's how I did errorMag
Its possible to do css? For ui? Wtf ?!
its necessary unfortunately, since on death/restarting the profession and trait factories are wiped and rebuilt by calling BaseGameCharacterDetails.DoProfessions, theres no real event for detecting when to rebuild at the appropriate time, so you have to overwrite somewhere
Yeah. I'm writing a React library for PZ UI with my own UI library that's apart from ISUIElement.
this honestly totally confused me for a few solid seconds before I remembered lua doesn't have +=
I wont hate making UI after thats built
...how tho
are you going to bake React TS into JS into Lua? that's insane
It uses TypescriptToLua to do the final transpilation from TS to Lua. They have custom JSX Factory stuff.
dear god
I wrote PipeWrench. I can do this too.
i both love and hate that concept entirely
So I'm writing a primitive HTML engine right now with CSS.
fuck it, go all the way. implement SASS/SCSS
Why not let SaSS do SaSS in a Node package and then compile it to CSS?
You wouldn't hate the part that allows you to see this:
I heard that EmiLua does some stuff like that too.
Having a UI that can be built in React would save a lot of headaches though.
god that's beautiful
isn't the whole point of React asynchronous viewmodels and whatnot? I can 110% see the need for TypeScript, but implementing a framework like React or Vue or Angular or whatever else seems kinda weird to me
I'd be implementing React for its other perks which is in-script DOM structures and properties stuff.
DOM objects as actual Types / Classes.
that makes some sense, but I feel like React wouldn't be my first choice there
not that I can really think of what would be my first choice at the moment
A parser can always be used in its place.
interesting Professions are reset only for Mouse
The idea is to have rules and have rulesets for UI.
I think modeling my solution around HTML and CSS with some utility from JSX would be a decent place to start.
yeah for sure
It can be done and that's what I'm doing right now.
Whatcha planning to do?
@finite radish If you scroll up my msg history in here you'll see a screenshot of a Java core mod I made that shows me inserting a GLSL shader program for UI.
If we had that...
I could do things like frosted glass.
just looking at the prev discussion
Also like-jQuery shenanigans for animation functions could be built into that.
Maybe I'll finish up that core mod and allow it as an optional, "experimental features" like Chromium likes to call it.
๐
i think java modding is still unlikely to take off. it became rooted in Minecraft out of necessity, no other options - but here there's Lua and the Workshop that are way too attractive to try spending a bunch of time setting up a framework (and without a framework, it's too much of a pain in the ass imo)
and that's from the perspective of wanting java mods really badly, for the record. just being realistic
In the past I've had tens of thousands download and use my Java patches to PZ.
If people want something enough, they'll get it.
So don't count that out.. especially with server-side patches.
that's the first I'm hearing of any successful java mods tbh, outside of projects like CocoLabs and Storm (which also don't/didn't have much traction)
Someone once told me that if they exposed the java reflect it would basically allow one to modify anything? I'm not well versed in Java, but would that be the case?
eh, sorta - you can do that with reflection already, it's just unsafe
I imagine it would be very unsafe
You don't need to do it this way. I simply do it by modifying the game directly or creating a JAR-builder environment that then premain-loads modified bytecode in before launching the game.
you don't really need to "expose" reflection (since it wouldn't be a Lua process) but I suppose you might be able to get some sort of reflection attached to the lua exposure - but it'd defeat the purpose of the security of managed Lua execution
Reflection is slow.
that too
You can dynamically inject bytecode into any Java process before it starts and keep files clean.
I think they wanted a silver bullet to hitting Lua hook roadblocks
(and messy, and difficult)
I could literally throw you an environment I built just for this for PZ.
bytecode is the same thing as IL right? I'm much more of a .NET guy than Java tbh, but from what I understand it's the same thing as IL manipulation
I don't know .NET Virtual Assembly.
definitely interested if you have links, as well as the project you mentioned before that gained traction
i'm working on mapping/data tools for PZ in .NET 7 at the moment, but nothing like interacting directly with the game like your TS layer/Java bytecode stuff
The TS stuff doesn't touch any Java code to work. It's compiled to 100% Lua.
only reason I mentioned that was I saw Java bindings mentioned on the github readme, but I figured it was pretty barebones
or is it just implementing linting/type defs for the Java code for when objects are returned/used via Lua?
(also was partially referencing what you mentioned above, separate from the TS stuff)
It uses a in-house set of two transpilers, one for PZ's exposed Java API and the other for their Lua codebase to Typescript definitions.
I built both.
The Java one going deep into and pulling up generic types for class implementations.
exposed Java API as in "anything that's public" or exposed as in "exposed to Lua bindings"? either way that's neat
The latter.
Consequently, updating the typings also creates an API changelog for the game's API via Git diffs.
that makes sense, yeah
Every change to the API in the core engine of PZ shows up with every version change. =3

Can't wait for B42 because so many tools could be made to help with the animal stuff.
facts. my pokemon framework is gonna be sick
@quasi geode This fixed the issue. Thank you for directing me to right direction.
Kind of went wild with the Events :D:D Just to be sure
Oh damn I was just thinking if this could be automated
So if I understood - this will show new exposures or changes to existing ones?
Yup.
this doesn't cover the respawn though?
The documentation is also automated.
Shows all parameter options for calling the method.
You mean the respawn mod?
Or creating a new character withing a save?
I tested it with my character death and with crating a new character within a save and they both worked. Showed other professions and added proper recipes.
when you die, there's an option to make character before quitting to main menu. If you don't have joystick, it resets the professions.
one sec
Yeah works with that too.
Thats why I went wild with the Events. So it can work in different situations.
honestly, I usually don't use that option since it seems to cause bugs with a number of mods.
Hi so I am thinking of making a pz mod to either reskin the zombies into the flood from halo or make new zombies in general
Looked info up on zombie modding to see if its even possible but I only saw a reddit post from 5 years ago that wasnt very helpful
Have never modded a game before either so I dont know anything here
but you have experience coding ?
nope
U might want to start with looking at some simple mods.
And you should learn the folder structures
Files types and then then syntax. Then learn lua..
But you you can create mods without even learning lua . Basic mods i guess
I know I know
right now though I want to know if my idea is possible at the moment
Hey, does anyone know where to find the list of abbreviated skills/stat code for the Recorded Media functions?
Hey, I'm digging through some code, can someone explain to me how does overwriting game actions work?
code in question:
local original_fix_perform = ISFixAction.perform;
function ISFixAction:perform()
local player = self.character;
local item = self.item;
local hasRestorationExpert = player:HasTrait("RestorationExpert");
if(hasRestorationExpert) then
self.item:setHaveBeenRepaired(0);
end
original_fix_perform(self);
end
As I read it, it stores what original repair function would do in local variable, then replaces it with custom function that as a part of it runs original code?
Yeah, so it seems like it is basically taking the default fix action, and piggy backing off of it. So it will have the same trigger as the default fix action, but it includes the check for the trait so it can reset the items 'times repaired' #
ye i get the mid part, was just wondering if I read the other part correctly
Now the fun part: where do I get code for what exactly base game perform actions do, for example
What do you mean?
cuz fuck knows what ISFixAction:perform() does
So basically go search base game files?
cheers, will look it up
Now where would I find FixingManager 
FixingManager.fixItem(self.item, self.character, self.fixing, self.fixer);
Tried searching for file name, got 0 hits
Wait- So what is the end goal?
General curiosity at this point 
sounds like a java object
yeah, it's java
yea im not gonna go into decompiling stuff
Yeah, but the framework for making a new fix action already exists lol
If you are trying to change the items needed to fix something, those are done simply through script files
yea i know that one. I generally was just researching how higher mentioned part of code works
all good! I figure that if you wanted to mess with it, you could also just go through and insert your own new function similar to how the code you sent did. Basically just modify the fixing action in some way to do what you want instead
Also- Would it be wrong to @ someone from TIS that is named in a file to ask where on earth they pulled variables from? LMFAO
Because I am trying to find all the shorthand codes for recorded media

You can see how each line has a dif effect- Most reduce boredom, but there is also the CRP+1 which is giving carpentry xp
trynna make vhs for other skils? ๐
Yeah, I had someone ask me about it. So I am deep diving trying to figure it out lol

those are in client/RadioCom/ISRadioInteractions.lua
every stat and skill has one, even things like thirst lol
can't wait to watch some VHS to quench my thirst
'drink'? dude i have Thirst for Beginners

While we are here, is it possible to give someone muscle fatigue as a condition?
Like- Without working out
But this guide makes it monkey easy https://github.com/Konijima/PZ-Libraries
You know, if you did want to...
maybe dis?
https://zomboid-javadoc.com/41.78/zombie/characters/BodyDamage/BodyPart.html#setStiffness(float)
Javadoc Project Zomboid Modding API declaration: package: zombie.characters.BodyDamage, class: BodyPart
it's referred to as stiffness internally
steamapps\common\ProjectZomboid\media\lua\shared\Definitions\FitnessExercises.lua
in here
ye
damn exercising with equipment gives like twice exp
ty, starred for future
@dull moss IntelliJ lets you independently search all the text of all the files in the Java decompile (case-sensitivity and regex optional), and also search each file that turns up in that search the same way... Pretty useful.
(While the parent (directory/file level) search is still live)
idk lmao I am describing this poorly but try it
I have worked on project zomboid mods in NotePad++, VSC, and Intellij. For simply opeing and reading a file, I will always recommend NP++, but for the actually coding, it is so worth it to decompile and use Intellij. Just being able to look up, and have the entire codebase referenced easily is so nice
i use np++ if i need to look at another mod briefly, otherwise always intellij
in some cases i might open a script folder or a mod in vsc but that's it
VS Code opens so much faster than Notepad++ for me
That's main reason I use Code... pure short-term simple-minded impatience
I have not thoroughly analyzed this decision lmao
But nevertheless it serves many purposes well for me and I would recommend if you've never tried it
maybe it's time to close your np++ tabs?
No I mean fresh install
๐
Code just boots faster
I think seconds faster iirc
But even if it's fraction of a second, it's palpable to me
vsc is noticeably slower for me but np++ i don't consider even useable for writing code
it's not even that good for reading it
Maybe #mod_development message
Hmmm Idk Notepad++ opening pretty fast now
Maybe I misremember why I passed on it
I just redownloaded it to test
True that. Esp if searching a keyword .
I am actually noticing something else that I did not notice last time I used Notepad++
Another thing that slightly bugged me was I would type "Not" and see "Notepad" until I got all the way to "+" in the Windows key menu
and making a shortcut for notepad feels excessive.
Whereas "Co" hit on Visual Studio Code off the rip
HOWEVER
to be clear, the purpose of this is so that multiple mods can overwrite the same function, and all of their code will still run, as later loading mods will pull the code of earlier loaded mods into their overwrite - it also means that we don't have to change things if the vanilla function is updated
I am noticing that Windows is legit remembering my preference
If I type "Not" enough times and select Notepad++ from menu, Windows notices I prefer Notepad++ on Not
Its the lack of sleep dude
Smart Windows, good job Windows.
Ya better catch some shut eye
(Or a new feature, who knows)
for notepad++, i'm always using it from right clicking a file anyway
I use note++ as a scratch paper . As a thing where i keep snippets and notes
Cuz it stays there after u close and it has bunch of diffrent tabs of files from various directory so i dont use it as a workspace unlike vscode where the main project is opened . But i usually run 2 instances
So my setup is
Vscode javadocs and lua folder on
vscode modproject workspace
Notepad++ with snippets and stuff
I run all from a autohotkey gui which contains bunch of usual snippets too. I prefer to use ahk compare to extension they have. Its just so that its universal for me
ye, figured
i was reluctant to switch to intellij but really quickly found the benefits after only a couple days
I'm sitting in Visual Code atm
How do you search stuff with intellij? I cant seem to find it
Ctrl+shift+F for words
Ctrl+shift+N for files
If you've used the libraries tutorial
I never bothered . I did try for a few mins and tried to install gradle and stuff but couldnt make it work so i gave up
But i might be able to figure it now . K didthis back when i wasnt modding yet. And wanted to learn how
the setup is pretty annoying honestly but it's very much worthwhile
Ah so it wasnt just me who thinks its frustrating then
i had to mess with it to force it to use more ram and stuff, it was such a pain
I thought it had to be learned as a basic thing for IT professionals
being able to find the source code for anything in the game in a handful of seconds pays off though
U mean like auto complete?
i mean like the actual lua/java source code
tbh, it works fine for most things. Since you can tell it your language of choice, it will show up with custom coloring the same as any IDE. The fact that it opens script and LUA files in a way that is actually legible is the reason why I use it. I can open a bunch of np++ tabs for different things for reference, and hop between them as needed just to double check things
Is it really that good? Cuz you can search using vscode and it has right click reference thing
Not really sure wht intellij has that cant be done by vscode
the main thing is the libraries generated by that tool don't quite work as well in vsc, and searching the lua/java isn't nearly as convenient
If u have the decomplied source then you can search it right or ahhh cuz it directly ties the java and the lua? Is that it?
using intellij you can decomp the zomboid files and set them as external reference libraries. It is SUPER helpful
Ye thats gota be it
Ahhh no shit can u run debug too?
I might try to install it again then
And are you like able to for example
Type in getPlayer():
Then a bunch of possible entries show up? If thats the thing then ill defntly install it
Imean gradle ..
it is super helpful
i just did
Someone should put it in the pinned section
used it before
ty
hey, I'm a noob trying to use ISChat.addChatLine like ("Message", 1, 1, 1) but got an error,
ttempted index: addLineInChat of non-table: null at KahluaThread.tableget line:1689., what is the correct way to use it?
Not splitscreen friendly for multiple Jumpers FYI, fair warning (also on the page). I fear someone will be tempted to try and it will be a bit borky.
Multiplayer online is fine
ow ! SOLD!! hehe
ISChat.instance:addChatLine
P sure
so, with my current drug mod I am working on- I am looking to trigger effects upon the consumption of the drug. So- Would it be better to use a custom onEat function, or should I make something new from scratch? I want to implement custom sound and animations for the mod, so I dont want to be hard limited if that is not the best approach
nah still the same, what is this complain about table stuff, I thought it was simple stuff lol
Stack trace: java.lang.RuntimeException: attempted index: instance of non-table: null
Hmmm weird
What is the full code you are typing?
bruh why unhappyness is in BodyDamage and all other stats like boredom or stress are in Stats
this game sometimes

most likely your file is in shared so it's running before ISChat is created
that would make sense ^
so folders matter?
although that might not be it, i'm not sure why you would be calling that function while the game is booting anyway
Hey guys,I've been working on getting my mod to work on multiplayer and since there are very little resources on that topic I have a few questions. isClient() / isServer() What these methods do is clear, however when I call isClient() in a file that is located in shared it returns false althought...
folders only matter a little bit
Zomboid mods have three different lua folders:
client
shared
server
These folder's purpose is code organisation. Simply putting code into server doesn't mean it is executed on the server and not on the client. In single player for example all code is executed no matter in which folder you placed it. ```
I'm using this thing https://steamcommunity.com/sharedfiles/filedetails/?id=2825060402, trying to setup some command, without that line the message is printed on the console
-- Check if the correct number of arguments are passed.
if #args ~= 1 then
return '/'..CMD_NAME..' [message].'
end
-- NOTE: The helper only becomes visible in global scope when the first lua server command is fired.
-- Make sure to reference the helper inside of the command's handler function.
local helper = LuaServerCommandHelper
ISChat.instance:addChatLine("Message", 1, 1, 1)
return 'Message: ' .. message
end)```
this is just wrong i'm afraid
All of them are executed, but ordering matters. So the issue here is that the file xpa made is loading before the game creates the chat... lmfao
whats wrong about it?
client files aren't run on the server, and the game loads vanilla shared -> modded shared -> vanilla client -> modded client -> vanilla server -> modded server
bruh
the folders actually matter a fair bit
so I need to think where i put my luas?
also from what i've seen, require calls only work in the same folder or in shared
e.g. client folder can only require client and shared, server can only require server and shared, and shared can only require shared (not sure about this last one)
... Wait, fr? damn- Good to know! Now I know where my drug modules go :)
I imagine you can require a client file in the server folder, but of course only on the client
every single mod i worked on has everything in client with exception of traitfactory which is in shared and they all work on server and sp
so how do they matter
hasn't worked in my experience
Depends what mods you have made, tbh
trait stuff mostly
it just didn't matter for your mods

you can usually get away with making the majority of things client sided

but also, Albion- Any insight on this?
i didn't respond because i wasn't sure ๐
Ah- lmfao, all good!
the simplest solution is usually the best, so i would try OnEat first, but i don't know if you'll run into limitations
I was thinking of piggybacking on the onEat because it would make the entire system a lot easier
Yeah, thanks! Honestly that was the confidence I needed lol
Also- Have yall seen the OpenAI chat bot?
what? this is executed if I type the command in the console ๐ค
oh... Weird... Might be the way you are calling the chat then
does this run on the server?
yeah, I just don't know the proper way to use it
the server doesn't run the client folder, so ISChat doesn't exist there
from the description of the mod i'd guess that it does run on the server
Yeah, you are right
Sorry for the spam- But I mentioned that chat AI earlier because I asked it to explain to me how LUA modules work, and had it explain to me what the module I had written would do, and explain how the module can be referenced in different ways
my experience with ChatGPT and lua is that it doesn't really understand the concept of pass-by-reference vs pass-by-value. It can tell you the difference, but not implement it in sample code
heh, it fails to localize the initial DInfo table in the first file. odd mistake
in the first one, it was just showing how to reference the DInfo in another file
The variables are defined as local in the module itself, not the new instance afaik
RIGHT? It is incredible
I had it write me a rap song about south american animals yesterday, and got it to explain to me its process for seizing control of the global cheese market
Like- Just the universal functionality of it is insane
I asked it for a joke about Dante's Inferno, it said
Why are there so many circles in Dante's Inferno?
Because its a round hell
Hold up.... Am I able to just call ANY function with the onEat trigger in an item? From what I looks like, I dont need to do anything fancy... I just set the onEat = to whatever function I want, and then it run it?
yeah, anything global
You know of a good way to add delay? Like- Function starts, x time passes, then the rest of the function occurs?
dumb question: say i want to make a new occupation mod using the vanilla ones as a base. where in the world do i started?
there's no simple way
the most basic way to do this is to count ticks on the OnTick event
if the time is particularly long and doesn't have to be exact you can use a different event
As you (probably) already know, PZ allows us to define timed events using OnEveryTenMinutes, EveryHours, and EveryDays. As handy as they are, sometimes we want a more refined system. Maybe we want a event to trigger in 15 minutes, and possibly repeat itself a few times then stop. Maybe we want so...
Seems like fWolf cooked up a system awhile ago
Does anyone know what happens when an NPC is removed naturally from the player's instance? I see the IsoPlayer still exists, but his model disappear
I tried this, to bring it from to cell
public IsoPlayer(final IsoCell isoCell) {
this(isoCell, null, 0, 0, 0);
}
but it doesn't works as expected
So for visual studio code I installed the Lua add on, but it still thinks the lua files have errors in them
You have to disable that specific check for your folder
i wrote this for a project of mine, no idea how performant it is compared to that one
local Delay = {}
Delay.currentTick = 0
Delay.Delays = {}
Delay.DelayFunction = function(func, time)
Delay.Delays[Delay.currentTick + time] = Delay.Delays[Delay.currentTick + time] or {}
table.insert(Delay.Delays[Delay.currentTick + time], func)
end
Delay.OnTick = function(tick)
Delay.currentTick = tick
local delaysThisTick = Delay.Delays[tick]
if not delaysThisTick then return end
for i = 1, #delaysThisTick do
delaysThisTick[i]()
end
end
Events.OnTick.Add(Delay.OnTick)
return Delay
It's cuz you call functions that are in PZ
I had the issue too, I think it is because you are referencing things from the base files that the IDE has no point of reference to on its own
So vscode be like 
it can't do anything except call a function after a certain number of ticks (like even pass arguments), that's all i needed it for
Yep
guess ill just ignore it



