#mod_development
1 messages Β· Page 515 of 1
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.
think this will work ?
if so where can i put it
maybe just a folder within the client folder and put the lua file there
I don't get what is command and Commands.
- Is Commands[command] just a string or a function?
- If so, do I need to init some command function?
- But what is that function and what is it use for ?
- Don't I need to you
sendServerCommand? Maybe it's whatCommands[command]do
I'm so freaking lost
someone pls help
I think you are trying to recover objects that are not objects, walls are not objects in the game, I think, for example
oh thank you :-)
i know now
Commands is an hashmap of fonction using strings as keys
command is a string
The line :
Commands[command](players, args)
Is invoking the function stored in Commands at key "command" with players and args as arguments
I have limited knownledge in LUA but it should work something like this :
function fooBar()
print("Hello world")
end
local Commands = {}
Commands["fooBar"] = fooBar
-- Prints Hello World
Commands["fooBar"]()
ive been looking for a mod that makes crates have more space any 1 know a good 1
I mean, I'm looking for the items the player can carry in its inventory (weapons, food, etc). How are they located in the game? I guess they are inside ItemContainers, but how do I get the reference to all of those containers in a building?
Is there a way to make players to spawn with random loot on my server? For example, I want to add m4, double barrel and magnum to the spawn list, but when the player spawn, he get random one from those three
- as Delran said (sort of)
Commandsis a table,commandis a string key in that table that returns a function. using the same example above:
Commands["MyCommand"] = function(player, arg)
-- do something
end
- I have no idea what you mean
- The function is used for whatever you want. its how you can get a client to call a function on a server and vice versa. what you use it for will vary
- likewise
sendServerCommandis called wherever you want. If your trying to have a client request info from the server (a ping/pong scenario), then yes you would put it in the function to send data back to the client
Ok, I think I get it thx. Thx @broken kayak too
Also not familiar with LUA's terminology =X
And incidentally, I suck at explaining anything.
ah well mostly correct, just no hashmaps (lua only has tables which serve as multiple object types), and missed the local keyword on the function declaration (making it a global function placed in a local table)
so not too far off XD
And I wanted to say hash table but ended up with hash map π€
tables are a weird sorta container if your coming from other languages. its a hashmap/unsorted array...its a sorted array...and its a object (not really, but can simulate one for OO programming)
I've done most languages, from extremely rigid collection in C++ to maps that are implicitly convertible to arrays in Python so, nothing is weird for me anymore.
idk, tables really are something else. to quote what i wrote up about them in the modding guide:
There are no objects, sorted/ordered lists or unsorted/unordered lists. These are all the same thing in Lua: a table.
Tables can operate as a sorted or unsorted list, or a in a object-like structure with inheritance (metatables). They can also operate as all 3, at the same time.
When used as a sorted list, table indexes start at 1, not 0
Both , and ; are acceptable separators for entries in a table.
Using MyTable.myFunction() calls a function in a table normally, while using MyTable:myFunction() calls it as a object method. It is the same as MyTable.myFunction(MyTable)
A example of how strange (and versatile) tables can be:
-- mixed table
local MyTable = {"a", "b"; "c", nil, d = 5; [6] = 'e', f = function(self) print(self.d) end, "The End" }
-- as a sorted list
print(MyTable[1]) -- prints "a"
print(MyTable[2]) -- prints "b"
print(MyTable[3]) -- prints "c"
print(MyTable[4]) -- nil
print(MyTable[5]) -- prints "The End"
print(MyTable[6]) -- prints "e"
print(#MyTable) -- prints 3. Stops at first nil
for i, v in ipairs(MyTable) do
print(i, v) -- prints "1 a", "2 b" and "3 c". Stops at first nil
end
-- as a unsorted list
print(MyTable.d) -- prints 5
print(MyTable['d']) -- prints 5
-- with functions
MyTable:f() -- prints 5
MyTable.f() -- errors, no 'self' argument passed
MyTable.f(MyTable) -- prints 5
MyTable.f({d = 7}) -- prints 7
MyTable['f']() -- errors, no 'self' argument passed
MyTable['f'](MyTable) -- prints 5
Yeah
I was wrong
they're pretty messed up XD
mind you, you can do some neat things them.. though you probably shouldnt lol
heh ya
especially since i explicitly declared MyTable[6] earlier lol
Can make some insane obfuscation out of all that
No one will ever be able to update any of my mods
Starts to look like something usable
so if you were to make a item distribution mod, how would you make the zombies spawn with the items equipped?
How reliable is the debug mode lua reload thing? It worked a few times but at some point it just stops updating the file and i gotta restart the game again. is that how i should be doing it anyway or am i missing something with debug mode?
Are you referring to reloading a single Lua file, or reloading everything?
@kind surge i mean this button here, i'd expect it to refresh the single chosen file with new changes. if there is a way to reload everything without restarting the game that'd be useful too
I've had issues using that button when the Lua code has certain programming techniques within it. I believe the issue is that that button only interprets the current contents of the file once again and does not purge anything from the result of that file being interpreted the first (or any subsequent) time. So it should work fine if that file is only doing things that would be completely overwritten by interpreting it again, but there are several techniques that are necessary when modding in PZ that violate that constraint. So I always quit back out to the main menu and reload the save when I am testing something like that.
My understanding is that there is a way to force a full Lua reload, but I don't recommend using it when testing in debug mode. One of the issues is that Events like OnGameStart would not trigger after being reloaded and some mods would be in very odd states. So again, it's safer to quit to main menu and reload the save.
I see, thanks. Looking back at that screenshot I actually saw that there is another reload button at the bottom of the upper right frame and that one seems more consistent but I'll keep in mind that it's not foolproof. It's pretty useful if you're just doing small changes to an interface that you can reload ingame.
Are there shortcuts for the line-by-line debugging, like for step over or step in? I only know of f11 which seems like regular Continue
F5 and F6
Those aren't house keys, they're lootbox keys π
Wait what? That a mod?
Oh I see from your earlier screenshots, that's awesome!
Would you find the key in the same house?
Or building
Unreleased wip, but the idea is that when it's complete that there will be assorted cases and keys that spawn in the world with the loot.
And every case will have a matching key, and vice versa, but there's no guarantee that they will spawn in the same building? It could be two people at opposite ends of the world. In fact, that's how I'm trying to have it work, so people are encouraged to communicate and cooperate in order to get the loot cases open?
I have always thought it would be awesome if the bank in rosewood had a room full of safety deposit boxes, and you had to find the keys all over the map in different towns or hidden locations and you got really cool loot from them if you went back to rosewood and opened the correct box.
Which also kind of ties into my idea of hidden rooms and houses, maybe there is a room that doesn't quite reach the end of the house and you might be able to notice from the outside. It doesn't look quite right, and there is a doorway hidden behind a big dresser or something that that leads to the hidden room where you can find good loot and maybe a key to a safety deposit box. Honestly, the game could also borrow a lot of hidden loot ideas from 7 Days to die, that's probably one of my favorite parts of the game is all the neat ways to find hidden loot. Using a shovel to dig up hidden loot would be awesome Also if you followed a map.
@willow estuary The safety deposit boxes are pretty similar to what you did! I think it's an awesome addition
It would also be nice if you can find the keys for safety deposit boxes in other loot rooms, giving some real loot to locked rooms that normally have little such as the secure room in jewelry stores.
ooo tarkov mechanics where the key is consumed on use?
Maybe something like this should work
local inv = player:getInventory();
local itemList = { 'Base.Revolver_Long', 'Base.DoubleBarrelShotgun', 'Base.AssaultRifle' };
local spawnItem = myTable[ ZombRand( #itemList ) + 1 ];
inv:AddItem(spawnItem);
end
Events.OnCreatePlayer.Add(OnCreatePlayer)```
Don't know if this is the right event for a server
Does anyone knows how to create a new weapon type or a mod that created a new one? I already have the new items and animations, but I don't know how make the xml files work property
Anyone know why this happends to my custom profession?
hitman:addXPBoost(Perks.Aiming, 10)
hitman:addXPBoost(Perks.Reloading, 10)
hitman:addXPBoost(Perks.Fitness, 5)
hitman:addXPBoost(Perks.Axe, 10)
hitman:addXPBoost(Perks.Blunt, 10)
hitman:addXPBoost(Perks.LongBlade, 10)
hitman:addXPBoost(Perks.Spear, 10)
hitman:addXPBoost(Perks.SmallBlunt, 10)
hitman:addXPBoost(Perks.SmallBlade, 10)
hitman:addXPBoost(Perks.Maintenance, 10)
hitman:addXPBoost(Perks.Driving, 10)
hitman:addFreeTrait("TrainedAssassin");
UI_prof_Hitman = "Hitman",
UI_profdesc_hitman = "Extremely high combat skills. Starts with a silenced handgun, a knife and some extra magazines.",```
obviously the UI stuff is in UI_EN.txt
you bastard, they finally fixed rando key IDs π
Your arg is not at the right place, see an example of my mod:
surgeon = ProfessionFactory.addProfession(
'surgeon', -- Ingame name
getText("UI_prof_surgeon"), -- Display name
"profession_surgeon", -- Icon path
-6, -- Point cost
getText("UI_profdesc_surgeon") -- Description
Yes
cabdriver:addXPBoost(Perks.Driving, 10);
cabdriver:addXPBoost(Perks.Mechanics, 2);```
This is what I have for the Cab Driver, its exactly the same and yet it works
So maybe its because there is no Driving perks
Your surgeon example dosnt work, it broke everything lol
There is, I have put Driving Perks on all the other Profession and they work just fine
O ok mb, so there is the full code that add the profession in my mod:
local function AddProfession()
local surgeon = ProfessionFactory.addProfession(
'surgeon',
getText("UI_prof_surgeon"),
"profession_surgeon",
-6,
getText("UI_profdesc_surgeon")
);
surgeon:addXPBoost(Perks.Doctor, 4);
surgeon:addXPBoost(Perks.SmallBlade, 3);
surgeon:getFreeRecipes():add("Make metal hand");
surgeon:getFreeRecipes():add("Make metal hook");
surgeon:getFreeRecipes():add("Make wooden hook");
surgeon:getFreeRecipes():add("Combine real surgeon kit");
surgeon:getFreeRecipes():add("Combine surgeon kit");
surgeon:getFreeRecipes():add("Combine improvised surgeon kit");
local profList = ProfessionFactory.getProfessions()
for i=1,profList:size() do
local prof = profList:get(i-1)
BaseGameCharacterDetails.SetProfessionDescription(prof)
end
end
Events.OnGameBoot.Add(AddProfession);
It's go in shared!
same problem, used that code :/
'hitman',
getText("UI_prof_hitman"),
"profession_hitman",
-40,
getText("UI_profdesc_hitman")
);
hitman:addXPBoost(Perks.Aiming, 10);
hitman:addXPBoost(Perks.Reloading, 10);
hitman:addXPBoost(Perks.Fitness, 5);
hitman:addXPBoost(Perks.Axe, 10);
hitman:addXPBoost(Perks.Blunt, 10);
hitman:addXPBoost(Perks.LongBlade, 10);
hitman:addXPBoost(Perks.Spear, 10);
hitman:addXPBoost(Perks.SmallBlunt, 10);
hitman:addXPBoost(Perks.SmallBlade, 10);
hitman:addXPBoost(Perks.Maintenance, 10);
hitman:addXPBoost(Perks.Driving, 10);
hitman:addFreeTrait("TrainedAssassin");```
Game dosn't like Hitman, that must be it.

Okay, this is gonna seem a little crude, but I'm trying to work on a personal, local-only edit of the More Traits mod. How or where are trait exclusions handled usually? Is there a particular place for those to be defined, or are they usually somewhere in the core script/code for the trait?
Nevermind, I just found em. Defined in the NPC code, odd.
Is there a way to make spawnitems be already equipped when I respawn?
guys im a lua noob here ,im trying to make my first lua coding, i manage to learn from other mods some, i set this on my lua file for Medicine Effects; i made a anti-sickness pill (-sickness) and a stimulant pill (-fatigue), the first one is already working, but i dont know if my code is right for the fatigue part, it doesnt work π¦
function WizRemoveSickness(items, result, player) <------------- first part works
local sickness = 10;
MSPStats(player, sickness);
end
--stat stuff
function MSPStats(player, sickness)
player:getBodyDamage():setFoodSicknessLevel(player:getBodyDamage():getFoodSicknessLevel() - sickness);
end
function WizRemoveFatigue(items, result, player) <---- this how do i set fatigue?
local fatigue = 10;
MSPStatsB(player, fatigue);
end
--stat stuff
function MSPStatsB(player, fatigue)
player:getBodyDamage():setFatigueLevel(player:getBodyDamage():getFatigueLevel() - fatigue);
end
Whereβs marked room key
You got the animations to work? Share your secrets oh wise one! π I'm still struggling with it lol
Btw when i set like this i got no errors it just wont remove fatigue
I import a base animation from the game just for the model in fragmotion, then I animate it there and export it in .x
What are your export settings? seems as soon as I export even a base animation it refuses to play
Default settings, didn't change anything
It works perfectly for me when changing an existing AnimSet, but I can't figure out how to create my own animset for a custom gun type
Hmm gonna try this again XD
Sorry just to confirm.. when exporting to .x you're using Format: text, Rotation: quaternion, and no other options selected?
I don't know if it's just some nonsense I do, but I always rename the animation to the same name I'm going to use in the xml
Is there any documentation or anything on how to parse how the LUA is designed? Like, I just want to make another dropdown selection in the sandbox UI, but I can't find anything in the LUA that traces back to the dropdowns that already exist, like Hearing or Sight, and it feels like that for pretty much everything I try to not make from scratch.
This is a ISComboBox in media/lua/client/ISUI
function MyUI:create()
self.comboBox = ISComboBox:new(x, y, w, h, self);
self.comboBox:initialise();
self.comboBox:instantiate();
self:addChild(self.comboBox);
local keys = {"One", "Two", "Three"}
for key,value in pairs(keys) do
self.comboBox:addOption(key);
end
end
sandbox-options.txt
sandbox_en.txt goes in your lua/shared/translate/EN
i set the page to BuffysMods so it created a new page with the string listed by the same variable in the sandbox_en.txt i've never tried adding them to existing pages but i imagine you just... set the page name to the same as the basegame one, no?
best practice to make your own page section for your mod stuff though. end users aren't reliable to comb sandbox options to find your settings themselves, nor recognize a non-vanilla setting in a list of vanilla ones 
Yes, you can just use the name of the page in the basegame. Though, if you try to add UI elements to the ZombieLore page, since it has the weird proper zombies checkbox, it does some strange stuff.
i figured it worked that way xD
But I appreciate the help. Thanks a lot you two π
I misunderstood, I thought you were trying to make a combo box in a new UI xD
Oh, no. I was actually trying to make UI under the ZombieLore page, but I think I'll stick with having it on its own page for now so I can work on something other than UI lol
If anyone is available 5min for me to test my mod on my server that would be great. Just log in, I tp you, I do a medical check and it's good. I'm available for about 40min. Send me a mp
hey guys how do i make clothing like jackets open and close using right click menu
Example for the item Hat_BandanaMask:
ClothingItemExtra = Hat_Bandana;Hat_BandanaTied,
ClothingItemExtraOption = UntieBandana;TieBandana,
ClothingItemExtra is the new item and ClothingItemExtraOption the name of the menu
DUUUUDDDEE that was it xD thank you!!
well that and export groups I think, one of those things fixed it lol
darn lol why this code wont work? fatigue just dont change
function WizRemoveFatigue(items, result, player)
local Fatigue = 10;
WizStatsB(player, Fatigue);
end
--stat stuff
function WizStatsB(player, Fatigue)
player:getStats():setFatigue(self.character:getStats():getFatigue() - Fatigue);
end
it does not give errors
aaah man i cant believe it was just a type error lol
guys is there any place i can see these game stats and such?
how people can mod these, like they guess too like i did?
I'm also looking for these stats. I'll let you know if I find anything useful.
also like for example, how do i know what is fatigue value when the player is extremly tired and such
i will let u know too!
I think all player stats are on a scale from 0-100, but thats just my guess
local stats = player:getStats()
local fatigue = stats:getFatigue()
stats:setFatigue(NEW_VALUE_HERE)
I think fatigue is actually on a scale of 0 to 1, which might be why subtracting 10 doesnt work. try doing player:getStats():setFatigue(self.character:getStats(): getFatigue() - self.character:getStats():getFatigue()); and seeing if that removes the player's fatigue
Can anyone tell me why all the cities I downloaded worked in my regular hosted game, but are not showing up and are not in my map world for this dedicated server i started.......
This might be a dumb question, but do they state that they work for multiplayer?
I was correct in assuming fatigue is 0 to 1. Take a look at the ISStatsAndBody.lua file
player:getStats():setFatigue(math.max(0, modData.swfFatigue)) if you want to prevent values from dipping below 0
you also will likely want to use mod variable to change a player's stats
local player = getPlayer()
local modData = player:getModData()
modData.swfFatigue = player:getStats():getFatigue()
modData.swfEndurance = player:getStats():getEndurance()
This way the data is stored by a variable that can exist even after your function has ended, as otherwise values do not save
I am unsure how helpful any of this info is, but its the one thing I have spent some time messing with
also someone please correct me if I am wrong about anything ive said
Can anybody find the file(s) indicating how the sandbox options are applied to the game? Like, where's the code that handles changing the radius of zombies hearing when a player selects "Pinpoint" from the Sandbox Hearing combobox?
default if hosting on Windows is C:\Users\your_user_name\Zomboid\Server\servername_SandboxVars.lua
ohh thanks i will check that file!
what you mean it wont save?
When using local var = getStats() that var loses its value when the function ends
It does not hold if you were to call that var again after that function that called and created it ends.
I am not sure if you need to store stats beyond a single application, but that is how I do it for Sleep With Friends
Where can I find information on setting up IntelliJ?
can i test this by loading the savegame and checking ?
you mean it wont save like after you reload the game or just for servers?
I am unsure if it saves outside of an instance, nor if it is client or server dependent
I mean in your mod's .lua wher you have your functions. when your function runs it ends. any values you saved as just local var = will not save for when your mod's function run again
I'm not sure if this is the right section for this question but does anyone know of a simple mod that allows access to tools/meds from containers in a backpack without first equipping the item, for example if i want to sew something up from my sewing kit that's in my backpack it'll find it for me and then equip it.
any idea how long the "Air raid siren" event goes for in expanded helicopter mod? Hoping its just a single day
really ominous and scary lmfao
function test()
local player = getPlayer()
local fati = player:getStats:getFatigue()
end
function test2()
local player = getPlayer()
local player:getStats:setFatigue = fati
end
running function test2 would result in attempting to set the players Fatigue to nil as the variable fati does not save outside of the function it was created in, unless you set the variable to a players ModData, like so:
function test()
local player = getPlayer()
local modData = player:getModData()
modData.fati = player:getStats:getFatigue
end
function test2()
local player = getPlayer()
local modData = player:getModData()
local player:getStats:setFatigue = modData.fati
end
local fati -- declare local outside the functions
function test()
local player = getPlayer()
fati = player:getStats:getFatigue()
end
function test2()
local player = getPlayer()
player:getStats:setFatigue(fati) -- this line was way off
end
you know how embarrasing it is to be looking at my code then write what I did
function swfIG()
local player = getPlayer()
local modData = player:getModData()
if player:isAsleep() then
if modData.swfLoopCheck == 1 then
modData.swfFatigue = (modData.swfFatigue - modData.swfFatTwo)
modData.swfEndurance = (modData.swfEndurance + modData.swfEndur)
player:getStats():setFatigue(math.max(0, modData.swfFatigue))
player:getStats():setEndurance(math.min(1, modData.swfEndurance))
if player:getStats():getFatigue() <= 0 and SandboxVars.SleepWithFriends.AutoWake == 1 then
modData.swfLoopCheck = 0
player:forceAwake()
end
elseif modData.swfLoopCheck == 0 then
modData.swfFatigue = player:getStats():getFatigue()
modData.swfEndurance = player:getStats():getEndurance()
modData.swfFatOne = (SandboxVars.SleepWithFriends.SleepLength * 60)
modData.swfFatTwo = (1 / modData.swfFatOne)
modData.swfEndur = (modData.swfFatTwo * SandboxVars.SleepWithFriends.EndurMulti)
modData.swfLoopCheck = 1
end
else
modData.swfLoopCheck = 0
end
end
wait, I did waht I did because I am not directly applying saved values, but editting them before applying
no need to store in moddata unless you need persistence across restarts, just store in a variable defined outside the function scope
im very confused rn lol
well obviously its going to depend on the nature of the code too (and how its called) but its easier to pass variables between unrelated functions that way
I was attempting to teach how to store vars, as I was under the impression vars never saved without being included in data outside of the function, and I never thought to do what was just taught to me lmao
ope
well its working fine like this:
function WizRemoveFatigue(items, result, player)
local Fatigue = 10;
WizStatsB(player, Fatigue);
end
function WizStatsB(player, Fatigue)
player:getStats():setFatigue(player:getStats():getFatigue() - Fatigue);
end
i just need to change that local fatigue value
you saying if i load the game again my char will be tired again?
no
so i can keep it like that?
since someone told fatigue is 0-1 i prb need to set that to 1 i guess or o?
1 fatigue is completely fatigued
yes but its what i reduce
so its tired 1, i reduce -1
- Fatigue);
it is working with 10 thou for some reason lol
if all you are doing is setting fatigue to 0 you can use getPlayer()getStats():setFatigue(0)
just jump straight to setting the stat to 0
yeah i guess but like that i can edit the value as i want
of course
if you have a need for that, I was only saying if you are only setting Fatigue to 0 in one move
we both learned something so thank you
and thank you @quasi geode
yeah i guess it makes sense too, its a pill, but maybe setting to 0 would be kinda OP lol, the item gives 10 uses (10 pills ) π
hmmm
i was thinking if it accept values like 0.5
I am sure you will find a good balance
it will
in Sleep With Friends it edits the Fatigue by as low as -0.0042 an in game minute
hum
I use get and set stats with a formula to set how long it takes for a char to fully recover while sleeping, using values set by the host to complete the formula
so there are 4 states of Fatigue; Drowsy, Tired, Very Tired and Ridiculously Tired (this would be =1)
then 0 is not tired
yes correct
hum so maybe 0.25 would be kinda balanced; 3 pills to remove ridicul tired to 0
i mean 4
hi
i came here to ask if anyone knew if there is an option or mod to add a smoke effect when you smoke
sorry for my english xD
smoking have effects on smoker trait chars; removing negative moddlets
but if you want to add extra effects you can look the cannabis mod structure, im sure you will find something there
sorry maybe i expressed myself wrong, i mean a mod that adds like a visual cloud of smoke
i wonder why this stat, unhappiness, have 3 numbers there on ISStatAndBody
self:addSliderOption(body,"UnhappynessLevel", 0, 100, 1);
0,100,1
on fatigue is just 0,1
ahhh yeah that would be cool hehe
min, max and step (number to increment)
ie: 0,100,1 min 0, max 1 and increments of 1
fatigue is a float, min and max are 0 and 1, so the third arg is less useful (in this case, not needed at all)
but what about unhappines? if i want a 'happy' pill i need to use the 100 scale or the 1 scale?
i'd assume its a integer value from 0 to 100 since thats what the slider uses. cant say for sure though without looking
Yah, I would assume you just pass an integer from 1 to 100, rather than a float from 0 to 1.
Does anybody know why the names of my UI elements appear like this: Sandbox_AIZ_Speed_option3 instead of being displayed by the value I set in the Sandbox_EN.txt file?
as i link the wrong image several times 
It's probably an error in the Sandbox_EN.txt file, now that i think about it
@autumn torrent try this maybe: translation = AIZzombieConfig_AIZ_Speed and Sandbox_AIXzombieConfig_AIZ_Speed_option3
but maybe you'll have to get rid of the underscore in AIZ_Speed
i will give that a shot
I'm actually surprised to find that i think i have to name it translation = AIZ_InactiveSpeed and Sandbox_AIZ_InactiveSpeed I know you don't have to use the object name (or whatever you wanna call it) cuz Foraging Buff doesn't, and that's what I've been using as my guide.
The messed up part is that there's no highlighting or anything, so the error could be practically anywhere and idk what it is lol
yeah, it's super hard to check for server errors and mods
For some reason, I can't get the example MySandboxMod mod, which contains the syntax for setting up modded sandbox options, to even show in the mod list, which is strange.
I'm a dummy. My Translate folder is in the wrong directory. Yikes
so if its for like Food Poison sickness, witch is like that, i should set the value to like 25?
function WizRemoveSickness(items, result, player)
local sickness = 10; <------------------ i was testing this in-game and its like just take a little bit, the queaze effect comes back and you have to take like more 2-3 pills to remove it
WizStats(player, sickness);
end
--stat stuff
function WizStats(player, sickness)
player:getBodyDamage():setFoodSicknessLevel(player:getBodyDamage():getFoodSicknessLevel() - sickness);
end
because i think food poison is like it gives this damage to the body for a time, so when you take the pill and remove 10, the food poison comes again damaging X, i guess works like that right?
i mean foodsickness damage is over time, not on a single 'blow'
i can be wrong thou lol
Good day,
Anyone know why when I "place" my modded item in-game, I do not see the item by the mouse cursor like other items?
I can still click and the character puts it on the ground, and I can see it on the ground, but during the "place" function, I'm not seeing it.
Thoughts?
Thanks!
i think you prb are talking about Tiles, and your item is a 3d object?
When you get so carried away with the backstory of your custom scenario that you accidently write a 400 word essay that no one will ever read.
thanks for the thought. I think I may have figured it out. I didn't have the 3d object in the correct folder. I just can't seem to get it to use .fbx. I can use a .x, but that's not my model. When I try to use my model (.fbx) it doesn't show up.
Also,
do you know what the difference is between
StaticModel =
and
WorldStaticModel =
in the item description text file?
Much appreciated.
it does not show as .fbx because of scale
.fbx models are x100 times smaller than .x ones
u can just fix that scaling
staticmodel is the one that shows on your hand, worldstatic is the one that show when its on ground/world
like when you take a pill for example, the staticmodel is the pill bottle on your hands
Thank you so much. That helps immensely.
Do you know if there is an online resource (wiki for example) for explaining these descriptions rather than asking in a chat?
i wish man, i could use that too
anybody knows what is causing this error? happens when i hover the mouse over the clothing
just 2 specific pieces
this is the item that give these errors when i hover the mouse it on the inventory
item Wiz_BurterArmor
{
DisplayCategory = Clothing,
Type = Clothing,
DisplayName = Burter Armor,
ClothingItem = Wiz_BurterArmor,
BodyLocation = TorsoExtra,
Icon = Wiz_BurterArmor,
BloodLocation = ShirtNoSleeves,
ScratchDefense = 100,
BiteDefense = 100,
Weight = 2.0,
BulletDefense = 70,
Insulation = 0.5,
WindResistance = 1.0,
WaterResistance = 1.0,
WorldStaticModel = Wiz_BurterArmor_ground,
}
It seems you're trying to have the engine use an InventoryContainer where it is expecting a Clothing item
See the class cast exception at the end of the stack trace
Anyone knows why i can't extract a pack as a tileset ? only as separate images.
Also i can't make a pack that works ingame.
i'm trying to make a simple mod that adds movable posters. The recipe works, i can craft the item, then, when i try to place it on a wall, it doesn't work.
The only thing i have which is different from other similar working mods is the texture pack.
i'm using gimp for the image export, and most tutorials use photoshop, maybe the export format is wrong ?
Is there a mod where I can control where my second character will spawn if my first one dies? I don't want to spawn very far from my safe house if ever my character dies.
Which texture orientation should WorldObjectSprite point to ?
{
Weight = 0.2,
Type = Moveable,
WorldObjectSprite = my_flag_01_13,
DisplayName = MyFlag,
Icon = Flag,
}```
You should ask this kind of question in #mod_support . But you can configure the server to respawn inside your safehouse
How could I get all the squares that belong to a building? I achieved to get them from a single room with
getPlayer():getCurrentSquare():getRoom():getSquares()
but I don't know how to get all IsoRoom from an IsoBuilding. Tried to access the public property
getPlayer():getCurrentSquare():getBuilding().Rooms
but for some reason this always returns nil
Oh, I see. Thank you
I have a quick question, do I have to relog every time i edit my mod or is there a way to 'restart' it ?
On the main menu don' t choose any mod (or just mod manager), and then choose mod only when you make a new game. Like that when you go back to the main menu, the game reload vanilla lua and when you click continue, it's reload all lua mod of the save. And the second load of a save is like 10 time faster
and you don' t start the game
Afterwards, if you change the translations or the textures, it doesn't work. Have to restart the game
Will do thank you π
is there an api to toggle electricity/water in the whole world? i've been going through the vanilla files and cant seem to fine anything directly related nvm i found the setHaveElectricity function
cant find anything about water tho
is there a way to get all grids in a world?
If anyone knows how to set a new weapon property that can be checked under conditions so that I can change the animations please let me know, almost giving up Γ§_Γ§
Or a list of properties that can be verified in m_Conditions
Anyone know how you can turn into a ghost (Runnin through objects and very quickly)?
I managed to do it once but i forgot how
(Debug mode)
I am back here to ask for some help...
For some reasons that I don't understand when I turn on my mod that just add an item it break the crafting tab.
(Sorry for the french part) I didn't do much so I am kinda wondering what happened
hey, me and my friend are playing on a server with mods that we added, and everything's going fine, except for brita's weapon pack not working, any idea as to why this is happening?
Use #mod_support ...
@quasi geode Ok so I tried different thing and I end up with that but it's not working and I can't make it work. Do you have any idea why ? My player say just Asked player xx, with the good name. But that it. No error so I guess the SendServer function is nevercall.
Server:
---Server side
local Commands = {}
Commands["SendServer"] = function(player, arg)
arg["To"]:Say("To")
arg["From"]:Say("From")
sendServerCommand(arg["To"], "TOC", arg["command"], arg)
end
local onClientCommand = function(module, command, player, args)
if module == 'TOC' and Commands[command] then
args = args or {}
Commands[command](_, args)
end
end
Events.OnClientCommand.Add(onClientCommand)
Client:
local Commands = {}
function Ask(player)
local arg = {}
arg["From"] = getPlayer()
arg["To"] = player
arg["command"] = "SendOriginal"
sendClientCommand(moduleName, "SendServer", arg)
getPlayer():Say("Asked to " .. player:getUsername())
end
Commands["Get"] = function(arg)
TOC_PATIENT_ModData = arg["toSend"]
getPlayer():Say("Get")
end
Commands["SendOriginal"] = function(arg)
local o = {}
o["From"] = getPlayer()
o["To"] = arg["From"]
o["command"] = "Get"
o["toSend"] = getPlayer():getModData()
sendClientCommand(moduleName, "SendServer", o)
getPlayer():Say("Send org")
end
The problem may be that I send isoplayers. Is it better that I send the player index and get the player on the server side ?
yep. cant send IsoPlayer instances
Ok, can I get the iso player on the server ?
eh use the player index like you said, though theres no reason for sending this to the server: o["From"] = getPlayer()
the server already knows who its from local onClientCommand = function(module, command, player, args) << with the player argument there
which should be passed to the function in your Commands table... instead of calling it like this Commands[command](_, args) since your passing it _ which is nil. that should be player
yep, that the first test ^^ I just want it to work and after I optimize.
So I change arg["To"] = playerNum and it's work ?
Like sendServerCommand(player, module, command, arg), player is an ID ?
no player is the isoplayer instance of who its being sent to
you'll need to fetch the instance from the id number
like that : getSpecificPlayer(playerNum) ?
ya
Ok, a rly big thx that should work this that !
O and player:getPlayerIndex() is the online index ?
Is there a mod tutorial section in this discord I can refer to? Thank you. Sorry if posting in wrong channel
Look at pinned message but otherwise
https://github.com/FWolfe/Zomboid-Modding-Guide
https://github.com/MrBounty/PZ-Mod---Doc
yep, i like this community, very active and fine XD
hi! there is this strange behavior of the transparent stockings and tights vanilla clothing items. some of you have probably already noticed. they make the player model somewhat transparent so that you can seen parts of the environment which usually should be hidden by the player model. see the screenshot to see what i mean. my question is whether there is a "correct" way to make transparent clothing items which do not have this undesirable behavior of the vanilla tights and stockings. they should simply show parts of the player model but nothing else. one way to solve the problem is by "glueing" some parts of the player texture to the texture of the clothing item but i am wondering whether there might be a better way...
the white-ish area on the stockings are in fact part of the fence. can be seen better when you are in game and move.
I've never noticed any transparency on stockings, though I had this problem when I tried to make transparent clothing way back.
this occurs even in vanilla
Well clothing that have no 3D models directly replace the character's skin texture everywhere the alpha channel isn't zero, and I don't know if there is a way to counteract this.
Maybe you could make the mask partly transparent rather than the texture? I have not used masks for a long time so I may not be able to reliably say exactly what they do now.
in that case, it's probably not possible (except for some clunky workarounds)
i do not know how to make a custom mask. when a vanilla item uses a mask, it seems to choose it from a predefined list ranging from 1-15: https://ibb.co/Nrgt9Yq
but i have never actually used masks. so i do not really know anything about that. π
It is a png. Its file path is in the .something file like how its texture file path is. You could copy a mask folder or file (one of the two) as a template and make it a bit transparent to test?
will give it a try but i still do not know how to handle those predefined masks. just ignoring them or deleting them from the xml?
I have not modded PZ xml files for a while. Mask ID's hide body parts, which is good for clothing with its own model. The mask png thing, I don't know what to type.
yeah i saw that part; the strange is that the 2 itens that give this error dont have any inventorycontaniner attach on them
the reason is simple; stockings are not a mesh; its a texture over the avatar body, so the body gets trasnlucent, makes sense i guess, it does work on meshed parts thou
This is probably a silly question, but if I want to add some code to one of the functions in a lua file from the base game, I have to copy the whole file to my mod folder and then edit it, right? I can't append functionality to a function, or just overwrite a single function?
and + no items i did spawn on zombies, i really dont get this error
no simple answer to that question, but I would not recommend copying the whole file, also would probably not work as you expect, and could break the game if other mods do the same
which function do you want to replace?
Well, I really just want to add my own sandbox preset alongside my mod, but the sandbox presets are initialized in SandboxOptions.lua
this error im getting is so strange, because these itens are not inventory containers
I guess you could simply hook: SandboxOptionsScreen:loadPresets()
got your code on github or something?
lemme see what i can work out. thanks!
do you kow how to hook? π
depending on how many functions you want to override and how interdependent they are on other function from the .lua file, overwriting the whole .lua file could be a legitimate option imo. but there are different philosophies on that issue.
no idea what that means XD
very new to lua
well if your philosophy endorse breaking the game and / or creating incompatibilities with other mods, sure go with it π
hum not yet, you mean like my entire mod codding?
yes
i never post anything on Githug not a clue how to do it... π¦
@autumn torrent try something like this in your mod:
local SandboxOptionsScreen_loadPresets = SandboxOptionsScreen.loadPresets
SandboxOptionsScreen:loadPresets()
SandboxOptionsScreen_loadPresets(self)
-- add your custom preset here
end```
its so strange only happens when i hover the mouse over those items
if the devs make an update which makes a single change to the lua file from which you overwrite a single function, this may break your mod or your mod may break the game. if you overwrite the whole .lua file, the dev's update will have no effect but at the same time, the game will not break when your mod is enabled. onyl the update won't take effect. never thought about this i gues....
maybe i could .zip all my scripts and lua files?
I respect your opinion but I don't really agree with it
Is there an api to set whether the world/chunk/grid has an unlimited water supply?
what if two different mods need to overwrite the same file?
if you do a proper hook it should have no impact for example
as i said, it is a matter of how interdependent the function you'd like to overwrite is with the other functions. if it is only interdependent with functions from the same lua, overriting the whole lua might not be as bad as a lot of people tend to think....
I think you just don't realize how bad it is
then you should ask yourself this question: what is worse, your mod being incompatible with other mods or your mod breaking the whole game (and potentially all save games) when a vanilla game update occurs?
btw mods being incompatible with other mods is fairly standard and occurs quite often, even without overwriting stuff
well the answer to that question is obvious I think but has nothing to do with what was being said before?
and also sure people can write crap mods but that doesn't make my initial point to be invalid?
I'm going to intervene
haha good point, and i dont think most mods are incompatible with each other, most times people use packs with dozens of mods without problems
@small topaz while overwriting might ensure your code works with a new update, if the new update would have otherwise caused your code to stop working, then youll need to update it anyways as your mod file might be overwriting new functionality that could cause issues elsewhere or even omit new features of the update
way more chance to break a save by overwriting a full file than replacing a single function in that file
it has absolutely sth to do with it! your point was that overwriting a whole lua might cause issues with other mods. my point was that issues with other mods might be less of a problem than issues with vanilla updates.
as i said, it depends on how interdependent the stuff you'd like to overwrite is with other functions and other luas
@small topaz anyway I told you I respect your opinion, now let's just agree to disagree
yea π
this is to spidey lee and not to co π : yea you have to update anyway but in case you overwrite the whole lua, people might still be able to play the mod and their save with the non-updated game. in the other case where the update might break it, they have to wait until the modder has updated the mod.
hm. is there no way revert back to a previous version of the game?
Quick question, is it true that on MP there is a max distance at which user data is no longer updated on a client, specifically, every users X,Y Coordinates?
Also, is there a way to import the Zomboid libraries into intellij ultimate to get that sweet, sweet autocomplete?
but i agree that issues might arise elsewhere. it is therefore advisable to check what other luas are calling functions from the lua you'd like to overwrite. i definitely agree that you always should be very careful when overwriting stuff.
i guess so but from a "customer" perspective (ie the people playing your mod) it might also be nice if they don't have to do anything and can just play imo.
I think both sides have their reason, but not overwriting and instead appending just seems like better practice in general. I'm sure there are cases where overwriting can be fine, or even better, but vast mod compatibility is a VERY valuable asset to any mod, especially if you're forcing a potential user to choose between your mod and someone else's, and possibly leaving them with a bad taste in their mouth cuz one of those two mods is now causing them issues due to incompatibility. You can make the argument of not using files that are frequently overwritten, but you can't take into account EVERY mod in the workshop
btw thanks for the suggestion although i haven't been able to affect transparency by editing the masks so far. but was definitely worth a try. many thanks! π
Does anybody know of a mod that adds a sandbox preset that I can use as a reference?
Is this the area I can request mods?
I guess lol
is it possible to make a lua scrip at a template for items ? i have like an item there should have a,b,c,d items and recipes for each item. is it possible to make a lua script there and read the items and crate + add it to the game it self? just like how the items.txt and recipe.txt do?
Just Throw Them Out The Window is one of my "mandatory" mods for my MP server, you do great work
Prototype of my scrolling list with folder for my equipment tab
So i stumbled upon this page while looking for how to setup InteliJ https://github.com/Konijima/PZ-Libraries/blob/Tutorial/README.md
But i wonder, do i have to decompile the java files to make it work, i assume it helps with auto completion. And how do i do that, the tutorial doesnt show how to and i couldnt find anything specific anywhere
does anyone know when the mods items.txt loads into the server setting ?
Thats extremely cool but can I request a version without the loadout and just shows ammo/weapons/guns? There's already a really good mod by Ramp that shows armor loadout
The thing is that after the mod becomes seriously limiting, it would be almost useless. The goal is a bit to offer my version of this mod
well i'll say one thing, you already are offering more as you cannot right click the armor pieces in that mod, iirc.
Trying a new approach. To see if it will be better
Also you can't get to the tailoring screen easily, through that menu, you have to do it through the inventory
So that mod is "kinda" useless already lmao, its just a kinda cool reminder as to what you have on you, not so much for functionality
Yes the goal of my mod is to no longer go to the inventory for the equipment at all
So disregard what I said initially, yours is looking great
Sounds amazing lol
How stable is it rn?
I'm confused about how power works, I've tried running
getPlayer():getSquare():setHaveElectricity(false)
but the appliances in the area appear to still be powered? lights are on etc
is there something else I should do?
It works fine, no bugs. Just need some polishing
But main features are here and work
Hell yeah. If you dont mind, as soon as you upload to workshop send the link and I'll like and download it
And it's me again. Let me know if i bore you with my opinion. :D
Could be great, if items shows right below specific section.
Like Accessory section and then all accessories below name Accessory. It's pretty hard to explain.
Currently:
Leg
Accessory
Head
Body
Belt
Holster
What i mean:
Leg
Accessory
Belt
Holster
Head
Body
It's already on the workshop but not this version, it's still under dev. It's the next update.
https://steamcommunity.com/sharedfiles/filedetails/?id=2726898781
It should work with mods that add guns because you're hooking to the vanilla inventory, which shows the modded guns, right? I'm not much into modding but I dabbled in some lua back in the day on roblox lmao
Oh shit i'll check it out
That planned, it's what I call polishing π
It's work with every mod !
Oh, great <3
Quick question, typically mods are tested on the workshop and therefore the creators include the "multiplayer" tag if they are known to work, right? well, is that exclusive for mods that don't have the tag and therefore still work on multiplayer just not tested extensively?
For me if there is no MP tag, it's at your own risk
But it's depend
i would say yes. but i will say there might be bugs. i do fast test if it works and spawn on multiplayer but i havent found out how to make .test files to test the whole mod out so i just do a quick smoketest πΌ
Personally, I only use that tag for mods that have multiplayer-specific components.
Since most mods should work in MP, and as modders better understand PZ+MP this will become more widespread, I feel like if it's used for mods that work in MP then it would lose all utility soon?
Wait, they should work in mp?
So I can assume its safe to download mods without multiplayer tag and just test them one at a time to see if shit breaks?
Another question is there a way to stress test or is it basically if-it-starts-its-good type of thing
That's how people should be doing things anyways TBH IMO?
tags are near meaningless. people apply them to things that completely dont fit
This too, but I'm trying to be cheerful and diplomatic π
I just put build 41 and multiplayer
which seems to show the best mods in most cases of the 500+ mods i've thoroughly looked through
I only have 150 on my server tho, lots of not so "realistic" mods on the realistic tag lmao
I wish we had an immersive tag but maybe thats the bethesda gamer in me
Tags quickly become useless on most platforms as the platform becomes more popular IME?
People "spam" the fuck out of tags on their pages to get more traffic + subs, etc.
where can i mod the frozen food not being available for stews and soups?
\media\lua\client\ISUI
ISInventoryPaneContextMenu.lua
maybe?
So any tut on decompiling it?
i agree but the problem is does it work for server multiplayer or the other muliplayer the one where you shared screen and could play together is it called "play together" over steam ?
Honestly, I believe people should just become accustomed to testing and evaluating mods themselves vs trusting tags?
Anyone can click on a tag when uploading a workshop item. But that person could be mistaken. Or could be lying.
There's nothing keeping insane 9 year olds or trained chimpanzees from uploading mods to the workshop, and saying that it works in MP. But that doesn't mean that it actually does work properly in MP?
Like Fenris said, tags quickly become meaningless π€·
so i'm creating a button but,, for some reason it just won't?? let me press it dfgvhgvdsgfh
self:drawText("Click a (Buffy Dice) skill to roll a d20.", left + 5, y, 1, 1, 1, 1, UIFont.Small);
self.reset = ISButton:new(10, y + 30, 20, 20, "Reset Dice Skills", self, reset_skills);
self.reset.internal = "OK";
self.reset.anchorTop = false
self.reset.anchorBottom = true
self.reset:initialise();
self.reset:instantiate();
self.reset.borderColor = {r=1, g=0, b=0, a=0.5};
self:addChild(self.reset);
y = y + 30
i know π i made my mod in singleplayer and did check on multiplayer and when i tried it first time on mp it just didnt fully work ^^ but then report the bug and hope he fix or edit his tag. i have noticed some people dont really know some of the tags meaning
Thats what the comment section is for, to know if shits borked or not π
no errors?
Personally, I believe there is a batshit bonkers insane amount of confused misinformation in the comments sections, I would not trust statements in the comment sections, and I believe that misinformation spreading via the comment sections is a genuine problem. Any time I look at the comment sections for mods, more often than not, I see people making outrageous claims that I know are wrong, and they're often very agitated about it as well?
Yeah people don't know how to fix the most common issue which is steam being absolute utter garbage with auto-updating and workshop related issues
Same problems that society deals with outside of steam TBH, but, like tags, it's a case of a source of information becoming tainted,
also can you show your reset_skills function please?
although i am currently working on a different part of the interface the ISButton call I use has a somewhat different argument structure than yours. here is what works for me in the character customisation screen:
presupposed that your button should have an effect on a single click. btw i am not an expert on this...
How do I make player corpses despawn every in game hour on my server?
It's seem ok for me, the problem should come from somewhere else
oh i probably need- an onmousedown func dont i
No you usualy don't for a button
reset_skills is the function call when you press the button
it's a bit weird you have a global function for a button click event but otherwise it looks fine imo, i dont define anything but the last param either for it
do buttons have to be initialized at the creation of the UI? or can i have a button created after it is initialised
You need a handler for the button
Like a windows and you put the button in it
tags... π
I just saw that I read quickly sorry. I don't know that, I prefer to make a temporary UI rather than making elements appear and disappear. Like that no issue
do you know if is possible to make a template.lua for items? like when i make an item in items.txt i want it to crate item a,b,c,d behind the scene so. and example have the item foonoditem { import base {} item foo { ....}
then make have the template.lua make the items
item bar_foo {
...
...
...
}
item bar_bar_foo{
..
...
...
} and so on and so on. what im doing really just need to be able to do in a template would make it easier to edit as well instead of edit on 140 items as it like right now
Where in the world is the time of day stored? I neeeeeddd it
Javadoc Project Zomboid Modding API declaration: package: zombie, class: GameTime
API? Never head of 'em (thanks)
@autumn torrent are you looking for in-game time of day?
yup
I've never heard of or seen anything that would imply as such, aside from vehicles having template functionality?
It might be worth looking at how vehicles do it, and experimenting with following, but it could be a dead end.
If you wanted to somehow automate applying parameters to items, maybe using the DoParam function with lua might be a solution?
local item = ScriptManager.instance:getItem("Base.Hat_Army")
if item then
item:DoParam("BulletDefense = 100")
end
it just have to run it all before it even spawn the items as well. but okay fair enough
Do you guys think it would be feasible for a vehicle that is locked to follow railroad track tiles
I imagine checking for the tile under a vehicle isn't impossible since its what prevents you from driving your cars across water tiles
i was thinking about to make a train onces lol
Hey guys is it possible to disable the godmode option and invisible option when im hosting a server? /setaccesslevel none doesn't seem to work and I don't want to feel tempted to use godmode to fix my character when I'm playing with friends.
I quote "Do you think we can make a train?" π
work on the ladder and elevator first could be much more nice ^^
are you in debug mode?
The long-awaited ladder
@odd notch Not currently, no.
in the admin panel -> edit admin powers
uncheck everything and hit save
and setaccesslevel requires a string username if you type it in chat like /setaccesslevel buffy none
@odd notch Ok gotcha thank you, let me try that out.
@odd notch Still seem to have the option to enable godmode through the client panel after disabling godmode and setting my access to none
Could anyone familiar with True Music tell me where the tapes/vinyls usually spawn ? Sifting through the mod files I cant find any info
bookshelves, nightstands, etc
you can see the distributions in the media/lua/server/items folder
but yes you will always have the option to enable your admin mode while the localhost
should throw up a dedicated server instead
@odd notch I thought about that actually, I'm just being lazy and don't wanna go through the process of learning how to do that lol
assuming your save is called like 'servertest' im pretty certain if you just run projectzomboidserver64.bat it will put up your save
you can find a guide for going from coop -> dedicated though it might be more complex
@odd notch Ok cool, thank you so much for helping me out π
gives me something to do while waiting for my game to load 81/81 chunks
speaking of my new dnd update is complete! now there'll be dnd style skills people can level separate from basegame skills for their d20 rolls 
@drifting ore can u tell i gave up on the button concept :)
That's a shame ! here I have a guide to make a UI if you want, with a full example with a UI that opens when you click on Y and with a button that closes the window
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md
Oh that's dope!
hilariously i followed your guide, im going to wager it was due to the button being instantiated deep within conditions and far away from where the ui was created
or perhaps some trickery with that specific ui; theres an element thats overlaying it or something idk
Seem like parent issue
Try the full example, he work I just try it
It open an UI at you mouse
yo MrBounty since you seem knowledgeable. Do you know where Strength and Reading is initialized in character creation so they start at 5?
marking
passive = true,
in the skill section seems to do absolutely nothing atm. Well, aside from Chuck checking it for skill journal mod.
what are the key bindings in the lua debugger? I have found F6 is step and F11 is continue
and how do I add a watch?
used to work in b40. digging around some old code snippits:
local script = {"module Base {"}
for sound, range in pairs(swingSounds) do
table.insert(script, "\tsound ".. sound)
table.insert(script, "\t{")
table.insert(script, "\t\tcategory = Item,")
table.insert(script, "\t\tclip")
table.insert(script, "\t\t{")
table.insert(script, "\t\t\tevent = ".. sound ..",")
table.insert(script, "\t\t\tdistanceMax = ".. range ..",")
table.insert(script, "\t\t}")
table.insert(script, "\t}")
end
table.insert(script, "}")
getScriptManager():ParseScript(table.concat(script, "\r\n"))
that was from a loop i used to generate the sounds.txt for orgm back in the day, using print on the last line to generate the file instead of :ParseScript though, used to be able to generate items with similar code, recipes were funky though, idk how well it will work with the new WorldDIctionary stuff, it probably wont work anymore in 41 though
F5 also does something, not sure if it's the same as step though.
to add watch right click one of the variables in the middle bottom screen (or maybe locals instead)
nice, thanks for the help
F5 steps over (will stay in the current file) F6 steps in (will continue on the code path, into the next file).
Hi just have a question about a mod which is the Auto Tsar Trailers, If i add the mod in the middle of my playthrough will it still spawn the different types of trailers around the world/map?
wouldnt it be the same way to generate recipe as item o.o
in theory yes, but it didnt work out so well...i had it generating all the mod's ammo types and boxes (items) and the recipes to open them. but the recipes wouldnt fully register. there was probably some validation step on recipes that was missing since it was generating later in the boot sequence, i never fully investigated the issue
instead i had it auto generate the items and recipes and print to file
π
since that was better for compatibility and other people trying to understand what the mod was doing
samething i need it for lol so its the scriptmanager you need to call on hmm also is there a speciel event you have to call on to get it before loot spawn on the server ?
eh loot spawns mostly as the world is explored. i really have my doubts though that autogeneration of items at runtime will be viable in 41, especially in a mp environment. better off to just use it to generate to a actual script file, assuming you only need it for generation due to timesaving (ie: avoid large amounts of redundant typing)....if you truely need dynamically generated items and recipes then that could be really problematic. but idk i really havent looked at this new worlddictionary stuff
the items still need to be made set into the managementscript and then into Distributions hmm okay going to be interesting
but will go to bed not and come and yell after you when i cant get it to work xD
Anyone know of a mod that increases the skill ceiling for first aid? By that I mean that it makes it more difficult for someone with no knowledge to just wrap their injury in ripped sheets and be healed in an hour.
Is there an event for when the time changes in-game? something like what handles the changing of the time on a watch? I think I could use the OnTick event and just check gameTime:getTimeOfDay() each tick, but that seems incredibly inefficient
every ten minutes event
wow i literally looked right at that event as well. thanks lol
i also didnt know i could go to the wiki for finding stuff like this. you have helped me in more ways than one π
For more precision check this one https://pzwiki.miraheze.org/wiki/Modding:Lua_Events
Are vanilla professions supposed to be available from ProfessionFramework.getProfession()? Doesn't seem to be the case from what I can tell
https://steamcommunity.com/sharedfiles/filedetails/?id=1343686691
It's either getProfession(string) or getProfessions(). Is that what you're looking for?
I'm starting to hype myself π @strong bough @cold burrow
Anyone managed to setup emmyLua on vscode.. the plugin came with no doc and I hardly see a link between the available config and the one for intelliJ π€
Is it difficult to change what tools is required to destroy or disassemble something? I want to destroy the house porch/deck fences or the fences around fields with a hammer and saw. Is this easy to change?
Yeah it's string, it's just that ProfessionFramework doesn't seem to load the vanilla ones, so it just returns null
Are you using the right one ? Like "unemployed" ?
burglar
It's "burglar" in the file game so it should work
Otherwise you can try
local profList = ProfessionFactory.getProfessions()
for i=1,profList:size() do
local prof = profList:get(i-1)
end
Yeah I'm just doing it like that for now
Stay like that. Never change something that works xD
but that also means you have to do this, which is the nice thing that ProfessionFramework usually takes care of:
local OldDoProfessions = BaseGameCharacterDetails.DoProfessions
local function DoProfessions()
OldDoProfessions()
local prof = ProfessionFactory.getProfession("unemployed")
prof:addFreeTrait("trait")
end
BaseGameCharacterDetails.DoProfessions = DoProfessions
can you use a bbq grill in your house? just found one and never tried lol
I don't think
You don't think it can be done or don't think it's hard?
I don't think it's that hars but you have to understand coding and it gonna take some time
Especially learn how PZ works
Java won't be hard
It's lua, not java
I just need to find an example of the existing code and change the item reference
Lua then
profession framework doesnt define the vanilla ones by default, so they arent actually registered in the PF, thus ProfessionFramework.getProfession wont automatically fetch them
You gonna need to check the vanilla game file to see where the code to destroy is made, them understand how it's done and try to copy that to a new item. But start to make a custom item, check the pinned message
media/lua/shared/translate/EN is actually a pretty good shortcut for getting things like the names for professions, traits, etc.
Can't I just add the two tools to the list of tools that can be used for an action?
The sledge action for those items already exists, and there are multiple recipes and action that exist that can use one of several tools to complete an action
you can define them however like any other new profession using
ProfessionFramework.addProfession("unemployed", {
traits = { } -- add traits in here
}
most of the other default values for that profession will stay
if theres a value it cant change on the vanilla ones that way it will throw a error msg in the console about it
Oh thanks, I was afraid it would just completely redefine the profession, so it's good to know it'll keep existing values
though if i remember right it should beable to change everything on the default profs, just some of the default traits it will not beable to change a few things like cost
I not sure but I think the hammer is a bit different from the other tool and the action of destroying a tile il a specifique action
Ahhh
Is the test mod provided with the game a good place to start to see how I should be setting things up?
I'm assuming I can copy, rename it and then make any changes I need to
Fenris_Wolf has a good guide on getting started. https://github.com/FWolfe/Zomboid-Modding-Guide
This is so cool
any mods to fix that VHS XP bug where if you create a new character after the previous one has seen the VHS, they don't gain skills
or like, another way to fix it?
would anyone be willing to help me make a mod at all? gonna read the modding guide but if anyone would like to help that would be great ^^
Quick question: whats the syntax you would use to call this function? CIZSandboxOptions.checkIfUpdateCIZSettings = function() end
I noticed throughout the files that functions were being defined in two different ways and I got confused. Some functions are defined likeCIZSandboxOptions.checkIfUpdateCIZSettings = function() and others are defined likefunction CIZSandboxOptions:checkIfUpdateCIZSettings()
What's the difference?
There's no difference
They're both called by CIZSandboxOptions:checkIfUpdateCIZSettings()
OOOHHH i think i understand now. thank you
theres a minor difference.
function CIZSandboxOptions:checkIfUpdateCIZSettings()
end
is the same as
function CIZSandboxOptions.checkIfUpdateCIZSettings(self)
end
calling them:
CIZSandboxOptions:checkIfUpdateCIZSettings()
is the same as
CIZSandboxOptions.checkIfUpdateCIZSettings(CIZSandboxOptions)
if its using : then it adds a variable argument self which contains the table holding the function
basically : is used for "Object Oriented" style programming
I see. So in other words, I'm gonna be defining functions with the : from now on lol
as long as you call them with : as well, otherwise it generally gets confusing/leads to typo errors...but theres not much point unless the function needs a pointer to the table its contained in, like if your running multiple instances of the same table
Right, that makes sense
things like IsoPlayer objects are a fine example, normally the functions need to know which player and theres multiple instances, why its player:Say("blah") and not player.Say("blah")
although you technically can do player.Say(player, "blah")
Is there a way to make sure your OnGameBoot event gets called after another mod's?
if (this.Activated && (GameTime.instance.getHour() > 22 || GameTime.instance.getHour() < 5)) {
WorldSoundManager.instance.addSound((Object)null, (int)this.getX(), (int)this.getY(), (int)this.getZ(), 50, 3);
}```
Was told to put this here. Friend went and looked for the light switch noise code
Do i get it right, i could write something like:
function Class()
function method1()
print("this is from method 1")
function method2()
print("this is from method 2")
And then just call method with?
Class:method1()
Sry for asking, i'm pretty newb in lua, but would be good to know. I even didn't know that OOP exists in lua.
kinda a pain, if you know exactly which file in the other mod is adding the event, you can ensure yours gets loaded after either by using require or naming so it comes after in alphabetical order.
you could probably fake it by adding a function to another event firing before, and having that one add the real to OnGameBoot thus ensuring it falls last (i used to do this is with the events firing on sound banks loading...not sure if they still fire in build 41)
Class = {
function method1()
print("this is from method 1")
end
function method2()
print("this is from method 2")
end
}
OOP doesnt actually exist in lua
it can fake it though
basically using metatables
Another quick question: Where do print() statements get sent?
console
Oh. It's like associative array filled with functions.
That's what I was hoping you didn't say lol
basically ya...though they arent quite associative arrays...tables are a hybrid of associative arrays, ordered arrays and fake objects XD
Oh, nope, it's not associative, it's just array.
Yeah. :D
Much appreciated your help and time. :)
Now i need to rewrite a few things :D
That's a pretty good idea. Where can I get info on the order events are called?
uh i'm not sure theres any lists actually defining order. I havent actually done much modding for 41 yet so not currently sure whats happening before OnGameBoot
you can try OnLoadSoundBanks thats what i was using to delay adding to OnGameBoot
but not sure if its still valid
Fair enough, thanks. I'll play around some different ones
sorry mutlitasking here, gave you a bunk example
Class = {
method1 = function(self)
print("this is from method 1")
end,
method2 = function(self)
print("this is from method 2")
end
}
there lol
Fenris being very active now it seems, is this a sign that Orgm is being worked on?
working off some of that rust. even started playing a game π
A game of zomboid?
lmao well i didnt mean some other random game π

damnit. i keep messing that example up..i'm just off today LOL
Fenris_Wolf, while you are here, i just can't not to ask.
I already trying to ask here, but still can't find solution.
Is there any way to completely remove item from a game with lua?
I already tried this one pretty bad workaround and it's works, but it leads to errors. This is .txt variant:
module Base
{
item ExampleItem { }
}
But i'm pretty sure there should be method to remove item.
No worries. It's enough for me just to know that i could use OOP in lua. Anything else i could google. :D
i cant say i've ever actually tried to completely remove something
somewhere i have a half completed tutorial on lua metatables/OOP that i ment to throw in the modding guide but never finished it off to my satisfaction, 1 sec (its in markdown format though)
its still pretty crude though, more technical then tutorial i think...and only got so far as covering __index (basic inheritance) and not any of the other oper overloading
I found this one example:
--class
Person = {}
--class body
function Person:new(fName, lName)
-- properties
local obj= {}
obj.firstName = fName
obj.lastName = lName
-- method
function obj:getName()
return self.firstName
end
-- magic!
setmetatable(obj, self)
self.__index = self; return obj
end
--creating class
john = Person:new("John", "Silver")
--call a prop
print(john.firstName) --> result: John
--call a method
print(john:getName()) --> result: John
Is there a function to get ALL IsoZombie objects? (god bless my performance)
its a valid example, though the
function obj:getName()
return self.firstName
end
part is a bit strange...since that method doesnt exist in the Person table, but is given to new instances on creation
self.__index = self; this is entirely unnessessary and recursive...actually the whole example is pretty strange lol
--class
Person = {}
--class body
function Person:new(fName, lName)
-- properties
local obj= {}
obj.firstName = fName
obj.lastName = lName
setmetatable(obj, {__index = self} )
return obj
end
function Person:getName()
return self.firstName
end
whenever i start up a modded server it says file missing night watch anybody know a fix?
Is there a mod that allows players to claim any house ingame?
trying to claim the fire station with my gf but it wont allow us
the other is 'technically' valid but meh
self.__index = self this alone is horribly recursive and not needed (its a cheap shortcut using the Person table as the metatable. bad format...only specific keys are actually used in a metatable, such as __index, __newindex __add, __sub etc)
ideally the metatable should be small, even that example i just showed could be optimized
Person = {}
local meta = { __index = Person } -- reuse this metatable for every instance
function Person:new(fName, lName)
-- setmetatable also returns the new table (the one passed in as the first arg, so no need to actually define it above)
return setmetatable({ firstName = fName, lastName = lName}, meta )
end
anybody know when i host a server it says missing file
are you using all mods the server is using?
yeah
but it just says missing file as soon as i load in my character
anybody know how to fix missing night watch in media file
@cold burrow Arsenal26GunFighter mod removes vanilla weapons and items with lua code in /server/items/ you can check that
Oh, omw then. Thank you for help. <3
I want to ask
So i just recently play this game
I download a lot mod which is up to date to the version
I didn't touch the mod load order
Every mods were turn green which is working
But when i play solo session
Sometimes in the right bottom corner
It's show error 79 sometimes error 40+
How do i check error logs?
C:\Users[user]\Zomboid
for console.txt
for future mod help check #mod_support instead
Ah i see thanks
Console.txt, on your zomboid folder
already answered π
How do I replace a tile with another tile in lua?
like lets say I want the code to pick a random asphalt tile and replace it with a grass tile
lol i must be blind sorry
Found a pretty reliable way to make your OnGameBoot Event fire last xD
Events.OnGameBoot.Add(function() Events.OnGameBoot.Add(MyFunction) end)
Is it easy to swap the "shout" mechanic text bubble for an actual sound?
Should be pretty straightforward.
just search ProjectZomboid/media/lua for "shout" and "playSound", should be able to cobble something together after seeing how those work.
Anyone able to help me test my mp patch for better lockpicking?
Need another player to test if the third bullet point is working.
https://steamcommunity.com/sharedfiles/filedetails/?id=2732916047
Thanks I will take a look
you'll want to override the class since it's java
__classmetatables[IsoPlayer.class]["__index"]["Callout"] = function(self, doEmote)
local range = 30
local shoutPath = "New"
if getCore():getGameMode() == "Tutorial" then
shoutPath = "Tutorial"
elseif self:isSneaking() then
range = 10
shoutPath = "Sneak"
processSayMessage(string.format('*156,108,108*' .. "%s" .. getText("UI_verb_whispershouts_roleplaychat") .. '"%s"', ISChat.instance.rpName, getText("IGUI_PlayerText_Callout"..ZombRand(1,4)..shoutPath)));
addSound(self, self:getX(), self:getY(), self:getZ(), range, range);
else
processShoutMessage(string.format('%s' .. getText("UI_callout_shouts_roleplaychat") .. '"%s"', ISChat.instance.rpName, getText("IGUI_PlayerText_Callout"..ZombRand(1,4)..shoutPath)));
addSound(self, self:getX(), self:getY(), self:getZ(), range, range);
end
if doEmote then
self:playEmote("shout");
end
end
Here's how jade did it in our roleplay chat mod
you'll ignore the processshoutmessage stuff lol
if you just want it to play a sound, you can literally just remove everything except addSound and the range variable, and just getPlayer():getSquare():playSound("yoursoundgoeshere") underneath it or something lol
Ok brilliant thanks for the help
hey, any guide on how to add custom sounds to my gun?
Checkout the ProjectZomboid/media/scripts/weapons folder
Now how exactly those are linked to the sound files, I honestly don't know
hey guys im doing this futurisitic visor that works like a digital watch, i manage to make it work doing 2 itens (same as watch;right/left), but since my item is just 1 location i was trying to make it as 1 item only, but settting like this dont allow me to equip the item;
item Wiz_DBScouter
{
DisplayCategory = Accessory,
Type = AlarmClockClothing,
DisplayName = Sayan Scouter (Green),
ClothingItem = Wiz_DBScouter,
CanBeEquipped = MaskEyes, <--- i try to set this but still wont equip
BodyLocation = MaskEyes,
CanHaveHoles = false,
Icon = Wiz_DBScouter,
Weight = 0.1,
ChanceToFall = 10,
WorldStaticModel = Wiz_DBScouter_ground_green,
Cosmetic = TRUE,
SoundRadius = 7,
AlarmSound = WatchAlarmLoop,
Tags = Digital,
clothingExtraSubmenu = Wiz_DBScouter_blue,
}
is there a way to make it equip without creating a second item?
i think i made it work now, i removed the line i pointed there and add this
ClothingItemExtraOption = Wiz_DBScouter_equip,
but now it give me errors
function: doClothingItemExtraMenu -- file: ISInventoryPaneContextMenu.lua line # 3496
function: createMenu -- file: ISInventoryPaneContextMenu.lua line # 726
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1426
ERROR: General , 1643272251170> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: get of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1643272251170> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: get of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1458)
at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1416)
at zombie.ui.UIManager.update(UIManager.java:902)
at zombie.GameWindow.logic(GameWindow.java:253)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:745)
at zombie.GameWindow.run_ez(GameWindow.java:661)
at zombie.GameWindow.mainThread(GameWindow.java:475)
at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1643272251172> -----------------------------------------
STACK TRACE
add ClothingItemExtra = Wiz_DBScouter_blue
Regarding this, anyone knows how to decompile the game to use it's jars in lua mods?
It's in the script folder, there is a sound.txt or something like that
Depends I guess, near what ?
How can I get the Base ID of an Item with Lua? For example the Base.Schoolbag string
yelling yelling yelling now im done with yelling at you as i promised yesterday.
so when would you call this lua ? because i cant see the reason why you should call it more then onces like when server starts and when player join on client site atleast. can you remember what you did there?
say i have an object in the world. is there a helper that will proc when a player goes near it? if not, is there like an inRange proc?

best i can think of is like,,, an ugly math checker that checks adjacent tiles on a tick
but,.,. how would i check if a player is in a square?
i know i can find objects by like,, for _,obj in ipairs(worldobjects)
I don't think it exists. But yes I think the best is to check the tile of the player and the one around. What are you looking to detect exactly ? An 3d item add to the world or a movable object like a oven ?
item:getType() in game name of item are call type
But you just gonna get schoolbag, not base.schoolbag
iβm looking for an object in the world to detect players nearby it
debug mode helps too
thereβs an option in the f11 menu to show detailed tooltips that include the full item type
Like an alarm or a mine? No idea I admit, except to detect the surrounding tiles
yeah i might have to make the object a radio to use the getlistenerinrange (i think thatβs the name) proc
iβll figure it out and post about it here iβm sure 
There is a getNearItem for recipe, you can maybe check that
But it's from the player
Otherwise I have a piece of code in my mod that outputs all the items at hand. You could use and check if the item is in
@odd notch is it for a single object?
yeah like a single object placed in the world that will detect players near it and run logic on that condition
Guess you could do something like this in OnPlayerUpdate:lua local maxDist = 10 local ps = player:getSquare() local os = yourObject:getSquare() if math.abs(ps:getX() - os:getX()) < maxDist and math.abs(ps:getY() - os:getY()) < maxDist then -- player is close end
how often does onplayerupdate run?
Very frequently, like for each frame
i like to use everytenminutes 
itβs odd nobody has made like an addtimer helper yet
speaking of ticks
i would love one
You can do it, just get the list of players and do the same for each player
Hi, its possible for modify a square inside To square outside? I like this "player:setcurrentSquare(isoflag:exterieur)" For all player get this square .
I search script.
I need that !!!! Its amazing
its already in
Can I have items that are in bags that the players are carrying?
waiting for the next update
Found how to get backpack :
local it = player:getInventory():getItems()
local playerBags = {}
-- found a container (Backpacks and other)
for i = 0, it:size()-1 do
local item = it:get(i)
if item:getCategory() == "Container" and player:isEquipped(item) or item:getType() == "KeyRing" then
table.insert(playerBags, item:getInventory())
end
How do i check if lua script got loaded?
in debug mode, press f11 and then you can search the scripts in the bottom right panel
yep, once you open it there (double click it), there's a reload button at the bottom of the code. it doesn't always work 100% tho, you'll have to restart sometimes if you see its bugged or you made big changes
Alright thanks
"Setsquare" existing please ?
Ty for debug tips, i reload game for testing script, but i Will testing reload ingame directly....^^
Another question, where do i exactly put the mods? In the mod menu it says <user>/Zomboid/mods but when i've put mods there, they dont appear in the mod menu
should be the Zomboid/Workshop folder, not mods
It says this path, either way in neither of those locations it's showing up
not sure how i arrived to the workshop folder but it works for me, there's a blank template to copy as well
it worked with enabled steam tho
Can anyone tell me how i need to set drop chance values to prevent items from keep dropping? I want them very rare, but i played with the values, looks like whatever low number i put on the end of the lines like "0.00001", they just keep dropping :\
anyone here have used the parseScrip for like a new item ?
If I delete the "recorded_media.bin" file in the existing save, will this reset the tapes seen by the players or il will just break the save? (i'm trying to reset recorded media of each players on the server) thank you
if i make an item an get it into getscriptmanagement():parsescript() how do i persist the item to the save file so i dont loose it when i save world and rejoin ?
guess no one knows atm ^^
can i (and if so how) set up so that custom items only spawn in specific places, like louisville university and the west military base?
are there mods for electricity like windmills ?
fun you asking i was trying to do that kind of mod so i dont think so
Guys.
would indeed be in intresting to have windpower generation
Nice, to go with the solar panel mod ?
i think hydrocraft had it or is it only solar cell.
also i kind of gave up on larger mod because i dont have any modeling person ^^
didnt even knew there was a solar panel mod lol
https://steamcommunity.com/sharedfiles/filedetails/?id=2623458493
I never use it in game but it on my save
@drifting ore i wouldnt say yes or no because i wouldnt use that mod my self for the reason it not working on mp maybe the reason i didnt knew about it ^^
Recorded media is stored in the client's save folder on their machine (Zomboid/saves/Multiplayer/ServerIP_Port_PlayerId/), and doesn't save by default. The server one doesn't matter.
Seems like this system was forgotten by the devs for the MP update.
I'm still looking into ways around this to make it stored by the server.
Here's a small showcase of a mod i'm working on - a radio manager that lets you easily transfer channels between different radios. started out as a simple notebook and I ended up adding automatic tune-in and preset generation π
https://www.youtube.com/watch?v=IbVSRtpA0F8
Thanks @drifting ore for the UI guide that got me started with it
Small project zomboid mod showcase. The radio manager enables easy copying of channels between different devices.
hi, is there a way to access java fields from lua?
want the values strength, speed ... stored in the IsoZombie class
saw an example to __classmetatables a few messages above and now i am curious if this is possible
yes, you just need to do it through the getters, so instead of p.name you say p:getName()
Nice, glad to see that what I do I useful
Good job !
Looks great!
thanks π its been fun, theres still so much more to do though
also, if any of you have a guide on local storage and how to persist stuff, that'd be great as well π
zed:getStrength() throws errors - there are no getters for these fields i want to access
probably depends on the java class in question, i saw the getters for my object in the debugger. sry can't help more
no problem, maybe another one knows a way
anybody know why the issue happnes with britas weapons where none of the guns spawn?
Use player:getModData(), it's a list that is attach to the player. You make a new list in it with you mod ID as key to limit issue with other mod and you good to go
Just use player:transmitModData() to save the list
otherwise it's not save between reload
nice, thanks. do i just save tables directly or should i convert to json or sth like that?
just table is ok
and how do you say when people help you? 'thank you' ? π
anyone knows what are the jumpscare sounds called in the files?
the ones that almost give me heart attacks? π
yes!
they are not on the sound folder?
hum maybe they are compiled in the code? like the tiles and lots of textures are? if its the case i think u prb can extract them just like people do with the textures
what happens if you just do zed.strength ? They're public variables, so I don't see why they'd not be accessible.
sadly they return null
you can DM me anytime if you need some pointers, i just started on PZ about 2-3 months ago but i will help if i can
you are trying to make a new fuel source?
would be cool to have Ethanol, lots of cars are moved by ethanol here on brazil, its does not burn as good as gasoline buts its a renewable source of energy; you can plant sugarcane and make ethanol with it; that can be a cool mod idea
sorry my english
I believe that if you just want the current value of a Java object property that this is doable, but if you're looking to set the value that that is not possible. Debug mode does have a way to display all of the Java object property values, and I believe that it uses getClassField(object, property_index) to get those values.
thx i will try. currently i only want them to visualize
Can you tell me how you got the bar above with the cross to close and the name of the window pls?
This works for single player right? but not in a server with people, which I do not really care lol
I've never used any features of the mod yet but it's on my save so I'd say yes
i added them manually, they are just regular buttons with icons instead of text, and the title is rendered text. you can offset it from right by calling getTextManager():MeasureStringX and then adjusting for it.
im planning to add rects with a background to make it more similar to vanilla headers too
Ok, I thought you had found an element or a function to do it directly.
unfortunately not, i looked for it too but no luck
thx - with the getClassFieldVal method and your mentioned methode i could finaly read the values
You may want to look at extending ISCollapsableWindow and ISCollapsableWindowJoypad. I believe that those have the title bar and resize bar already built in.
I'm wondering, since you can get the FIeld with getClassField, if maybe you can use the getters/setters from here as well https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html
only (possibly) in debug mode, its not exposed to lua otherwise
I think it depends on whether or not PZ chooses to expose those getters/setters via Kahlua. To use a Java method in the Kahlua space, it needs to be declared in the Java portion of the engine. I believe that PZ exposes the generic reflection getters, but not the setters.
hi guys, do anyone knows how to enable debug mode on a linux server?
@LuaMethod(
name = "getNumClassFields",
global = true
)
public static int getNumClassFields(Object var0) {
return var0.getClass().getDeclaredFields().length;
}
@LuaMethod(
name = "getClassField",
global = true
)
public static Field getClassField(Object var0, int var1) {
Field var2 = var0.getClass().getDeclaredFields()[var1];
var2.setAccessible(true);
return var2;
}
the exposed global functions lua uses to get the fields that way
if (Core.bDebug) {
this.setExposed(Field.class);
this.setExposed(Method.class);
this.setExposed(Coroutine.class);
}
Field.class isnt normally exposed unless debug is enabled
#mod_support is a new channel, so a lot of people don;t know this yet, but that's the channel for issues using mods; this channel is for talk regarding making mods. π
@quasi geode is there an easy why to look up where an item comes from . like in which module its origin is?
item:getModule()
-- or
item:getModuleName()
^^^ this. the second version is for script items, first for inventory items
thx guys ^^ so i gess item:getName() will give me the items name π
probably not what you'd expect...its more similar to display name (prefixed with 'broken' or 'tainted' etc)
least for inventory items
no no i would need the realy name of the item not the translated name of the item ^^
displayname is the translated one right ?
:getType()
ya
though it maybe getName for script items just not inventory items
not sure on that one tbh
just to be sure
item foobar <- item:getType() retunr "foobar"
{
DisplayName = "foo" <- item:getDisplayname() returns "foo"
}
?
yes but again, theres a difference between a script item (unspawned template) and a inventory item (specific spawned instance of a item). they use different methods
for script items it might be getName i'm unsure and not digging through the files atm. for inventory items getType returns the string you pointed at in your example
also the displayname wont likely be "foo", it will be whatever is in the translation files for "foo" and will return the translated version
also all the items is able to be in inventory and not isoitem so fa r
also i would never use the word foo normal in my code ^^ so i know that π just tried to make a more abstract and generalized question
you were right, deriving ISCollapsableWindow worked like a charm, thanks!
Are the statistics of the players kept in the database?
For example, how many zombies did they kill?
Anyone has an idea of what could be the cause of the warning : Warning: Moveable not valid
It is displayed 5 times when crafting my custom moveable item.
The item is still successfully crafted, then i get the following error message when trying to place it: RecipeManager -> Cannot create recipe for this movable item: AnselmeFlags.TestFlag
making the extra item be itself? does it work?
yeah cool i guess i works, thanks!
i wonder if we really need this thou, because like that my inventory clothing now have 2 'equip' options lol
I got a weird bug. When I try to create a new UI. Same way as before that worked.
I get an error at the line o.x = math.max(0,math.min(x,maxX-width))
But x = 0, maxX = 1920 and width = 400 so that should work.
I rly lost on that one
The line is in ISUIElement so it's at the root of the creation of the UI
if x = 0, then math.min(x, maxX-width) is just returning 0
thank you!
We agree that he shloudn't give me an error ?
What's the error?
It's delete now, I try something else
Ok that was something else but still, weird error
Hello friends, I'm trying to learn how to mod and want to try and work myself up to the point of writing some form of unit test to try out different evolved recipes (I want to get to the point of understanding evolved recipes enough to implement a way to jar/can prepared dishes) where would I look to see where PZ defines "evolvedrecipe"?
How do I know if an item is a melee weapon ?
I know that the item has a variable type that store "Weapon" but I can't get access
instanceof(item, "HandWeapon") and item:isRanged() == false
Should work but I just remember that item:getCategory() == "Weapon"
item:getType() == "Weapon" and item:isRanged() == false should work
getType will return the item name
item:getCategory() == "Weapon" and item:isRanged() == false will work as well
name, type, category, display category π€ͺ
We may be thinking of different item types? I'm thinking of https://zomboid-javadoc.com/41.65/zombie/scripting/objects/Item.html
Scripts define it as such Type = Weapon
Javadoc Project Zomboid Modding API declaration: package: zombie.scripting.objects, class: Item
Nah, Fenris is right, as always, getType() returns the item's "script name", ie if used on a schoolbag you get "Bag_Schoolbag" and not "Container"
That's exactly it, I reversed type and category because https://projectzomboid.com/modding/zombie/scripting/objects/Item.Type.html is call type but it's a category, so that not help xD
It's confusing AF to be fair π€ͺ
its a weird inconsistency
You just get used to it eventually? π€·
There's a lot of those in PZ π€ͺ
lol ya XD
Think of it as a minigame to be defeated? π€ͺ
i believe though if you call getType() on a script item though it gives you the type param
If only there was a way to check if SubCategory == "Swinging" xD But of course there's no getter for that
Using notebook++ & searching the lua files in the PZ media directories is my go-to when I need to remember/figure out/outsmart some of these reverse-logic puzzle function names.
theres a item:getSubCategory()
Yeah I'm seeing it for inventory/types/HandWeapon
SubCategory = Swinging yeah, Fenris was on it.
ya i should clarify its for HandWeapons, not InventoryItems
local swing = item is a weapon and item's sub category is swinging to pseudocode it
Most of important files seems to be on media\scripts.
Recipes.txt (contains the syntax to making jars and opening them)
Items_Food.txt (contains the syntax for raw data for the food you get from opened cans/jars and in which evolve recipes they can be used and the nutrition data for the evolved recipes)
Evolvedrecipes.txt (contains the syntax for making evolved recipes)
Currently digging through the java classes to see if I can find where it's hidden in there, ty ty though.
Good day,
Does anyone know how to make an item, once placed, solid, so that characters cannot pass through, like a table? Is it a simple as defining it as furniture? Or?
I forget who, but there was investigation into globalmodData and whether or not it was server-side and shared/universal? what came of that?
howdy everybody! i've been working on a pitch for a mod/suggestion for a while now, but it only just dawned on me to check with ya'll and see if it's even feasible. i want to play a type 1 diabetic. the principal mechanic behind that would be monitoring a new need/status called blood glucose. is it possible to create a new need/status? and if it is, can they be tied to a trait?
Release of the final version of my equipment tab
https://steamcommunity.com/sharedfiles/filedetails/?id=2733680483&searchtext=
I found where the evolvedrecipe class is! If anyone is wondering it's at (project zomboid directory)/zombie/scripting/objects/EvolvedRecipe.class
Can anyone tell me how the snow is rendered? I was wondering if it'd be possible to recolor the snow accumulation on the ground
It can be done easily I think
easily? wow you are good man, i dont think this would be easy at all
Make a custom trait, decrease a variable "sugar level" in ModData every 10 minutes, add value of calories to the sugar level when eat and set endurance depending on sugar level every minutes and you done
I find that ok
After that if you want something nicer, you reduce the value of the sugar level with the difference in weight between 2 times, as it depends on the energy spent (running, walking, sport). And it's just ideas like that
I mean, it can be done. Some come and ask if we can redo the game
Anyone know of any mods that could possibly interfere with large pre spawned fences? Found a wharehouse with large fences surrounding it but there are now gaps. Assuming a mod, but wasn't 100% sure.
sure can... i want to learn traits sometime, but i still got other stuff i want to learn first
That a fricking good idea !
Probably a good idea, but not mine since I'm a day Z player π
Anyone have an idea of why the Louiseville gates have a sync issue most of the time?
Was thinking of patching it, but no idea what could be causing it honestly.
Is there any way to play a dynamically created sound? I see methods on classes like WaveData and AiffData for creating sounds from byte buffers, but I don't see anything similar on the SoundManager (or see how to use those to do that). Alternatively, is there a way to create temporary files? I feel like the latter is even less likely, but figured I'd ask just in case
does the trash from trash and corpse mod from algol cost us performance ?
is that not on mod_support section?
Is there a mod that allows you to armor your car like mad vehicle
does anyone have
2482660773
it was a mod patch for brita's and SF's blacksmith for ammo compatibility
mod author removed it
@echo leaf what happened to your patch?
i wanted to ask before i attempt to make it again
I'd send a note to the developer of Immersive Medicine mod, since that sounds like it would fit in VERY naturally to what they're working on.
anyone have a basic mod that adds a single piece of moveable furniture?
tiles? i think imersive solar panels have tiles but i dont know about one that adds just 1 tile
basically, a mod that just adds an end table (holds loot or not doesn't matter) and a 2 piece table. so i can learn how to implement my own.
Is there an easy way to make moveable objects useable? As in right click to call a function or something?
After they've been placed I mean
yeah i tried to make my own tile couple weeks ago, its a pain... and the program people use for make them is kinda buggy atm not sure
i end up making my world forniture as a 3D object for now
what is the correct code to add a custom profession to the list of bonuses in the forage system? I tried
`require "Foraging/forageSystem";
forageSystem = forageSystem or {};
-- Same as park ranger bonuses
forageSystem.professionBonuses["CUSTOMNAME"] = 1;
forageSystem.weatherEffectModifiers["CUSTOMNAME"] = 33;
forageSystem.darknessEffectModifiers["CUSTOMNAME"] = 10;`
in a lua file in the same folder, but I think it didn't work out (I saw a mod using a similar code).
The vanilla file is in \media\lua\shared\Foraging\forageSystem.lua
If the trunk capacity of a bag or vehicle is large, the letters overlap like that. Is there a way to move the location of the name text of the button or container to the left, such as 'acquire all, floor, trunk'?I saw the LUA file, but it was difficult for me to find out.π’
@fair frost
sad add the property moveable to it ?
i want to make NEW art... could you throw together a basic mod?
How do I create a mod pack
sound more like a mod_support thing?
is it simply dropping all the mods that I want in the pack under \Contents\mods ?
wait is the mod pack like couples of mods or the texture.pack files?
sadly i struggling with some other thing in another mod m8
a bunch of different maps that I want to put together into one pack
I opened the snakes mod pack, and it really is just that
steam do have a create steam workshop collection which is the modpack you talking about right ?
a bunch of mods
No
When you download a modpack, it's just one steam workshop item
in it will be a bunch of folders
Take a look at 2719327441
or like this one
this one look like he made a steam collection and manuel did somehting but have fun to ask everysingle modder for promisison to make that kind of modpack ^^ also maintain will be harder aswell but yea i guess the correct way is to make a steam collection..
also this quesiton you asking about is more down in #mod_support
I know about steam collection
the problem is once you have a lot of mods, the server description run out of character
and it will appear as version ??? and the mod list will disappear
the only way to fix that is to put things into a pack
which in the worse case can be hit by an DMCA. if you don't get permission from the person who made the mod. atleast in barothrauma modders like to dmca people there do that what you talking about and i dont know how the zomboid modder communities are like ^^
doubtful, it's a private and only visible to certain people
HMMMMM
have the larges brain fart right cant think i did get enough sleep to night even failing to print out a list in debug mode xD
is it possible to edit some proprieties of generators like effect radius and condition loss rate?
where can i get player model rig to animate it
Maybe play in english instead? You might get used to that, easy solution imo
Anyone knows how to integrate zomboids javadoc into project? I've read through many threads, tried all that capsid/ZombieDoc and stuff but nothing seemed to work for me
can you make a craftable furniture item?
like you build it via the crafting menu, but place like furniture?
can use the crafting menu to do just about anything
how would you iterate over the lau datatype "userdata"?
hmmm where is "WorldObjectSprite=" set?
item Mov_FoldingChair
{
DisplayCategory = Furniture,
Type = Moveable,
Icon = default,
Weight = 0.5,
DisplayName = Moveable,
WorldObjectSprite = furniture_seating_indoor_01_60, <<<< - this part
}
world sprite like when you place it as a isoObject?
well that sets the moveable item for a folding chair.
i need to know where the world object sprite is set.
it only shows up in lotheaders and the place i posted.
Does getDisplayName() change with translation?
yes
Fck
do getType
yes but I want ammo
the ammo have a name right ?
yes but it's if mod don't follow the same name shema
ΓΈhm it kind of look like it does
only problem i have rigth now is how to go though my userData lol
So every ammo have a bullets in there name and box box ? But what if an other item have also box in the name
Can I get the displayName of the current language in english ?
where does the base game store trait scripts? specifically I'm looking for hemophobic to use as a base for a similar modded trait
Is it possible to get a list of all the getTypes of all items? Like a global functions
A bit everywhere. If you make a global search in all lua file of HasTrait("Hemophobic"), you gonna find everywhere hemophobic change something in the game
got it, thanks, figured it was scattershot looking at the directories directly
I don't understand the question, sorry
i think i have to iterate though the object i get back from getScriptManager():getAllItems() but some how i fail to do a
ipair or pair on the object i receive. so how would i be able to iterate though the object i get back ?
dont know if that helps the clear out the question
I understand that it is more complicated than I thought it would be, so thank you.
i know if i do a lua print(type(obejct)) its a userdata object and i know when i just try to print(obejct) it look like a json object but from that i dont know how to convert it to somehting i can do an iterate over all the objects ^^
do you kindly have some insight on my other question too, if I may ask? #mod_development message
how you did it up the is how i would have done it as well
just remember both the charector and the forages system need to get the perk in the list
No, that doesn't change
so, any of y'all into Java modding? I've been working on a thing in my spare time and it's (just barely) polished enough for me to release it
hmm everytime i have done it it have changes i think. hmm
I just try with a french version
does you pzhook also need each client to have it installed?
yes, you can't just enable arbitrary code execution
although you could have answered that question for yourself if you'd read the page
unfortunately, that makes no sense
the JVM doesn't care what your code does
Anyone have any insight on this?
but nice work. last time i did anyhting like that was in wurm unlimited.
@frank elbow are you talking about in Lua or Java?
the game uses FMod so you might want to check their docs
Lua. I know I could do it via Java modding, but I'd rather not go that route
Is there direct access to fmod?
sure, it can be useful to poke through the Java side to get a quick idea of what's exposed to Lua
I don't know offhand, but if I wanted to, I'd crack open IntelliJ and grep through it π
Yeah, I've looked at the source code & the API docs
I still didn't find anything like what I described above; I'm asking if anyone knows of a way to do that because I couldn't find one after a while of searching
well, looks like there's a playSound function on the character object
seems to take a string
That takes a filename yeah
I'm not so sure it does
I want to either create a sound via a byte buffer, as in the sound "Data" classes (WaveData, AiffData, etc.), or create a temporary file which I can then use with playSound
fmod has sound banks
and for example, I can't find BuildWoodenStructureLarge in the game folder, which makes me think it's in a sound bank instead
I've looked through other mods that use it
I believe it uses both sound banks and filenames
okay this is gonna make me mad. why is my recipe not working.
alright, so have you tried dropping a sound file in with your mod and trying to play it?

