#mod_development
1 messages ยท Page 206 of 1
Anyone willing to do a remington 700 commission just to replace the skin of the msr700 and msr788? I want to keep the rest of the stats and magazine capacity and stuff vanilla
Thank you from the future ๐ I'm gonna try this out later
@valid steppe I saw another PZ discord with a channel for commission requests, will dm
Sweet thanks
Iโm looking to get into modding. I would like to start with changing pill durations like to antidepressants from two hours to three hours. I opened up the script file for items, I didnโt see a line in the code under antidepressants that was for duration. Can anyone point me in the right direction?
try search in lua folder
notepad++, ctrl + F
Is there a way to ask devs a question without tagging them?
Need to know what is the exact load order of lua files.
Wild guess is that anything in base media/lua is loaded first but I have to know if it is true.
you don't need to ping devs for this, you need to use search or check the logs
I'm not overriding the whole lua file, I want to access and modify existing IS objects in their Lua
But according to log it does seem to be that way
@nova socket
looking for the file that governs reloading skill XP 
can somebody pin that, that is actually helpful asf
found it.
lua > client > TimedActions > ISLoadBulletsInMagazine.lua
Hey guys! Can you help me out, please? I'm a real newbie at pz modding. I need to spawn a car and some items on the first launch of a server. I've found the functions I need already, but what event should I use?
How does a campfire make ashes and in which file to search for this function?
maybe try OnInitWorld?
I vaguely recall discussing zombie and custom AI here a while back, did someone figure out how to track zombies consistently without using outfitIDs?
Wish discord had personal pins
I know you can retain modData using reanimatedPlayer but being this could be for alot of zombies, that will tank the savefile size.
Also, looking through the java a bit to see if there's anything abusable - I don't see a place where zombie modData is thrown out.
When you need to spawn it will determine the way of doing.
Because you cannot just spawn anything in unloaded areas
Seems like the zombies are calling load() using super. all the way to objects which have their modData saved ๐ค
I wonder if the modData is getting saved, and just not recovered due to object IDs being inconsistent
Hey guys i have a question
How difficult is make your mod compatible with other mod
that entirely depends on what causes the incompatibility
But i reffer you make something like
In general overloading functions properly helps avoid issues - or makes them a load order fixable issue
Thanks, I'm going to try it
Crossbow mod and you want to make compatible with like the britass
That's highly dependant on those mods
are you the author of any of these? Compare the conflicting code.
are you not the author? Not much you can do
You can write a patch
of course!
Not something that comes with a tutortial to do so, though
you gotta be able to code it yourself, as an end user you can't do anything about it, is what i wanted to say 
I want to make a simple mod for our upcoming small private game for 5 players. I want to give some players some items from the start (even on a respawn), I've already figured it out - I check player's username on OnNewGame event and give him what I want. But I don't want to spawn items in containers and a car as the game goal manually. So it would be cool if I had an opportunity to spawn it automatically right after a server created the world
Not sure why I was replied here, but there's a sandbox option for starterkits.
Going to check it, thank you
I used a code from "More Traits" mod tho. It spawns sigarettes for smokers from the start
For anyone curious, I found where zombies are told not to load their modData
There is some issue you need to chew thru, server doesn't spawn anything on its own, until the area is loaded for the first time by players visiting it, neither it does spawn any loot anywhere until player is in certain proximity of said container, then it uses loot tables to spawn in items.
Oh no i just only interested in development and if in the future i make a mod i alredy know
@upper sapphire Areas (cells) that are unloaded cannot provide any specific information about its content to server, until player physically loads it in by visiting it. So the only way you can spawn anything is using player context, with events.
maybe there is a way to forcefully load specific cell i dunno, but I would probably not recommend doing that.
I had to deal with such geo before and I just literally bound my stuff to having a loop on server side to lookup if specific squares are loaded or not and then continue to operate with what's inside.
There's systems to schedule loading/events once the area is loaded
Most people use(d) on square load, but it's costly compared to the other method https://steamcommunity.com/sharedfiles/filedetails/?id=2969455858
Hmmm... What about the idea: there will be some value stored in server's save file. Like SpecCarSpawned = 0. And when the target chunk will be loaded by some player's visit, it will check this value, then spawns a car and set the value to 1
like @sour island said its better to target squares.
'told not to load' do you mean it's saved but not loaded?
you can use GlobalModData for such
If I understand the java, it's in IsoMovingObject
public void load(ByteBuffer var1, int var2, boolean var3) throws IOException {
float var4 = var1.getFloat();
float var5 = var1.getFloat();
this.x = this.lx = this.nx = this.scriptnx = var1.getFloat() + (float)(IsoWorld.saveoffsetx * 300);
this.y = this.ly = this.ny = this.scriptny = var1.getFloat() + (float)(IsoWorld.saveoffsety * 300);
this.z = this.lz = var1.getFloat();
this.dir = IsoDirections.fromIndex(var1.getInt());
if (var1.get() != 0) {
if (this.table == null) {
this.table = LuaManager.platform.newTable();
}
this.table.load(var1, var2);
}
}
public void save(ByteBuffer var1, boolean var2) throws IOException {
var1.put((byte)(this.Serialize() ? 1 : 0));
var1.put(IsoObject.factoryGetClassID(this.getObjectName()));
var1.putFloat(this.offsetX);
var1.putFloat(this.offsetY);
var1.putFloat(this.x);
var1.putFloat(this.y);
var1.putFloat(this.z);
var1.putInt(this.dir.index());
if (this.table != null && !this.table.isEmpty()) {
var1.put((byte)1);
this.table.save(var1);
} else {
var1.put((byte)0);
}
}
I think I can jerryrig zombiemoddata using readbooks - but it will be ugly as hell
Looking around to see if there's another way
for the case of how to know if area is loaded or not you can either use the mod above or something like this
...
local square = getCell():getGridSquare(x,y,z);
if square then print('So square is now loaded!') end
...
@upper sapphire
If square is not nil that means its cell is loaded in. getCell() on server returns a merged information about all currently loaded cells at once in the world.
Should I put it in some tick event on a client side?
I use my own stuff for schedules
Seems like zombie save their data and don't load them - but on the next load it would be saving a blank table unless it's reused the same way
@upper sapphire
function IC:sleepDo(seconds, func, condition)
local time = os.time();
local targetTime = time + seconds;
if condition == nil then condition = true end; -- Optional
local function OnSleepTick()
local timeNew = os.time();
if not condition then
Events.OnTick.Remove(OnSleepTick);
return
end
if timeNew >= targetTime then
Events.OnTick.Remove(OnSleepTick);
func();
end
end
Events.OnTick.Add(OnSleepTick)
end
allows you to use time based schedules, not ticks or frames or whatever.
Thank you, I really appreciate your help, guys
I'm going to try it all. But it seems that it's much easier to spawn these few things manually
Can anyone tell me why some of the object placed through building menu aka ISBuildingObject enables some sort of collision at of north of a built sprite, meanwhile its totally set to be non-solid or non-blocking and it doesn't do that with brush tool?
Maybe someone who is a bit more java savvy can confirm is this is in fact saving and not loading the table.
i'm looking into it and i'm not convinced zombies usually go through these methods to begin with
I assume when it calls super.save/load it does
I'm also not familiar with bytecode stuff
i don't think they usually use save/load is what i mean
ah
the code for reusing zombies doesn't call anything related but i haven't got the full picture yet
so poking around that may not even help me find a way to make a consistent ID
Is that under virtual zombie manager?
yeah
reuse is how the game recycles isozombie objects to avoid reallocating memory constantly
sort of
when a zombie unloads it gets its info reset and added to a reusable pool, when zombies load it checks if there's zombie objects in the pool to use instead of creating new ones
so anything it uses to load zombies should probably be called there
and that would be using the load( ?
I'll keep looking - poking around chunks and cells
it would make sense with how i understand the zombie architecture to work for them to not truly save/load though
looked at the other similiar mods and they use hashCode() which does very little for what I'd need
I would assume OnlineID is consistent
even the descriptor object isn't saved lol
ah game Character has a flag to only load it in a certain byte condition
figured it out
๐ฎ
nvm
If you set a timed since last smoke it gets saved but it appears to also count down lol
oh it's clamped from 1 to 10
hmmm
well that's interesting
time since last smoked is saved, but to the objectID
which is recycled
This is using the stuff I can find with in save/load @bronze yoke
Seems like the game has parallel systems for saving/loading zombies - one looks to be depreciated though(?)
I don't see a point to saving object data for recyclable objects
Hmmm
The weapon in back changed which outfit it was in
This seems to only happen when you reload the game though
Anyone able to confirm if onlineIDs are persistent?
Hate to entirely derail the conversation, recently getting back into Zomboid and modding, and I'm trying to pick up a side-hobby I had with trying to expand the base Zomboid chat functionality by adding some interactable buttons to add/remove tabs at a whim and possibly a menu to specifically assign chatstreams to the tabs on the user's end. Anyone familiar with the ISChat.lua and the associated dependencies of "ISUI/ISCollapsableWindow" "ISUI/ISRichTextPanel" "ISUI/ISButton" "ISUI/ISTabPanel" by chance?
I'm trying to figure out how/where the game calls the 'Admin' tab to be created on chat initialization and if I can hook off of that to have it generate tabs on user client button presses instead.
Not persistent
@nimble spoke I know you had a suite of AI tweaks, did you run into anyway to handle persistent IDs on zombies? ๐ค
I wonder if I could create a hash using their outfit, hair, position
My mod didnยดt use IDs, I think that Randomized Zombies mod does it
You used outfitIDs like I did for specials?
Yeah, outfits are enough for that
and I looked over that mod, and it appears they supply an ID using HashCode() but it's also not persistent
oh wait, they actually do track it
they're using the cell's zombieList ๐ค
zombieList is also not persistent
seems like they're going through some trouble writing to a textfile - I wonder what is going on
I looked around back then and seemed very complex for what it is supposed to do, but didnยดt get to test or anything
Hi all, i have zero experience in zomboid modding but i just wanted to know if anyone thinks its even slightly possible, can you randomise the cells on the map, sorta like old school roguelikes where you get a new map every time
appears they're saving the makeup of the cell's crawlers/sprinters etc - to maintain the %s
they do mention the mod requires the %s for each to total 100
The persistent ID challenge is the kind of whitewhale I can sink hours into trying to crack
If you really need to make them persistent it might be worth the trouble, I simply neve had a reason to try
I mostly don't need to do it - but it would be nice to figure out
Working on a zonable zombie behavior mod
using my zoneAPI (the UI)
there's alot of things the zombie code locks out though
no setters for basically any of the stats
and they recalculate the stats every tick requiring update events to offset them (which you're aware of since you made specials)
This is unfortunately not possible as best as I understand it, cells are pre-determined locations. Map mods inhabit specific cells that are pre-determined, overwriting what does/does not exist there.
what's the best way to increase a stat over time at a constant rate while a condition is met?
i know that there's OnPlayerUpdate but i'm not clear on if it runs at a fixed interval or not
persistentoutfitID might actually work ๐ฎ
@bronze yoke Have you messed with this?
so far tested in SP, and moving away or reloading is persistent - they all seem unique
interesting
ok, so would it be correct to use getMultipliedSecondsSinceLastUpdate inside of OnPlayerUpdate?
yeah, that would be correct
in MP, used fast move to unload
i presumed that referred to the id of the outfit itself, but now that i think about it, what would 'persistent outfit' actually mean except a specific instance of an outfit
same
and I'm figuring this is used to load the zombies too
maybe it's a hashed ID of some sort
yeah when i think about the terminology that would make perfect sense
the outfit is basically the only thing unique about a zombie anyway
I assumed it was like outfitID which is a string, but noticed it wasn't
this could be pretty slick
wonder what these do, they do slightly concern me that they might not be unique
I tried to spawn a few of the same outfitID - i know there's some chanced clothing options but haven't seen any matching
public void dressInPersistentOutfitID(int var1) {
this.getHumanVisual().clear();
this.itemVisuals.clear();
this.m_persistentOutfitId = var1;
this.m_bPersistentOutfitInit = true;
if (var1 != 0) {
this.bDressInRandomOutfit = false;
PersistentOutfits.instance.dressInOutfit(this, var1);
this.onWornItemsChanged();
}
}
```isoZombie
Seems like it can be 0 at some point ๐ค
public void dressInPersistentOutfit(String var1) {
int var2 = PersistentOutfits.instance.pickOutfit(var1, this.isFemale());
this.dressInPersistentOutfitID(var2);
}
public void dressInPersistentOutfitID(int var1) {
}
```isogamecharacter
public void dressInOutfit(IsoGameCharacter var1, int var2) {
var2 = this.getOutfit(var2);
if (var2 != 0) {
int var3 = var2 & 2147450879;
short var4 = (short)(var3 >> 16);
short var5 = (short)(var3 & '\uffff');
PersistentOutfits.Data var6 = (PersistentOutfits.Data)this.m_all.get(var4);
if (var6.m_useSeed) {
OutfitRNG.setSeed(this.m_seeds[var5 - 1]);
}
var6.m_outfitter.accept(var2, var6.m_outfitName, var1);
}
}
it's a seed/hash
Trying to figure out a way to handle the zombieIDs now that I have them
I think having it stored on a table/saved would probably cause alot of issues
and math.randomseed is not exposed ๐ฆ
afaik MP valid and all ๐
This seems to be more about syncing onlineID
I assume once everyone logs out the ID is no longer cached
persistentOutfitID is a persistent int ๐ - so alot less overhead in that regard
I assume it's natievly sync'd
my issue now is what do I do with the ID - as I don't think making a giant list to compare to is a good idea
I'd like to maybe mimic a randomseed using the persistentoutfitID
So supplying the outfit ID produces the same result
Cobbled together a seed thing looks good on lua.org
I'm trying to write a mod to overwrite the Remove Propane Tank function off of BBQ Grills from ClientCommands.lua.
ocal _orig_bbq1 = Commands.bbq.insertPropaneTank
Commands.bbq.insertPropaneTank = function(player, args)
local bbq = getBarbecue(args.x, args.y, args.z)
if bbq then
local tank = bbq:removePropaneTank()
if tank then
player:getSquare():AddWorldInventoryItem("Base.Processedcheese", 0.5, 0.5, 0)
end
tank = InventoryItemFactory.CreateItem("Base.PropaneTank")
tank:setUsedDelta(args.delta)
bbq:setPropaneTank(tank)
bbq:sendObjectChange('state')
end
return _orig_bbq1(player, args)
end
But I'm getting an error:
unction: VanillaLuaOverwrite.lua -- file: VanillaLuaOverwrite.lua line # 4 | MOD: ApocalypticCrafting
ERROR: General , 1700956308527> 196,037,382> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: bbq of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1700956308527> 196,037,382> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: bbq of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
local _orig_bbq1 = Commands.bbq.insertPropaneTank
this is line 4
Well Commands = null here
ok - i think i see an issue, let me try and see if it works
the seed being a large number breaks this lol
I keep running into an issue with the crafting menu breaking when i try to introduce a new recipe via modding 
Can anyone point me towards a resource for adding custom console commands? Either an example of a mod that does it well or discussion thread? I've searched for e.g. "add custom console command" but I get mostly results about reading from the console. I'm really new to PZ modding, my objective is to build reward systems I can "pay out" via the console but this is the first hurdle I need to overcome
@sour island @mellow frigate Any of you know how to force a player to trigger an animation? I have copied a .X file from the original vanilla animations and written an XML animset, and triggered it's condition but nothing happens. I don't know what I'm missing?
You're my last resort, nobody else seems to know 
Are you using setVariable on the player?
Yeah
what does the xml look like?
Copied this vanilla sleep file
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>SleepIdle</m_Name>
<m_AnimName>Bob_SitGround_SleepIdle</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>true</m_Looped>
<m_EarlyTransitionOut>true</m_EarlyTransitionOut>
<m_SpeedScale>1</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>sleepidle</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>
what does your setvariable look like?
playerObj:setVariable("sleepidle", true)
bools there are text I think
try "True"
Oh it's cause I made it a string
<m_Conditions> <m_Name>SCUCK_Anim</m_Name> <m_Type>STRING</m_Type> <m_StringValue>True</m_StringValue> </m_Conditions>
Nothing either :/
Seems like vanilla uses bools, maybe there's something else
I know the .X file itself works, you can even see it in the animations debug thing
I would dobule check the basics, make sure its the right playerobj etc
animation stuff isn't well documented so most of what can be learned is in the vanilla files
Setting it to string didn't cut it either
If you have a git repo I can check it out
I'll try a timed action
Do you know how to loop an animation there?
Ah think I found it
Yeah
Is that the maximum width and length or can it be, say, 16 x 32? Or just 20 x 20?
Or does it have to be 32 x 32?
What would cause this error message? I cant decipher this
Afaik it has to be 32x32 if you want it to fix properly in the hotbar and stuff
And the game just scales it otherwise
You tried to call getFullType of an empty variable
in laymens terms? 

does it tell me what variable it misses?
what do i need to supply for it to work
its an error message that pops up when failing to open the crafting menu
i was adding a recipe with my mod
Say, what's the difference between these tree items? Why are they listed as pop1empty, pop2empty, and pop3empty?
The visuals are the only difference, and because the game at the time didn't have a variant system for items.
Is there a way to manipulate fields of scriptItems directly for fields that don't have a function to do it? Like e.g in place of DoParam("DisplayCategory = Accessory"), there's no setDisplayCategory so I'm not sure the best way to do it. I just realised how slow DoParam is in terms of performance and that I probably shouldn't be using it at all.
it's ok to use it once, during loading
Does that mean there is no better way to do it? I'm doing it hundreds of times on loading, and I'm having long loading times, so I thought I'll double check my own mods before I troubleshoot everything else, then I noticed how slow DoParam is
You can use python to generate the files once and then no need for in-game logic.
max performance?
Is there a guide on how to do that? I know a little python but I don't know what files I'd even want to generate, I'm iterating through and tweaking other mods' script items in a personal mod. I don't really care about max performance necessarily though, I just wanted to know a better way to do it than DoParam if there is one.
if there's no setter there isn't another way, you can't write to fields directly
ah damn, I suppose I could do a java mod if I really wanted to
easier than lua, except I don't think you can add any new files with java from what I tried, so no compatibility between java mods that way
easier than lua? 
haha, I get so lost modding this game with lua compared to everything else I've worked with, I'm constantly thinking of a simple way to do something, then lua is too simple to be able to do that
It makes it feel so complicated especially when you have to look at the java to see how everything works, it's a shame java modding isn't supported
hm, what event is best for tweaking items like with DoParam? A lot of that I'm not even doing in an event since that's the way I saw others doing it when I started modding, not sure if that's bad, think I tried OnGameStart once but then it ended up doing some changes twice since script items weren't reset the second time
you don't need to use an event
i usually stick things on OnInitGlobalModData since that's when sandbox options first become available, but if you don't need them there's no point
OnGameStart is a bad idea since it fires after the first chunks have loaded, so any properties that are copied to the instance will have the pre-tweak value
That's good to know, I remember having trouble with that once where sandbox vars were all default in the event I tried
It feels hard to have good practices in my code without any reference or guides on anything, only found a few on the forum
modding is primarily done by complete newcomers so good practice is not easy to come by
i've been meaning to write a few more resources
mostly just to try and get people to use modules and to stop using globals ever
I'am pretty sure the devs said in one of their updates on steam they are working on updating the Modding area, like the guides and what not.
yeah, I'm decent with some other languages and game modding but it's tough when not used to lua and then so much is particular to the game to figure those out, I often feel like I'm doing it wrong based on what I saw from another mod but unsure what's right
Resources would be so useful, using modules as in like making everything local?
people often give out the advice that you should look at how other mods do things, and you absolutely should to find out how things work, but when it comes to code style and optimisation very few are up to standard and you'll likely learn more bad habits than good
yeah, you keep everything in one local table and return the table at the end of the file, other files can then require that file to get a reference to that table
globals are slow and prone to name conflicts, better to just avoid them as much as possible
interesting, I actually did see one mod doing that for some functions and thought it seemed like a good idea
i've seen a lot of mods that do this but don't keep the table local, which is a lot better since it condenses things down to just one global, but why add one when you can add none
Exactly
I feel totally unsure the best way to call/set local variables when doing anything, like I would have thought if I'm manipulating a lot of mod data, it'd make sense to only get it once e.g local modData = player:getModData(), but everything I look at tends not to do that and just repeats getModData()
that is much better and you should do that
this is faster in all languages, but there is a lot of overhead on calling java from lua so it's really important here
it's also just way less ugly...?
That's reassuring, I thought so but then it makes me wonder when I see no one else doing it
yeah, I always find code easier to read when it actually declares everything with decent names
most mods are written by people who don't have any prior experience with programming
that combined with the lack of resources about it means the style can be substandard
speaking of mod data, do you know off hand if it needs type checking? It looks like the java creates a table if it's null, but I'm not sure if I need to check if e.g player:getModData().myNumber ~= nil before I try to check/compare the value
I see checking it's not nil sometimes and not other times in examples I look at
some comparisons are fine with nil, some aren't
generally anything with numbers is going to go bad if nil gets in there, but nil evaluates to false so it can take the place of a boolean fine
Thanks, all this cleared up a lot I wasn't sure on ๐
Any IsoZombie enthusiasts? I need a solution for server-side to determine if zombie is moving by any means.
isBehaviourMoving() is unfortunately not known to server and always false there. isMoving() doesn't seem to be true ever anywhere.
getActionStateName() does seem also not shared with server. So server has literally no behavioral context whatsoever.

I have a timed action I make the player execute, that set these custom properties:
action.maxTime = 9999999999
self.action:setBlockMovementEtc(true)
I am trying to cancel it after some time by calling:
ISTimedActionQueue.add(ISTimedActionQueue.clear(playerObj))
But I get the following error:
function: addToQueue -- file: ISTimedActionQueue.lua line # 23 | Vanilla
function: add -- file: ISTimedActionQueue.lua line # 131 | Vanilla
function: DelayFunction -- file: BB_OGTechDemo_Main.lua line # 117 | MOD: Till Death Do Us Part
function: onTick -- file: BB_MyLittleUtils.lua line # 106 | MOD: Braven's NPC Framework
LOG : General , 1700979877069> Object tried to call nil in addToQueue
More precisely it's this snippet:
-- none in queue, so go!
if count == 0 then
self.current = action;
action:begin(); <---------- THIS
--print("action started.");
-- ISTimedActionQueue.IDMax = ISTimedActionQueue.IDMax + 1;
end
Any idea?
Zombies barely exist to the server. Maybe try sending a client command with info to the server?
Just.. messing with zombies at all in multiplayer is a terrible, terrible thing to do.
This is exactly why I want to queue actions only for those that are actually moving through a ladder of conditions.
Returning velocity of zombie probably has to be the easiest task for a game server
trying getMoveSpeed() now
Nah, also always 0
No real clue 'bout timed actions, but from the way it looks is... that you may not at all require the "add" method.
Trying to cancel a timed action by adding a removal of an action to the queue? (if that even returns anything) ๐
ISTimedActionQueue.add(ISTimedActionQueue.clear(playerObj))
ISTimedActionQueue.clear(playerObj)
From just the sound of it, with the argument provided, it does sound like a method that intends to clear all actions currently queued.
Which would likely not return a specific timed action to then add to the queue again?
It's just supposed to stop all timed actions altogether
I've been using it on my NPCs, works perfectly for normal actions
I think it's related to the time on mine
Or something
what's the add call for?
if you're just trying to clear the queue that function will handle it
clear doesn't return an action so when add treats its return value as one it inevitably errors
Ohhh I get what you're saying
LOL yeah
Why is that there
I encapsulated it and didn't even realize
Why do I keep coding at almost 4am
Yeah that should solve it. Actual facepalm for me. Thanks people!
Now I can finish the tech demo
That and the animation are it
The only 2 things I am missing
Take a look!
Ignore her animation lmao
I just can't find a way to play the damn animation lol
she's in the falling animation? that might be the source of the issue you've been having with that
No no, that's just a miserable attempt of mine to play the animation
For some reason she ended up doing that
Here is a convo I had with chuck. I couldn't get it to work with setVariable
oh right, i was thinking if she was being registered as falling for whatever reason it might be taking precedence over your animation
It just won't play
So I tried timed actions
Nothing either
This is my timed action approach
Nothing
It's sooooooooooo annoying
Like if I can manage this one thing, it's over
It's all I need
Nevermind the raider NPC, it'll be a nightmare but I can handle it. But this? Why won't it woooork
The timedAction has a name property?
So my dreams with PZ is to make a riverside expansion mod but I have 0 idea of how to even get started, I get the jist of it but also dont know what I am doing, I could use some help on the ways of mapping, really I'd also like it if someone here whos got some experience could help me out.
I also dont know if I should wait for B42 or just go for it now to atleast train
Well no one knows when B42 is going to be out. Their are plenty of guides how to get started in mapping even on youtube.
In this short video I will quickly show where you can find the project zomboid mapping tools, both on steam and on the indiestone forums.
For a link to the forums please click here:
https://theindiestone.com/forums/index.php?/forum/64-mapping/
And if you want to support me here is a link to my patreon:
https://www.patreon.com/DaddyDirkieDirk
Agree, the tutorial is so helpful on the beginning of making maps
Does anyone know if there is a way to instantiate Moveables.* which do not have items bound to them directly (cannot spawn)
Something like this ?
function DebugContextMenu.OnMannequinCreateItem(script)
local spriteName = script:isFemale() and "location_shop_mall_01_65" or "location_shop_mall_01_68"
local obj = IsoMannequin.new(getCell(), nil, getSprite(spriteName))
obj:setMannequinScriptName(script:getName())
local item = InventoryItemFactory.CreateItem("Moveables.Moveable")
item:ReadFromWorldSprite(spriteName)
obj:setCustomSettingsToItem(item)
getSpecificPlayer(0):getInventory():AddItem(item)
end
hmm, but it seems you need to read it from world.
fellas, i cant get my recipe mod to work and ive been on it for 2 days 

Greetings all, im trying to change the lass display counters to display the gun texture instead of the default jewlery - i cant find any mods for this, so how easy would this be for me to do - i know its a rabbit hole, but i can follow tutorials
*glass
is this something i could do with tileZ/?
or would i make a new craftable container using the vanilla textures - so adding one new tile?
another method i was thinking was to just replace the jewlery textures with the gunstore textures? -how could i make this work? even if its just for my game? rather than a seperate mod
hello guys, i wanted to ask how use the info form pz modding website, for example this https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.PerkInfo.html
there are field, constructor, and method. so how i use method getLevel() in lua code?
declaration: package: zombie.characters, class: IsoGameCharacter, class: PerkInfo
For adding items to zombie distributions, can I set the max for the group of items I want to try and roll like so?
Like I have it set to one roll currently, but I'm noticing zombies can spawn with multiple items from the list I'm adding to them
it's one roll of every item, not one roll for the entire list
Oh geez, really? Is there a way to limit that anymore? I'm making my chances so low yet I'm still getting a tonne of items because of how many I'm adding. Especially now knowing that it's a roll per item...
I've only achieved timed actions animations and movement replacement animations.
<@&671452400221159444> Why did I get silenced for trying to post some code?
if you post too many special characters its blocked to prevent spam
How am I supposed to shared code without using the triple ` man
I had something similar while formatting a message.
I'm simply relaying information to you. Please, relax. This is what I know to be the cause. I didn't design the filter for the auto-bot.
Okay, fair still, this is an absolutely idiotic filter. Can you guys disable it for the mod dev channel, otherwise how are we supposed to share code?
code
does it happen with only the code block? Try posting it like a file or in parts.
#mod_development message
this was acceptable, but changing format gave me the same issue.
This is absolutely idiotic, I posted the same code block, without the lua formatting, and I still got timeout out for 60 second
This is absolutely idiotic, why making sharing code more complicated in the channel to share code? @tame mulch and @willow estuary can anyone of you please say something about this?
This change
also as the mod said, images are "acceptable" alternative.
It's dumb, discord has code hightlight, and formatting, and we are supposed to share code as an image?
wtf man
This automod change just killed the ability to actually share code in the code channels.
Absolutely idiotic change
to answer your actual question, it is an encapsulated class, it is not a Trait it is a TraitFactory$Trait
Thank you albion
Anyway, this moderation change is dumb, and I'm quite pissed, I'll go out for a walk and a cigarette
We'll look at the regex again
Meanwhile would be cool if you could get the sand out of your pants
Lots of ways to make us aware of it without...whatever this is
Yeah, good point sorry about it, this change and getting randomly silenced really infuriated me, I'll go chill for a bit.
Hey guys, how can I fully override lua file from another mod?
you could maybe overwrite all of its functions?
it has only one function, and it's declared as local. I was told that local functions can't be overriden
hm i dont know if thats true or not but that would make sense that you couldnt
are you trying to disable the entire mod?
or just one file
I want to make a "patch" that basically removes a couple lines of code.
you just need to have a lua file with the same name in the same location
that's what I've been doing, but original function is still getting called
make sure your mod is later in the load order
Is in-game load order accurate?
i don't think vanilla even lets you choose load order
not in singleplayer anyway
i think mods that require other mods always load later than them? not 100% about that one
otherwise it's alphabetical
In-game my mod is after the original. I also tried alphabetical. Still, first original function is called, and then mine.
and I also tried adding a requirment, same result
you can see when files load in the log
it should never load two files with the same directory and filename
have you confirmed your file is being loaded at all?
in your console.txt you should see a bunch of lines like```
LOG : Lua , 1701031673825> Loading: media/lua/shared/a_requires.lua
for modded files it'll show the full path it's being loaded from
there should also be some lines like```
loading MyModID
mod "MyModID" overrides MyFilePath
Thanks, I'll check it
Yeah sadly that's the one thing that sucks about B42 but is also why I love Indie Stone. I'll look into this, tyvm.
I straight up forgot to reply when writing that whoops lol
Is it possible to get vanilla mapping and just modify it from there?
is there a way to check if a specific animation is being played? on the player of course
Anyone know where the function for car dismantling is located in vanilla lua files
does anyone know if attack speed is also tied to animations or is it a variable something i can easily change?
It's tied to animations, but you should be able to change it on weapons by altering their BaseSpeed, MinimumSwingTime, and SwingTime
Though I'm not sure those work with the heavy weapon animations, I couldn't manage to increase the speed of one when I tried using those with it
alright cool thank you, im going to be messing around with it alot for a trait so would you like me to tell you if i manage to get two handed weapons working?
By two handed, you mean using the heavy animations the sledgehammer and wood axe use? If so that'd be really cool to hear if you did actually
Nice, good luck, I hope you manage since I ended up thinking the speed was fixed based on the animation for those
that would work but not for what im trying to do sadly
im trying to change the attack speed when your injured only
how it slows you down
im talking about myself
oh lol
let me look
yea i saw weapon and assumed this was just a list of all the stats for a weapon
lol
please tell me how I can get a weapon type before starting the game or immediately after starting the game (for example, I need to know if there is a mod or vanilla shotgun in the game)
you can use ScriptManager.instance:getItem("MyMod.MyItem") to check if an item type exists
thanks!
hello guys, i have a question, did servertime using GameTime.getServerTime() also got paused when the server is empty (i turned on the option to paused the server when empty)? and whats the diffrence if im using os.Time(). thanks
Hey I'm the owner of Project Aftermath, a new PVP server that has a lot of mods that need to be developed, if anyone is interested in getting paid to make any of these below please reach out โค๏ธ
Claiming/raiding cars
- You can claim any car with a specific key that you can only use once, and once its claimed to you it vanishes
- The car can be lockpicked using a lockpick, it takes 3 minutes irl to lockpick
- there is an indicator when you right click the car that it is claimed
Better queue system
- The built in queue system for zomboid uses the slots of the server itself as the queue (Ex. for a 100 player server, 60 can be in the server and 40 in the queue) and anyone -else who wants to join will not be able to do to the โserver being fullโ
- On top of that, the queue system lets players in one by one even if there are slots, so if we restart and 100 join, they will all be waiting behind each other in a line to join, which takes forever.
- The new system would either use a new server to sort of hold all of the queued players then let them in once there is a slot, allowing the actual server to have 100 players -playing at the same time
- There will also be a priority queue option where we can give vip members priority
- Or it'd use some other system that'd work as this one would^
Sleeping bag system
- A system where you can place a sleeping bag down and respawn at it as a spawn point
- Has a timer that you canโt respawn back on it of 3 minutes
Safezone indicator
- Allows admins to make a safezone radius that doesn't allow PVP
- An indicator that youโre in a safezone that doesnโt allow PVP
Codelock mod
- A mod that allows you to put codelocks on either pre-existing pz doors or player built doors, letting you set a 4-digit codelock that anyone can use
- Is placeable with a โcodelockโ item
Sorry for the block of text but im just looking for modders to help us out thanks โค๏ธ
what would be the correct syntax for importing more than one module in a .txt file?
would it be
base, othermodule
}```
or would
```imports {
base
}
imports {
othermodule
}```
work?
and (bc i don't necessarily want to link the server itself) this is always the best place to look imo https://www.reddit.com/r/projectzomboid/comments/14uxa15/pz_modding_community_discord_server_commissions/
I already asked to post in there
appreciate it though
You could check translations for what a string for it is called and then find where in the lua it uses that string.
Is there a better way to control item spawning on zombie corpses? Initially I was using inventorymale and inventoryfemale tables to insert items.
However, I have like 40+ items in a mod I'm working on that I want spawned on corpses but the chance value doesn't seem to apply. As in I'm getting way more items than what my chances should be dropping. Is there a post anywhere that goes into details as to how rolls and chance function when determining dropped loot?
Adding that many items to the zombie loot distro list will likely result in a 1-in-5 or 1-in-6 chance to drop anything on that list. Anything added to the zombie loot distro table can drop without any limits. You would be better off making a function that rolls the item and linking it to OnZombieDead event
Hey @sour island @nimble spoke, if you have any questions about Random Zombies and its implementation, Iโm happy to share the knowledge and rationale behind some decisions if you @ me.
The math.randomseed functionality youโre trying to recreate is called a hashing function, which is what I do in RZ to avoid having a shambler become a sprinter suddenly (like it is the case in some other zombie mods)
Most of the code in Random Zombies is diagnostics and debug, it does not actually run during gameplay, like the writing to a file bit.
Let me know if youโd like to know more.
Hello, I noticed you were using object hash - but I think running that on objects isn't persistent through unloads.
I was able to find an alternative that is persistent for IDs - as well as recreated a fixed random set of the numbers to keep the behaviors the same.
I also saw you are flipping sandbox options and rerunning zombie stats - is that at all performance impacting? ๐ค
That was sort of the plan B I had in the back of my mind.
I'm sort of new to modding. Do you know what the method looks like for adding items to the zombies when that event is called? I've seen for adding to player inventory, but not the zombie inventory before
Random Zombies relies on zombie online ids for simplicity and multiplayer friendliness, do you use something else?
Rerunning zombie stats is the only escape hatch I found to trick the game into actually changing zombie stats, since you cannot set these Java class fields directly afaik. Itโs not expensive since itโs Java code thatโs being JIT compiled. You should always profile your code tho, to know if the performance is expected and what is actually the bottleneck
onlineIDs are not persistent
Just a heads up on that front - I discovered persistentOutfitIDs are persistent and unique
Oh you mean the sandbox options flipping? Thatโs just a set on a Java field, so very inexpensive
The rerunning of zombie stats on each zombie - is my larger concern
thank you, Iโll look into it. But does it mean that 2 zombies with the same outfit will have the same persistent outfit ID?
No, it appears to be a hash of their combined worn items or something similiar
Tested by spawning zombies with the same outfit and did not see any repeats but they were similar in starting digits
Also works in SP/MP
OnlineID and Object hash are not persistent from what I tested
interesting, I'll definitely look into it to understand how they're assigned. Persistence through game reloads was not a big requirement in my case and, anecdotally, I've never received feedback related to it
I think that's correct
So your zombies would be rerolled each encounter?
each server restart
That's fair - I was more interested in it as a challenge.
Actually, moving away from the area and reloading the zombie will also not get the same ID.
The game recycles the zombie object.
yes, I have read way too much Java code around zombie recycling that I would have liked, it can be annoying to deal with, especially around cache invalidation
if you save stuff in the getModData() table
Yes, zombies don't save that either
in terms of gameplay, that would mean that all players moved a long distance away from the zombie, so I'm fine rerolling it
Fair, just curious - cause some people told me it wasn't the case with your mod- and I saw you were doing some slice stuff (I assume to get/confirm the population %s)
what wasn't the case? I never check the zombie distribution since I extensively tested the hashing function to have the required properties (that's why there's so much "debugging" code in the mod)
(namely the uniformity property)
Hi. Is there anyone here who has worked with ZombieEatBodyState? It looks like it issues an exception when try to access getName() or instance() but everything is fine with other states.
Can someone help me with the profession framework? I want to make my own profession to override farmer.
Try downloading another mod that uses it and just see what they do
is getModData() strictly local namespace? Object in question is said IsoZombie
You can see the source of almost any mod on the workshop in your files
I have a model ready and such im trying to add a set of armor, head legs and chest
how do i insert these models now
You can check https://zomboid-javadoc.com/41.78/
In this case, getModData() is a method on IsoObject, which IsoZombie and many other classes inherit from
Javadoc Project Zomboid Modding API package index
i'm pretty sure the safezone thing already exists in the base game
you can pay me for telling you that
lol
Ik but an indicator
Cool, I was asking about scope of the namespace attached to it, not if IsoZombie inherits it.
Found it out already, getModData is local until you transmit it.
Hmm. How does the game distinguish between which items can be used as fuel for fire and which ones aren't? I would have expected a tag on the items, but neither twigs nor branches have anything of the sort.
Nevermind, found the camping_fuel.lua now.
Oh you mean local in a client/server sense? the word namespace is pretty confusing here. Glad you found the info
Well it has to be stored, usually its a namespaces for such things, not sure how it might be called in Lua/Java sense.
Next question is what the f*** is receiveObjectModData: index=-1 is invalid x,y,z=12597,908,0
man im having trouble with this
so i have created a model for armor in blender, i think i have the file sets right
i exoported the amor as an fbx
what the hell am i doing
I haven't done it myself yet, but I know here's Blackbeard's vid on YT about making and importing models into the game. Give it a shot.
https://www.youtube.com/watch?v=ecGTLTup4b0&ab_channel=Blackbeard
0:00 intro
0:46 open Blender
0:57 add background image
2:39 making the model start
6:01 Fast forward / making the model
7:12 Using the Knife Tool to work on the trigger guard area
8:05 Fast forward / making the model
9:17 Adjusting the model thickness
11:25 Map Image (uv mesh)/ Node setup
14:33 Painting to help place image
16:57 Using Photoshop...
Anyone know of some good camera mods?
I'm getting closer with my mod and being able to use a custom weight table as to not overload the default male and female inventories.
Still not the best at Lua so of course things are breaking. Is anyone able to see why in my screenshot why line 33 is returning Object tried to call nil when trying to add an item?
capitalisation of AddItem doesn't match
Oops ๐ Good catch
It still returns something about trying to call nil. I even moved the table out of scope to make it global to the script and same issue regardless of where it is
alright so im just stupid i guess. Anyone got a complete mod folder i can look at and see what you did
just look for the workshop folder in your zomboid installation, if you have any mods installed, they will be in there
mine only shows i think the testmods
That is a different workshop folder
You need the ones through the steam directory thing
You'll know it's the right one because it's a bunch of number folders of the workshop ids
I can't give you exactly where it is right now though sorry
damn thats alot of numbers
Yea just search for the mod name you want lol
If you don't know it look at the workshop page and at the bottom
It should say the number ID and the name one
im just working through the mod example stuff and trying to set this up exactly like theirs
Hey as long as it works
Reason: Bad word usage
Your main project zomboid folder in the workshop folder
Get a list of all the trait references with their label in game:
print(for i=0, TraitFactory:getTraits():size()-1 do trait = TraitFactory:getTraits():get(i); print(trait:getType() .. " == " .. trait:getLabel()); end
link to vanilla output
Edit: omg I found this spreadsheet of functions: https://docs.google.com/spreadsheets/d/1Wf08bl7Cq2jRyKDJPsWI_Tm8Iiq4LgxvIyL4e2xSDmU/edit#gid=16296920
do i have to upload in order to use in my game?
Nah it just needs to be in ~/Zomboid/mods folder
i can see it in the upload section but not the mods?
@clear compass I think you have it correct in the workshop folder but maybe not in the mods folder. The directory for your mod in the mods folder shoud have a media folder directly inside of it like Zomboid\mods\<yourfolder>\media if it doesn't it won't show. I link these directories so I don't need to mess around with copy and pasting
ive got it now. Had to reload game
How useful! Thank you, replying to spread this (so many useful function calls)
Hey hey folks, I'm trying to figure out how to have a recipe return tailoring experience, does anybody know what the code is for that?
I've looked at other mods, and OnGiveXP:Recipe.OnGiveXP.Tailoring10, seems to be something some folks use, although I haven't had any luck and the game says it doesn't exist in the recipe manager
it doesn't look like there are any vanilla tailoring ongivexp functions
Oh well shoot, I suppose that would be why
but you can just write your own referencing the ones in server/recipecode.lua
I'll be sure to look into that
Got ponies being able to be sewn added recently, and figured tailoring XP would be useful
All righty, got it working! Thanks! I s'pose it's mainly cooking and stuff in the vanilla recipes thing, which makes sense why tailoring wasn't working
Still not 100 on balancing for 'em though
does anyone know / have any documentation for animating world tiles/structures? Or have a mod that does this to refrence?
What the fuck?!!!??!
If this is possible please @ me as well!
Hmm, anyone know the simplest way to discern which food items are perishable and which aren't, when first spawned? I've tried various - :isFresh() just returned true for all food until the perishable stuff rots, :getRottenTime() just returns zero for everything, :isPackaged() will be true for some perishable foods, and false for some non-perishables... I can't work out how to just return a simple "this will go off eventually" flag.
@blazing osprey @median prairie If you haven't already seen: #mod_development message
Thank you!
Thanks
My guess to check whether an item is perishable is to check whether it has that tag in its item recipe:
~~local isPerishable = item:getTags():contains("DaysFresh")~~
Thanks. Sounds promising, but I only get false for everything running that on the food items themselves. Is there a way I can return the recipe given an instance of the item?
I was on the wrong track. Looks like albion made a mod to retrieve script parameters more easily directly from objects: https://steamcommunity.com/sharedfiles/filedetails/?id=3001901955
Ah cool. Thanks for the help. I'll take a look at that then.
yw, so my guess it it's if it is perishable with that mod. lmk how it goes since I have a mod in mind for a similar thingitem.DaysFresh ~= nil
Installed the mod, and it doesn't throw any errors, but still always returns nil... neither zombie.inventory.InventoryItem nor zombie.inventory.types.Food seem to contain DaysFresh as a field according to the wiki... so I guess I'd still need to access the item's recipe instead of the item itself?
Ah, finally cracked it. Just need getScriptItem() - item:getScriptItem():getDaysFresh() either returns a small number for perishables, or 1000000000 for non-perishables.
No field access required
what a nice big number
Yeah, would figure -1 would be a better marker value. Wonder if this means non-perishables still perish, but it takes 2.7 million years...
Cool, yep, local isPerishable = item:getScriptItem():getDaysFresh() ~= 1000000000 works a charm
It seems to check DaysTotallyRotten.
Wiped my log now, but pretty sure it showed 6 for Processed Cheese - which tallies with the wiki for Days Fresh.
invItem:getOffAgeMax() ~= 1.0e9
Huh... so it was there all along huh? Just never clocked that "OffAge" referred to food spoilage ๐ Thanks!
Yep, just tested, and that works exactly the same. I presume that'd be the less round-the-houses way then. local isPerishable = item:getOffAgeMax() ~= 1000000000
Hello.
I'm trying to make a mod where the flashlights take a different kind of battery. I've created the new battery item, changed the recipes and edit the "OnCreate"-functions.
If i dismantle the flashlights, both of them, or take the battery out, im getting the new battery item. But when i try to insert a battery, it works for the "Torch" (the yellow big flashlight), but the "HandTorch" takes only the vanilla battery.
I already tried to override and/or hide the vanilla recipes but without success. What am i doing wrong? Can someone help me with that?
I want to create a mutant zombie mode but I don't know where to start. Also I couldn't find a guide showing what's needed can someone point me in the right direction?
So I just encountered some really weird netcode clusterfuck. I picked up a local dedicated server on my local port and just join it to test mods.
What happens is something I cant comprehend
- I spawned a small horde of 25 with debug tool and one guy just before that.
- I log out, log in
- One guy i still there but all 25 others are gone.
- I log out, log in
- All 25 guys are back again where they were.
I thought I'm going insane or logging in wrong servers all the time, but no, checked it 3 times in a row and it keeps happening. ๐ซ
#!/bin/sh
# Script for checking and restarting server when mod updates are in order
# Use crontab to add this to queue but consider sleep timers to not overlap with cron job.
# Example:
# */10 * * * * /bin/sh /opt/pzserver/checkmods.sh
SOCKET=/opt/pzserver/zomboid.control # Path to your zomboid server socket, FIFO service should be installed as recommended in Dedicated server manual for it to work
LOG=/home/pzuser/Zomboid/server-console.txt # Path to your server console log to read commands responses
echo checkModsNeedUpdate > $SOCKET;
sleep 10;
if grep -q "CheckModsNeedUpdate: Mods need update" $LOG; then
echo servermsg \"WARNING! Server restarts in 5 minutes\" > $SOCKET;
sleep 240;
echo servermsg \"WARNING! Server restarts in 1 minute\" > $SOCKET;
sleep 30;
echo servermsg \"WARNING! Server restarts in 30 seconds! Logout NOW!\" > $SOCKET;
sleep 30;
systemctl restart zomboid;
else
echo not found
fi
Oh one thing thou is that manual for zomboid.service is having a control command for stop saying echo exit > zomboid.control which is not true, because there is only quit command, not exit.
if i have an item in the Hotbar, how can i designate a different action than "equip on primary" as the action when the keybind is pressed? 
Hello, I have a animation for the zombies using Blender and I want it to be used for the zombies when they are bashing a door for example, I noticed what all the animations in the game are in X Format. Anyone knows how I can add it to the actual game? (Actually I have it converted to X, I only need to know how to vinculate it to the zombies)
I have an item with useDelta = 0.5, but somehow it doesn't 2 uses out of it. Is this an issue with the item not being created at 100% uses?
So, I've been so far avoiding hooking up my stuff to OnTick event but now I kinda want to, how bad it is to do that?
function is very lightweight
pretty much adjusts pain level to make sure it doenst go above set threshold
when testing didnt notice any impact
@trim juniper did you figure it out?
you can check if item item is replaced with something when its rotten
if it is, then its preishable
ez
{
DisplayName = Ice Cream,
DisplayCategory = Food,
Type = Food,
Weight = 0.2,
Icon = Icecream,
Packaged = TRUE,
ReplaceOnRotten = IcecreamMelted,
DaysFresh = 1,
DaysTotallyRotten = 1,
HungerChange = -30,
UnhappyChange = -10,
Calories = 1680,
Carbohydrates = 180,
Lipids = 84,
Proteins = 26,
WorldStaticModel = IceCream,
}```
ReplaceOnRotten
oh wait it doesnt work for everything
nevermind
Anyone know the easiest way to get the largest value from an array/table? It would look like this:
local myTable =
{
Mustard = int,
Ketchup = int,
Relish = int,
Mayo = int,
}
Basically, I want to compare the int's, but get the actual name of the variable that is the largest. So, if the table looked like:
local myTable =
{
Mustard = 0,
Ketchup = 7,
Relish = 1,
Mayo = 9,
}
The output of whatever I do would return Mayo
|| Not making a condiment mod... just for an example lmao||
Usually isnt so bad. Do you have more info about what you are trying to do? I have messed with a lot of these sorts of effects before, so I might be able to help
local function painTolerance(player)
--local player = getPlayer();
local PainTolerance = player:HasTrait("PainTolerance");
local stats = player:getStats();
local pain = stats:getPain();
if PainTolerance and pain >= SBvars.PainToleranceThreshold then
if detailedDebug() then print("ETW Logger | painTolerance(): pain:"..pain.." is above"..SBvars.PainToleranceThreshold) end
stats:setPain(SBvars.PainToleranceThreshold)
end
end```
i already decided imma go with it
thought of a way of making it better
Are you running this 100% of the time, or are you only adding this to the event manager if the player has the trait
Dope, yeah. That should be fine then

Worst part... I literally have a ChatGPT tab open right now... LMAO
thank you though, that is actually really helpful lmao
Hey guys, is there a way to add a line to a vanilla item without overwriting the whole item? I only want to add an OnEat to plonkies
Its not exactly a mod, but its coding related to zomboid so I figured this would be better of a place then pz_techsupport, Im trying to access rcon like this however it keeps refusing my connection
Are the devs working on a new engine/ engine migration? I remember something between those lines from a while back, but couldn't find anything related online.
nothing as grand as that but there are quite a few major engine upgrades expected for b42
would anyone working on making mods be interested in my ideas?
i have a few diffrent ones starting with more fitness choices and things that fit with the 80s
willing to put in the work to help with the research and stats
I'm trying to use the code in the image as a guide to making a mod that prevents xp gain based on a corresponding trait. I'm starting with carpentry. So the "no carpentry" trait would disable xp gain for woodworking in exchange for like 8 - 12 trait points.
I've already got the trait working as far as being selectable and giving the points. I'm having trouble with finding a suitable event to tie the trait functionality to as well as whatever methods call the "traitMultiplier" stat, which I want to set to 0.
Currently already have this part workin:
` require 'NPCs/TraitFactory'
local function NoCarpentryXPTrait()
local trait = TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end
local function NoCarpentryXPSkill()
if player:HasTrait("NoCarpentry") then traitMultiplier = .75
end
Events...(NoCarpentryXPSkill)
Events.OnGameBoot.Add(NoCarpentryXPTrait)`
Well, the first function and last event
the 2nd function I'm guessing the snippet above can help with.
If you are changing Sandbox Vars do you have to do it inside the shared folder and the defines.lua file?
you can do it anywhere
is there any better documentation for methods than https://zomboid-javadoc.com/41.78/ ? I'm trying to figure out how to get the direction the player is facing and cant figure out what the parameters are for faceLocation
Javadoc Project Zomboid Modding API package index
https://projectzomboid.com/modding/ is better, it has parameter names
and a little bit of documentation but most of it seems automatically generated
Is there any way to know what methods do other than just asking?
Before I go back and look at my previous questions for another mod I was developing (but then stopped cause next build would fix it anyway) anyone know how one could access the faction system and create two teams and assign people to those two teams through it? Also I can't remember if there is a way to turn off friendly fire for the aforementioned factions, but if there is could it be turned on and off via modding?
Followup, could one check a player's faction and then execute code based on whether or not they are in a certain faction?
edit: the documentation for factions seems to have an array of each player stored in each faction, but I'm wondering of the ability to set - nvm theres a function for that too
but without familiarity with the codebase and stuff it will be difficult to tell what things actually do
i don't really know anything about the game's pvp systems since i don't play those modes, but the last one is certainly possible
i think it is probably pretty likely that you can assign them teams automatically, and if friendly fire toggle functionality already exists i can't see any reason you wouldn't be able to use it
Im a newbie when it comes to modding, would it be possible to setup a script that accesses the time/the current in game date of the server [or uses real life time] and then executes code?
basically im asking if I can make a script that performs a loop/a threaded func in order to run logic essentially separate of the main game [like score, etc]
i'm trying to set my mod's trait and another mod's trait to be mutually exclusive, however my TraitFactory.setMutualExclusive call is creating an error that (if i'm reading the trace and the decompiled code right) is because the other mod's trait does not exist yet
i've got my trait creation code in an OnGameBoot like i should and my mod is loaded after the other one
how would i make my code run after the other mod's code?
Question is it possable to put a Function inside an IF like so.
yeah
require the file from the other mod that adds the trait
e.g. if it's added in shared/MyModTrait.lua, add require "MyModTrait" to the start of your file
ok
Does anyone have any general advice on how to start learning scripting?
Every YouTube video is about adding items and recipes and I already know how to do that, and written guides are sparse.
I know lua and java but don't know how to start with zomboid integration.
These are main links for general stuff
https://pzwiki.net/wiki/Modding
https://github.com/FWolfe/Zomboid-Modding-Guide
seems like there's a video too
#mod_support message
it also helps to check out the Lua code in Lua files that may be related to what u want to do
and also to check out the code in mods that act the same functionally
theres also an excel spreadsheet made by glytch3r thats full of stuff although i dont have the link right now
and u can use this alongside the pz javadoc to find out what methods and functions a certain class has
any help?
id also like to know that so please ping me if someone answers u
though its not very descriptive u just kinda need to infer from the arguments, name and return type
There is a mod called skill limiter I think that limits the max level of a skill.
i think they want to set whether or not a player can earn any XP at all at a skill
oh wait
I guess that would work if the max carpentry level is set to 0
both music mods are now updated for those who wanted to know :)
a lot more jungle music haha
gotta put some raver music in there ;)
Ty, yeah, it does it by profession, I was hoping to accomplish it by trait for multiplayer.
So individual players can opt into limited traits and be rewarded for the decision with more trait points.
I am trying to write a mod so when a player sprints into a door the door opens, and if there is a zombie behind it, the zombie is knocked down:
local function OnObjectCollide(char, isoDoor, isoGridSquare, isoThumpable, isoWindow, isoZombie)
if char ~= getPlayer() then return end
if isoDoor then
if isoDoor:IsOpen() then return end
if char:isSprinting() then
isoDoor:ToggleDoor(char)
local otherSideSquare = isoDoor:getOtherSideOfDoor(char)
zombie = otherSideSquare:getZombie()
if zombie then
zombie:knockDown(false)
end
end
end
end
Events.OnObjectCollide.Add(OnObjectCollide)
The code "works" if I have a debug breakpoint set anywhere in the OnObjectCollide() ie: the zombie is knocked down and the player is OK. But if I don't break the player is tripped by the zombie. The zombie should be already in knockDown state as the trigger is on the OnDoorCollide, so the player has not passed through the door before the knockDown. I don't know what going into a debugger breakpoint is doing to make it work the way it should, but I would like to know ๐
Yeah that's correct. But I want it to be based on a trait instead of profession. The skill limiter is based on professions or just all folks all the time.
A trait for each skill
it works at all? that isn't the signature of OnObjectCollide, this should be spitting a bunch of errors
it only passes two objects, the moving object colliding into something and the something it's colliding into
oh, i see, your zombie doesn't come from there
iirc you have to set some animation variables to knock down a zombie...?
Setting animation variable to knock down. No I have not needed to before. I have knocked down zombies in my Concussion mod to "shoot" them when tripping with a loaded firearm. And in this code it works if I set a breakpoint. The code hits the breakpoint, and I press the Run btton and it works just fine
#mod_development message here's what i remember about it
if it's unnecessary it might be some weird race condition, otherwise i can't see why a breakpoint changes anything
but that kind of race condition is very unusual here as very little in pz is multithreaded
I tried some of those setVariable(..) but I don't think it liked doing them to an IsoZombie. They seem to only work on an IsoPlayer() but it was 2:00am when I tried it :). It is probably some race condition, or some other animation settle down which runs when breaking. Any ideas where the code is that transitions into the debugger so I can see what states it is setting/freezing?
Hello gentlemen. I decided to try to make a mod (for the first time) and almost everything is fine, but there was one problem that I just canโt solve. The problem is that I need to set MaxHealth to the building, which is done EXACTLY through IsoDoor.new. I know that there is no setMaxHealth command, but maybe someone still knows a way. Because of this last little detail, the mod will not be completed. Thank you in advance to everyone who responds and forgive my English.
There's things that change while in debug f11, like mouse position which leads to UI weirdness for example when dragging windows or clicking on objects.
True, but those don't apply in this case as the player is sprinting without using mouse aim or mouse buttons. The mouse position is changed.. but you might be onto something here
maybe something changes in the collision and then you delay it while in debug.
btw, state would change next zombie update. You don't change the zombie state in the shown snippet.
I tried adding zombie:changeState(StaggerBackState.instance()) before zombie:knockDown(false) and it didn't fix it, and it prevented the "break and run" from working too (player just trips over zombie). This will take some working out I think ... soo much java code to wade through... ๐
hello, i have question, i can i remove a data from player mod data. i use
modata = getSpecificPlayer(0):getModData()
modata["itemhotbar"] = {}
i store many item type to that mod data, and i want to remove 1 of the item in that mod data, how to do it?
you mean, i can remove it like i remove data from table using tabel.remove?
I never tried to save a whole table, but yes you should be able to
Just like how you can do modata.X = nil to remove a variable entirely
ah yes, i just found it out just now haha, thanks btw
ordered table: use table.remove
key-value table: set to nil
thanks
hi guys im modifying a mod to add an attachment but to a different body location. I can now wear it perfectly and attach a weapon to it but it does not show up in my character. Is there anything I missed? Do I need to add to this file too fileGuidTable.xml? I specified a new ClothingItem to it but I'm not sure if it is the right way. Btw, the attached weapon is showing up but the clothing is not
Has anyone made it so that when you kill a zombie they can randomly burst into flames?
yes, I think somebody has exploding zombies on workshop.
I used to have them drop molotovs like last stand.
Fire Hazard mod can randomly set killed zombies on fire.
Hi. Does anyone know what event is called when you hit the window or other parts of the cars?
Events.OnWeaponHitXp doesn t seem to be
and i'm pretty sure it also shows in the corner that you're in a safezone
or maybe it was a mod i used idk
Does anyone know if ModData.transmit can meet a race condition if sent frequently within the same module?
from my previous analysis of the code there is not really any handling of potential race conditions at all
when moddata is received it overwrites the local copy completely, so if two clients transmit the same one at roughly the same time (allowing for ping) it probably will just use the latest one received
however there might be handling for this somewhere in the networking as i have literally never seen this cause an issue, when it probably should?
How do I make a clothing item that covers the whole body protect your feet?
Bumping for help.
Does anyone know where the game sets the xp multiplier from the books, when you level up?
Cause I need to check where the game sets the multiplier to 0 when you get over the lvl that the book provides
addXp method
Oh, so in the java side of the addXp?
sorry it will be something like if player:HasTrait("ABC") then ... no way around this. You have the mod ready for you to be tweaked.
Alright thank you polter, I will look into the java ๐ฅฐ
I had a skill book that gives multiplier for all levels if that's what you are looking for.
Nope, I'm working on a mod that allows you to keep the multiplier after you die, but I have bug where it gives you the previous multiplier when you respawn as higher level
Like, I read the book that gives XP boost for carpentry lvl 1 and 2, but the new player spawns at carpentry lvl 3
The code is giving it he boost from lvl 1 and 2, but this should not happen
read the next book?
Yeah, that fixes it, but I don't like that
Maybe it's a silly math mistake on my side
ah, levels are lower by 1 I think
Yep
Which is what I'm testing right now
Ah, nope still broken ๐ค
function KeepBooksMultiplier:load(player)
local modData = self:getModData()
for bookFullName, readPages in pairs(modData) do
player:setAlreadyReadPages(bookFullName, readPages)
end
local skillBooks = self:getSkillBooks()
for _, skillBook in ipairs(skillBooks) do
local item = skillBook:InstanceItem(nil)
local mockAction = ISReadABook:new(player, item, 2)
-- I had a +1 here
local skillTrainedLevel = player:getPerkLevel(SkillBook[item:getSkillTrained()].perk)
local isTooHighLvl = item:getLvlSkillTrained() > skillTrainedLevel
local isTooLowLvl = item:getMaxLevelTrained() < skillTrainedLevel
if item:getAlreadyReadPages() > 0 and not isTooHighLvl and not isTooLowLvl then
Debug:print('Perk:', item:getSkillTrained(), 'lvl:', skillTrainedLevel)
Debug:print('Apply XP multiplier from:', item:getDisplayName())
-- checkMultiplier sets the multiplier on the player too :D
ISReadABook.checkMultiplier(mockAction)
end
end
end
I think because I'm looping over each book, it's giving the multiplier when it's not supposed to?
seems like math is off indeed
Ah goddamit the internal name of carpentry, is not aligned with the item:getSkillTrained()
FFS
Alright I fixed it
Took a while, but now the system should be bomb proof
now I'm always sure on what I'm getting ๐
How is mod data on items handled by the server in MP? I don't see anything like transmitModData used on items in code I've looked at. Since player inventory is client side, can I expect mod data on items to be automatically transferred with items themselves when they're transferred to the world (and vice versa from the world to a client)?
It's kind of not. Alot of stuff that could be useful to you or I, simply don't, because the devs didn't need it to at the time of implementation.
I did some really janky stuff in GameNight which quickly picks up and places down an item.
You could try tapping into the worldInventoryItemObject or whatever that is called
and try to push changes into it's InventoryItem there
worldInventoryItemObject is an IsoObject so it has transmitModData
Thanks, I feared that might be the case but wanted to be sure for anything I do in the future. Luckily, I haven't really done anything yet where it matters if it's kept or not on items
Just an update on the ZombieSlam mod where sprinting through a door with a zombie on the other side knocks the zombie down: I can repoduce the correct behaviour "Sprint into Door -> Door Opens -> Zombie knocked down" so long as I stop sprinting the moment the door opens. The debugger was doing the same thing - when the debug code breaks, it stops the sprint. I feel a bit silly not realising what it was doing the first time. Anyway... I guess the thing is either the player has to stop sprinting on the door opening, or I have to somehow code the player to not be sprinting for a few frames? Perhaps I can do it by unmapping the sprint key for a brief period and that will be enough? Experiments to follow. Thanks to @fast galleon and @bronze yoke for your assistance ๐
guys
who know how i can see it in online
rgb
it's standart rgb or...
just i can't find this format, only rgb(0-255)
it's the same, it's just 0-1 instead of 0-255
ah, oky, thanks
ty, I did have the code below but it didn't ever prevent xp. Again, the selection of the trait worked when creating the character (it didn't show up on the character sheet later though). And it never prevented xp gain.
`require 'NPCs/TraitFactory'
require 'NPCs/ProfessionFactory'
-- Define the NoCarpentry trait
local function NoCarpentryXP()
TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end
-- Function to apply the trait effect
local function applyNoCarpentryTraitEffect(character, perk)
if not character or not perk then
return
end
local carpentrySkill = "Woodwork" -- The identifier of the Carpentry skill
-- Check if the perk is Carpentry and if the character has the No Carpentry XP trait
if player:HasTrait("NoCarpentry") and perk:getId():lower() == carpentrySkill:lower() then
-- Set the trait multiplier for Carpentry to 0
local traitMultiplier = 0
-- Apply the multiplier effect to the Carpentry skill
print("Carpentry XP gain set to 0 for character with No Carpentry XP trait.")
end
end
-- Event handler for perk leveling
local function onLevelPerk(character, perk, level)
applyNoCarpentryTraitEffect(character, perk)
end
-- Register the trait and event handlers
Events.OnGameBoot.Add(NoCarpentryXP)
Events.LevelPerk.Add(onLevelPerk)
`
You can use triple back ticks for multiline code
```lua
code goes here
```
And it looks like you're setting
local traitMultiplier = 0
but then not doing anything with it in your applyNoCarpentryTraitEffect
This shouldn't do anything unless you actually apply that value in the function. As for the NoCarpentryXP function, seemingly not working fully, I'm not sure what's going on.
if it doesn't show up on the character sheet that's likely just because it doesn't have an icon
That's a good shout.
ty for showing this, i can finally get to work on something!
Yeah all good, map looks awesome.
I made a mod thats basically like this, I never had this issue because barging open a door i made the character play the bump animation, so they wouldn't technically be sprtinting and not trip
if you dont want a bump animation however then you probably need to do some funky trickery like other people suggest
I never got to actually publishing the mod so good luck on your endeavors, maybe youll get to actually post it before you get distracted like me lol
if it saves you some trouble this is all you need to play the animation, the bump types are "left" and "right" dont mind the function in it it just returned left or right based off some pretty bad deciding factors
and this if you want some fun noises
hey there, im looking for some mod that i could help develop
i have some good knowledge of Java and some of lua
you're volunteering?
yep
i need to get some experience to be able to get some job in the area of development
so whats better than helping mod one of my favorite games
Thanks for the suggestion. I resolved the issue by unmapping the sprint key for 80 RenderTicks. It took a bit of playing to get the sweet spot for it. The mod is finished and published as "Rick's MLC Zombie Slam". Your suggestion for the door noise is a good one... I might plug it in and see how it goes, as well as try out the bump animation to see if it is a better solution.
If you decide to keep your current implementation thats cool, i'll probably quickly finish and publish my mod since they would then work differently enough that it wouldnt be redundant
why onTick? https://pzwiki.net/wiki/Lua_Events/OnObjectCollide
why not OnObjectCollide?
just cancel animation when on collide with doors
nope?
looks like mod "zombies jump into windows", when u change state of collide object (Doors in your case) like in open state if its not barricaded and closed (and not locked for doors on your case)
nvm, im stupid
Is there any way to use the in-game debugging tools to change modData on an item in my inventory?
I am tiring of having to do 'legitimate' actions to test my mod ๐
Just a heads up to anyone using zombies modData as a tempt place to store data - if the zombie gets recycled the modData isn't wiped ๐
Oh dear.
console commands, debug keybinded function, notloc test framework
Unsure where to find information on the first two, but realistically speaking, Notloc's framework is all I'm looking for.
If somebody is ever going to be frying their brains trying to understand how items is filled in context menu of inventory
local function yourFunc(player, context, items) end
items = ISInventoryPane.getActualItems(items)
end
Events.OnFillInventoryObjectContextMenu.Add(yourFunc);
That VERY intersting ISInventoryPane.getActualItems(items) does seem to return PROPER items refs
Does some1 takes commission?
i've taken it to mean 'isometric'
oh interesting, i noticed this when i was looking over the recycling code but i thought 'no, this can't possibly be true, i'm missing something' so i didn't mention it
Indeed, it caused an issue as my zombie zones mod tries to retain the behaviors outside of zones
So people started getting sprinters cause it was the same object ๐
Im attempting to use capsid but everytime i run setupWorkspace it gives this error, can anyone interpret this?
It seems like it has something to do with the version but i don't know what i would be able to do about that
hmmm i think im on the wrong gradle version
that was it, thanks a ton man
Does anyone know if there is any documentation on how broadcast radio works? I found some examples but it looks pretty complicated. I have a station created and trying to figure out the loop timing so that the text triggers every 2hrs in game.
Right now it triggers for a while and then pauses for hours on end.
Yeah I think that's it.
ty, I was using 1 backtick and not 3
Can I make custom animation for a weapon?
Does anyone know if it's possible to create new server console commands through the LUA?
Anyone know if it's possible to enter a string with a comma in sandbox vars?
Updated the code to what I will link below, I'm trying to edit this "traitMultiplier" from the output log.
require 'NPCs/ProfessionFactory'
require 'NPCs/PerkFactory'
-- Define the NoCarpentry trait
local function NoCarpentryXP()
TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end
-- Function to apply the trait effect
local function applyNoCarpentryTraitEffect(character, perk)
if not character or not perk then
return
end
local carpentrySkill = "Woodwork" -- The identifier of the Carpentry skill
-- Check if the perk is Carpentry and if the character has the No Carpentry XP trait
if player:HasTrait("NoCarpentry") and perk:getId():lower() == carpentrySkill:lower() then
-- Set the trait multiplier for Carpentry to 0
local traitMultiplier = 0
-- Apply the multiplier effect to the Carpentry skill
player:getXp():addXpMultiplier(perk, traitMultiplier)
print("Carpentry XP gain set to 0 for character with No Carpentry XP trait.")
end
end
-- Event handler for perk leveling
local function onLevelPerk(character, perk, level)
applyNoCarpentryTraitEffect(character, perk)
end
-- Register the trait and event handlers
Events.OnGameBoot.Add(NoCarpentryXP)
Events.LevelPerk.Add(onLevelPerk)```
I guess I'm struggling to figure out where/how to target that specific multiplier.
if the value is string type then you can use any characters. Most times the option should explain the proper format for the text.
There is a person here who does this, try searching. It's not a vanilla behaviour.
add big bazongers
Yo, can anyone help with server-related stuff?
I'm hooking up to vanilla function to catch some stuff
local original_fix_perform = ISFixAction.perform;
function ISFixAction:perform()
local player = self.character;
local modData = player:getModData().EvolvingTraitsWorld;
local vehiclePartCondition = 0;
if detailedDebug() then print("ETW Logger | ISFixAction:perform(): caught") end
if self.vehiclePart then
local part = self.vehiclePart;
vehiclePartCondition = part:getCondition();
end
original_fix_perform(self);
if self.vehiclePart and ((SBvars.Mechanics == true and not player:HasTrait("Mechanics")) or (SBvars.BodyWorkEnthusiast == true and not player:HasTrait("BodyWorkEnthusiast"))) then
if detailedDebug() then print("ETW Logger | ISFixAction.perform(): car part") end
modData.VehiclePartRepairs = modData.VehiclePartRepairs + (self.vehiclePart:getCondition() - vehiclePartCondition);
ETWActionsOverride.mechanicsCheck();
end
end```
And it works in SP but in MP it doesn't, apperently 
Some server-client stuff and im not really familiar with server side of pz
Tested it out and it indeed doesnt update the value
Youโd have to transmit that to the server first probably
With i think sendServerCommand
My bad. I meant custom attack weapon animation. I'd like to make a 2 hand weapon, that would look like the char is holding one weapon in each hand and he will switch between them in the attack animation. Like having dual wield without actualy having dual wield.
I forget, can we access Java public fields in an instance and expect them to work reasonably correctly?
I want to get all the keys out of a HashMap stored on an IsoGameCharacter.
Ack, nevermind, it is a private field.
What is the most performance friendly way to get a list of all items in all the players backpack/fanny bags?
yo guys, anybody available to be hired for a mod? It's a paid work
looking to do some tweaks for my server, namely:
1. replace certain vehicles from a vehicle pack with their counterparts in another mod (eg. KI5-M998 in place of FRUsed hmmw)
2. blacklist certain literature items (eg. keep volumes 1, 2, and 5 of Aiming from LY, but exclude 3 and 4)
probably not the first person to ask, so feel free to point me to a page that has the info, but all I've found was prior to some changes that happened in 2021/2022 and at the very least, the mods in the workshop I've loaded to do this aren't working. I've reviewed the code others have written, but can't get them to work properly in my debug instance and so figure there is some step or linkage I'm missing int he chain. Finally decided to make my own mod to patch them out and don't want to be stumbling in the dark.
FTR - I do IT and have a part-time development background, so I don't need to be hand-held, but I do need accurate, current information.
you need to find the client command that actually changes the condition and then hook that to send a server command to update the moddata
if what the commenter says is accurate the condition is being changed on the server but your code expects it to already be changed on the client by the time that code runs (which will only happen in singleplayer since there's no actual networking going on)
if it's deterministic a hack could be to just predict how much the condition would change by based on how the serverside function actually works
I found the action itself in ISFixAction.lua 
oh wait I think I see something
function ISFixAction:perform()
if self.item:getContainer() then
self.item:getContainer():setDrawDirty(true);
end
self.item:setJobDelta(0.0);
FixingManager.fixItem(self.item, self.character, self.fixing, self.fixer);
if self.vehiclePart then
local part = self.vehiclePart
if isClient() then
-- The server should call FixingManager.fixItem() but doesn't have all the info it needs.
local args = { vehicle = part:getVehicle():getId(), part = part:getId(),
condition = self.item:getCondition(), haveBeenRepaired = self.item:getHaveBeenRepaired() }
sendClientCommand(self.character, 'vehicle', 'fixPart', args)
else
part:setCondition(self.item:getCondition())
part:doInventoryItemStats(self.item, part:getMechanicSkillInstaller())
if part:isContainer() and not part:getItemContainer() then
-- Changing condition might change capacity.
-- This limits content amount to max capacity.
part:setContainerContentAmount(part:getContainerContentAmount())
end
part:getVehicle():updatePartStats()
part:getVehicle():updateBulletStats()
end
end
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self);
end

server is doing fixing manager
I get 0 hits on looking for fixPart, which is what I assume a client command
yeah, i think vanilla handles them entirely within two files? look for commands and vehiclecommands in the server folder
i imagine fixpart is in the latter
yep, i figured out a workaround though
was trying to use sandbox string to populate a table, ended up separating the string and using gmatch to populate my table
i found the function in VehicleCommands.lua needed but idk what to do with it. No clue how sending commands stuff works
function Commands.fixPart(player, args)
local vehicle = getVehicleById(args.vehicle)
if vehicle then
local part = vehicle:getPartById(args.part)
if not part then
noise('no such part '..tostring(args.part))
return
end
local item = part:getInventoryItem()
if item then
part:setCondition(args.condition)
item:setCondition(args.condition)
item:setHaveBeenRepaired(args.haveBeenRepaired)
part:doInventoryItemStats(item, part:getMechanicSkillInstaller())
if part:isContainer() and not part:getItemContainer() then
-- Changing condition might change capacity.
-- This limits content amount to max capacity.
part:setContainerContentAmount(part:getContainerContentAmount())
end
vehicle:updatePartStats()
vehicle:updateBulletStats()
vehicle:transmitPartCondition(part)
vehicle:transmitPartItem(part)
vehicle:transmitPartModData(part)
else
noise('part item is missing'..args.part)
end
else
noise('no such vehicle id='..tostring(args.vehicle))
end
end```
do i overwrite this function to catch condition change?
in a same way i did with isFixAction
What are you trying to do?
There's two IfixAction:performs?
Oh you're overwriting
I would overwrite before the original firing on the event, so it can hit both MP code and SP code in the original
As the vanilla function seems to be transmitting the modData of the part
Can anyone let me know how/where to find info on this "unboostxp"? Google isn't being helpful nor is it findable on the projectzomboid.com/modding site. I've been trying to use a function to change the "traitMultiplier" but I feel like I've just been running around using functions that don't write to that specific variable.
LOG : General , 1701469910753> unBoostXP: Woodwork xp:3
exerciseMultiplier: 1*3= 3
traitMultiplier: 1*3= 3
sandboxMultiplier: 1*3= 3
xpBoostMultiplier: 0.25*3= 0.75
skillBookMultiplier: 1*0.75= 0.75
Woodwork to be recorded: 0.75
is there a way to get this PerkFactory.Perk? this is to addxp on a character
wdym
Commands is local tho 
--***********************************************************
--** THE INDIE STONE **
--***********************************************************
if isClient() then return end
local VehicleCommands = {}
local Commands = {}
VehicleCommands.wantNoise = getDebug() or false
local noise = function(msg)
if VehicleCommands.wantNoise then
print('VehicleCommands: '..msg)
end
end
function Commands.hotwireEngine(player, args)
local electricSkill = args.electricSkill;
player:getVehicle():tryHotwire(electricSkill);
end
...
function Commands.fixPart(player, args)
code here
end```
so I cant catch it like this for example
local original_commands_fixpart = Commands.fixPart;
function Commands.fixPart(player, args)
if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): caught") end
original_commands_fixpart(player, args)
local vehicle = getVehicleById(args.vehicle)
if vehicle then
local part = vehicle:getPartById(args.part)
if part then
if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition) end
end
end
end
unless im misunderstanding something
Like i just don't have Commands
cuz its local to VehicleCommands.lua
this seem to do the trick
local Commands = {}
function Commands.fixPart(player, args)
--if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): caught") end
print("ETW Logger | Commands.fixPart(player, args): caught")
local vehicle = getVehicleById(args.vehicle)
if vehicle then
local part = vehicle:getPartById(args.part)
if part then
--if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition) end
print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition)
end
end
end
local OnClientCommand = function(module, command, player, args)
if module == 'vehicle' and Commands[command] then
local argStr = ''
args = args or {}
for k,v in pairs(args) do
argStr = argStr..' '..k..'='..tostring(v)
end
Commands[command](player, args)
end
end
Events.OnClientCommand.Add(OnClientCommand)
I just joinked how VehicleCommands does its calls and duplicated it
Does anyone know if either of these options is possible for dedicated servers?
- Get a total report of items remaining on a server to support a view of the overall map item economy?
- Can one export information from a dedicated server such as faction list?
- unlikely (there is no time where vanilla PZ does load everything). but you could implement something with the overall discovered map economy with errors (errors related to unloaded part)
- yes
Hello everyone, I'm trying my hand at modding PZ to add genuine stat differences to the Occult Zombies mod. I got the hang of it, but I have no idea how to give zombies a permanent flag to avoid updating them again once the game is quit then loaded back up. Is such a thing even possible ?
So apparently we can add icons to context menu options. I made a quick mod to show it off for some of the vanilla options yesterday:
https://steamcommunity.com/sharedfiles/filedetails/?id=3101668503
That is awesome, I had no idea you could do that. Do you have any plans to add support for other mods or are you gonna leave that up to others?
I wonder. Is there a way to see what code runs when I trigger an action in the game?
I'm trying to find the code that handles combining partially used glue or duct tape, but finding anything in the folders is a bit of a nightmare. For example in Maya I can do stuff in viewport and have all actions printed out in the script editor, so I'm curious if there is a setting in debug that would allow that, so I can get an idea where to look for the specific code I need.
Something that usually works for finding actions that trigger from context: search for the translation text, then search for the translation key, then go to the function set for that option.
I might add support for other mods, but I don't play with a huge roster right now.
Probably going to add for Inventory Tetris (Unpack context option), but not sure about other stuff.
I also haven't looked into adding icons to crafting options (e.g. "Rip cloth")
sendClientCommand + https://pzwiki.net/wiki/Lua_Events/OnClientCommand
Feel like rewriting it to be more modular would be a better approach. That way it would be easier for others to exapnd.
function: doMenu -- file: ISHotbar.lua line # 105 | Vanilla
function: doMenu -- file: MutiesContextMenuIconsAttach.lua line # 11 | MOD: Mutie's Context Menu icons
function: onRightMouseUp -- file: ISHotbar.lua line # 280 | Vanilla
java.lang.RuntimeException: attempted index: null of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
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.UIManager.update(UIManager.java:910)
at zombie.GameWindow.logic(GameWindow.java:262)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:667)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)```
I will actually use this. It's bigger addition to UX than you can imagine
Hell yeah. Feel free to drop a comment on the Steam page about any other context menu actions need icons.
Or if you figure out how to add icons to submenus..
Submenus are the same ISContext instances
sweet, I use Tetris all the time so that will be nice, and yeah, I'll probably take a look at my mod list at some point and pay one of my artist friends to make some icons for a few of the mods on my friend groups private server if you're cool with that, I doubt I would release it public prolly unlisted as a patch mod
simply because I'm lazy and wouldn't be able to keep up with updates if I released it public
You can navigate to ISBuildingMenu.lua or ISInventoryPane to inspect how exactly contextes are built @agile vigil
Basically there is a context within a context that has the same option added via addOption that returns entry. You can set icon to any entry same way you did it for other stuff.
All the icons I've sourced are open source and free to use, which is why they're not always perfect ๐
They're the same context? So I can just get the submenu option by name from the "outer" context? That's.. Weird, but I'll give it a shot before dinner.
That would be nice, Having things like the "attach - container" option from Noir's attachments having a container icon for example, would make it look really nice, also make it easier for people who might not have those mods translated into their language, pictures are a universal language in a way
yeah that works as well, I just happen to be in a friend group that has a lot of people who do art in some form and whenever I need something I tend to pay one of them to show support
either way the mod is awesome, been using it all morning and I think it's gonna be one of those mods that is permanent in my load order
addSubMenu: ((option: any, menu: any) => any) | any;
addOption:
| ((
name: any,
target: any,
onSelect: any,
param1: any,
param2: any,
param3: any,
param4: any,
param5: any,
param6: any,
param7: any,
param8: any,
param9: any,
param10: any
) => any)
| any;
You can add submenu to existing context. Where menu is the parent context and option is the field this parent has returned from addOption.
So in fact you can build an infinite ladder of options in context menus. context:options() can return all entries of current context.
Does anyone here have capsid intellisense working? I can't figure out what i'm doing wrong
Use Umbrella for IntelliSense.
That isnt' concole commands but thanks
What version of Intellij works with umbrella? The latest 2022 version says it's not compatible with my computer
Just to clarify, I'm not adding submenus, I am accessing submenus that the game already added.
Ah, Intellij doesn't have working lua IntelliSense now? Then you can use vscode.
you need the script to access sub menus? I'll have to dig that up later.
- options have number to link to submenu
- function that gets that submenu
I'm hoping I can do something where I don't have to "guess" the number, but I can consistently get the right number, even if there's one or more unexpected submenus.
I did see something that used numbers, but it all seemed a little fuzzy so I decided against doing anything with it for now. The context icon mod was meant to be a quick thing ๐
Basically you access option, get submenu from it, access its options.. and do that until you reach the end.
Which function are you using to get the submenu from the option? And to access an option I need a Context.
So ideally I'd access the submenu context from the option.
Got it.
A minimum working example.
function test(parentContext, optionName, subOptionName)
option = context:getOptionFromName(optionName);
if not option then return end
local subContext = context:getSubMenu(option.subOption);
local subOption = subContext:getOptionFromName(subOptionName);
if not subOption then return end
subOption.iconTexture = getTexture("media/ui/icons/Test.png");
end
PS: I do not like the stripes much, I think I'll just do a solid colour.
Much better. I'll hush for a few hours now 
The file for context menu is ISContextMenu, there's a lot of fun things in there
A good QoL for a lot of modders to consider is keeping the option even if it's not allowed and instead making it unusable and red instead.
Maybe add a tooltip to tell you why - etc
Seems like you found it already, but you can scroll this repo https://github.com/asledgehammer/PipeWrench/blob/stable/lua/client/ISUI/ISContextMenu.d.ts
This repo is so much harder to read than the .lua 
I use it as a pivot when I have no idea of what exactly is going on with specific class methods and functions.
i mean otherwise you can use that source (dont have a link) with it described from Java perspective
For me its all about having returned types here and there.
What's the quickest way to completely get rid of certain items?
Make item.txt copy item , for example :item AssaultRifle { DisplayCategory = Weapon, ImpactSound = null, MaxRange = 11, WeaponSprite = AssaultRifle, OBSOLETE = true, }
And just add OBSOLETE = true,
Could doParam that I guess.
Seems to do the trick. Thanks! Hopefully that parameter is not very destructive.
I don't care about the items themselves, but I wonder how it affects distribution.
I have a list of sound items that starts in the game as a defined list.
Playlist.files = {}
Playlist.files[1] = "sound1"
Playlist.files[2] = "sound2"
Playlist.files[3] = "sound3"
Playlist.files[4] = "sound4"
later I have a command that is run by a client to update the sound list.
for i=0, ContainerItems:size()-1 do
local item = ContainerItems:get(i)
Playlist.files[i+1] = item:getType()
print(i+1 .. " is " .. Playlist.files[i+1])
end
I need to get that list to update to the other clients. Is there a way to do this with moddata on a server?
Maybe something like this? if isClient() then ModData.transmit("MyModData") end
can i use assetto corsa models in zomboid if i triangulate them in some way
hey boss
-- If Shop.SellisBlacklist and Shop.SellisWhitelist set to false every item is sellable
its was only one set on false
but it work before idk why its not now
I honestly have no idea what is this about.
Have a shop ingame to sell the jewelry etc and every item is priced at $1
Ok, but why are asking me about this?
My guess is the fact you have both set to true, blacklists and whitelists do the opposite of eachother so having both turned on will not work.
A blacklist would ban items from being sold, a whitelist would allow only those in the list to be sold, that list can not do both at the same time
Having them both on false means, there is no whitelist to allow only the list to be sold, and there is no blacklist to ban certain items from being sold.
I'm looking for the file that govern zombie noise attraction intensity (player shout, gunshots, etc.). Anyone happen to know where it is? 
so just a heads up to anyone here it seems that "getPlayerMoveDir()" does not return the correct direction if the player is in combat stance
at least for me it repeatedly reproduces a result different to then if your not combat stance walking that direciton
Is there a reliable way to stop zomboid from trying to load the lua code from your workshop folder when you are in debug mode and working on a local version of your mod?
I just wasted the last hour of work because zomboid kept loading the mod from this path
C:\Program Files (x86)\Steam\steamapps\workshop\content\108600\3001605399\mods\casualoid\media\lua\client\Casualoid\OnGameStart.lua
instead of
D:\ZomboidDevCache\Workshop\pz-Casualoid\Contents\mods\casualoid\media\lua\client\Casualoid\OnGameStart.lua
It loaded my local version only after I unsubbed from my own mod ๐ฆ
I'm not sure why this keeps happening, but I remember this used to not be a problem about a year ago
-modfolders mods,workshop
steam workshop content (as opposed to workshop folder) is 'steam' in that list
I'm sorry how should I use this lauch option?
Shoul I just add it to my current options?
yeah
Does the order matter?
Cause I still kinda need to have the steam workshop loaded to debug incompatibilites with other mods
the order doesn't matter
(probably)
i started just symlinking in mods i want to test with but it's somewhat manual
I do that for my NOS-Client and NOS-Host
But for local SP development is very very overkill having to use symlink ๐ (IMHO)
yeah luckily i just haven't had too much need for it yet, i imagine i'll turn it off when i need to
maybe write a python script to do the heavy lifting for me...
Maybe with powershell you could have an easier time since it would already take care of running with admin privileges, and be a bit more native, if you are windows
hmm, i've got no experience with that but it does sound more sensical
How does one get started in the modding world?
do you know how code?
Learning, what language?
project zomboid supports lua coding
you can also make a mod in java but having others download it is not as easy
usually reserved for when you tamper with hard coded stuff
in 99% of cases the lua api is enough for modding
above anything else youll probably need this
its a bit overconfusing so you dont have to use it if you dont want to
but eventually youll get to a point where it wil be helpful
it just lets you get autocomplete and stuff for when writing code
https://projectzomboid.com/modding/
this website has like every single function and detail for most things that you'd want to know since rn zomboid doesn't really have a modding documentation this is as good as it gets
package index
overall though its sorta just a think of a thing you want to do and throw yourself at it till you get closer or learn something from it lol
How would you implement changing model of weapon based on current durability?
i don't think that's possible at the moment
the only hacky way i can think of doing that would be replacing the item entirely with the different model variant once it either breaks or its durability drops to a certain point
Whats the limits of moding?
hard to say for sure
there's hard coded things you can't change via lua coding, and that are for example the vehicle and zed stories
but you could change those by java modding
depends on what you're trying to do i guess?
I have a local mod and it is working perfectly last time but after I tried to verify integrity of game files any changes I made to the mod has no effect. Is there anything I can do? Maybe its cached or something
Mods installed in the Workshop folder have higher priority than in the mods folder. So if you updated your mod in the mods folder, your game will still load the mod from Workshop instead, if it exists there
Oh I see. Should I delete my Workshop while updating my mod? or is there any other way?
i always delete the mod from Workshop when i have uploaded it to the workshop. I don't know if there is an easier way 
Okay. thank you so much for the help!
Hmm. How does the game figure out if a food item is stale? I can find isCooked and isRotten to figure out the other states, but Staleness doesn't seem to be handled the same way.
I can see the food items have the age fresh and rotten coded in. Is the only way to find if an item is stale to query the age of the item and then compare it to the fresh age? :/
Hey I'm looking to make some tshirt retextures for the server I admin. Is there a simple guide for that? or consult the wiki?
I dont want to edit stats, or add models, just retexture the vanilla tshirt.
The best way to learn how to do it is to study the files of mods that do the same thing
How can I change character player model if it possible?
Heyo. Iโve been trying to get started on some mod ideas for a while now, but Iโm having quite a hard time getting things to work and just with figuring out where I should begin
One of the mods overhauls everything about the gameโs medicine and health mechanics, I have around 30 documents for organizing the various ideas. Iโm looking for something easier to start with. Two main mods Iโm working on are expanded short blunt and expanded boots.
However, Iโve run into a few critical issues with the boots mod.
I suppose the first issue I have is with changing the properties of Riding Boots.
I want to make it so that they cover both the feet and the shins, and only replacing the shoes, whilst still allowing to wear socks and stuff
However I canโt figure out how to get the body locations stuff to function ๐
Any help is greatly appreciated!
Just to be clearer with what the issue is:
I canโt figure out how to make Riding Boots protect both your feet and your shins whilst only taking up the shoes/footwear clothing slot.
I don't think thats possible, at least not in easy way, but if there is one, id like to know too.
Iโve come to learn that seemingly few of my ideas have any easy solutions ๐
I also donโt know how to go about adding new weapon modification slots to firearms. That was probably the first major issue I ever ran into and probably the one that broke me and made me remember why I hate coding lol
I could just compile a list of all my main questions and issues and see if anyone can help with them.
Will get back to yโall with that
protection uses the blood location rather than the body location
you can have multiple on an item by just separating them with semicolons
body locations are mostly just 'equipment slots' in that they're used to make items mutually exclusive with each other, most functionality actually looks for the blood location
New respawn mod prototype, With optional Respawn penalty trait for players who want a bit more challenge.
Trait cost, and XP is fully configurable,:D
Wait really!? Huh! I had no idea
Thank you so much!
Thereโs one big thing down for me, hooray
Lore idea:
Somehow, after dying, you woke up again. You feel like absolute shit. You're not were you died but you survived. Your wounds have closed but your memory is hazy.
spitballing here
I like that!
also depending on how it's set up
there should be special interactions if you encounter your old dead body/your zombie self
like
MAX PANIC and MAX STRESS
but only for the first few times, when being a returner is still a concept that has to be digested
would become weaker over time, the stress and panic
I like this mod idea. Did you also look into keeping the gear you died with?
Nope because it's a bit too complicated IMHO
But I could try
so
not gonna be able to work on it today
but
any recommendations for when one wants to learn how to mod?
for start i want to add:
-Stone Firepit (Like campfire but you cant walk into it)
-Log barricade Window/Doorframe
-Stick Fortification/Unopanable window
-Cobblestone floor
then slowly expand from that idea when i get better
if i can reverse engineer the games definitions, i'd be very happy
That's a great idea, but I think it's a bit out of scope for my mod. As the respawn feature is just one of many
Either one of these individually are pretty doable - I'd probably argue the fortifications are the most simple, as adding things to the "Building menus" is a headache.
Doing the other things by just making a new menu for your own building is not nearly as difficult, though, and you could look at mods like the ones that let you place concrete floors for examples.
I should make a framework mod to make it less of a headache, actually...
might actually be a bit harder, cause i want to treat the existing log barricades like the wall frames, so the options only appear when you rightclick the existing wall
but that should not be hard, just need to look how vanilla does it with their wall frames
Reading the vanilla code for these things is headache levels of annoying, but getting a good grasp of what happens within a few hours should be doable.
I hope you've set up your IntelliSense and all that ๐
IntelliSense?
dafriq is that?
It's like the catch-all term for type-ahead suggestions and stuff in your coding IDE of choice. It lets you click over to the definition (or uses) of a .lua function so you can see what file implements it as well, and keep clicking around to get a full picture of what's going on, even if everything is in 7 different files.
ah
like
having tabs in Notepad++ to keep track of all the code youre doing?
Hey, I'd like to make a small mod that simply adds a few cool posters to the game for me and my friends, should I use the modelling guide found on the forum and use a downsized png for transparency and performance or is there an easier way to add wall decorations similar to the vanilla clock I guess?
Is there a way to change the display name of a vanilla item?
Iโm trying to make it so that "Military Boots" are renamed to "Combat Boots"
Canโt seem to get it to work though
๐ฎ Steamworkshop stealth update - you can now let co-authors upload to workshop
Community-Modding account can now be added as a co-author to any mod and update right from a github
hey guys, how can i detect if a door is closed or opened
declaration: package: zombie.iso.objects, class: IsoDoor
source?
Cows with Guns told me and I just tried it
uhhh how tf im supposed to have this in lua
ok, how to not let co-auth update?
Only list them as a credit in the description - no clue tbh
Maybe in the next 10 years Steam will add support for differentiating contributor to co-author
When using getPerkLevel(), what exactly should I be using. I tried PerkFactory.Woodworking, "Woodworking", PerkFactory.Perk.Woodworking, to no avail.
Perks.Woodwork
framework you say 
Build 42 could still be quite a way off.
is there an event for before vehicles spawning but after sandbox options have been loaded? For context, I am trying to add a custom part to vehicles based on sandbox settings, but apparently sandbox settings do not have the time to load yet so the option is always false (at least as far as I understood the problem)
I am using this script btw ^
Yup, this does the job, thanks!

something else i wanna add longterm, but want to know if its possible at all: woodash and woodash cement
I would need a script that checks for how long a fire has burned for in total and then deposits a unit of woodash into the fires inventory after x amount of ingame minutes the fire has burned for.
I'm messing around with the addXpMultiplier thinking that it would allow me to get at the attached photo's traitMultiplier, but it doesn't seem to have that capability. Any idea which method targets that specific multiplier?
Also, is there a way to mess with the .75/1/1.25 boosts such that you can set them to be 0 if you put the number negative?
As in, 3*0 = 0 and you get 0 xp.