#mod_development
1 messages ยท Page 58 of 1
i mean like
you mean the list of all the vanilla ones?
no more like
holdon lemme make copy
nyctophobia:MutuallyExclusive({TraitFactory.Traits.Brave});
could i do smth like this
like where's the traits stored so i can exclude them
cause im new to all this trait stuff
should just take strings, vanilla has them as:
TraitFactory.setMutualExclusive("SpeedDemon", "SundayDriver");
as listed in shared/NPCs/MainCreationMethods.lua
oh so thats where that is hiding
couldnt find anything about traits in the game files
been looking at the wrong place
if you look at the github page for the profession framework (even if you dont use it) it lists where everything related to profession and traits are defined in the vanilla files (as part of the example)
actually, i should fix that example to include the full paths to the files, not just the file names
i actually wanted to use profession framework but like
my mod which isn't centered around traits would add 1 trait and that'd need a dependancy
and dependencies suck lol
PF was only made because i'm a lazy ass git, and dont like redundant code, the vanilla methods for adding traits and profs was too effort, and i wanted a crapload of phobias for our server (wasnt actually meant to become some dependency for all the other trait/prof mods out there) ๐
but here we are. lol
you made profession framework?
how did i not notice
ya
dependencies are a nightmare for maintaining your mod, people *will* fork the dependencies in a way that breaks your mod
even with good intentions
because i dont upload it to the workshop, so its not under my name
hmm good to know, so i should try and stay without dependencies for as much as i can?
pretty much yeah, there's been some pretty famous incidents with dependency forks and i just want to stay clear of all that
fair point
PF's workshop status is a pretty good example of a dependency fork nightmare
idk i can't use dependencies anyways
i like to use the framework if i'm doing something complicated (i would not want to rewrite occupational clothing to not use it), but recently i've mostly used stuff that would just be a single vanilla function call anyway
i just started out modding i have a LONG way to go
but hey now i can finally actually make the trait work
time to scratch my head and see if it's possible to detect if the player is standing in the dark or not
wooo
yeah, better to stay clear of dependencies when you can (particularly because some of the popular ones are literally pointless)
Anything u see when you type lua on search engine are good materials. There are also some youtube vid that u might want to check out first
But i suggest looking at pz codes first
https://projectzomboid.com/modding/index-files/index-1.html
index: A
Cuz u might try to code with lua functions that arent available on for pz
Such as random
worry about functionality first, then looks XD
i can guarantee i've seen worse?
hmmm
maybe
function initGame()
local daysPassed = 0;
function countDay()
local player = getSpecificPlayer(0);
if daysPassed >= 7 then
print("7 days have passed");
local function timeCheck()
if nil then -- check if it's 18:00 here
-- play siren sounds in certain cities so everyone hears it
elseif nil then -- check if it's 20:00 here
-- never make it go daylight ever again muahaha
end
end
Events.EveryOneMinute.Add(timeCheck);
Events.EveryDays.Remove(countDay);
else
print("it has not been 7 days");
end
daysPassed = daysPassed + 1;
end
Events.EveryDays.Add(countDay);
end
Events.OnGameBoot.Add(initTraits);
--Events.OnGameBoot.Add(initOptions);
Events.OnNewGame.Add(initGame);
pretty bad tho
everything, even the traits are in the same file
i mean it works so i don't really give a damned but yea
yep...i've seen worse. might want to turn those 2 functions local though, they're kinda generic named (thus may cause conflicts) and only getting passed into events anyways
oh i did not notice they weren't local
my bad
if you've seen worse that's a good sign for me
maybe i'm not the worst worst
don't believe adding this mod mid-game will still do the event though
seeing as it's onnewgame
i should also move this code cause
it's all in client
wouldn't work on the server
well OnNewGame doesnt trigger on server side anyways.
it don't?
can someone help me with installing the true music mod
its strictly a client event. it also doesnt trigger when the player dies in SP and clicks the new character button... though i believe it still triggers if they exit to menu, load the save and creates a new character then (it used to, i need to recheck though)
well it's good that it doesn't trigger on new character
as i want this to fire when the world gets created
but yeah if it doesn't work on a server i'll have to find a different way
isn't that a bad idea?
if it only fires when the world gets created, you'll need the server to stay online for the whole seven days, right?
oh?
i mean i guess so
maybe this is a bit harder than i thought
is there not a way for a server to save a variable?
cause if i could save the variable it wouldn't matter cause it'd remember the time, and i could use a different event to just start ticking on world load or something
you can save variables to global mod data, but you can probably just use something like getGameTime():getDaysSurvived() for this
getdayssurvived is for a character's survival time though right?
although i remember that not working exactly how i wanted it to when i was doing something similar, i think i ended up rounding getHoursSurvived() / 24
i think it was getWorldAgeHours() actually
i think on gametime the x-survived stuff is basically just how old the save is, on a character it's how long they survived
ah
ya getWorldAgeHours
let's see
this may be a lot better yeah
cause then the server wouldn';t have t obe up for 7 hours straight
iirc getDaysSurvived only increases every 24 in-game hours after the game started, which doesn't line up with EveryDays firing at midnight, so i used worldagehours instead
there's also getNightsSurvived, but whatever the difference is that didn't work for me either
aw man you guys have been super helpful
it works exactly how i needed it to work
thank you guys so much <3
anyone here using Brita's know why you I can't make a suppressor?
I have a bottle and tape, tape is showing as ready to use, but the bottle, no matter where I have it in my inventory, won't highlight in the crafting
can you put " in a translation line
for example, UI_trait_test = "if you "XYZ" then ",
would that work or not
Wrong thread bud.
#mod_support
knowing normal progrmaming, you cannot use more than 2 " else it'll mess up
as a devout single quote user, i can tell you single quotes don't work in the translation files
ye thats why i asked
darn
there may be a special thingy just like /n is new line
might be one for adding quotes
i've seen it before
actually i think this would work
how long is 2 ingame hours irl?
if time in sandbox is realtime, then 2 hours
lol
var9 = var9.substring(var9.indexOf("\"") + 1, var9.lastIndexOf("\""));
```as far as i can tell it tells where the string is by looking for the first and last quotation mark, it probably won't care about any in the middle
earlier I asked a question about setting exterior climate colours :'). I just wanted to say that I fixed it after checking client\DebugUIs\DebugMenu\Climate\ClimateOptionsDebug.lua. My brain wasn't ready for the fact that the Color class takes RGBA values from 0 to 1, instead of my 0 to 255. My bad
no but like
1 hour irl = 1 day in game
so the next step would be uh
five minutes
an in-game hour is two and a half minutes by default
so i'd have to make my audio cue like 5 min long to make it sound good
atleast 5 minutes*
I havent done any climate related stufd sorry.
not bad i suppose
remember player can fast forward
:)
heck you're right
nooo
damn
but don't sounds speed up too?
i could swear some sounds speed up in-game
i don't think so
crying
i can't say i know for sure because most sounds aren't five minutes long but
in a server it'd be fine but singleplayer
depends
heck it ill just make the sirens go for a while rather than tryna sync with nighttime approaching
damn that's the first time i've ever seen that allowed
ever
i still have to make my trait do something too
do what
var9 = var9.substring(var9.indexOf("\"") + 1, var9.lastIndexOf("\""));
thats super easy
infact i already did it for cowardly
gimem a min
well keep in mind i started modding like an hour ago
so easy for you is harder for me
local function GameSpeedMultiplier()
local gamespeed = UIManager.getSpeedControls():getCurrentGameSpeed();
local multiplier = 1;
if gamespeed == 1 then
multiplier = 1;
elseif gamespeed == 2 then
multiplier = 5;
elseif gamespeed == 3 then
multiplier = 20;
elseif gamespeed == 4 then
multiplier = 40;
end
return multiplier;
end
local function NameOfFunction(player, playerdata)
if player:getCurrentSquare() == nil then return end
if player:HasTrait("name") then
if player:getStats():getFatigue() < 0.9 and player:getStats():getPanic() < 55 then
if player:getCurrentSquare():getLightLevel(0) < 0.35 then
player:getStats():setPanic(player:getStats():getPanic() + (0.1 * GameSpeedMultiplier()));
end
end
end
i'm just glad i got experience with lua
imma strip all the unwanted things
Does anyone know if there's a bug with loot tables on zombies right now? We noticed the loot levels dip a whole lot
We have a custom table for them, it's working, just not dropping much
btw for player you do GetPlayer() and for playerdata you do player:getModData()
then when u call that functio u do NameOfFunction(player, playerdata)
Has anyone seen the Advanced trajectory mod
Havent tried it or seen the code. Any thoughts about it?
Wait what? U can embed function within moddata?
wdym embed
i think you've misread that glytch3r
no i mean like
they're just sending moddata as a variable
yea that
for grabbing the player, it's better to use
for i=0,3 do
local player = getSpecificPlayer(i)
if player then
-- do stuff to player
end
end
```otherwise you're not supporting splitscreen for basically no gain
it's just rarely much harder to support splitscreen, so no reason not to
uhhhh probably
I think so
drat
i wanted to alter the case on the mod id of one of my mods for consistency but doing so would cause it to drop out of the mod lists of servers it's in
just me being fussy about pointless details
Hmmm try it do a modtemplate thing and try it
Cuz u know what .. steam might have something that auto changes the files on the client aslong as the workshop doeant change cuz thats the real address
Ow also i rember on the workshop page u can rename the mod.. but maybe u just rename the title ... Idk might want to test it if u still feeling obsessive
mod name and mod id isnt the same
Ye thats what i thought ehhehe
mod name is for workshop and in mods tab
mod id is for other mods
say, if getActivatedMods():contains("ModID") then
add it to a local save, change the modid capitalisation on your local copy, see what happens
Thats a good idea
or just do
sorry was eating but thanks
im about to do somethign stupid
i doubt it will work
local function nyctophobiaPanic()
local player = getSpecificPlayer(0);
local playerData = player:getModData();
if player:getCurrentSquare() == nil then return end
if player:HasTrait("nyctophobia") then
if player:getStats():getFatigue() < 0.9 and player:getStats():getPanic() < 55 then
if player:getCurrentSquare():getLightLevel(0) < 0.35 then
player:getStats():setPanic(player:getStats():getPanic() + (0.1 * GameSpeedMultiplier()));
end
end
end
Events.EveryTenMinutes.Add(nyctophobiaPanic)
would this stack
the effect
cause if so that aint good
if getActivatedMods():contains("ModID") then
print("Check 1");
end
if getActivatedMods():contains("modid") then
print("Check 2")
end
change everyntenminutes to OnPlayerUpdate
otherwise you will get no panic at all
Iprinted this table and returned a bunch of functions most probably they are functions. Can i check that using type() ?
ISWorldObjectContextMenu
also put this function above that function
local function GameSpeedMultiplier()
local gamespeed = UIManager.getSpeedControls():getCurrentGameSpeed();
local multiplier = 1;
if gamespeed == 1 then
multiplier = 1;
elseif gamespeed == 2 then
multiplier = 5;
elseif gamespeed == 3 then
multiplier = 20;
elseif gamespeed == 4 then
multiplier = 40;
end
return multiplier;
end
the way panic in pz works is your character has a constant decrease rate based on a few factors and any source of panic just gives you an impulse of panic
ah
this is literally a lua table, just read the file it's from?
you mean all events?
Its so long albion very long. Probably the longest of all lua. Its hard to event start diesecting it
Nope this is just for the context menu
oh
client/ISUI/ISWorldObjectContextMenu
Yes that
what are you trying to do?
ISWorldObjectContextMenu.setTest is probably the one i should look at
what r u trying to do
Yey is it an easier way to call context menu? If yes pppplllllleeeeeaaaasssseeeee share
you're totally on the wrong track
Heres my plan so i can properly undderstand
1 corpse
2 container
3 specific tile
4 item
5 character
6 other player
7 vehicle
answer me
are you trying to do new context function
I just want those to react to click and invi the context menu if (condition)
oh
Yesyes
ruh roh
---@param player number
---@param context ISContextMenu
---@param objects ArrayList
function onFillWorldObjectContextMenu(player, context, objects)
context:addOption('text', first arg, function name, second arg, etc...)
end
Events.OnFillWorldObjectContextMenu.Add(onFillWorldObjectContextMenu)
Hopefuly
i think i did an oopsie...............
Ye i see alot of mods do that idk why
is that why my trait magically dissapeared and it errors?
thing is
whenever i comment out everything but what i had before u even helped me
it's still gone
oh wait nvm
so i prob did smth wrong
addConMenu(player, target, title, conditions, func)
addSubCon(player, target, title, parent, condition, func)
and for context menu same thing
contextMain:(target, moddataARG, condition, title, function()
end)
contextSub:(target, moddataARG, condition, title, parent function()
end)
i only have 1 file
for everything rn
life of someone whos tryna learn what everything means
Something like this @deft falcon
lemme dm u it
i have no idea
i don't understand what you're trying to do
To give an example
addConMenu(player, "household_tables_01_12", "check for fingerprints" ,someTestfunc, function()
print("insert code here")
end)
addConMenu(player, "Base.Corpse", "identify cause of death", isSometest, function()
print("insert code here")
end)
loop through the objects passed from the event and see if the object is there, then add the context option
Yup i want to make a function that automatically does that thing
store a table of [object type] = function and then look up every object in the table i guess?
Probably its missing another arg..
Maybe
isoplayerobject
MovingObject
isoObject
Etc idk
Mostlikely yeah
so anyways can i check every single entry usong type()?
you'd probably need different tables for different things, like a sprite table and a class table
wait was getting class names debug only
print(tostring(identifythis).." : ".. Type(identifythis) .." : ".. identifythis)```
Well im going add to this as time goes..
but i dont think i need to loop thru all the sprite just for the type
Ill just let it return string
i don't know, unless you really need a *lot* of them i think automating it would just make it more complicated overall
If its a sprite then i jist need to loot thru the location if ita close. But then i think it already has the locatipn cz of the right click
it only gives you the objects on the tile you right clicked on
๐ฎโ๐จ welp ill just put this on a corner for now then..
looking at other mod's code is really nice
dayum
didn't expect to be able to throw together sandbox settings so soon
the vanilla code calls a texture I want to change with
public void setTexture(String var1) {
if (var1 == null) {
var1 = "dir_arrow_up";
}
this.texture = Texture.getSharedTexture("media/textures/highlights/" + var1 + ".png");
}
but I've put a file called crash_arrow.png in my modname/media/textures/highlights/ folder and called setTexture("crash_arrow") but it continues to use the old textures. Is there something else I have to do to make a new texture work?
you should check where this.texture actually gets used
in what sense
well i don't see anything wrong in this function so it's probably not the problem
I think I found it.
var10.setTexture(var5);
var10.setTexDown("dir_arrow_down");
my texture only gets shown in certain contexts, otherwise it shows the dir_arrow_down instead
there we go, that works. Just need to make an arrow texture that isn't terrible now
Oh, good point about deleted-but-still-lingering files triggering a checksum mismatch. Hmm.
it might not though
it *should* only really checksum loaded mods...
but it might checksum the entire workshop item, i don't know
Yeah. I guess we can always tell users to unsub/resub. That cleans up the whole thing.
wondering if i should keep my workshop description short or make it big and very descriptive
having tons of info
I like them short with a lengthy discussion
hmmm
this makes the rather generous assumption people actually read the descriptions ๐
i mean i usually do
even if people don't
it's useful to have
like a faq or something in the desc
some people do... but i've watched the whole first page of comments one of my items asking the same question (which is clearly stated in the short description)
which is why i stopped replying on steam XD
if they do that on mine i'll just kill them
send a hitman to their location
ban them from using my mod
die puppet die
i don't think most people read the descriptions, but i do and i like an elevator pitch followed by actual explanations
oo
How does one get into making a mod? Wouldn't mind trying to make a van interior mod.
You can check all sorts of tutorials/guides on the wiki and through googling. I would try to start smaller so you understand the fundamentals of the script/LUA system. You can check the https://pzwiki.net/wiki/Modding for a helpful jumping off point. And there are some good tutorials on youtube for the basics as well
also, when pulling info from literature- I am trying to make an OnCreate function that will take the information from a written piece of paper, and transfer that to the resulting item from the recipe. I think I would just need to look for: getLockedBy(), getBookName(), and getCustomPages() from the paper, and set them onto the resulting item- Is that correct?
is there a way of checking for another mod in lua?
Hello!!
Is there any tutorial on how to interact with objects of the world like trees? Or any mod that could be useful to read its code?
Found this: https://theindiestone.com/forums/index.php?/topic/28643-vehicle-cutaways-a-solution-to-the-camper-conundrum/
So I'm not the only one who's thought of it, and it's a basic idea of what I wanted to do.
Vehicle Cutaways: A Solution to the Camper Conundrum Hi everyone, I've been giving some thought to the vehicle interior issue. There have been suggestions in the past of having interiors on large vehicles like RVs/Campervans, but it seems the discussion always ends at something along the lines of...
How does one mod a MP server
In what way? Like- A hosted server, or a steam server? And do you mean how do you mod for a server, or how do you add existing mods to a server?
I'm hosting a server for some friends and I wanted to install mods, however when I do what I think is right the mods didn't show up In game
I am going to use the getSquare() function pretty often.
Does it make sense to put the function in a local variable then? Is it better for the performance? I want to create a mod for a server, but that one has already a lot of mods, so I want to make mine as fast as possible.
yes, though you'll want to drop the () if you want to localize the function (and not the result)
local getSquare = getSquare
its always going to be faster calling a local function vs doing a lookup in the global table and then calling
Thank you very much
if I post some lua i am working on, can someone spot check it for me rq?
--[[
This function copies the information from literature, and applies that to the result of the recipe.
]]--
function Recipe.OnCreate.KeepText (items, result, player, selectedItem)
for i=0,items:size() - 1 do
local item = items:get(i)
if instanceof (item, "Literature") then
result:setBookName(item:getBookName());
result:setCustomPages(item:getCustomPages());
result:setLockedBy(getLockedBy());
end
end
end
Hmm... Would it be viable to make a mod that adds like thermoses for soup and stew? I think that would make a lot of sense, to have a way to carry soup or stew on you without it going cold or stale for longer.
I'm not too familiar with the code of PZ so I'm unsure of the viability of a container like that as an alternative to putting soup in bowls and such. Would probably be easier with the upcoming liquid system rework from what I know of it.
Did anyone else notice GetOnlinePlayers() is returning empty for non-admin players? Apparently this is happening since 41.78.12. Any suggestions on an alternative?
already exists tho
So, I'm rewriting the code for the generation of nuke explosion in PZ
I made a demo of it on code pen if someone wants to give a hand and review the code
Is there any monetary incentive to making mods? I want to join the mod scene but I would also need a donation incentive to trade my time. (Whether people dono/support or not)
Wut?
I see people doing commissions sometimes, but modding is largely thankless for the most part
gotcha
unless your mods get hugely popular, i wouldn't expect tips at all
commissions are another story though
u do modding for fun
i mean, how many times have you donated to a modder? probably never right? that's why
I've been making mods for games for 20 years now and never made a dime, haha. Not that I've ever asked for money or tried to take commissions
Really? And your sure it's a van? Because I searched earlier, all I found were the Bus, RV, and Unimog interiors. I'm specially looking for a van.
You know, like Chris Farley.
"Living in a van down by the river."
oh nvm
How much do you need? What do you accept Visa or PayPal?
haha, I don't want money, I mod because I like games and like to add feature I like to them. As for commissions, thats too much stress.
Damn. Hoping I wouldn't have to. Like "oh! Did it just drop on steam while I was away from my computer."
But I guess I could try out the camper trailer in the mean time.
I'm just taking a Mick out of you
don't discourage him im always willing to dish out some dollars for a good mod ๐
my mods.....
It really depends
they require pay
How much?
i ask for some wild shit...
10 cent?
lol i have, but i was also joking. th ko-fi is from y streaming days
10 p?
well skizot made a good bit for his last thing from me haha...
i try to do like 20 dollars to 100. i think glytcher made a mining mod for me it was like 200 dollars. all depends on what all is needed. skizot albion and glytcher work together pretty well so like normally i try to give out money to each of them at the end of the week.
Hell no
sometimes people donate like on the server i break it up even between them and just send them money.
How about a kidney?
sometimes i see albion working on stuff for like hoursssss lmao. aint no way im giving her 10 cents LMAO
Well it really depends
My mods dont really fit like in normal pz and are specific to my server so i make sure i pay. otherwise people make those mods cause it fits in the game.
that's probably the main difference.
What's your mods about?
we have a no zombie rp server. its kinda like gta5 rp.
No zombie RP
so we needed mining and a refining process to get resources and sell them to make money.
Basically life RP?
yeah
Doesn't need mining
why not lol
I think the professions you have is fun to be honest
Doing your Job as a Cop sounds fun
yeah we have a cop database mod, and licensing. all stuff created by RJ another guy on our server.
I see
so cops can issue tickets and what not.
albion is making a bad ass mod so cops can arrest people.
Sounds cool
skizot made a animation for cuffing and stuff.
That actually sounds legit cool
we got tons of custom stuff.
an atm on the server that actually counts money and stores it.
Wait isn't that you in the Knox County Police Car?
rn i think glytch is working on a industrial mod, where players drill for oil and create gas for the gas stations.
In the picture in showcase?
yeah i posted some pics in it.
I see
i posted those most recent pics. thats skizots hand cuffing.
Yeah I saw those pics he sended looks cool
I think it's something that look interesting
id love to donate if you made me some mods or helped work on the server, given you have experience with lua and what not.
Maybe I might join
we have almost hit 500 members on disc
yeah alot of my server is ui, or coding. albion normally does all the coding but glytch does alot as well.
albion does alot of the main super important stuff. cause shes pretty refined with it
looking at maybe doing power grids? like each house needs electricity ran to it, and plumbing.
maybe during storms power could be knocked out and stuff. and power companies would need to go fix it.
Im not familiar with what server you are talking about
My this is a lot
oh yeah i've got tons of random cool little things i have planned.
there's always work to be done, it's a huge project
I dont think i can swnd disc links here kentuckyroleplay
nah
but if you'd like to take a look around pm me
If u add u can go discord slash kentuckyroleplay
well i was actually looking at an idea i had, where players could play each other in pool and wager money? i know its hard in pz so likely i'd just want it to be simulated. so like you and your friend click on the table add our currency into it and who ever wins gets the money? we could open it up to other cool games like darts and what not. just a cool little idea i had if you're interested.
sent you it.
I gave you a dm William
That's gonna be a lot of work tho
Well you tell me what to do yeah you can guide me tomorrow
Maybe I bring my mates
couldn't you just have it open a pool game website or something for both players?
yeah but when one looses who says they are gonna pay them? muhahaha
Hey there beautiful people. How do y'all debug lua running on the server?
I'm just using diagnostic print statements ๐
Like, the regular print(x)?
Oh, @ancient grail is this the guy?
Yup
Where do they log to? I am not seeing them..
I'm in the server now but I'm admittedly a bit busy ATM and haven't finished verification

Windows or Linux server?
Windows, I have the debug text log open
When I host locally on Windows, the logs go to C:\Users\Rob\Zomboid\Logs
Yeah, same
I have that open, so if I am not seeing the logs clearly I have bigger problems.
yall i was playing with the meme jumpscares and i shit my pants at this one fucking guy just screaming
There are a few files, I think my output was going to the (timestamp)-DebugLog-server.txt file
Hmm i see, so when the game starts it pulls up a website to play pool or something? then it sends you back to the game and pays the winner. @warped valve may know how to do something like that
Caveat - I'm incredibly new to zomboid modding, so might be giving noob advice ๐
Okay.... this may be a really stupid question... does isServer() return false on SP?
coop-console.txt
or server-console.txt if it's dedicated
So, I am working on my mod. If isServer() always return false on SP, then I need to rethink some stuff haha. I need to test.
that's the idea.
i like it mkp is in the server now. i think hes doing the gambling stuff.
openUrl doesn't work, so unless you want to write an in-game web browser with html5 support i don't see how that'd work
albion shut us down
huh?
Yeah, both isServer() and isClient() return false in SP. So e.g. in my client files that I want to load in SP and only on the client in MP, I test if isServer() then return end at the top of the file
ty my friend
ye
Neat!
Hey guys, I'm currently working on a mod that involves EXP values and such. I was wondering if anyone could tell me where I might locate the file that sets vanilla exp values and such? My guess is vanilla sets "exp groups" that are effect by exp multipliers, I was originally going to set a flat exp gain amount but realised that it probably wouldn't be effected by any multipliers. Any idea where I can find the vanilla exp settings?
nothing u talked about would have told me ur talking about that sort of xp giving function that u show in the pic
but if u mean those
they are called "recipecode"
iirc the file is just recipecode.lua but im gonna double check that
Yeah, I'm referring to the GiveXP.DismantleRadio.. what is the file that its pulling the value from
those are functions
sec..
media/lua/server/recipecode.lua
:P
u can feed any function in there tho
all it does is programmatically give the xp
I can see the variable loot in there now, but not how it's deciding exp gain
Oh, I think I see it
Guesses, on how long it will take after animals comes out, for someone to make a rideable horse mod.
We have a horse track... we could have horse races ๐
For anyone with experience using Mod Options to add configurable key bindings: my key binding label in the Options menu isn't matching up with the key in the shared/Translate/EN/IG_UI_EN.txt file. The other keys in that file are working fine if I use e.g. getText with them, just not the auto-generated key from Mod Options.
Client code:
local keyData = {
key = Keyboard.KEY_X,
name = "RV_INTERIOR_ENTER", -- Maps to UI_optionscreen_binding_RV_INTERIOR_ENTER in Translate files
}
if ModOptions and ModOptions.getInstance then
ModOptions:AddKeyBinding("[Vehicle]", keyData);
end
shared/Translate/EN/IG_UI_EN.txt file:
IG_UI_EN = {
(stuff)
UI_optionscreen_binding_RV_INTERIOR_ENTER = "Enter or exit interior.",
}
console.log shows the mod loading, but then later on:
LOG : General , 1670131457625> ERROR: Missing translation "UI_optionscreen_binding_RV_INTERIOR_ENTER"
... and sure enough, the "Enter or exit interior" text is not showing up in the Options menu, just the key UI_optionscreen_binding_RV_INTERIOR_ENTER.
I'm at a loss to see why it's going wrong.
the prefix in the translation string needs to match the file
i.e. UI_... needs to be in UI_EN.txt
Ah, ok. Thanks - I'll give that a try! So we'll either need a second file, or need to rename the files and change all the other keys to start with UI_.
i can't wait to have some cops on horses that'll be sick on my server
truthfully, the second animals come out ill be commisioning a horse mod immediately so anyone whos gonna do it ill be paying them for it.
That worked - thanks for all your help 
are you sure the b42 horses aren't going to be ridable anyway?
Has to be purely cosmetic, not actually protect the horse...
maybe some fancy saddles would be fun
the world is safe only because even i think making the horses into my little pony characters would just look garish
im sure someone will do it either way tbh
probably... i've been very disappointed with the lack of pony mods though
this isn't how things used to be...
Could have sworn I saw a horse-drawn carriage mod on here a while back
Hey guys, is there a preferred/easy way to get all cells?
what exactly are you trying to do?
I wanted to get all the cells to access things within them, like potentially moving zombies across cells which I heard they don't do on their own? Under most circumstances outside of meta events. Not entirely sure how feasible that is though.
lol I will save this, the other day I was looking for it
i'm not sure how possible this is, cells aren't really very well exposed at all
and zombies definitely do move between cells
Do you guys think there would be a way to change the possible zoom levels with Lua? I was able to do by changing on float in the java, but thats not really convient to share.
many have tried...
never looked at it myself but i've seen more than one person convinced it's impossible
that really seems dumb, because its just in a list of constants
also is there a way to change the java without using bytecode? im not much of a programer
Not sure what you mean by that. Java is a language which compiles to bytecode, which is what the JVM (Java Virtual Machine) executes. Java bytecode is just a form of binary machine language which is designed to be executed by the JVM instead of a physical CPU.
So, any changes to what actually executes on the Java side of things requires you to change the actual bytecode in the .class files.
But as I understand it, the terms for Zomboid modding are more restrictive about what you can do to the .class files. I gather that mods available in the Steam workshop can only customise the lua scripting side of things.
it really just comes down to java mods not being easily distributed through the workshop atm. There seems to be a couple different java toolchain projects, but they don't get discussed much around here, maybe there is a bunch of it going on in a forum somewhere
Is it possible to place item in world and rotate as you want? Specifically I want to flip an item bottom up.
update: script models can be rotated.
I need a horse mod to go with my anime horse girls mod

I mean we already have the horsing around mod, famous for putting things in the "horse's back compartment".
Is there a name for this mod, for research
anyone know the precise tile width that yyour "hearing" circle is from ur character
is it like 1 tile away from ur character?
Is there a way to reload mod scripts without reloading the game
I have debug enabled
getScriptManager():Load()
for recipes: also do before :Reset()
for tags: RecipeManager:LoadedAfterLua() need to check this one???
I just need to be able to update my lua scripts without exiting client to save time
Theres a filter?
yep, select box and type
@pastel storm
https://pzwiki.net/wiki/Debug_mode#Reload_File_in-game
But what if we want to execute some function when the player creates a character not for the first time? This thing can be bypassed by simply going to the menu instead of pressing the respawn button in the game. What needs to be changed for this behavior?
Thank you right away, ye
Should I make a "chair" bucket tile?
๐ค
or make bucket a vehicle or smth, how do vehicles get flipped? Using setAngles?
How would I use the require function? I have a module I want to load.
to require lua client/ISUI/myLua.lua
require "ISUI/myLua"
Its my own files
I assume that it would be without client/
And it would just be the file name
Is there a way to multilog to test multiplayer things
for modules, you can use this
---main.lua
local myModule = require 'myModule';
print(myModule.test()) -- Prints "A test"
--myModule.lua
local myModule = {};
myModule.test = function()
return 'A test';
end
return myModule;
ok sweet
Hello im new here and i want to play with my friends on my DEDICATED SERVER.... so i dont know how i can setup my own BRITAS WEAPON MOD like changing the spawnrate can someone help me out because no one in youtube shows it... like i know that i have to setup my own mod but yeah i dont know what i should put in there... anyone have time for a call ?
probably ok for defacation mod
Is it possibel to add a carry capacity bonus to clothing items?
The other poop mod actually has a crap bucket. 
Bruh I can't find a file in the lua/server folder of my mod in pz lua debug
sounds useful as a fertilizer bucket
question: if i wanted to change the model of an item based on a sandbox setting, is that possible?
{
Type = Normal,
Weight = 0.05,
Icon = TCTape10,
DisplayName = Cassette 2Pac - I Get Around (1993),
WorldStaticModel = Tsarcraft.TCTape10,
}```
let's say i've got this entry--can i change WorldStaticModel based on a sandbox setting somehow?
Okay, looks like I can't just try to change clothing to wearable containers with capacity and clothing stats 
anything that's sandbox needs to be done late in load, so pick an event and use the DoParam on the Item script.
there's a few fanny pack mods around, maybe that can help you
The ones I have installed don't seem to be able to have clothing stats like bite protection or stat modifiers
Basically I want something like Fallout 76 power armor functionality with both protection and high carrying capacity
do you know if there is a way to alter sound scripts with sandbox settings as well?
{
category = True Music,
master = Ambient,
clip
{
file = media/yourMusic/TCBoombox/A Silver Mt. Zion - 13 Angels (2000).ogg,
distanceMax = 75,
}
}```
like this one
You'd need to replace the value with a Lua script, probably via DoParam
yeah i was curious if it would work the same way
However, replacing the assets while the game is loading in the save... Well, I dunno how well that will work
yup yup
Now... I remember there was some kind of a post or guidelines for translations somewhere?
Does anyone happen to have a link?
hm, i don't see it in the pins--not sure!
also, this is probably very basic but i'm not a coder and my googling hasn't turned up much: is there a way for me to run DoParam once for a list of items?
@tardy wren #translations message oh i found this
this might be what you're looking for?
Well, you need to loop over the list of items, to my knowledge
Also not what I'm after
darn
Any particular guide for with modding (adding) traits and using them within the script?
Could probably reverse-engineer a mod that already does that but would prefer a straight-up guide if one exists
Nvm, figured it out. Another question -- Is there a way to lock the player's character into a timed action? I.e. just start the timed action and forbid the player from cancelling/controlling his character until the timed action is done
I think the idea for these is that the player can cancel them at any time...
Because, you know, Zombies and whatnot
Yea, I however am trying to add to my mod a negative trait that locks the player into an action
so you know, its not something I am trying to do over all timed actions, just one of them
Best way might be a weird animation lock.
local item = ScriptManager.instance:getItem("Tsarcraft.Cassette2PacIGetAround(1993)")
if item then
item:DoParam("Weight = 1 * SandboxVars.MFTEOTWC_cassetteWeight")
end
ItemPickerJava.Parse()
end)```
would this work, do y'all think? any glaring errors?
and, if this tries to check for the item but the item doesn't exist, will it produce an error or simply move on?
How'd that work?
a. "Weight = " .. 1 * SandboxVars.MFTEOTWC_cassetteWeight
b.no need to call ItemPickerJava.Parse()
c. if ScriptManager.instance doesn't work use, use getScriptManager()
gotcha! thank you poltergeist :)
from lua I've seen
setPlayerMovementActive(player, false)
I'm no good with animation, but some of them lock you, I just thought It'd look better.
will it throw errors if it tries to check for an item that doesn't exist?
it shouldn't
Will give it a go, thanks!
so should it be uhhh
player seems to be number
item:DoParam("Weight = " .. 1 * SandboxVars.MFTEOTWC_cassetteWeight)
or
item:DoParam(Weight = "1 * SandboxVars.MFTEOTWC_cassetteWeight")
i was kinda confused by point a haha
Should be easy to do with
local player= self.character:getPlayerNum()```
samall question
that is correct or i missed something
table.insert(VehicleDistributions["TrunkStandard"].items, "Base.TIREFIX");
table.insert(VehicleDistributions["TrunkStandard"].items, 1);
im not getteing any error and dont see item to spawn (on snadobx option loot all MAX)
but self item can normal spawn
yet more questions from me:
if item then
item:DoParam("Weight = 1 * SandboxVars.MFTEOTWC_cassetteWeight")
end```
am i able to do getItem as a list like this, or does it have to be a single item?
function BreakIntoTears_TimedAction:start() -- Trigger when the action starts
local player = self.character:getPlayerNum()
setPlayerMovementActive(player, false)
self:setActionAnim("BuildLow")
--Some not so relevant code
end```
Doesn't seem to disable character controls
Looks correct to me. Did you put
require 'Vehicles/VehicleDistributions' at the top of your distributions file?
still wondering if anyone knows if this is how this works!
I am not really quite sure how it works but an easy (and lazy) way to do this is just
local item1 = ScriptManager.instance:getItem("Tsarcraft.CassetteYasuhaFlydayChinatown(1981)")
local item2 = ScriptManager.instance:getItem("Tsarcraft.CassetteTomokoAranSlowNights(1984)")
if item1 then
item1:DoParam("Weight = 1 * SandboxVars.MFTEOTWC_cassetteWeight")
end
if item2 then
item2:DoParam("Weight = 1 * SandboxVars.MFTEOTWC_cassetteWeight")
end```
Inefficient? yes. Probably best way to do it until you figure out the more efficient way or until someone with more experience than me has a better answer
inefficiency is a bit of a notable concern at the scale i'm working at
i'll have to do this for about 2000 items
ah. Definitely the worst way to do it then.
hehe, thank you though!
my pleasure!
ok, that might be only for joypad
IsoPlayer: setIgnoreMovement(boolean var1) setBlockMovement(boolean var) / setMoveSpeed(float var1)
you can go through all item scripts if you want
and have some table based on type or something
self.character:setBlockMovement(true)``` works! Thanks so much!
scriptmanager has this
public ArrayList<Item> getAllItems()
probably can set one check, if module == "Tsarcraft" then
you might even be able to gel all items from a module
local old_isPlayerDoingActionThatCanBeCancelled = isPlayerDoingActionThatCanBeCancelled
---@param playerObj IsoPlayer
function isPlayerDoingActionThatCanBeCancelled(playerObj)
if not playerObj then return false end
local queue = ISTimedActionQueue.getTimedActionQueue(playerObj)
if queue then
for _,action in ipairs(queue) do
if action.Type == 'ISPrisonerForceMove' then return false end
end
end
old_isPlayerDoingActionThatCanBeCancelled(playerObj)
end
in your specific use case you might only want to check queue[1], but this is the general idea
Thanks for the time! However, how different is that from just using self.character:setBlockMovement(true)?
it's probably a tiny bit more compatible with other mods i guess
are you sure that blocks them from cancelling the action with escape?
the mod i wrote this for actually uses setBlockMovement as well, but i wrote this before i put that in, so i'll be pretty annoyed if that works LOL
HMM gonna have to give it a go
nope, doesn't work with escape. You can pretty much cancel it using escape
well my one does get around that
so i guess you need both after all
oh i just remembered, with my one you can cancel the action by attacking, as my mod stops you from attacking anyway i didn't look into whether that would be easy to fix
i could probably get around that somehow
i'll let you know if I can figure out a way to totally disable all controls that may cancel the action
actually blockmovement does disable attacking if I remember correctly
i think with a mix of both blockmovement and your code, it'd work
it does, block movement just bans you from doing anything basically
but pressing escape is allowed
yup, which your code would fix
okay ye
a mix of
BreakIntoTears = BreakIntoTears or {}
local old_isPlayerDoingActionThatCanBeCancelled = isPlayerDoingActionThatCanBeCancelled
function isPlayerDoingActionThatCanBeCancelled(playerObj)
if not playerObj then return false end
local queue = ISTimedActionQueue.getTimedActionQueue(playerObj)
if queue[1] then
for _,action in ipairs(queue) do
if action.Type == 'BreakIntoTears' then return false end
end
end
old_isPlayerDoingActionThatCanBeCancelled(playerObj)
end```
and
```lua
function BreakIntoTears_TimedAction:start() -- Trigger when the action starts
self.character:setBlockMovement(true)
--more irrelevant code
end
function BreakIntoTears_TimedAction:perform() -- Trigger when the action is complete
self.character:setBlockMovement(false)
--even more irrelevant code
end```
that did that trick
Thanks!
.. i think. I may have screwed sth up haha
i have a final question before i think i'd be ready to implement my thing (once i have my internet back anyway...)
{
category = True Music,
master = Ambient,
clip
{
file = media/yourMusic/TCBoombox/2Pac - I Get Around (1993).ogg,
distanceMax = 75,
}
}```
asked before but no one knew:
is there a way to alter a sound file like this using DoParam or something similar?
i don't see a getGameSound(), but i do see a getAllGameSounds() - you could loop through that array and modify matching sounds
there's getSound
i couldn't see how to access the object it belonged to, unless it's a static
that gives a GameSound, not a GameSoundScript, the difference being... who knows
omg.. of course
okay actually, GameSounds only have a setUserVolume(), otherwise everything they have is just a bunch of getters, so i don't know if it'd work for you even if we can get to them
curses... being able to modify that distanceMax via sandbox settings eludes me
i think we can do it with getAllGameSounds, as that gives us a script
actually, i don't see any way to actually identify which sound is which from that array...
what a pain
drat!!
we can get their module, that'd work if there's no unwanted sounds in that module
hmm.. that'd be a gamble sadly
the module is Tsarcraft and that module also applies to all of tsar's other mods
ah yeah that's no good
you try to increase cassette audible distance and end up making boats louder on accident without even noticing
lmao
looks like we're messing with something we're not supposed to
alrigghtt so I may be understanding something wrong but apparently after some testing, calling old_isPlayerDoingActionThatCanBeCancelled(playerObj) will make it so that escape key can't be used to cancel any timed action, which is kind of confusing. It wouldn't matter what I write above it because at the end of the day, it ruins other timed actions?
local old_isPlayerDoingActionThatCanBeCancelled = isPlayerDoingActionThatCanBeCancelled
function isPlayerDoingActionThatCanBeCancelled(playerObj)
print("test")
old_isPlayerDoingActionThatCanBeCancelled(playerObj)
end```
When you start a timed action, and press escape, test will be printed, then the escape menu will appear instead of cancelling the timed action. (Unless this is the way its supposed to be?)
return old_isPlayerDoingActionThatCanBeCancelled(playerObj) ๐
that mod... may not be thoroughly tested
haha np
mb for not even noticing that considering I've fiddled around with such functions before ๐คฆโโ๏ธ
btw you don't want to loop through queue. What you should do is sth like
local currentAction = ISTimedActionQueue.getTimedActionQueue(playerObj)
if currentAction then
for _,action in ipairs(currentAction.queue) do
--rest of code```
? this is the exact same code with different variable names
oh! no it isn't
i'm going to choose not to question why my code is working when it doesn't make sense... i'm happier this way
oh probably because i last tested it when the return was fucked anyway
Haha I'm not sure why it didn't work either but I had to go into game files and apparently there was an extra .queue
yeah still nothing happen
I'm not sure then tbh
Just want to share something
To be fair I am not sure if this code is right, but it seems a good start
does anyone know if you can trigger a door/gate with a vehicle collision
i'm trying to make a mod that will open/close if a gate is driven through
looking for a mod, that will fully allow a player, to construct a house. including placing interior lighting and running light switches that work with the rooms light, anyone interested? we have more builds and stuff so you can already do alot of construction. but if you wanted to do a big mod where we revamb it and all all kinds of different crafting for walls. i've got a awesome team that works on mods on my server so they can always help as well. and also i was looking at making one power hub center and allowing power lines to be ran to each house. its a weird server and hard to describe but if you're interested let me know will for sure pay good for a working mod with that stuff.
i think glytcher has a mod already that kinda messes with the power and allows you to craft power lines and stuff or fix them, i can ask him if we could build off of it.
or maybe glytcher wants to build the power mod himself idk hes working on my gas stuff right now i think.
anyway to hide the magnifier?
wat
Anyone willing to share proper way to add customUI class?
Not sure if I've been doing it right but something like this I think
--Then override the methods you want
function MyPanel:render()
--Your code here
end```
@lusty marsh maybe I wrongly stated my question, I meant proper way to register it within the game, just with events?
Key pressed for example - render?
This one will do https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md
@fast galleon @lusty marsh thanks a lot
Does anyone have any tips for adding controller support to a UI mod? I'm working on adding support but I have no idea how it works
@thick karma is probably the regular poster with the most controller experience at this point
Derive a new class from ISPanelJoypad. Look at other classes that derive ISPanelJoypad to see exactly which functions you need to overwrite.
If your UI element is an ISPanelJoypad it'll be prepared to take user input
You can also decorate onPressButtonNoFocus (or whatever it's called), just be sure to store the original function so you can pass signals to the original function when your UI is inactive
And be sure to include all the vanilla checks that come before that function does stuff with its input, because otherwise you might cause bugs, especially alongside other mods.
This is more of a lua question, but I'm currently trying to add the contents of an Array to another array.
For example, I have the array local bodylist.
Now, I want to add the contents of the array local bodies one by one to the array. Is there a shortcut command like in Java collections.add() or do I have to program an foreach?
In Lua, you can use the table.insert() function to add an element to the end of an array. This function takes the array as its first argument, followed by the value you want to insert.
Here is an example of how you can use this function to add the contents of one array to another:
local bodies = {"head", "chest", "legs", "feet"}
for _, body in ipairs(bodies) do
table.insert(bodylist, body)
end
In this code, the table.insert() function is used in a for loop to iterate over the elements in the bodies array. For each element, it is added to the end of the bodylist array using the table.insert() function.
Alternatively, you could use the table.move() function to move the elements from one array to another. This function takes the source array as its first argument, the index of the first element to move as its second argument, the destination array as its third argument, and the index of the first element in the destination array as its fourth argument.
Here is an example of how you could use this function to move the contents of the bodies array to the bodylist array:
local bodies = {"head", "chest", "legs", "feet"}
table.move(bodies, 1, bodylist, #bodylist + 1)
In this code, the table.move() function is used to move the elements in the bodies array starting from the first element (index 1) to the end of the bodylist array. The destination array is specified as the third argument, and the index of the first element in the destination array is specified as the fourth argument. The # operator is used to get the length of the bodylist array, and the result is incremented by 1 to specify the index of the first element in the destination array.
This is a very detailed response. Thank you very much. I will read into table.move to understand it more and to properly use it.
I don't believe table.move exists in PZ
U sure?
PZ is based on lua 5.1, I think table.move was added in 5.3
As per @astral dune comment, I think I've made an oopsie. However the for loop example I added works, because the Insert is present on 5.1
just for confirmation
Yea, sorry. I was dealing with something else recently in Lua and just jumped in
@thick karma Okay thanks! Yeah it derives from ISPanel so not a big change, thanks!
Hey you beautiful peoples. Does anyone know if modData (which is a KahluaTable) sync between client and server automatically for InventoryItems? From my testing it doesn't seem so, but I am probably doing something wrong.
Alright! Thanks for the help you two!
i think they do? i'm pretty sure moddata on items isn't client-specific anyway
I only know about how I think inventories work, so I'm going to keep my musing to myself. I can say two things for sure though
- inventory items used on a vehicle as parts, like brakes, have to be manually synced if you mess with them on the client
- your personal inventory doesn't exist on the server
Oh dang, the personal inventory not existing might just f-up the entire thing I am trying to do... hmmm.
yeah, items are generally handled by the client
so server often doesn't know about them
obviously it needs to know what items are in containers and stuff but the client is where you want to do item stuff
Maybe I need to rethink how I am approach this then. basically, I have an item which can interact with the world. My thought process was the server should do the actual interactions, because if the client does it, then the latency between the "holder of the item" and the server + the latency of each user could be over 200+ milliseconds easy. If the server originated the events, then it theoretically would cut that delay in 1/2
Make your mod update the server once the item is picked up, to identify which player holds it, and use the player data to interact with the world
i'd have to know more specifically what you're trying to do, but it probably would be best to do anything like that on the client
Demo of it working on single player. On my multiplayer tests though, the delay would cause the timing of the light shows to be all over the place. To make sure it was a good test I am renting a server on the opposite side of the world to do my testing lol.
The implementation shown here works in MP, but the delays are a bit annoying
how are the lights synchronised? does zomboid do that for you or is it manually done?
Zomboid does it, I set the lights state on server
that's a shame... if it weren't done automatically you could just send the sequence to the clients and have them run it
Oh I can do that too
I did that for a minute, it could be a better way then the server is just passing messages
it won't strictly be synchronised between each player's screen, but the timing will look good for everyone
i don't think it being synchronised is actually that important from what i can see
It's wayyy more work tho
I have to worry about players connecting, moving into or out of the area, etc
yo anyone here happend to know where the meta/helicopter event files is ?
i found the 5 chopper.ogg files and also the zombie_meta.txt , replaced it with my owned files and it isnt working as i intended
Okay, one more question (let's be honest probably not but I can hope lol). Is there a globally universally unique id on InventoryItems? I see a "getKeyId" but even looking at the decompiled java I can't tell if that's going to be unique across all clients and the server
How do I run a code when a specific moodle reaches a certain level?
To clarify, I am trying to make it so that when a unhappiness reaches 80% or more, a certain code is run. What's the function to use for such event?
how do i add tooltip on context menu?
Or os it possible that thr name of the context option changes if its a varable?
You simply call another function
no
local tooltip = ISWorldObjectContextMenu.addToolTip()
tooltip:setName('title here, usually just the same as the name of the option')
tooltip.description = 'the actual tooltip'
option.toolTip = tooltip
Able to clarify? Not sure what you mean there
I am trying to find the event handler that checks for certain conditions I can define every second, or as long as the game is running, or however its done in PZ, or better yet, when a specific moodle reaches a certain level
onPlayerUpdate?
local cryOption = context:addOption("Cry", worldobjects, BreakIntoTears.OnCry, player, currentUnhappyness, currentStress, canCry);
local tooltip = ISToolTip:new();
tooltip:initialise();
tooltip:setVisible(false);
description = " <RED>" .. "You have already cried today. Try again tomorrow.";
tooltip.description = description
cryOption.toolTip = tooltip
This is how I did it for my mod. Is initialise even needed? Thought it was important for the tooltip but seeing as you didn't include it, I am not sure now what it does lol
Is this what u ment?
i've never used initialise for a tooltip, and i originally grabbed my code from vanilla
probably, will look into it, thanks!
so vanilla doesn't use it either ๐คท
hmmm not sure where I got it from lool
Hmm maybe initialize is used for heavy to load computations so before you right click its been processed...
And woops i spelled that correctly tho the syntax is spelled with s
๐ญ
zomboid uses uk spelling/terms in a lot of places
and some just bad spelling. brekingObjects comes to mind
oh yeah there's a fair few straight up typos
blegh, I've somehow managed to break intellij, it just completely hangs after loading my project. wtf
I suspect as much, trying to disable it now
ya, things work fine with it off, completely break with it on. All I did was move a couple functions from one file to another, but I can only guess that broke something
question: is there an easy way to make items renamable like backpacks are? in the item script or otherwise?
Mx's Quality of Life Pack has his mod "Rename Everything", if you're just looking to have that feature. If you want to implement it yourself for something you're making, you'll find the answers in there too
hmm, ok
i do indeed want to implement it for something myself
i had the cute idea of introducing an optional mode to my true music mod that makes all music you find unlabelled
so you would bring it home, sort through it, play it to confirm what it is, and then rename it
Pre Woodland M151 MUTT Livery test
Okay so I have a question
I want to make a mod that just changes the numbers of the weapons from another mod.
I've already made a duplicate version of the .txt file that I want to replace with the numbers and stuff edited, but how do I make it so that the game uses the file from my mod instead of the file from the original mod?
i've just found that you can add self.action:setBlockMovementEtc(true) to your action's start() function and it'll block everything setBlockMovement does, but as they're separate in java you won't potentially interfere with mods that play with setBlockMovement
Oh shit I did it
Is there a way to get a in item to spawn in a container only if another item spawns there? E.g., a 9mm pistol magazine or bullets only spawning in said container if a Pistol spawns.
I figure you'd need complicated lua for it, but I was hoping someone had or knew of an example I could look at.
no previous example, but i think you could just try something like
local function onFillContainer(room, type, container)
if container:getFirstType('Base.Pistol') then
container:AddItem('Base.9mmClip')
end
end
Events.OnFillContainer.Add(onFillContainer)
of course if you only want it to have a chance to spawn, you need to add randomisation in there, and if you only want it in certain rooms or containers you need to fork it based on those
@bronze yokeHey there! I am working on a mod that made military loot in military vehicles more immersive. Am I correct to assume though that if I were to plug that into my mod, a magazine would spawn anywhere a pistol does, regardless of container?
that's correct
Ah.
i actually don't think OnFillContainer even fires for vehicle containers, so i don't think this is what you're looking for
๐ฆ
editing vehicle loot with lua is really annoying...
@bronze yoke I have learned that recently, yes. ๐
Maybe it'll help if I explain a bit? I'm trying to define some proper military-themed loot tables of some of the military vehicle mods I have. Just about all of KI5's mil stuff uses the same basic vehicle loot. I was trying to figure out how to remove some of the randomness of the game's RNG in favor of something more realistic, if that makes sense? E.g., a Rifle or a pistol could spawn with compatible magazines and ammunition.
I thought Brita did something like that, but I was wrong. Hence my question here.
i've been too busy to do it yet, but i'm supposed to do some vehicle loot trickery for str, and my plan was to use something like this:
local function onRefreshInventoryWindowContainers(inventoryPage)
if not inventoryPage.inventory then return end
local vehiclePart = inventoryPage.inventory:getParent()
if not instanceof(vehiclePart, "VehiclePart") or vehiclePart:getModData().lootEdited then return end
-- code to actually modify items here
vehiclePart:getModData().lootEdited = true
end
Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers)
this basically checks every time we open an inventory page if that inventory page belongs to a vehicle, and if it hasn't been modified yet
since iirc vehicle loot doesn't get filled until you actually look at it? otherwise we could just hook the part being created
I didn't know that about the vehicle loot. I presumed it was created when the vehicle itself was, not upon interaction.
honestly needs checking, if it is created when the vehicle is it doesn't need to be nearly this complex
i don't really remember where i heard that
Rifle or a pistol could spawn with compatible magazines and ammunition.
I thought Brita did something like that, but I was wrong. Hence my question here.```
not sure about britas. orgm did, not with vehicles though
ORGM, now that's a name I haven't heard in a long time.
It not working with vehicles would make sense - it predates B39 ๐
last update was 2019 for build 40.43 lol
but used OnFillContainer as suggested above, didnt parse previously spawned items though since all the loot handling was done with the event instead of using distribution tables
Would the above bit of code work with distro tables? E.g.:
if not inventoryPage.inventory then return end
local vehiclePart = inventoryPage.inventory:getParent()
if not instanceof(vehiclePart, "VehiclePart") or vehiclePart:getModData().lootEdited then return end
if getActivatedMods():contains("Brita") then
table.insert(VehicleDistributions["MilitaryGearTrunk"].items, "Base.M9");
table.insert(VehicleDistributions["MilitaryGearTrunk"].items, 3);
end
vehiclePart:getModData().lootEdited = true
end```
Or am I getting it wrong?
no, you need to manually spawn the items and stuff
so basically, you need to write your own item spawning system ๐
Neat!
I don't know how to do that yet though. 
I barely understand if and then logic.
I'm learning though, slowly.
the simplest thing you could do with this would be something like this:
local function onRefreshInventoryWindowContainers(inventoryPage)
if not inventoryPage.inventory then return end
local vehiclePart = inventoryPage.inventory:getParent()
if not instanceof(vehiclePart, "VehiclePart") or vehiclePart:getModData().lootEdited then return end
if container:getFirstType('Base.Pistol') then
if ZombRand(3) == 0 then -- 1 in 3 chance to spawn
local item = container:AddItem('Base.9mmClip')
container:addItemOnServer(item)
end
end
vehiclePart:getModData().lootEdited = true
end
Events.OnRefreshInventoryWindowContainers.Add(onRefreshInventoryWindowContainers)
```although if you want to redo all ammo/weapon spawning, it would much better to do this with tables and stuff
Does anyone know where I can find the texture for the moodles cause I want to make a custom texture for them
so you basically also need to write your own distributions tables ๐
@bronze yoke I've basically been doing that already, no worries. I'm scratch writing custom distro stuff for KI5's military vehicles. Not hard, just time consuming.
Plus some internal patches for mods... yeah. Brita's stuff is a particular headache there.
Am I correct in understanding that the 0 in ZombRand(3) == 0 corresponds to the clip being guaranteed to spawn? Or as close to guaranteed as the RNG would allow?
no, ZombRand(x) rolls x random values (between 0 and x-1), so ZombRand(3) == 0 means a 1 in 3 chance
All right, that makes more sense. I was probably thinking it was a boolean for some reason? ๐
One other question. "VehiclePart" corresponds to a given container id right? E.g., "TruckBed"?
it just checks that it is a vehicle part at all
All right.
if you want to check which container id it is, you can use vehiclePart:getId()
i.e. ```lua
if vehiclePart:getId() == 'TruckBed' then
Does anyone know where the game has the information where it defines how a tile/sprite can be destroyed?
E.g.: Where does the game defines which tiles can only be destroyed with a Sledgehammer?
oi
Who goes there with a meerkat image
Such a handsome meerkat indeed tho
@round stump
I am at a point where I need to use custom events. How do I register an event and fire it?
I believe those textures are inside UI.pack (and possibly UI2.pack?) under media/textures, along with vast numbers of other textures. There's no mechanism to override just selected textures though, you have to replace the entire pack file just to tweak one thing, making it conflict with anything else that also wants to override a texture.
Vehicle loot used to not call the OnFillContainer event, but should currently.
If people need to test loot spawning they can use this code, a variant of a debug feature I made for b42.
local insert = table.insert
local function LookAtLoot(roomName, containerType, itemContainer)
local items = itemContainer:getItems()
local list = {}
if items:size() > 0 then
for i=0,items:size()-1 do
insert(list, items:get(i):getFullType())
end
end
list = table.concat(list, ", ")
local square = nil
if itemContainer:getParent() and itemContainer:getParent():getSquare() then square = itemContainer:getParent():getSquare() end
if square then
if list ~= nil then
print("Loot spawned in container type " .. tostring(containerType) .. " in room type " .. tostring(roomName) .. " at x:" .. tostring(square:getX()) .. ", y:" .. tostring(square:getY()) .. ", z:" .. tostring(square:getZ()) .. ", and consists of:")
print(tostring(list) .. ".")
else
print("No loot spawned in container type " .. tostring(containerType) .. " in room type " .. tostring(roomName) .. " at x:" .. tostring(square:getX()) .. ", y:" .. tostring(square:getY()) .. ", z:" .. tostring(square:getZ()) .. ".")
end
else
if list ~= nil then
print("Loot spawned in container type " .. tostring(containerType) .. " in room type " .. tostring(roomName) .. ", and consists of:")
print(tostring(list) .. ".")
else
print("No loot spawned in container type " .. tostring(containerType) .. " in room type " .. tostring(roomName) .. ".")
end
end
end
Events.OnFillContainer.Add ( LookAtLoot )```
Yes, it is very spammy, but it's a brute force tool ๐คช
Sweet. And vehicle loot should be generated when the vehicle is generated in b41?
yeah, i'm unsure where i heard it wasn't, and i definitely haven't actually tested it myself, so it may still be
Sorry for the late reply, Ive been able to decompile the bytecode and edit it, but when i try to compile it back to a .class file I get a bunch of errors. i was using the javac command in the command prompt like i saw online. Is that actually the way to do it?
Ok, so I have no experience with hacking Zomboid's Java side, but from my previous (quite rusty) Java experience, it's pretty hard to go through that decompile-edit-recompile process. As you've noted, the decompiled Java usually has issues.
If you're just trying to edit some constants, you might do better with a binary editor, although finding the constant values you want to change in there would be non-trivial.
thanks! i think the main issue is importing the resources, but I guess I can keep doing stuff with the bytecode
I had already done this with just editing the byte code, because the zoom levels were just constants
folks seemed to think it was impossible earlier but i'm just gonna put out a feeler in case someone has some Arcane Knowledge:
does anyone know if there is a way to alter a sound script with sandbox options?
{
category = True Music,
master = Ambient,
clip
{
file = media/yourMusic/TCBoombox/2Pac - I Get Around (1993).ogg,
distanceMax = 75,
}```
like, is there some way to DoParam the distanceMax here? the problem we were having is in actually _getting_ the sound and modifying it, because it doesn't seem like there's a way to do that in lua
Have you had a poke around in the decompiled Java? There seems to be a class GameSounds which is exposed in Lua, which has a function getSound(string) which returns a GameSound object.
Or even GameSounds:getSoundsInCategory(string)
this is what i was told about that
Hmm, that's true... GameSoundClip seems to be a better match for the data you have above.
GameSoundClip has distanceMin and distanceMax fields, at least.
we couldn't find setters for anything we needed
A GameSound has a getRandomClip() method, so if there's only one clip associated with it the "random" clip would be the one...
we could use Load on the GameSoundScript, but the only function we could find to get those returned an array of all of them, and it doesn't have any getters at all so we can't actually identify them
Hmm, ok. It looks like GameSoundScript is used by GameSounds to load the scripts, but GameSounds does build up a HashMap soundByName that getSound uses to look the sound up by (via getOrCreateSound)
[me quietly nodding in the background while two people who know way more than i do about anything talk]
I have no idea, I'm just poking around in an area of the engine I've never looked at before, so take anything I say with several handfuls of salt ๐
So- anyone know if there is an event called when throwing an item? I imagine something has to trigger the noise/effect, just not sure if there is an accessible code for it
Hey guys, is there any way how to have two people as a mod creator in a workshop? Contributor cannot upload updates, which sucks.
at least something, thanks
Yeah I was about to say. Use git for version management
Can I somehow... affect the execution of Java code via Lua?
Any way I can see what parameters are available to functions called by events?
Anyone has an ideia regarding my question?
Tiles Tileset images These are the same tilesets released on February 16. For Windows TileZed + WorldEd 32-bit TileZed + WorldEd 64-bit The 32-bit version of WorldEd seems unable to load all the tilesets due to high memory usage, displaying ??? for some tiles. Linux TileZed + WorldEd 64-bit This ...
it's in the .tiles files
lua side checks get the sprite properties and check values
@hollow current sorry to ping you but i have a question.. so basicaly the tooltip worked with no problem whatsoever.. the thing is if need to have more tooptips on each context option do i really have to do the whole code block you gave or just a piece of it and which one?
thn xin advance
Hey lads.
What do two boolean arguments mean in the context of setScratched?
maybe
object:isDismantable()
canDestroy()
what do you mean
setScratched(boolean boolean1, boolean boolean2)
from BodyPart
What args do?
oooooh my gosh
I just got a heart attack because I forgot there were zombies in project zomboid

i've been working on a farming mod for so long I forgot this was a zombie game
if bodyPart:getScratchTime() > 0 then
bodyPart:setScratched(false, true)
bodyPart:setScratchTime(0)
else
bodyPart:setScratched(true, false);
end
thx
And same for setCut? Yeah?
๐คช
client\XpSystem\ISUI\ISHealthPanel.lua
if bodyPart:isCut() then
bodyPart:setCut(false)
bodyPart:setCutTime(0)
else
bodyPart:setCut(true)
end
but
setCut(boolean boolean1, boolean boolean2)
cut seem to have only one bool
chr:getBodyDamage():getBodyPart(BodyPartType.LowerLeg_R):setScratched(true, true);
chr:getBodyDamage():getBodyPart(BodyPartType.LowerLeg_R):setCut(true);
got all i need in DMs, thx
For future reference of anyone that needs it, variable one of setScratched determines if the wound bleeds, and variable two determines if it wasn't a zombie scratch.
I.E, true, false is a bleeding zombie scratch.
false, true is a non-bleeding, regular scratch.
So, maybe a silly question and I am pretty sure I already know its not possible... but.. is there a way to have two zomboid clients running to test multiple player support for my mod? Would I need two computers? Do I need to buy PZ twice on separate steam accounts?
Unsure since I just pray that my stuff works in multiplayer LOL
I'm sure someone knows though, just ask every once in a while throughout the day and I'm sure someone will have a more proper answer for ya.
I am pretty sure what I wrote will work, but I need to test some edge cases to make sure I don't crash out clients and stuff haha.
maybe can help you, is a guide with a section to create a non-steam MP development environment
https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774
Thank you!
anyone know why the extended stack mags are not working in guns they should be for britas weapons
like an extended 9mm mag isnt going into my glock or my extended 45 isnt going in my sig
Dang, this is awesome. Have 2 instances of PZ running and a server. NICE
anyone aware of a mod that makes light switches, lamps, and strangely enough, bushes much larger than they should be? Not necessarily an issue but I can't figure out what is causing it.
Press the bracket buttons to switch mag types []
When you're having trouble with Brita, make sure you check Arsenal and it usually has the answer
cool thanks
So both basically do the same thing under different names?
It's no problems!
You don't need the whole block. Initialise and Setvisible lines aren't even needed.
You'll need to define a tooltip for each context option. Add a description for each tooltip previously defined, and then assign each tooltip to each context option
You can also refer to albion's here. It's much more simpler to read and basically does what I said in my previous message, aside from the setName line. I'm not sure what it does exactly but I never seemed to really need it
So in summary the main block you'll need is something like
local tooltip = ISTooltip:new()
tooltip.description = 'the actual tooltip'
option.toolTip = tooltip
Rest are additional optional stuff
Yep i did . I kinda try 1 version the. Next then mix it up and stuff
Anyways
Can i have it done like 2 lines
local tooltip = isblahblah
option.tooltip.descrip =
Like skip one of the lines
it just adds a little header, vanilla usually did that in the places i was using it so i did for consistency
You can't assign the description of the option's tooltip if the option doesn't have an assigned tooltip in the first place afaik. I don't think it'd work
Aaa I seee, I should probably give it a go and see its effect considering I've been setting headers manually using the normal tooltip and line breaks, thanks for clarifying!
My pleasure:)
pretty much, but this seems to be how tis prefers you to do it
there's technically greater compatibility with other mods, but i'm not sure there'll be many mods that ban you from moving but still let you do timed actions, lol
Don't think I ever came across one at all lol, but imma use it anyways. Thanks for the heads-up!
How does joypad focus work? I've been trying to understand it by reading the game's code but I'm at a loss there's just too much going on to see how it works. I have an ISPanelJoypad that I'd like to take control of the joypad when it's moved on to then pass focus back to the parent when moving out again
@thick karma must know
setJoypadFocus(player, o)
sets focus on o table
setPrevFocusForPlayer(self.player)
sets previous focus
sorry I should have clarified, it's in the main menu if that makes a difference?
this should still work
is it in-game or out?
out, it's in the character customisation screen when starting a new run
I haven't tested that, wonder how controller would work without player.
the player in examples is a number, so you can try with 0
I am not sure how the game tracks joypad focus before you actually join a game... But in general the game knows what the joypad is focused on by checking joypadData.focus, and joypadData is obtained in different ways in different contexts (you'll see if you search for joypadData in the vanilla Luas). I suspect game creates a joypad player for the main menu when you first press A after launch or Lua reload, in which case Poltergeist's suggested functions would work fine.
The focus is generally a panel or nothing at all. When you are in the game playing normally in the world, your focus is nil. When you open inventory, the game sets a player's joypadData.focus equal to the inventory pane itself.
I believe you could catch NoFocus events in the Main Menu by decorating onPressButtonNoFocus. If you do that, you can pretty flexibly define the behaviors you want to see.
Is it possible for mods to interact with the voice chat system? Like apply filters and add mechanics and stuff? ๐
i really have my doubts about the possibility of it, but if someone adds voice modulation for gas masks you are my hero
how does UseDelta work? I have a recipe that uses 10 units of the Propane Torch and the wiki says it has 100 total, so i expected to use 10% of the torch. but it uses the whole thing up. is the wiki just wrong because the UseDelta for the torch is 0.1
you'll be the first to know if I figure it out ๐
the propane torch was changed to 10 very recently, someone needs to update the wiki
alright then just updated it thanks
is it possible to place a tile at a certain location via lua?
yep
Are there any cannibal mods out?
any chance you have an example @ruby urchin?
Can I somehow block the player from getting xp for a hit? OnWeaponHitXp
in other games I would simply return false in the event, but sadly ain't that easy here
Right now I'm a little busy, but I remember working with them, later I can send one
that would be great.
๐
just wanna spawn some signs and maybe set some variables on them ๐
#mod_development message
from pzwiki
ooh lol. i'mma need that in a function form. XD
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
anyone know why this code isn't working? everything about it works... except for the last bit, the blindMode bit
it just doesn't work, it doesn't change the display names of the items at all, but everything else works
it doesn't produce errors either, just silently doesn't work
I need a vote for this please help
On Which is better
God I suck at deciding
Alright
I make that one
If I can't decide I will add them both
i like the black one more, heh, something more pleasing about it to my eyes
Okay That's good
pweeease someone save me from my foolishness, this is essentially the last roadblock and i'm stuck at it >_>
We see
Doing that right now
nice
try printing the sandboxvar!
yeah that one looks nice
local blindMode = SandboxVars.MFTEOTWC.blindMode
for i=1,#itemList do
local item = ScriptManager.instance:getItem(itemList[i])
if item then
item:DoParam("Weight = " .. 1 * SandboxVars.MFTEOTWC.cassetteWeight)
if blindmode then item:DoParam("DisplayName = Unlabelled Cassette") end
end
end
that might be better, this can be further improved obviously...
ooh i'll give that a try, thank you
also, is there a way for me to use DoParam on a model script?
{
mesh = WorldItems/TCCover,
texture = WorldItems/TCVinylrecord5,
scale = 0.0012,
}```
like, say, if i wanted to change the mesh here
yeah, they use Load which has slightly different syntax but it's the same
local model = getScriptManager():getModelScript('Tsarcraft.TCVinylrecord5')
if model then
model:Load('{mesh = WorldItems/DifferentModel,}')
end
off the top of my head
thanks!!
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it seems that.. neither of the things i did in this update worked ;w;
blind mode still doesn't change the display names of the items, and also the attempt i made to change the meshes doesn't seem to have any effect either
absolutely vexing
@rancid tendon
how are you testing the change, do you spawn a new item

