#mod_development
1 messages ยท Page 160 of 1
I wonder if staff looks in here every once in a while to see how we're mangling their game
lmao
congrats
ty. Strangely enough, it wouldn't work with not isBumped() or not isKnockedDown(), it would set it once, not trigger for the zombie again, and the zombie would only be bumped, not knocked down
Does anyone know of an example mod that has an item that when you use it, you gain a level in a skill?
Or better yet: sets you to a specified level - both up or down.
Character save sets level, but not from an item use https://steamcommunity.com/sharedfiles/filedetails/?id=2673317083
thanks
hmm, okay, turns out I need to decompile the Java code. What's the most convenient way to do that?
Does anyone know where you can find the basegame clothing spawns?
do you want the normal, fixed distributions, or the procedural ones?
I assume the normal, but i worded that poorly. I meant to ask about the ones you can assign to your own spawning character
ah, the clothes you can select? idk tbh, but I know the "Insurgent - Black Ops Profession" mod changes them, so you could look at what it does there
I'll check it out over there, thank you for the suggestion!
I figured I'd upload a vid of this working for funsies
Okay so setting levels is easy, how do I add custom right click interactions on an item without using recipes? Or even "on eat" effects if I use food? I basically need a hook in to lua from 'using' an item.
shared/Definitions/ClothingSelectionDefinitions.lua
Oooo, thank you!
gonna make my first Java class replacer mod i guess, because vehicle story definitions are hardcoded in Java for some reason
Nice!
what version of Java did the devs use for Build 41? so that I compile my changes correctly lol
or hmm, nvm. javac hasn't changed much since Java SE 6
AHA, found it. Build 41.71.16 is using JDK 17.0.1
for future reference
hmm, anyone PipeWrenchy know what I'm supposed to do with KahluaTable when using this event? I was expecting a context menu and something iterable of items, not KahluaTable
export type OnFillInventoryObjectContextMenuListener = (playerNum: number, table: KahluaTable, items: KahluaTable) => void;
๐ ๐
How do i prevent my custom professions from looking like this?
what's wrong with them?
The UI_prof
I have a translate file set up but it's not taking the text from them for some reason
is the translation file named correctly?
I have it named as Real_UI_EN, should it just be UI_EN?
yeah
translation files should always use the name of the vanilla file, they don't get overwritten since they aren't actually loaded as part of the lua environment (even though the logs say 'mod "whatever" overwrites file ui_en.txt')
Yeah, that part confused me. Well, thank you for the assistance! It's working perfectly now!
does somebody know why i cant make the player model turn around in a vehicle?
player model positions are tied to vehicle script files
Im trying to make a recipe to make a chipped stone from two stones, but I want one of the stones to be kept and the other to convert to a chipped stone
my problem is I don't want you to be able to use the chipped stone with another stone
I want it to be two stones only to create a chipped stone
but for some reason its allowing me to use a chipped stone and a stone to make a chipped stone
can you show your recipe script?
there are mods that do this already. you need to have one stone kept as an tool per say
whats the code formatt thing
yeah nah it's gonna be part of a mod
I just wanna start off easy
check out the files in this mod
https://steamcommunity.com/sharedfiles/filedetails/?id=878592795
```
code
```
{
Stone=2,
Result:SharpedStone=1,Stone=1,
Sound:chip,
Time:300.00,
Category:Foraging,
}```
thanks
I did do
stone```
basically im looking to exclude chipped.stone
oh, they're evaluated totally separately, so one stone fulfils both conditions if you have two
also I figure having two results won't work
you can't have multiple results, you can get around that with an OnCreate function
OnCreate:NameOfLuaFunction, and then a lua file with a global function by the same name that adds the extra item(s) to the player's inventory
oh I see
Oh I noticed this for the bowl and I was wondering why they did that
thanks
thanks for the info, do you know which file i should look into?
Looking at the above and about OnCreate can you have recipes with NO output but still call a OnCreate?
So you could forfeit items to trigger custom code?
blud does not have the ark stone hatchet
you do need a result item or the recipe menu breaks (it needs a result icon and name), but there's a property to have it not actually make the item you specify
They are both tables; table would perhaps be more appropriate as context since it's an ISContextMenu instance, but they're tables under the hood anyhow
As for what you're supposed to do with them, see the methods in ISContextMenu.lua. addSubMenu, addOption, etc.
Yeah, I got that part working. I still can't figure out how to iterate the items table using TypeScript ๐ค
I can do it in lua but not using pipewrench
items is a collection of items & you can get just the items using ISInventoryPane.getActualItems, or similar logic
Not sure what its actual structure is off the top of my head, but it's not just a list of items
the file that defines the vehicle itself, there are coordinates in there. I don't know how to properly modify them though, never tried it.
What property? I couldn't find it :x
RemoveResultItem?
RemoveResultItem deletes the output, you don't want that lol
Yeah, I don't want an item, just code to run
hmm then maybe
darn, I was hoping to make my vehicle mod completely dynamic, but I need to write in compatibility for certain categories of vehicles. There is no ambulance or truck categories
I could try using Vehicle Spawn Zones Expanded as a dependency, but that complicates a lot of things
How can I get the display name of an Item using their full name?
Like Base.Hat_Army to Military Helmet
getItemNameFromFullType(fullType)
Thank you
anyone know a good way to integrate zomboid with intellij?
I've tried this guide: https://github.com/Konijima/PZ-Libraries
but it didn't work
I get an error on step 3
anyone know if there is a better way or if I am just doing something wrong?
wrong, there IS an ambulance category, but the only sort of "utility truck" category is fossoil, which is what I'll use
another being mccoy but log trucks don't fit as well
I can't figure out how to compile my Java class files. Does anyone know if every class file must be fully decompiled or not?
what's the error?
Hey guys, I want to create a mod that basically adds some recipes for two different mods.
In essence I want to take weed from one mod and then a bong from another mod and allow them to be combinable. The problem is when I create a recipe using those items, the recipe does not even show up. My suspicion is that because I have not created said items in my mod already, even though they are loaded in the game, my recipe can not use items from outside itself.
I tried imports{} and added the modID names for those mods along with Base, but that was just a shot in the dark.
In summary: How would I make a recipe in a standalone mod, that uses items from another mod? Am I on the right track?
import the modules from the mod's item scripts, not the mod ids
Albion, I genuinely get excited when I see you typing. Thank you so much.
๐
Does anyone know why I can't place tiles directly next to my lots? https://i.gyazo.com/6362a62b260da6510dd75bcd411eadd9.mp4
I would imagine that all the Java files in the package you are touching should be decompiled but not the packages that you havenโt touched
Maybe try #mapping ?
What's the difference between StaticModel and WorldStaticModel for item defs?
import { ISContextMenu, ISTimedActionQueue, InventoryItem, _instanceof_, getSpecificPlayer, getText } from "@asledgehammer/pipewrench";
import { onFillInventoryObjectContextMenu, onFillWorldObjectContextMenu } from "@asledgehammer/pipewrench-events";
function onItemContextMenu(playerNum: number, context: ISContextMenu, items: any) {
const playerObj = getSpecificPlayer(playerNum);
for (const [_, item] of items as LuaTable<number, InventoryItem>) {
if (_instanceof_(item, "InventoryItem")) {
const itemFullType = item.getFullType();
if (itemFullType !== "Base.Axe") {
context.addOptionOnTop('hello', null, () => {
});
}
break;
}
else {
for (const [_, _item] of (item as any).items as LuaTable<number, InventoryItem>) {
if (_instanceof_(_item, "InventoryItem")) {
const itemFullType = _item.getFullType();
if (itemFullType !== "Base.Axe") {
context.addOptionOnTop('hello', null, () => {
});
}
break;
}
}
}
}
}
onFillInventoryObjectContextMenu.addListener(onItemContextMenu);
here is how i use it with pipewrench
beautiful
thanks
const [_, item] of items as LuaTable<number, InventoryItem> was the part I was missing, I got as close as const item of items and messing with that was driving me wild
ohhh, and I was using the wrong instanceof too so thanks for that snippet
๐
we often have to infer types using as to get the correct compiled result but it also gives the correct intelisense
so when i dev using pipewrench i still have a second vscode opens with the game base lua files to search for reference
yeah, I was trying that but I'm bad at converting between lua/ts still as I have no idea what I'm doing with lua. Hadn't even spotted the LuaTable in ts
Also you can change noImplicitAny to false in your tsconfig
lets say you want to assign something to the globals
(_G as any).something = something
with noImplicitAny: false you would just need to do:
_G.something = something
also when using game events:
// function will reload correctly when reloading the script
function onItemContextMenu() {}
onFillInventoryObjectContextMenu.addListener(onItemContextMenu);
its better to have the function outside (like that first example) instead of this next example:
// will not reload properly in game
onFillInventoryObjectContextMenu.addListener(function() {});
also if you want to define interface you can name those files .d.ts so they dont actually get compiled into an empty lua file in your dist
// file: src/my_mod/shared/person.d.ts
export interface IPerson {
name: string
age: number
}
noted all the above, thanks for your help ๐
Can I use Override = true for a recipe?
why not?
@thin hornet @fast galleon The doors that have just been opened for me.
The reason I was asking is there are several different mods that handle "Blacksmithing" differently. I wanted to recombine all the recipes to use any of their items but was worried I'd end up with 2 or 3 identical context menu options.
Now I shall
On books, the LvlSkillTrained = 1, is this the required skill to read it? Cos I see BookMetalWelding3 has LvlSkillTrained = 5
it's for giving xp multiplier from level 0, also used to choose the value of multiplier based on this.
oh hmm, how do those books handle the whole "not skilled enough to read it" thing?
ISReadABook.lua something like player skill < LvlSkillTrained - 1
hmm, so LvlSkillTrained gets used for multiple things?
true, ill try that
Anyone got a mod example of putting text above the character?
e.g. I want on using an item for it to say "Skill requirements not met" or something
Smoker and dynamic dialogue come to mind
thereโs a player:Say() that doesnt attract zombie attention afaik
you could have it trigger that on an event happening
๐ morning all. Does anyone know what language the scripts in the script/ folder are written in ? Screenshot attached for clarity.
The extension is .txt , but it's clearly something since there are modules and imports
Good morning.
mornin'
Hello guys ๐ hope you're fine.
Working on a new mod : do you know what chunkdata savegame files containing pls ? ๐
thanks
How do I delete an item from a player's inventory? As in, I want to destroy the item so it's gone
I see a few different ways/functions from other mods... Not sure which is best
I'm super struggling with lua tables, can anyone help me out?
testTable = {}
-- Game doesn't boot if I do it this way, not sure why
testTable["Entry"] = { perk = Perks.Woodwork, level = 1};
-- Saw a different mod wrap the perk in {}
testTable["Entry"] = { perk = { Perks.Woodwork }, level = 1};
-- Doing this causes an error though... How do I get `.perk` to be correct?
playerObj:getPerkLevel(testTable["Entry"].perk);
try replacing .perk with ["perk"]
Aren't they equivalent?
No, because in my limited experience thus far, lua does not have the concept of "properties" you would find in JS/TS
and the goofy workaround is to create a table mapping in place of it
hence testTable["Entry"]["perk"] should point at the correct table value now
rather than testTable["Entry"].perk
See albion's response, I need coffee
Hmm, so my issue is with something else but I can't figure out what ๐ค something to do with this perk system
Hello, if i place my mod in a file at "media/lua/server/". It's not working on a dรฉdicated server. Do you know why? Here is my code.
local MaxTime = 0
local ReanimationChance = 0
local function WakeUpSetup()
MinTime = SandboxVars.ZombieWakeUp.MinTime;
MaxTime = SandboxVars.ZombieWakeUp.MaxTime;
ReanimationChance = SandboxVars.ZombieWakeUp.ReanimationChance;
end
local function OnContainerUpdateWakeUp(zombie)
if zombie and instanceof(zombie, "IsoDeadBody") then
if ZombRand(1, 100) <= ReanimationChance then
if MaxTime < MinTime then
MaxTime = MinTime
end
local ReanimationTime = ZombRand(MinTime,MaxTime);
zombie:setReanimateTime(getGameTime():getWorldAgeHours() + ReanimationTime);
end
end
end
Events.OnGameStart.Add(WakeUpSetup);
Events.OnContainerUpdate.Add(OnContainerUpdateWakeUp);```
It's work fine in solo game.
Certain API and events don't work on the server-side.
Trace what's not firing or returning expected data by using prints.
If it doesn't work on the server, then you'll need to figure out how to implement what you want by executing or gathering info on the client and sending that to the server.
ok thx, like file in directory client. Grab event and call function server side?
Take a look at ServerCommand and ClientCommand
ok thx. I will go see this. Thx for your help.
No problem.
Just looked further in to the mod that's using perks in a table and uh... what
local perkobj = PerkLookup["Test"].perk[ZombRand(1, # PerkLookup["Test"].perk +1)];
they access the perk with [] and do a random number between 1 and the perk + 1... I do not follow
Though not sure what the # does
PerkLookup["Test"] = { perk = {Perks.Woodwork}} for reference
Oh right that's saying random between 1 and length of perk... What. That still doesn't make sense
it's because perk is a table
that code picks a random perk from that table (though there's only one so it always picks that one)
I guess I'm confused why PerkLookup["Test"] = { perk = Perks.Woodwork} (no {} around perk) bricks the game. I'm assuming that means what I really want in my code is just PerkLookup["Test"][1]
I'm eyeballing it,PerkLookup["Test"][1] returns nil
it returned the perk and worked
oh wait no
I sent the wrong message earlier, yeah
I meant PerkLookup["Test"]["perk"][1] - that got me what I wanted... The question falls back to why I need to wrap the perk in {} when creating the table otherwise it bricks the game. I assume my script is running too early or something.
When you're asking questions about an error it's good practice to indicate what the error was ๐
That's the thing: it wasn't giving me a proper one
just attempted index of non-table no stack
Can you show it? That's odd
-----------------------------------------
function: mGuv_LevelOverhaul_PerkDefinitions.lua -- file: mGuv_LevelOverhaul_PerkDefinitions.lua line # 2 | MOD: Matt's Brita Trade Overhaul
LOG : General , 1683991060031> attempted index of non-table
LOG : General , 1683991084832> EXITDEBUG: RenderThread.isCloseRequested 1
upon game booting
That was from the lines in this code? Excluding the first one?
mGuvLevelOverHaulPerkDefinitions = {};
mGuvLevelOverHaulPerkDefinitions["mGuv_LevelOverhaul_PerkUnlock_Aiming_1"] = { perk = Perks.Aiming, level = 1}
And how were you using it?
I'm assuming some information is missing here, because that's odd if it's truly just what you sent above
playerObj:LevelPerk(mGuvLevelOverHaulPerkDefinitions["mGuv_LevelOverhaul_PerkUnlock_Aiming_1"].perk, false)
all of this blows up
it works now I changed it to:
mGuvLevelOverHaulPerkDefinitions = {};
mGuvLevelOverHaulPerkDefinitions["mGuv_LevelOverhaul_PerkUnlock_Aiming_1"] = { perk = {Perks.Aiming}, level = 1}
--
playerObj:LevelPerk(mGuvLevelOverHaulPerkDefinitions["mGuv_LevelOverhaul_PerkUnlock_Aiming_1"].perk[1], false)
That shouldn't be necessary
My game doesn't even boot with the first mGuvLevelOverHaulPerkDefinitions I showed
Hangs on black screen with the error above in console.txt
When it refers to "line #2" in the error message, is that the line where you declare the table with the perk?
ye
I don't know if you care to figure it out since you have it working anyway, but I'm curious
I do care, because it's annoying and goes against everything I thought I understood ๐
That implies that Perks is potentially the problem, to me. Only other option is the table you just declared
If you set a variable with the value of Perks.Aiming or try printing it what happens?
So if you're in an executing script somewhere deeper, that works fine, as it's an instance of PerkFactory$Perk - the built in perk system
but for some reason, if you just have a loose .lua file that executes instantly.. it blows up
Yeah, just wondering whether you tried it on its own
Yeah, I used it loads before. This definition way I'm doing it is to cut down the code I need to write. As I'm generating lua/items/recipes via TypeScript
I thought it was a problem with my TS -> Lua chain, but it ended up being a lua/zomboid problem
I mean in this caseโlike, with the script that's currently giving you grief
Oh I see what you mean
one sec
I'm lost. It's suddenly working now
Well working as in, it's booting without errors
Not related; Reorganizing my tokenizer, my linter, and my formatter WIP code for the ZedScript vscode extension.
Okay, moment of truth. I reverted back to when it was all broken
Aaaand it's fine.
Now I'm very confused, haha.
I was manually editing workshop files at one point, I must have butchered something...
rip, use git versioning control.
^
Learning the complexity and process of linting language tokens these past months..
I'm now closer to writing my own languages.
Feels like a rite of passage. =P
I use git obsessively so we're all good there ๐ It's getting it work the first time I struggle with at the moment.
Is there anyway when using a keep item on a recipe, to lower the items Condition? And/or require a minimum condition?
If not, I can just add in my own item with a delta and use it like glue
OnTest and OnCreate functions
Annnnnyone know if there's frame calculations available to us in lua?
Good shout, bit more manual/lua than I'd like but perfect
like in unity there's a time.deltatime() function--anything similar in here?
One (bad) tip i can give is to use a OnTick event
that could still be useful for me
I mainly say its bad cause of performance issue for lowtier hardware aka mine
In what context? There are a few different methods
I don't know Zomboid but yeah, on tick events in general, depending on what you do in them can be killer for performance
There is a OnTick and OnRenderTick events
Context: I want to stop the player from sweating. There's a wetness increase global var listed in the vanilla lua files that i think is in charge of that, and printing the difference between oldWetness and currentWetness seems to be frame-dependent
In lieu of any actual, written functions that we have access to to stop sweating, my thought is in onPlayerUpdate I could do something like
if not getClimateController():isRaining
then
player:getBodyDamage():setWetness( player:getBodyDamage():getWetness() - 0.015 * time.DeltaTime())
(and for context 0.015 is the actual wetnessIncrease value, just didn't know how to reference it)
with the on tick method I could at least get closer to the value i'm expecting to see in testing per frame (i think frame) which is 0.015
Render code + Lua = disaster, IMO
I don't wanna mess with it too much, I just want the time between frames as made available by java
Would be cool if The UI API would allow for cached instruction calls or even better, render toggles for caching the result texture buffer.
Was working on a core mod to demonstrate this.

OnPlayerUpdate doesn't offer that as an argument, but you can keep track of the elapsed time yourself using getTimeInMillis or one of the other similarly-named functions
I think it may be possible to do what you're trying to do more accurately with Thermoregulator functions, but I'm not certain
the thermoregulator class is a big fucking mess ngl
Actually getTimeInMillis wouldn't work all that well because it doesn't factor in paused time, lemme take a quick look to see what doesn't do that
GameTime has some stuff that may be of use
getTimeInMillis + OnTickEvenPaused
Yeah, I've done something similar before, but if there's a cleaner way that'd be ideal imo
You're already inside of a pseudo Lua environment ran in Java, so don't blame yourself on optimization.
We still don't even have primitive data wrapper API for PZ.
Heck, Roblox has those.
I don't worry too much about optimization, but I do like to go with whatever option won't make future me say "why did I do this" and then sigh when reading the comment that tries to justify it
GameTime has a bunch of stuff for this
getMultiplier() is the main one, getRealworldSecondsSinceLastUpdate() and getMultipliedSecondsSinceLastUpdate() are pretty useful too
BET
thank you albion, once again lmao
what would this community do without you?
๐
Is this going to apply conditionally, or all the time?
If it's the latter it seems like you could just modify the value (that is, the WetnessIncrease value you referenced earlier)
Worth noting either way: looking at the code in ClothingWetness suggests that WetnessIncrease is a multiplier & not the final value which will be added to the wetness
Depends on the method you're calling
Looks like that's used as the maxTime for the craft actionโI'm uncertain what unit it is, but I think it's tied to game time rather than real time
Oh okay
I was just wondering because i'd like to make a sound file in time with it
but if I make it short will it just loop or play once?
oh cool I didn't realize
ISBuildAction.lua has an example of sound effects
thank you
getTimestampMs() for real time
May want to reply to the person asking instead ๐
Although I don't think they necessarily need real time anyhow; I said that because milliseconds were mentioned
I usually need it. That's also because I'm a freak.
I needed it when I was doing music stuff, but I don't think I've needed it in any other case
Ah, fair
The update() call for UI is intentionally slowed way down so I had to overstep that.
My fucking fingers can't do anything.
Was using render not an option?
I realized this when I was working on a React-based HTML solution for PZ UI.
You need to use it.
render() is fine.
Just know that it runs on the main UPS thread.
Interesting, I was wondering about such a thing a while back but didn't explore the thought
The HTML-based UI bit, I mean
I tore the UI engine apart to implement GLSL support.
It works, yeah.
CSS styling too, nice
You have to create any element you'd use here but.
It's totally doable.
It's a shelved project for the time being.
The skeleton for it is there to build on.
The plan was to make elements for buttons, check boxes, forms, etc.
I think that people would have a far easier time using web logic to make their UIs.
Agreed
Again, it's there and can be worked on by me or anyone.
I had more of a templating style in mind, but I have to admit the jsx is appealing
One more reason to join the Typescript bandwagon.
Someone's got to be the dark force in here.
TS is a non-canon way to mod PZ.
I see it as valid but choose to admire from afar
That's right, old guard.. Keep yer distance. >=)
More lore for the lore goblins.
Wish I had a vet badge. Been modding since '14. 
BTW RadialMenus in HTML would be insanely useful.
Is there an up to date resource for finding perk/trait names, etc?
This link on the modding page of the wiki is borked
I think I know one, one sec
btw anyone know how to knock a player onto the ground?
So for these, is it Perks.Perkname?
I apologize for the dumb questions, I'm new to this.
not sure
I'm new too
I'm looking through the game media file and I can't find any perk declarations
yes, i think that they are
I just found the perk name "Woodwork" referenced in the code
I'm not sure where they are defined, but those seem like the actual names
All right, I'll see if I can't get it figured out. Thanks for the help!
perks are defined in PerkFactory.java
the Perks enum should be on the reference site
I belive you can iterate the whole list
Im not sure but i might have the whole list here
#1070852229654917180 message
How hard is it to start learning how to make mods if you haven't used any language?
Or do you need to have learned another language?
If your looking for the full list lf traits
I think you can get by iterating over this
TraitFactory.getTraits():get(i)
do you know any programming
also does anyone know how to emit light with lua?
Hello. I'm trying to use sendCommandServer for making my mod working on server.
Actually my file shared is:
ServerCommands = {}
}
local function OnContainerUpdateWakeUp(zombie)
if isServer() then
ZombieWakeUp.ServerCommands.ZombieWakeUpServer(zombie)
end
end
Events.OnContainerUpdate.Add(OnContainerUpdateWakeUp);
return ZombieWakeUp```
And my file server is:
```local MinTime = 0
local MaxTime = 0
local ReanimationChance = 0
local function WakeUpSetup()
MinTime = SandboxVars.ZombieWakeUp.MinTime;
MaxTime = SandboxVars.ZombieWakeUp.MaxTime;
ReanimationChance = SandboxVars.ZombieWakeUp.ReanimationChance;
end
ZombieWakeUp.ServerCommands.ZombieWakeUpServer = function (zombie)
if zombie and instanceof(zombie, "IsoDeadBody") then
if ZombRand(1, 100) <= ReanimationChance then
if MaxTime < MinTime then
MaxTime = MinTime
end
local ReanimationTime = ZombRand(MinTime,MaxTime);
zombie:setReanimateTime(getGameTime():getWorldAgeHours() + ReanimationTime);
end
end
end
RegisterServerCommand("ZombieWakeUp", function(zombie)
if zombie then
ZombieWakeUp.ZombieWakeUpServer(zombie)
end
end)
Events.OnGameStart.Add(WakeUpSetup);```
But i get an error call nil server file at ```RegisterServerCommand("ZombieWakeUp", function(zombie)```
Anyone have a pist for resolve it? I ma doing something weird? I don't find many doc for help to understand how to use it.
thx in advance for your time and help.
what is registerservercommand?
i see on a forum, it's needed to register my new command. But i don't understand why. And i can't get it to work actually.
i think it might be something old or specific to someone's mod
you don't need to register server commands
check for getCell():addLamppost(...) and getCell():removeLamppost(...) this will add a static light source
thank you
local LightSource = IsoLightSource.new(x, y, z, r, g, b, radius)
getCell():addLamppost(LightSource)
๐
it wont be synced between players
so one way to handle this, is to add the light information to a square modData and when loading that square checking if there is info and recreating that light for the client
ok, I'll try that out
thank you
also just wondering if there is a way to reload scripts mid game, or do I need to reload the game each time
basically using Events.LoadGridsquare
which run everytime a square has been loaded into the client game
what about when the light is initially created, will it be triggered?
Hey, anyone have a guide for adding a context option to something? I want to be able to r-click the item, click the custom option, and have it trigger a function. Just not sure on the possibility of that
I know it is possible* I just dont know how lol
well i would transmit the light to all players when created dynamically. Then if the square exist in each client create it. otherwise it will load when the square is loaded
research Events.OnFillInventoryObjectContextMenu
there are many example in the base game lua code
thank you
one example:
local function RemoveItemContextOptions(player, context, items)
if not (isDebugEnabled() or (isClient() and (isAdmin() or getAccessLevel() ~= ""))) then return true; end
local container = nil
local resItems = {}
for i,v in ipairs(items) do
if not instanceof(v, "InventoryItem") then
for _, it in ipairs(v.items) do
resItems[it] = true
end
container = v.items[1]:getContainer()
else
resItems[v] = true
container = v:getContainer()
end
end
local listItems = {}
for v, _ in pairs(resItems) do
table.insert(listItems, v)
end
local removeOption = context:addDebugOption("Delete:")
local subMenuRemove = ISContextMenu:getNew(context)
context:addSubMenu(removeOption, subMenuRemove)
subMenuRemove:addOption("1 item", listItems[1], ISRemoveItemTool.removeItem, player)
subMenuRemove:addOption("selected", listItems, ISRemoveItemTool.removeItems, player)
end
Events.OnFillInventoryObjectContextMenu.Add(RemoveItemContextOptions)
also thanks for your guide on github
Thank you! That is very helpful <3
All you guys are awesome who help in here, just chipping in. I learnt more in 1 hour here and accelerated progression through the roof, than I ever did googling and reading the forums
Big props ๐ค
While I am here- Do you also know the formatting for the way custom pages are kept track of? I know it is a hashmap. Trying to find out if it the int is page number, and the string is the text on that page
Here is my lil list of a bunch of helpful links too <3
Oh nice, thanks.

to put a note that does not affect the code in notepad, wasn't it // ?
-- in lua
thx
Every other language it's // ๐
or # or ;
sql uses - -
SQL can use /* and #
Hello everyone. Can somebody share with me masks_basic_starter.psd ? Thx. :3
Hello good evening, I have an idea for a mod, if anyone wants to take this idea and run it feel free. But I wanted to make a mod for zomboid but I have no idea how to do it, could anyone help me?
The idea is to make a machine that, when energized, re-supplies all the sinks, showers, etc.. in an area
As if it were a generator, but with the purpose of water
That would be really difficult to localize :(
It would be possible to have something that requires maintenance / upkeep to reinstate the water/electricity for the map though. You would basically just set it up to take the sandbox setting for the water shut off, take the current world time, add a modifier to it, and then set that shutoff value to it
But also, does anyone know how PlayerEmoteState() is used? I am trying to make a function that will force the player to exit an emote. I presume I would use PlayerEmoteState():exit(). Possible for that to have some unitended effect? I dont want to interrupt normal game functions, just the literal emotes used in game to like wave
i think you need to change the player's state to something else
These are all of the methods for that class
It is an extension of the State class
you'd want to mess with the player's state machine not the state itself i think
player:changeState(IdleState.instance()) for example
But that would mess with the global state, which would be exactly what I wanna avoid- Since that'd break any sitting / fishing / timed action they were doing
I basically JUST want it to end any emotes
they're emoting at the same time?
I am helping a friend with a mod. It will trigger talking emotes when the player is typing
I am making an escape function
the player should only be in one state at a time
Alright, than is helpful. Do you know if there is a way to check to see if the player is emoting or if they are in any other state? It is going to be on a short timer, but I dont want that to accidentally end something like someone climbing a sheet rope immediately after typing or whatever lol
player:isCurrentState(stateObj)
So would I just use like player:isCurrentState(PlayerEmoteState)?
PlayerEmoteState.instance()
does anyone know if the vehicle door open, enter, exit and close timedactions are overwritten in mods frequently?
or by any large ones
If you overwrite while storing the old version it should be fine with other mods. But no, I don't imagine there's alot of car mods adding to the in-game events.
There a handful of mods that add animations to those. I've made a mod that adds carjacking and another that adds rolling out of the car.
thanks, I saved the old versions but I fully override the isValids because I need to change somehting within the function
i had a quick look at those functions and i don't see why you'd be forced to fully override them
Overwriting isvalids can actually be tricky
Or I may be overthinking it
But an earlier overwrite could pass the function as true
The default isvalids should only if into false and default to true
But that is the joy of mod-to-mod compatability ๐
there is a check in those isvalids that I want to remove
you can return true on the specific combinations of conditions that you want to overwrite instead of overwriting the entire function
returning true is a little problematic for mod compatibility but less so
#modeling try pin posts
Does this mod still work?, from what I had read from the comments it was broken
Iirc pao already patched this
I always admired this mod, but I thought it didn't work
this doesnt really plumb sinks
It just adds water to the sinks everytime you open context menu making them infinite water source (make sense cuz it require water tiles as water source)
So it means its tapped to a body of water. Thats the idea behind it.
Thank you. Im pretty certain client had us patch it so it should be working
I always thought, because you can turn the power back on. But it cannot build any machinery or repair the plumbing to have potable water again.
i'd be surprised if it's been patched considering that it has never received an update
Then i guess it wasnt .. maybe im thinking of repairable power grid. Sorry bout that
Hello! I am trying to add xp and traits to my professions and it decided to shoot me in the foot. If I add the trait function it won't add the trait and remove the entire description
I think it wasn't fixed, when I put it in a test save, and now I can't open the map

you are reassigning the same var name
YES, I just realized this on my own a few minutes ago but thank you regardless-
Can someone point me in the right direction of modifying vanilla skills
what do you want to modify about it
Specifically, I want to modify the modifiers for each level of the aiming skill
Well, skills are called Perk in the code. Perks only store the require xp needed to level up.
Also have a look at media\lua\server\XpSystem\XpUpdate.lua
So really what you are actually looking for is to find where aiming perk level actually effect aiming.
Would I be able to change the actual modifiers of the skill itself?
Like, per level?
yes, we just want to modify the values of the effects you get from each level of aiming
probably only possible with a java mod
public float getAimingMod() {
int var1 = this.getPerkLevel(PerkFactory.Perks.Aiming);
if (var1 == 1) {
return 1.1F;
} else if (var1 == 2) {
return 1.14F;
} else if (var1 == 3) {
return 1.18F;
} else if (var1 == 4) {
return 1.22F;
} else if (var1 == 5) {
return 1.26F;
} else if (var1 == 6) {
return 1.3F;
} else if (var1 == 7) {
return 1.34F;
} else if (var1 == 8) {
return 1.36F;
} else if (var1 == 9) {
return 1.4F;
} else {
return var1 == 10 ? 1.5F : 1.0F;
}
}
it is indeed hardcoded
thanks
tho i cant seem to find any usage example of getAimingMod anywhere
so not sure its in use atm
There are two getAimingMod, one from the player as reported by Konijima and one from the HandWeapon. As Konijima said, none of them is used in B41.78.16
hi! is there a way to add new java classes without replacing the original .class files?
Good morning, I have many doubts about how to create furniture, is there any tutorial?
If you have any doubt, you can find many tutorial.
https://www.google.com/search?q=project+zomboid+modding
I dont understand
You have doubts if jts doable?
Or you doubt yourself if you can do it?
Create furniture? You referring to vanilla?
Tilepicker/brush tool?
Moveable? Place item?
Or do you mean to create a tilesheet? Or a contextmenu thing like. Or
Similar to more builds?
We cant help u if we dont understand what you need
We cant even tell if youre end user asking for support or a modder

Can someone point me at a mod/how to for adding things to loot tables, specifically zombie drops?
I see one mod doing table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Item");, is that the right one?
I'm making a mod that uses crafting tables to make items, but I wanted to make something similar to the Vaccine mod, they made movables that can be used as a condition for recipes. I have no idea how to create a new piece of furniture through the mod, which is a lot to learn, I didn't want to do those creation tables by dropping the item on the table on the floor @ancient grail
There now thats alot clearer
First you need to learn to make tiles
Watch daddy dirk videos
Then you need a lua code for context menu
And detect the sprite when you rightclick
Use the event
OnFillWorldObjectContextMenu
Goodluck man
Oh and for the "dropping the jtem"
U need to make an item script that will define your moveable
I wanted to be able to build a table that would be used to craft items when approaching it. I know how to make recipes in script and in lua, except how to create new moveables, with textures made by me. Sorry for the bad english, it's not my native language
Nah the english isnt the problem
Its the missing info at first but now its all clear
Anyways yeah like i mentioned
Watch daddy dirk videos on youtube
Make the tiles
Thats the first part you need to do
I didn't know he had tutorials on youtube, I'm going to watch it now
1 make tilesheet
2 make moveable item
3 make context menu code
4 make main function
5 upload to workshop
6 share your success here so we can congratulate you
Its literally named tiles
Or custom tiles
thank you for your attention and help Glytch3r
If I want to add items to a zombie on death, I see there's a OnZombieDead event. My question is, I assume that script would need to be a server script?
Can it not be done with distributions?
I want a bit more logic behind it
and without interfering with existing tables
Hmm, though looking at other mods OnZombieDead is used always on the Client... Even Killcount does it and doesn't even filter what player killed it - so I assume that means the Client that kills the zombie, is the one that triggers it
if you go this way, know that vanilla loot is added a few ticks after this event to the dead body and that syncing containers from server is not the best.
but if you just add the item on zombie death it should be transferred to the dead body automatically
it all on depends on what you're trying to do with this
Literally just stuff some items in to the zombie
if there's no random involved you could have it in shared probably, but yes I think start with server only and see what happens
Is there a zomboid mod that enables respawn? Like in minecraft?
You die, loose your gear, but you also re-spawn at the bed
Cause if not I think I need to develop it myself
MP has the safehouse respawn, right?
Really?
ZombRand is Inclusive Min, Exclusive Max?
It's not with the same character, though (I think?)
Ahh, now that's different
See ISBuildMenu (media/lua/client/BuildingObjects/ISUI/ISBuildMenu.lua)โit's a context menu, which is created with ISContextMenu (under the hood, table with a metatable)
I see
Most build options are not data driven.
Is it just me or is the XP system really weird ๐ especially if you're manually setting it and leveling skills via code
it's not just you
I've seen Chuck say the same quite a few times
this sounds familiar
It scales with starting skill level.
Basically, I've added a way to get xp and spend it on skills... But right now, I'm trying to get carry over xp to work
----Perkboost values 0/1/2/3 - AddXP100: 25/100/133/166, 0 <= boost <= 3
say you level to 50/75 and you use my mod to go up a level, I wanted that 50 to then apply to the next level so it wasn't lost
but uh... it doesn't come back as 50, it comes back as like a fraction of that 50
there's an addxpnomultiplier or something
Yeah, I tried that and AddXP - they both did the same thing ๐ค
Is there still no working bicycle modification that lets us fold the bikes so we could use them as a spawn loadout?
https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.XP.html#AddXP(zombie.characters.skills.PerkFactory.Perk,float,boolean,boolean,boolean)
I think this was the one people used to get unaltered XP values.
declaration: package: zombie.characters, class: IsoGameCharacter, class: XP
I tried the one above, that just takes Perk,float - any idea on what I want for those three bools?
albion โ 12/12/2022 00:26
yeah
specifically the arguments are:
type: the perk
amount: the base amount of xp
callLua: whether to call the AddXP event
doXPBoost: whether to apply xp multipliers (other than strength/fitness protein boost)
remote: if false, send a packet to the server describing the xp change (too annoying to tell what this actually does)
albion โ 12/12/2022 00:42
you should just revert the protein bonus manually, it's pretty consistent
if proteins lie within a certain range, divide by 1.5, otherwise don't
oh, specifically: above 50 and below 300, xp is multiplied by 1.5, below -300, xp is multiplied by 0.7
Thanks, that seems to be working.
I just did false, false, false and now it's granting the right XP. About to test when I have boosts
Yup, all good.
No idea why that one works differently to the same named two parameter AddXP function.
im trying to create a health check for a function. There seems to be something wrong with "if player:getHealth() == player:getMaxHealth() then" line in this part of the code
function InjectPropital(items, result, player)
local char = player;
-- Check if the player's health is already at the maximum value
if player:getHealth() == player:getMaxHealth() then
print "Your at max health."
return
end
local bodyDamage = player:getBodyDamage()
local overallHealth = bodyDamage:getOverallBodyHealth()
i think its a value from 0 to 1 and if not, then probably 0 to 100
ok now i got that to work now to write the rest of the code
Long shot but it'd be super useful/time saving for me to debug: Does a "Firing Range" mod/map for Brita's Weapons exist anywhere? Basically just a big place full of all the guns, attachments, ammo, etc... And loads of zombies.
Trying to test stuff and that'd save me time spawning it all in manually
Godโฆ seeing Chuck try to explain how he was circumventing annoying aspects of the xp system made my brain hurt ๐ฆ so many weird interactionsโฆ
Hi, currently working on my first mod, I need some help. I'm trying to check what weapon does the player has
local function Advanced_EnhancementWeapon()
local player = getPlayer()
local weapon_current = player:getUseHandWeapon()
if weapon_current == "Pistol"
then player:Say("gun")
else player:Say("no gun")
end
end
Events.EveryOneMinute.Add(Advanced_EnhancementWeapon)
what am i doing wrong?
no errors showing btw
print('Hello, World!');
@uneven fractal try
getPrimaryHandItem() instead of the one you have. You can then make a statement that checks the items type, and then if it is a weapon, say/print the name
Hello, I would like to know if someone could help me.
I'm trying to make a survivor notes mod using images. In this case I wanted to use the maps you find during the game as a base but I'm racking my brain trying to get this to work right. Can anyone offer me a basis to continue my project?
like this
Authentic Z does this with the zombie checklist stuff. You might be able to find your solution looking under the hood there
If I had to guess, there is probably some designated png location for the maps, and you just tell the map what image to use. Not 100% on that- but checking out that mod is probably your best place to start IMO
how can i paste code with darker background so it doesn't take much space?
paste here of course
lol
@uneven fractal if you surround it in a set of ``` on either side itโll be a code block
You can do inline code with just a single ` on either side
thanks, i'm on esp keyboard distribution so I don't have that character by default
so what i need to do is to check what weapon am i using everytime I equip an item in my primary. Is there an event for when I equip smth or do i need to check manually using Events.EveryTenMinutes.Add for example?
so when i use that event testing with player:say if i equip a weapon it says two times, unlike unequiping where it says one time
any ideas?
Can you post your full code w/ the current changes?
AETest = AETest
local function Advanced_EnhancementCheck()
local player = getPlayer()
player:Say("Working!")
end
Events.OnEquipPrimary.Add(Advanced_EnhancementCheck)
i know i can use print but player:say is easier to see
local function Advanced_EnhancementWeapon()
local player = getPlayer()
local weapon_current = player:getPrimaryHandItem()
if weapon_current and (weapon_current:getItemsFromCategory() == "Weapon" or weapon_current:isRanged()) then
player:Say("Gun")
else
player:Say("No Gun")
end
end
Events.EveryOneMinute.Add(Advanced_EnhancementWeapon)
Hello! Not sure if this is the right place to ask, but looking to get some clothing commissions done. Anyone available for that?
local function Advanced_EnhancementWeapon(player, weapon_current)
if weapon_current and (weapon_current:getItemsFromCategory() == "Weapon" or weapon_current:isRanged()) then
player:Say("Gun")
else
player:Say("No Gun")
end
end
Events.OnEquipPrimary.Add(Advanced_EnhancementWeapon)
@granite arch the modeling channel might be a bit better for your search :)
there you go
hi
we do commission
link is on my profile
Thanks!
it's giving me errors
maybe my syntax is wwerong
local function Advanced_EnhancementWeapon(player, weapon_current)
if weapon_current and weapon_current:isRanged() then
player:Say("Gun")
else
player:Say("No Gun")
end
end
Events.OnEquipPrimary.Add(Advanced_EnhancementWeapon)
try this
this one works fine, thank you!

so whats the difference between stating weapon_current like that and doing local weapon_current?
the event passes the player and weapon so it's a waste to get it yourself when it's already provided
what i mean is, when are you saying that player = getPlayer()? for example
you aren't, the OnEquipPrimary event provides the player and the weapon to any function you add to it
hmm i can't seem to understand, so for example if i want to add a variable that stores the name of the weapon i'm currently holding how can i do that in the same function?
Events has set of params they already have
Lile on player update give you player
So you dont need to getPlayer()
Try getName()
Or
getDisplayName()
so should i do it like local variable = getName() or add it to player, weapon_current?
well my game seems to be bugged cause i tried your code again and it isn't working correctly, saying "no gun" and "gun" at the same time
I feel a tad bit silly, what bit of this code would be the one PZ uses to give the trait an Icon?
weapon_current:getName()
doesn't work
also any ideas on this?
Is there a more precise timestamp I can get than getTimestampMs()?
No. TIS doesn't forward nanoTime()
Making progress on my linter.
I'm using ruleset tables to define where things should be.
export const SCOPE_RULES: { [word: string]: LintScopeRules[] } = {
module: [{ scope: 'root', title: 'word', body: 'scope_only' }],
imports: [{ scope: 'root.module', body: 'imports'}],
/** ANIMATION **************************************************** */
animation: [{ scope: 'root.module', title: 'word', body: '=' }],
copyframe: [{ scope: 'root.module.animation', body: '=' }],
copyframes: [{ scope: 'root.module.animation', body: '=' }],
};
Same with properties:
export const PROP_RULES: { [word: string]: LintPropertyRules[] } = {
frame: [
{ scope: 'root.module.animation.copyframe', type: 'int' },
{ scope: 'root.module.animation.copyframes', type: 'int' },
],
source: [
{ scope: 'root.module.animation.copyframe', type: 'string' },
{ scope: 'root.module.animation.copyframes', type: 'string' },
],
sourceFrame: [{ scope: 'root.module.animation.copyframe', type: 'int' }],
sourceFrame1: [{ scope: 'root.module.animation.copyframes', type: 'int' }],
sourceFrame2: [{ scope: 'root.module.animation.copyframes', type: 'int' }],
};
I've learned a lot from trying to make a working linter for the past month and a half. The best approach I know right now is to split up syntax linting to phases.
So if anyone ever goes down this road in life for programming, break your stuff up into phases or separate runes in sequence.
The way I went about it this time is:
- Check for curly braces to be even. The EOF should have a value of 0 when incrementing { and decrementing }.
- Check for scope blocks. (entity { ... }) and make sure they follow basic rules and position inside of nested scopes.
- (Working to get here) Property rules and their positions as well. Also value type checks. =)
The phases helps assert that prior phases passed which means I don't need to compile all linting logic into one loop which is the nightmare I endured for almost two months now.
=)
@frank elbow
It gets to be fun when you get to a place that can finally show simple pictures as what's been worked on, rather than endless ranting about failures.
I save my endless ranting about failures for smaller friend groups so, outside of those groups, it seems like I know exactly what I'm doing
Nice to see the linter coming along
Yeah. If I knew this info 2-3 months ago, this plugin would be further along.
This is the third rewrite, meaning there were four attempts at this one component.
Anywho. Taking a break.
I am hugely stuck at the point of trying to add traits to my mod- I'm not sure what has gone wrong here so uh, have at me people who are more capable
what is wrong with it?
What ends up happening is that when I go to use it... nothing happens, and if that is it-
whats the path of your file?
Oh no, I know the program works because I have this section of the code in the same file which works perfectly, the addition of the second bit of code is the thing that's messing up (and I'm not sure if it's because it's sharing a file)
Here is the path anyways
You're adding perks as traits? Or am i just too sleepy to understand the code (or anything else...)
I am adding perks as traits, yes- the plan is to make them choose between them as a sorta starter
Oh my god it really just was this...
okay, I'm going to just check over for typos. Because that's clearly just the issue and not some bigger thing, thank you for the help!
hi everyone, i've written a script to generate EmmyLua documentation for events:
the event data has been rewritten from scratch and should be more accurate than the ones on the wiki, and it includes the events added since the wiki was last updated
if you're interested, you can downloaded the generated files here, and then add them to your IDE as a library: https://github.com/demiurgeQuantified/PZEventDoc/releases
it's not exactly a plugin but that works
Love that client only is included in the schema. I'll have to modify the script a bit for the LuaLS fork's annotations but def putting that to good use, thanks albion
i'm interested to see exactly what's different, a future idea was a command line argument or something to change annotation styles
Mainly the deprecated annotation: https://github.com/LuaLS/lua-language-server/wiki/Annotations#deprecated
Plus I'll prob just change around the format a bit to match how I usually doc
Can it be downloaded from the vscode extensions
ooh, i think i could safely add that and emmy would ignore it
it's not an extension, it's more like a single file library
If you're using lua-language-server, you can include it as a library in the workspace. See https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace
personally i'm just dropping it into zdoc's library folder but you can load it standalone as a library too
Take note im not IT
So i have no idea whats really going on im just here to support hehe
Oh, one other thing for LuaCATS annots; a ---@meta comment at the top tells it to not run diagnostics on the file. I can create a PR that adds those (maybe with a flag for whether to include them?) if you'd like
it seems like emmylua will just ignore them, so it should be fine to just drop them in
Zdoc where is this
zdoc is the library capsid generates
Made the PR
merged, thanks for the help!
would anyone be able to help me make a mod to automatically announce messages and player locations over the radio?
finally learned enough about the process to finish my first mod
Is there a tutorial to adding IDEs to visual code studio, i'm new to it-
Is there a way to have clothing glow? Or do you guys think the neck collar wouldn't have enough light to have a glow?
i also wanted to make the protosuit mod glow but i couldnt find anything i can use
visual studio code is an IDE, if you want to add this as a library you can download Events.lua, place it in a folder anywhere, and then add the path to that folder as a library in the lua extension's settings
Ooooh okay, thank you-
i'll probably write up a proper guide on how to use it at some point since i feel most new modders won't know how to do that either
Yeah, I haven't ever touched Visual Code Studio's settings so...
I dunno what I'm doing
aww man, maybe in the future
Just for anyone who's trying to add these events and are extremely fresh to coding like I am
Download the LUA extension by sumneko and add it that way
I'm having some trouble getting Override:true, to work.
I have a recipe from one mod, and a duplicate recipe in my integration fix. I used Override:true, on my mod to override the default mods recipe.
It works on one item, but not on others.
What considerations might I be missing? How does Override check to see if the recipes are the same? If they have different ingredients will that consider it a different recipe altogether?
Figured out my issue: Like a dummy, I wasn't paying attention to the fact that there were multiple recipes with the same name but different ingredients. So using override for them was simply taking the last one or something similar to that.
I'll have to create a custom Category:Omni Metalworking, that will store all of my modified recipes.
has anyone noticed that so many modding guides on steam are missing with this error (from the how to make a clothing mod guide):
Probably means they're outdated.
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid. Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Ble...
Use the top one for like the setup and stuff
It's hard to get into the clothing stuff, it's easier once you figure out what ya need though.
yep, I'm experienced with blender but the exactly stuff for zomboid is confusing
this will really help, thank you
I know blender but ngl this was...a bit much to figure out lol
Hey plungers, saying this just in-case you don't know. #modeling Is a place to focus more on the modeling side of modding. =)
It's fine to talk it here. Be mindful though if the discussions on modeling get lengthy or busy.
Does anyone know off the top of their head how Crafting Window Tabs are sorted? Doesn't seem to be alphabetical. Is it load order?
Hi, I try to add worn clothes to zombies. inventoryItem = InventoryItemFactory.CreateItem('Base.Boilersuit_Flying') local strName = inventoryItem:getBodyLocation() zombie:getWornItems():setItem(strName,inventoryItem) anyone can point me in the right direction ?
this failed ๐
an outfit ๐ฆ I want to avoid that
you can change the visual but it won't be saved
try adding zed:resetModelNextFrame() to see changes
thx
but the exact clothes with color is kept among saves, so it must be stored somewhere.. (the outfit has randomness that is not reroll at reload time)
I must be failing greatly, even with zed:resetModelNextFrame() I do not get the expected clothes
Thanx a lot anyway ๐
zxTest = zxTest or addZombiesInOutfit(x,y,z,1,"Naked",100):get(0)
local zed = zxTest
---[[ add worn item
zed:setReanimatedPlayer(true)
local duffel = InventoryItemFactory.CreateItem("Base.Bag_DuffelBag")
zed:getInventory():AddItem(duffel)
zed:setWornItem(duffel:canBeEquipped(),duffel)
--zed:resetModelNextFrame()
--]]
--[[ add new ItemVisual
local iv = ItemVisual:new()
iv:setItemType("Base.Bag_DuffelBag")
zed:getItemVisuals():add(iv)
zed:resetModelNextFrame()
--]]
ItemVisual definitely doesn't save though
there's PersistentOutfits.Data but it's not exposed
Is there a way to change voice chat distance during gameplay?
Like for example whisper mode so only players near me can hear me
@mellow frigate works if you set them as reanimated
thanx. And then do I have to rebuild the whole outfit ?
hm, there's probably a command for that if it's not initialized
anybody explains
zombie.network.GameServer
Hey all, what's the 'proper' way to allow people to configure your mod? I see so many mods use different solutions (or other mods) that now I'm not sure who to follow
i think most of the time people use sandbox options to let the user change something like spawn rates and such
Depends on the type of configuration.
For user preference stuff I'd recommend the Mod Options mod.
For settings that effect game balance and should be the same for every player in an online context, I'd go with sandbox options.
https://steamcommunity.com/profiles/76561199131666750/myworkshopfiles/?appid=108600 Ya'll modders gon' luuuuuv this
lol at best he doesn't understand that he uploaded these publicly not privately; at normal, he doesn't understand intellectual property and etiquette; at worst, he knows but doesn't give a fk
Anyone know what all the weird [H] tags are for Brita firing modes?
Like guns can be Single fire or Single[H], there's others too
Most translations done this way are doing it out of perceived necessity -- I've seen worse implementations that are 1 giant collection of actual mods.
๐ง I could add a translation branch to community projects :0
hello
does anybody know a mod that can increase the generators range?
does anyone have an idea of where to look at the base game health regeneration
CalculateStats
what file would that be under
Look for OveralHealth
You can manually regen your player no need to hook to the actual regen functions
nerd
im trying to make it an over time thing and its being a pain in the ass
Theres already a translation category right
I have this code
But im afk
damn
this is what i have so far
function InjectPropital(items, result, player)
local char = player
local bodyDamage = player:getBodyDamage()
local overallHealth = bodyDamage:getGeneralHealth()
local maxHealth = 100.0f
local addHealth = 10.0f
-- Check if the player's health is already at the maximum value
if overallHealth == maxHealth then
print "Your at max health"
return
end
-- Define the function that heals the player up to max health over time
local function addHealthOverTime(amount, interval)
while overallHealth < maxHealth do
end
end
end
untested, but this is how i would approach it:```lua
local function addHealthOverTime(player, amount, seconds)
local bodyDamage = player:getBodyDamage()
local gameTime = getGameTime()
local rate = amount / seconds
local healthAdded = 0
local function doAddHealthOverTime()
if seconds <= 0 or healthAdded >= amount then
Events.OnTick.Remove(doAddHealthOverTime)
return
end
local delta = gameTime:getMultipliedSecondsSinceLastUpdate()
seconds = seconds - delta
local addAmount = math.min(rate * delta, amount - healthAdded)
healthAdded = healthAdded + addAmount
bodyDamage:AddGeneralHealth(addAmount)
end
Events.OnTick.Add(doAddHealthOverTime)
end
Iโm surprised the armor isnโt made with 300 Stuart Little mice as the bullet fodder
lmfaoooo
There's a patch - but thats more to do with fixing issues in the Lua
A translation patch would be to support mods that may not have translations or a means to translate it
Offers a place to update them too
This is also kind of how the base game handles it
is OnCreatePlayer the event for doing anything for when a character is freshly made?
not 'freshly made', it fires every time that player loads in
are there any cool lua guides that are not on the wiki for whatever reason?
cheers
@bronze yoke You said that you're rewriting events documentation, correct?
i'm pretty much done with rewriting event documentation
That's a lot of docs. You must've been at it for a bit.
there's some misc TODOs and i haven't covered a couple of the steam integration ones but nothing important is missing
Do you have this available for the public?
no, it isn't
Hmm...
Looks like I have some grunt work to do. Transforming this to work with the PZWIki code by co` will be useful. (Also PipeWrench-Events)
yeah, i would've written parameter descriptions like the wiki has but it didn't really have an application for annotations
and i'm sure there's other differences too
I chose to act because the current official documentation via the PZWiki portal is factually incorrect in areas.
It affects my products as well.
yeah, that was why i decided to write mine from scratch, the wiki's is unreliable and i wouldn't necessarily know every place that it was wrong
When we get this documentation forwarded to the PZWiki tool format, I can pull the trigger.
Hi, dumb question. How can I leave comments in my code without messing it up?
prefix the comment with --
Wait really? If so, the more traits mod looks wrong.
thx
Oh, is it OnNewGame for a new player?
yeah!
Thanks
@gilded hawk have you seen this
did you gave em permission
https://steamcommunity.com/sharedfiles/filedetails/?id=2975587874
Yeah everyone can make settings for their own server
And to stop this massive spam of mods, it's why im slowly remaking the transmog mod
its ok if it requires your mod
Yeah it's okay but it's also stupid. That version of the mod I made was poorly implemented and did not really need to make an extra mod to do the transmog. It was shit code I wrote in a very shit state of mind.
dont be so hard on yourself bud its a popular mod
Is there any easy way to find recipes that are unique to mods?
Hi, all!
Someone knows any guide to upload created mods to Steam Whorkshop? ๐ฎ
I never seen this fuction addItemOnServer what does it do?
And should i use it instead of addItem?
if you are adding an item to a container from the client, and it's not the client's inventory, yes
Hopefully with the inventory changes that's all streamlined a bit internally
you also have to removeitemonsever for the inverse
and as per the vanilla lua you should confirm if it's in a player or not
anyone know where I can get larger icons of like the hunger moodlet/waterbootle icon ect
most are 32x32
but need bigger ones
this is pretty neat. Any chance to get the documentation outputted as plain-text?
I'm looking at an older mod... is this an actual function in base PZ? getPlayerData()
I know there is getSpecificPlayer() and getPlayer()
yeah, playerdata is lua
the code for it is weird and it didn't seem used very often so i never really worked out what it's for
getPlayer gets the player to the current client - I presume its the same as getspecificplayer(0) which uses IDs as the argument/parameter
I honestly don't test co-op ๐คทโโ๏ธ
Holy shit I nailed the transmog in MP
It works without external mods, and it keeps itself updated up to 5k new clothings
Nice!
Damn I really needed this win to turn a bad monday into a good one
Legit confusing me, because both functions appear to work identically... but one is documented but the other, I can't find.
thanks the replies!
getPlayer() always gets player 0, getSpecificPlayer(index) gets player 0-3 depending on the value passed
there might be more to it that i'm not seeing, but it seems like playerdata is just used to keep track of each splitscreen player's ui objects
currently making custom professions with profession framework, i'm making one with nothing under the xp = [perk.] etc.
How do i make it not have an empty box on the tooltip when i mouse over my profession
i think just don't include xp at all instead of leaving it empty
i excluded it
its a profession with no skill bonuses or traits
it doesnt affect anything besides being annoying, just wanted to see if there was a way to avoid that
@bronze yoke Responded to the issues on PZEventDoc with some info (too lazy to create a PR atm & likely will continue to be too lazy/busy until the weekend ๐)
i also have another question
does anyone have the names of the clothing slots for professions? in the readme for profession framework i see tshirt and pants
thanks for that! i'll look it over and add to the schema when i get a moment
Does anyone have any suggestions about hiding items in the inventory view? Or a code snippet to share?
I need to hide my transmog items
I am trying to use this in profession framework:
replace bool value, completely replaces all vanilla clothing options (default false)
Where would i put it in this?
clothing = {
Hat = {"UndeadSurvivor.StalkerCloakDOWN"},
Tshirt = {"YakiMakeshift.Makeshift_Shirt_Rogue"},
Pants = {"UndeadSurvivor.StalkerTrousers"},
Hands = {"UndeadSurvivor.StalkerGloves"},
Shoes = {"UndeadSurvivor.StalkerBoots"},
},
Just starting to read all that guides. Can you actually debug mods in game?
what do you mean by that
I add the game as a non-steam game then I add -debug to my launch options. So I start the game in debug mode.
Then you can press F11 to open the debugger.
You then have a console to test lua in the game
and a way to reload scripts
Is there a way to replace the sandbox option of a mod with an addon? For example:
In sandbox options, the mod page shows as "mod" and if I enable an addon the page changes to "addon"
you could try loading your addon mod after and using the same sandbox options names
but if its only for a translation text you can just override it in the Translate/EN/Sandbox_EN.txt
Well, I managed to put new options from my addon to the mod's sandbox settings but for some reason I'm not able to rename the mod's page name
nvm i did it, thx
I may write a forum post regarding the request for primitive type support for Lua in PZ.
That can help with both overhead and complicated solutions requiring a lot of data.
Clothing can have different textures for male and female right?
you can but not how you think. You can use different models with different UVs on the textures that you want.
Thank you!
Hello everybody
Into my mod i want to add mod items which PZ can choose to place into crates like every other items.
It's about military stuff, so i check everywhere PZ put military stuff and copy it.
I use this code (for example, for a Flecktarn Jacket) :
table.insert(ProceduralDistributions["list"]["ArmySurplusOutfit"].items, "Base.JacketFlecktarnGreen");
table.insert(ProceduralDistributions["list"]["ArmySurplusOutfit"].items, 3);
Problem is : i think that doing this with 15 jackets and 15 trousers and a lot of more stuff, with this commande, add items to the vanilla stuff, it result with MORE and MORE items into crates and everything.
But i want that game could choose my moded items, not spawn in additionnal of vanilla items.
Do you think there is another solution to do more like this ? ๐
I'm still new to modding but in theory, it's just a lua table, so you should be able to clear that index by assinging it to {}, wouldn't stop other mods/later loads also inserting in to tha ttable.
Or you could make your own distribution and somehow update loot zones to use that distribution instead (Unsure how to do this, or if it's possible that way)
yeah, the game rolls for every possible item individually, so more possible items = more items per container on average
that's why the spawn rates in large true music packs get out of control
in the past i've reduced the chance of all items in the container to drag the average back down
I just see most people set their item to 200 and blow the weights out the water lol
every number only affects the specific item, everything is rolled individually.
Wait, as in, "rolls 3" on a table means, it checks every item 3 times if it should spawn?
so if you had perfect luck, the container would have 3 * itemsInTable items in it?
Hi, I want to identify a moveable at runtime. e.g. I want to identify a poster or a mirror on the wall. When I look at all IsoObjects on the square I only got that object name: walls_interior_house_02_49 (I do not count the floor). Any idea on how I can get the poster / mirror object ?
So you want to know if the isoObject is the one with the specific sprite name?
I want to know if there is a mirror on the wall. I got the square.
I parsed the objects and did not found an,ything that I could identify as a mirror.
Thank you @bronze yoke @novel swallow and @fast galleon โค๏ธ
i don't think so because some vanilla values are like 0.5 or 0.2
weird
You know the F2 key, Chunk Debugger feature?
no
Press F2 and put your mouse on the tile
you'll have got the list of tiles on the left of your screen ๐
maybe you'll find you mirror tile
Thanx. That may be of use in the future ๐ But It gives only the name for the wall.
I guess it could be in attached sprites then.
isoObject:getAttachedAnimSprite()
declaration: package: zombie.iso, class: IsoObject
it's not an overlay, is it?
@mellow frigate
select object and a list of attached sprites appears
yes, thanx
it is indeed an attached sprite: walls_decoration_01_9
is there a tool to view all walls_decoration_* ?
oh also in-game tiles picker UI
and North wall decorations are attached sprite. while West wall decorations are IsoObjects (at least under the F2 chunk debugger)
It might depend on the way they are spawned?
Reminds me of how not all doors are IsoDoor ๐ค
Might be a mapping thing.
Maybe but in this case I spawned them all with the brush tool. (except the initial mirror I installed 'as a player')
I'm wrong, you're correct. those spawned with the brush tool are IsoObjects. while those installed manually are attached sprite, as you suggested !
yes, walls_decoration_01_8 should be attached according to the properties it has
So I'm trying to change the intro text the "this is how you died" I did everything correctly I think but the game won't detect the mod.info
How do we get the square behind the player again?
Which folder is it in?
My naรฏve answer is getting their position & facing direction and figuring it out from there, if there's not an existing method for it
Hm..i bet i need to to add the directions to a table
Like if north then south
But i was really hoping for a mathematical way to get 180 degrees
declaration: package: zombie.iso, enum: IsoDirections
Do I have to bump the version number to trigger a redownload of my workshop item?
If so, what format does that use? Is it just semver?
or incremental, given it starts at 1 lol
As I uploaded a change to my mod but my subscribed copy isn't updating, I still see the old version
anyone know if build 42 will have a big change to the UI or no
trying to make an intro sequence and i can't do that with how the UI is currently
How can I create presets with custom options like "Six Months Later" or "Apocalypse"?
https://projectzomboid.com/modding/zombie/SandboxOptions.html#savePresetFile(java.lang.String)
I have no example and that's not exactly how the defaults are made.
declaration: package: zombie, class: SandboxOptions
thx i'll check it out
I have the feeling that notloc is having a hard time adapting the mod to multiplayer, but as I don't know about it, I can't say for sure.
I wonder if it is more difficult to make something for multiplayer than for 1 player.

UI is client sided - the only thing he has to worry about is calling the correct add and removes
Is there a way to play the level up noise?
The doom banjo shouldn't sound as playful IMO.
The doom banjo must only be played in depressing melodies.
well I played getPlayer():playSoundLocal("levelup"); and it worked but... that wasn't the noise I was expecting haha. Ah it's GainExperienceLevel
how to delete an item? like additem just the opposite
for example, after I eat something - this item goes to the same place ... how can I do this?
Is there documentation for Events.OnRenderTick? I see Add(), but is there a Delete() or Remove()?
there is a Remove() for events in general
Thanks, I'll give a try now because a function being called unconditionally onRenderTick is terrible for performance...
Im currently afk. You can just mpdify my snippet
delete everything from your inventory
local inv = getPlayer():getInventory()
for i = inv:getItems():size() - 1, 0, -1 do
local item = inv:getItems():get(i)
inv:DoRemoveItem(item);
end
getPlayerLoot(0):refreshBackpacks()
thanks)
if you want to delete everything from a container just use removeAllItems()
if you want to remove items from anywhere but the player's inventory use removeItemOnServer(item)
Question for you all. Is it possible to slow the time taken for certain timed actions without having to hook into each one?
Like could I hook into the base ISBaseTimedAction and do something like
if ISBaseTimedAction == "ISUnbarricadeAction"
then
self.maxTime = self.maxTime * 1.2
end
or better yet
if unwieldyHandsSlowedTimedActions.contains(this.ISBaseTimedAction)
then
self.maxTime = self.maxTime * 1.2
end
as long as the method you hook into doesn't get overwritten by those actions
if self.Type == "ISUnbarricadeAction"
it seems like vanilla already does something similar in ISBaseTimedAction:create()
so i would go for that one
My quest system and a stalker quests pack are now public. https://steamcommunity.com/sharedfiles/filedetails/?id=2953552945
Awesome you did a quest system that does not require to replace java code.
for the workshop mod should It be called contents or media
Uhhhh, yes.... why would it?
There is already a quest system by Oneline that has that requirement https://steamcommunity.com/sharedfiles/filedetails/?id=2793385743&searchtext=quest
Ohhhh, I didn't know that system required java changes...... maybe that is why it didn't work properly for servers?
Example Mod?
that also works lol
I was looking at that too
when ZombRand(100) is called, is it between 0 and 100? or 1 and 100?
curses... well, I better use the overloaded version with 2 parameters then... (min, max)
That should be what you'd want.
PZ utils are whacky because it mainly caters to Lua code.
I'm used to 0-index.
Thinking in Lua gives me brain scars.
=P
Yeah I wanted to make sure this actually makes sense...
local isSpawning = (spawnChanceVal > ZombRand(0, 100)); -- spawn if spawnChanceVal is greater than the random roll between 0 and 100.
[0,100[
so that little comparison operation means a value of 5 is actually 5 percent chance spawning.
so i hope
-_-
I do nextDouble() >= 0.05
thanks for clarifying, but I'll update the existing code to use 2 values so I won't be confused in the future.
or was it nextFloat()?
If a decimal is going to be 0-1 I don't have to waste CPU time flooring or integer-transforming the value.
local function coin()
if ZombRand(1) ==1 then
return true
end
end
Oh yeah slrey
slrey???
Im carry my kid
Am lost.
Just drop the phone glitcher. It's all good.
Curses.
what
Oh and before you ask, it's modeled after 5.1 Lua, so no bitwise.

well, I'll give it a twirl; gonna update the code and try running it in PZ.
Error
kahlua does have a math lib, it just doesn't have the random functions
I think this was a modification via TIS.
They're really picky about what PRNGs are used.
(I've had this convo a few times in the past)
Added a mod to servers that allowed for using medium to low-quality PRNGs so that the tick time on the server lowered.
i'm actually looking into what's available right now, never seen it before but newrandom():random() is an alternative to zombrand
ZombRand calls an instance of a maths PRNG which is a high-quality, typically used for things like casinos or higher-security.
Hey all absolute newb questions. I started developing a mod and obviously I want to test it. How should my folder structure be? Says it needs preview png file yet I do and it doesnโt recognize it. Iโm pretty sure the image isnโt actually a problem because I just threw one from an already exiting mod as a place holder
looks like you're missing a mod.info file
In windows, you can grab a copy from the example mod and edit it for your mod
not sure how you would do it on a mac.
preview.png should be in whatevenisthis
You can test by putting
MODNAME/media/ etc into
Users/YOURNAME/Zomboid/Mods
I believe instead. Installing mods the "Zomboid way" rather than workshop.
i would say just don't do the workshop file structure until you're ready to upload
work from mods instead
you'll need a preview.png and a workshop.txt and stuff if you work from workshop
I tried that too. And it told me that only folders are allowed in Contents/
that's because it should be Contents/mods/myMod
the preview was right so it went onto the next error
I copied and pasted a working mod CustomizableWoodWeight
with Contents/mod/whatevermod
Workshop/myMod/Contents/mods/myMod
Question. Instead of hooking into a function, could i... add an overload instead?
this is why i recommended working from mods/ instead of Workshop/, you don't have to deal with the weird file structure until you're ready to upload
There are a few more odd Kahlua-isms that I didn't see documented anywhere
there's quite a few, i started working through them earlier
I wrote a quick type stub for them that doesn't actually document anything other than types
i just might do that. i was expecting to get stuck early on but not this early. thanks
not even tis seem to know about them, some of them are redundant with luautils
Yeah, I noticed the same thing. I was a bit concerned about the serialize one since it doesn't handle recursive tables, but then again hardly anyone knows about it so I don't think it'd be used naively
Included the type stub up here: #mod_development message


The grid itself was by far the largest time sink in my render
