#mod_development
1 messages ยท Page 327 of 1
i'm just saying there's absolutely no difference whatsoever
kahlua actually likes it
it still does nothing though
It won't actually matter - using 1 or 1.0 will become a "number" in lua and then then it converts when passed to java
๐
"Put any data in here, IDGAF but don't you DARE tell me what sort of number you're using!"
if you like type annotations you can use```lua
---@type integer
local int = 5
---@type number
local float = 5.0
-- (or just do nothing for numbers because it's the default anyway + specifying it doesn't change anything)
the language server treats integers as a subtype since it's generally convenient to do so
Ints aren't added in lua until 5.3. Though I don't know how Kahlua works so I can't give word on that. But on any version before all number types are simply number (int, float, etc etc etc)
Honestly typechecking in the future similar to Luau would be nice
yeah, i was talking about that just a couple messages ago ๐ the language server treats them as separate types in any version because it is convenient
local mynum: number = 1000;
there's no runtime difference but 'this function only takes integers'/'this table's keys should only be integers' etc are such common concepts and so easily checked that the language server might as well, especially if it supports the integer type for later versions anyway
that's fair
what would be nice is straying away from kahlua in the future
maybe it can be an experiment in the future, trying out something else like jua (luajit4java) or some other alternative
it doesn't really seem like TIS are interested in something like that but i think nearly everyone would appreciate it
definitely
most of all kahlua just runs like shit LOL
i haven't really looked much into how Kahlua works
by far the slowest lua implementation i've seen
i haven't messed with it much since i'm too busy on other projects, but i did take a look at kahlua and i was worried about that.
Anyone know where the code is for the temperature health gui
I'd like to replicate the UI a bit, if it's exposed
Hmm someone used it for a trait mod
Let me see if I can find it back
You could reverse engineer their mod to easily have a working example of modding it in
If that's the temperature GUI you meant
Hmm, does anybody know where the code for weapon sharpness is located? I'm interested in how dull a blade can become before it starts to affect damage and increases condition loss and by how much.
Most likely in the Java, but no idea exactly where
HandWeapon.java
InventoryItem.java
Max damage drops as soon as the wepaon isn't perfectly sharp, but will never drop below mindamage (This is why the katana with 8 min damage/8 max damage never needs sharpening.)
Mighty kind of you, thanks. :)
Interesting
So it's linear
I think a non-linear decrease would probably be better ...
Something like this sounds more fair
Tho at the same time it's not it's setting the damage to zero anyway, so it's not as hard as getting tired
I really dislike the sharpness mechanic. It's a brutal straight up nerf to all bladed weapons and it's especially devastating for short blade.
Think i'm just gonna add a set of combat knives that can be crafted or found that don't have sharpness and are slightly more durable to counter the fact, that weapons can no longer be repaired like in 41.
@bright fog IsoGridSquare:getObjects() doesn't include walls, i can't figure out how to get all the walls other than north and west(?) wall using IsoGridSquare:getWall(), by any chance do you know how i can get the walls of every direction?
those are the only walls on that square
the wall to the east belongs to the square to the east
same with south walls
yeah
the walls look like they're in-between squares, but really they're on the same grid as everything else
Basically what Albion said, this was something I had to tackle with my ray casting code
ye thats what I want to do, I have the ideas for it lined up in a txt file somewhere ๐
Hello! I need help, I made a fashion for clothes and a recipe for crafting them out of money. Everything works fine in build 41, and there are crafting recipes. (I named the files with build numbers to show the differences.)
However, in build 42, the crafting script does not work and the game simply crashes with the error of not being able to load the crafts. If you remove the "craftRecipe" functions and everything in them, then the game works fine, however, logically, there will be no recipe for crafting clothes, but the clothes themselves will exist in the game and can be found using the Debug menu.
I believe something is incorrectly written in the "craftRecipe" functions, but I can't figure out what's wrong. Please help me!
in outputs you shouldn't enclose the item name in []s
Yea, what albion said
Alternatively, refer to the wiki page regarding craftRecipe
so we're in minecraft ๐
lol
next TIS is gonna add Bite Protection VII or something
That's kind of a thing already ?
ik I meant like enchantments or something, it was a joke tho lol
Yea ik lol
why do coroutines loops yields the main game thread brah
i thought coroutines are supposed to be like... behave like a different thread
whatever
@ancient grail I see you've only linked your workshop files and not the mod itself. Those are private mods ?
No it's not
Please, link the mod itself or I will remove those links myself !
I see Tcherno did the same
Yea I think we need to apply some policy to this so the workshop items themselves are linked
I'll clean up that page a bit I think
How would you guys do a timed event for a object. Like i got a Workstation, and a GUI for it, how would you make sure that workstation works in the background
i feel like hooking the timed events like 1min and so on seems suboptimal. Or is there like a timeout ?
if you can't tell, I spent way too much time debugging why self.currentItems was nil when it got to PickupItems()
I'm gonna change that to self:PickupItems() and then go cry in a corner for a bit.
Open GUI on Object, Start Progress on GUI, wait 10 min, collect from Object
Imo the best method is to note the timestamp the action started, then check the current timestamp every minutes (no point doing it every seconds, in-game timestamps update only every minutes) and check how many minutes have passed, and if enough have passed
- Start progress: note current timestamp
- Every minutes, diff between current and start timestamps
- If diff > time of action: finish task
hmm i will try thanks
Check GameTime for timestamps I think it's in ?
no, no version of lua can run multithreaded, it just isn't compatible with the fundamental design of the language
am used to Luau.....
basically the entire coroutine library is just to have functions you can pause and resume lol
lua parallel execution is fake
i don't find it useful even for the marginal cases where writing in that style would be helpful since it has awful overhead anyway
anyone know a workaround for overriding your own craftrecipe in build42? im trying to build a compatibility patch right now
module Base
{
local script =
"{ inputs { item 1200 [Base.BlowTorch] flags[Prop2],} }"
local recipe = getScriptManager():getCraftRecipe("PackBoxOfWeldingTorches")
recipe:getInputs():clear()
recipe:Load("PackBoxOfWeldingTorches", script)
}```
what ive got so far
i copied it from an indie stone forum post and modified it to try and make it work for my mod, ended up just making every recipe in the mod not work!
Thank you 
First off I'm shocked there's up to date forum posts regarding modding stuff ๐ญ
Secondly, you just loaded a crafting which only has inputs in it, would that replace inputs or completely override the recipe in this case ? If the last one then you're missing a lot of parameters for the craft to work
well let me get the recipe set for you:
craftRecipe OpenBoxOfWeldingTorches
{
timedAction = OpenAmmoBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
inputs
{
item 1 [Base.BoxOfWeldingTorches] flags[Prop2],
}
outputs
{
item 12 Base.BlowTorch,
}
}
craftRecipe PackBoxOfWeldingTorches
{
timedAction = PlaceAmmoInBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
OnCreate = Recipe.OnCreate.ToConditionInheriter,
inputs
{
item 120 [Base.BlowTorch] mode:destroy flags[Prop2],
}
outputs
{
item 1 Base.BoxOfWeldingTorches,
}
}
im trying to override item 120 [Base.BlowTorch] mode:destroy flags[Prop2], with item 1200 [Base.BlowTorch] mode:destroy flags[Prop2],
i'll also offer my file structure and whats going on there
the base mods craftrecipe.txt file is in Workshop\Box more!\Contents\mods\Box more!\42\media\scripts\B42FM_craftrecipes.txt
the txt file i put the script into is in Workshop\Box more!\Contents\mods\Box more! for torch fix\42\media\scripts\B42FM_craftrecipes.txt
That's a Lua script, not a script script ๐ญ
I didn't notice the module Base
Oh god

makes sense, i'll have to put it as a .lua in the lua folder then
Inside lua/server I would say
or lua/shared at the very least
remove module base?
Yea, remove that completely haha
The original post you found was most likely without any of the module Base thing ;)
Thanks for the help! And one last point
Do I understand correctly that the folders Contents\mods\Mode_Name\41 and Contents\mods\Mode_Name\42 will be read by the game separately in the 41st and 42nd versions of the build? How do I make the mod work on both 41 and 42 builds?
I fixed the error above, but I would like the mod to work on both versions 41 and 42. However, the scripts are slightly different
Folders **41 **and **42 **contain the same mod.info and posters.
The **common **folder contains the working version for 42 builds
it was yes
let me see if it works now!
Contents\mods\Mode_Name\41 is not a thing
B41 doesn't use this
oh and while im at it should i keep any other lua files
Refer to the wiki page regarding the mod structure
Remove all their files, if you just plan on making an addon
Completely delete every files that are not yours at all
yeah thats what im doing
yes
pzwiki my beloved
:3
oh and while we're at it theres also an issue where any liquids i pack into it get a duplicate empty bottle?
;3
Hmm
i'll get the code to you momentarily
It uses crafts right ?
yes
craftRecipe PackBoxOfAlcoholBottles
{
timedAction = PlaceAmmoInBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
inputs
{
item 11 [Base.Disinfectant] mode:destroy flags[Prop2],
item 1 [*],
-fluid 0.5 [Alcohol],
}
outputs
{
item 1 Base.BoxOfAlcoholBottles,
}
}```
this is what we got right now for it
So this takes 11 bottles of disinfectant and packs them in a box ?
its supposed to take 12 bottles of disinfectant and put them in a box
Why 11 ?
fluid is buggy in crafting right now
and the modder i commissioned to help me do this did that
that modder is unreachable right now too which is why im here
What happens to the fluid ? It just disappears right ?
its supposed to yes
So you could just remove that fluid part right ?
And just keep the 12 bottles getting consumed ?
i'll test it
but im pretty sure theres a reason for that fluid part
Tho one issue would be duplications, so not sure how you should handle fluids for box recipes like that, I'm not familiar with those in the base game. Does the base game have such a recipe for items with fluids ?
Figured, but that's probably why there's an empty bottle at end, bcs it destroys 11 and the 12th gets its fluid drained, which leaves an empty bottle
yeah i don't really get what's intended by that part
new code did this when packing
craftRecipe PackBoxOfAlcoholBottles
{
timedAction = PlaceAmmoInBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
inputs
{
item 12 [Base.Disinfectant] mode:destroy flags[Prop2],
}
outputs
{
item 1 Base.BoxOfAlcoholBottles,
}
}```
i did this and the alcohol bottle just appears when im done packing
and yes the welding torches are fixed i forgot to add a mode:destroy
i dont think it does?
well
it has some fluid recipes
for coffee and smelting
Duplication of the fluid is what I meant
well i packed it again and it just left me an empty bottle
So in the 12 bottles being packed, the 12th didn't get destroyed ?
no the 12 bottles get packed fine but 1 empty bottle gets put in the inventory
Did you make sure that you do not have your own mod downloaded on the workshop
Bcs it could be it doesn't take your changes into account
i have my own mod uploaded on the workshop but not this version
Make sure to unsub from the original mod, to only use your own local version
it overrides the workshop mod
i found that out last night trying to test out other boxes
Depends, sometimes it does, sometimes it doesn't
Highly suggest you unsub from the original mod regardless
i'll check
This has caused more than a few brains to fry due to it
it's known to cause a couple issues
unsub from the workshop or just uncheck it in the mod manager
yes
did that
Bcs you got two mods locally and workshop that have the same ID
Both will mix together and that will cause issues
the patch has a different mod ID
After you done that, test again your new script recipe
alright i unsubbed
i'll check it
The patch is another story, that craft you're testing is from the main one right ?
The patch itself is new if I understood that right and so is not yet present on the workshop version, so it would work
voila
See ;)
the patch is new and not present
What I think was happening:
- the game picked one of the 12 bottles to empty with that fluid entry
- sometimes it would use the same as the bottle not being destroyed, thus leaving an empty bottle
- and other times it wouldn't and pick empty a bottle that gets destroyed anyway, leaving a full bottle
And since your own modification of the mod wasn't loaded, it used the one on the workshop, with that fluid recipe
well the mod is fixed up now i believe but i have other issues with fluids
That's why you unsub from your own mods when dev or use a closed environment from the Workshop
like water, i wanted to make a box of water but when i did
when i opened it it just gave me half seltzer water half water
regardless of what i put in it
something to do with the [Water] fluid tag because i dont know how to indicate it
yeah the issue there is that the game just randomly picks one when it spawns a water bottle
might need an oncreate to fix that
fair enough
but it would be nicer to be able to have seperate boxes of seltzer and water bottles
i'll have to look into that
im not very experienced with modding but im aware of code structure and the basics of formatting
Sadly the fact the box system uses items that don't hold previous informations of the items will mean that you will never retrieve the bottles with their previous fluid content. This could be fixed however
Also
One issue: make sure that empty bottles that get packed don't unpack as full bottles
Bcs the fact it even gives you a fluid in the first place, means this is going to be an issue
there is a conditioninheriter lua script intended to solve the previous information problem
i'd like it so i can pack it like batteries for example, keeping the usedelta data
Doesn't seem to be doing it's job properly then for bottles ๐
Didn't the original modder add that in ?
the person i commissioned yes
so you paid someone to make this mod and it doesn't even work properly...?
require 'recipecode'
function Recipe.OnCreate.FromConditionInheriter(craftRecipeData, player)
local items = craftRecipeData:getAllConsumedItems();
local results = craftRecipeData:getAllCreatedItems()
local box = items:get(0);
for i = 0, results:size() - 1 do
local resultItem = results:get(i);
if box:getModData()["condition" .. i] then
resultItem:setCondition(box:getModData()["condition" .. i])
end
end
end
function Recipe.OnCreate.ToConditionInheriter(craftRecipeData, player)
local results = craftRecipeData:getAllCreatedItems()
local items = craftRecipeData:getAllConsumedItems();
local box = results:get(0);
for i = 0, items:size() - 1 do
local item = items:get(i);
if item:getCondition() ~= item:getConditionMax() then
box:getModData()["condition" .. i] = item:getCondition();
end
end
end```
it was partially complete before they canceled on me because i tried to pay them and they didnt give me an exact commission price
they just said "i dont want your scraps"
christ
this is the condition inheritor
wait
i still paid them some money though
and the code they gave me isnt published by them anywhere else
that name doesn't ring a bell tbf
they're active on the steam discussion page for zomboid
Damn this shit's a thing I forgot
they were harassing someone earlier because they had a typo on the word "feelings"
so that says something
in any case i dont see any issues on my end with this
its likely not linked or incorporated with the craftrecipes
oh
it does have an oncreate thing
for example
so it is linked
yeah the assholes and scammers avoid the main circles since everyone will catch onto them there ๐
this looks good, but it only covers condition, so any other properties (e.g. fluid) aren't copied
True
they were in this server before but they left
You just need to make a new function for OnCreate
one that applies to fluid
oh my god
does it work for flags[prop2] or is it exclusive to prop1
i'll test it out
so on my end what would i have to do?
add the inherit condition to the inputs area?
@ancient grail removed references to links to your mod page (as well for others that had done it) and replaced those with links to the mod itself, when I managed to find it. For the future, please link the mod itself or nothing at all. And for mods that may be hidden in private, add a note mentioning it like Private mod
You shouldn't use that in your case
i'm not really sure this is directly relevant, what they're trying to do is pack x items into a box item and then get items with the same condition/fluids/etc when unpacking
yeah thats what im trying to achieve here
some items dont have a condition so they're fine the way they were
(bandages et cetera)
but then theres crowbars and welder masks
and other similar items that have condition
or some sort of data that should be kept
You need to use the same method as the battery one
But replace the condition check to something for the fluid
so the condition stuff from the oncreates you showed isn't working?
So it notes:
- fluid type
- quantity
I wouldn't have packing recipes for welding masks; some items have so much individual data that storing and re-instancing it is problematic both in the sense of potential bugs, and save sizes.
he lives
Welding masks don't have unique properties tho
Oh they do no ?
although i'm not really sure why you'd want to pack them anyway ๐
Yea no idea LMAO
i dont think so
i remember a patch note about something to track ingredients used to craft an item but i've never looked at it so i have no idea how detailed that is, probably not very or save size would balloon
ii'll test it out
Well, according to good game design, every item must be packable if packing exists, regardless of bugs or save size issues
i play with the bandits mod and im a heavy looter, so i get that stuff in large quantities
But he's not packing welding masks anyway no lol ?
i.. am
That was removed for inventory items because of the save size issue FYI.
It's used for tiles only currently.
yeah
Asking too much to the devs here buddy ๐
It's intention was just "if we add some way to build something with nails OR screws how does the player get the right nails or screws when taking apart it"
Aaah
That's an interesting challenge to handle
I know Vintage Story has that for some recipes I believe
No idea how they handle it however
alright so what ive gotta do here is copy the way the battery pack inherits its usedelta, and also add to the conditioninheriter an ability to check and return fluid type and the quantity of that fluid
if i were doing this i'd honestly just require them to be full ๐
i agree but later on i am interested in adding firearms and ammo mags to the list of packable items
(because i also play with the smokes n guns mod, get plenty of those)
Yea figured something like that would be a good idea too
for the time being thats actually how it is i believe
i tried to put in used caffeine pills once
To be absolutely blunt and honest I consider going down the rabbit hole of "making everything packable" to be the equivalent of a Hellraiser puzzle box of endless workshop page bug reports.
I really think that even for organizing stuff, you shouldn't pack things that aren't full (or empty)
but theres a rule i learnt for coding when i studied c#:
never trust the user
The Hellraiser puzzle isn't that bad to achieve tho ? 
And also I can't imagine anything more useless than a box of packed 5% remaining/condition/whatever screwdrivers/light bulbs/wahtever
Yea ๐
arent the devs adding the ability to scrap alot of items
"The garbage bins exist"
yeah i consolidate alot of the pills i have
or the thread
So packing half empty pills sounds so stupid lol
again, never trust the user
I don't see how that applies here
Imagine going through a tripe-crate stack of packed lighbulbs and they're all in crap condition.
alright i concede
in b41 i had to write item serialisation for one of my mods to work and when b42 released i immediately vowed to never update that mod ever, even if i don't mess it up it's impossible to keep it up to date with the game and people are going to get very angry when i delete their items ๐
we'll work with full condition
i think we stormed off track because what i wanted to see was how i could implement water bottle boxes
full water bottles and empty water bottles
both water and seltzer
god alot of the elements of this mod sound complicated
for now we'll stop here you've all told me enough
thank you
but its water, and the fluid [water] refers to both seltzer and regular
However you need two box items for empty and full
yeah thats the gameplan
๐
i'll come back with my next problem sometime soon but in the meantime im gonna publish the mod and test it on a copy of my main world so I can implement what would be most useful right now
condition inheriter works fine
my next move: pack empty plastic bottles into a box
because i have much more of those than filled ones
i'll have to find the right parameters on the wiki though
any way to check if the player has been shot, or has gotten into a car crash
Don't bother, soft plastic recycling is a scam.
naw i just have so many empty bottles i dont know what to do with
better to pack them
throw them out
just fill up garbage bags of rubbish, walk outside and dump them in the rubbish pile.
loot respawn is off in my world and so is zombie respawn
saving garbage bags for crafting
hahahaha
just throw the empty bottles on teh ground then
they're currently in a crate
Oh, a full on hoarder mod.
yep
you talking about the sprite?
gonna wait for other mods to add renewable resources or for the game to do that for me
advanced 3D placement is the ultimate hoarder base decoration tool.

(my boxes are all full of food, ammo, water, etc...)
back on track... do you need to track details of you empty plastic bottles, or are they all interchangable?
somewhat
when packing it should only pack empty water bottles, and when unpacking it should only give me empty water bottles
Because if they are all generic, I think there is a generic "pack box of 12 things" recipe
(in B42)
there is but my mod currently isnt formatted to work like that
and it would cause conflicts with other mods i believe
im aware of that recipe yes
I'm pretty sure using lua you can add the extra input item and the extra entry to Item mapper
there should be some kind of parameter or attribute i can add to the craftrecipe where it will save that it is an empty bottle
i was told that earlier
the override=true thing was removed for b42
i have to use a lua function to work around it
and the lua function is very limited
Yes, because you don't want to override - you want to read the current recipe values then add one, then write back.
not sure how i'd do that
currently my function would replace the entire thing
Definitely do not do that
declaration: package: zombie.scripting.objects, class: Recipe
I'm not sure that is still the correct object for B42 recipes, but you probably want to: 1) use recipemanager to get the item for the PackInBox recipe, 2) read the existing input and mapper fields, 3) update those fields with your extra values
Then repeat for the unpack recipe
you can extend the OnTest.GenericPacking and Recipe.OnCreate.PlaceInBox functions if needed
I'm not sure if this will appeal the same way but another option is to make container versions of the different sized boxes, then you can put anything into them using the standard inventory interface and place them around your base/in cupboards/etc.
lovely website, thank you!
noted!
Found the problem
local playerDirNorm = dirNormalize[pl:getDir()] or "W"
will always return "W" because dirNormalize[pl:getDir()] will never find a result
Because the output of getDir() is not a string, it's userdata which is basically Lua's way of saying "I don't have any idea what this is but I will pretend I do just enough to confuse the heck out of you"
So you can use it like a string for some things... but userdata containing "W" is not the same as a string containing "W" so you can't use it as a table index.
change it to local playerDirNorm = dirNormalize[tostring(pl:getDir())] or "W"
and the same here:
oop!
I'll leave it here in case one day it helps someone searching for "userdata" or "getDir"
I'll copy and paste this on a .info file rqqq-
No tiledefs wiki page
Wrong ref
declaration: package: zombie.scripting.entity.components.crafting, class: CraftRecipe
Should be that one I think
Oh yeah I've some bits like that, you need to manually do tostring to it I believe
Bcs if you use print, it will do it automatically, so that's why if you view it with print you think it's a string
You can also use the == comparison with userdata, though I think it only works with other userdata that is exactly the same
But not >, or .., or a bunch of other stuff.
The loot application API interface library mod is now live.
And a gun mod that uses it: https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=3487312468
Nice ! I'll document that
Do you have a repository for it ?
I can add it to the wiki page too
I'll make a github for it.
Don't feel forced to
It's a good idea - the mod folder is already under git control, so addinga github is easy and makes sense if it's a mod I that other people will use.
author name column might be a good idea tho
shared
#1070852229654917180 message
Thought about it
Link the mod instead
mod description has a link to github, I'll link github back to the mod later when I fix up the readme.md formatting a bit
Yea I meant for Glytcher
Because he linked the Github instead of the mod, that's going to be problematic if people find that and end up making copies of your script
Oh also I noticed you don't use modules and your lib is in the globals
Instead use modules since you already have modders require the script
That is correct, because I know how to do it that way lol.
Good idea, I'll update later tonight/tmorrow.
๐
Instead of using this an excuse to avoid going shopping even longer ๐
wait, do I just add "return EasyDistro" to the end of the file? Since everything is already in a single table
Yea
Told you it's easy as fuck ๐
then modders can do "local funnyname = require("EasyDistro")" and call funnyname.AddItem.
lol
There's a single line to change for you and for the modders that use it
I'll do it after shops anyway because making a change and wandering off without any testing feels like a bad idea.
And it won't invalidate anyone who starts using it as a global before I do that.
(unless I make EasyDistro local)
@silent zealot https://pzwiki.net/wiki/Easy_Distributions_API
Didn't go in the detail of how to use it, wanted to but since you're probably going to change to use modules I figured I shouldn't add codes
Feel free to add to it
Do ISO Objects needs to be 3d or can i use the mesh of like an oven and say Zomboid to retexture it?
World ISO objects are 2d images
with some depth map images
oh that make things easier xD cuz my Photoshop skills are bad but my modeling skills are badยณ
Things like placed inventory items, cars, players are actual 3D models.
Actually there's something regarding tiles that can ACTUALLY be 3D objects
Not just a depth map
Good news: Zomboid 3D models have very low standards, because they are tiny in-game and getting something vaguely OK with a few polygons and a 512x512 texture is better than a highly detailed model with a 2k texture.
It was Ash that showed that, washing machines being actual 3D objects, but not appearing 3D, and it's the model getting a special render to become a tile
Similar to the way dead zombies/maniquins get rendered to an "atlas" of low-res still images?
Perhaps
I looked into making mannequins higher resolution, but it looked like it would be a bit of a nightmare to code and a huge pain to keep updated as the java changed.
i cant seem to find the images for iso objects
Get-ChildItem -Path "G:\SteamLibrary\steamapps\common\ProjectZomboid\media" -Recurse -File | Where-Object { $_.BaseName -eq "appliances_cooking_01_5" } | Select-Object -ExpandProperty FullName
i just used the sprite name of a random oven
A lot of vanilla iso images are in texture sheets
They are in the tile picker
I don't know how to access the image tilesheets, I think there is a tool for that
Thanks, will look into it
Can a weapon use a different model when equipped vs. when attached to a hotbar? I'm going to make a folding survival rifle, but I don't want to go through the tedium of having a whole separate item for the folded version and swapping back and forth via recipe.
if I set up a new stash, is it possible to force the triggering map to spawn as the annotated version? I can't find the file that dictates this... I can only force it through the stash debugging atm
I would say yes
Iโm creating a mod where I need to export an fbx model for it. How can I convert the fbx to .txt? and how do I export its texture? can someone help me?
Where you got an idea to do fbx to txt?
Game uses X or FBX, while FBX is encouraged by most modders
.x has text and binary formats... but avoid .x if you can.
thatโs what they told me, that to import it into my mod, it needs to be in .txt
.fbx plays a lot nicer with blender, and you don't need to convert naything after exporting.
They might have meant you need to make an item in a .txt script file.
I'm using blender
srry for the dumb questions, Iโm new to modding and have no idea which folders I need to add to include the fbx
Back up a bit - what sort of mod are you making?
the main idea is a plush magazine that removes the playerโs sadness
Lots of good stuff on https://pzwiki.net/wiki/Modding including "mod structure"
What is a "plush magazine" in game terms? And what if your model a model of?
Iโm gonna make a magazine shaped like a duck
so that when players read it, it removes sadness
On one hand that makes no sense to me, on the other hand I know how to do it.
You're basically going to create a magazine, similar to vanilla magazines, but instead of the model for teh item looking like a magaizine it looks like a duck.
Have a look in media\scipts\iitems\items_literature.txt
Unhappychange is how you remove sadness
module MyMagazines
{
imports
{
Base
}
item HappyMagazine
{
DisplayName = Happy Magazine,
DisplayCategory = Literature,
Type = Literature,
Icon = Item_MyMagazine,
Weight = 0.2,
WorldStaticModel = Magazine,
UseDelta = 0.1,
StressChange = -20,
UnhappinessChange = -20,
BoredomChange = -20,
PanicChange = -20,
Tags = Reading,
Tooltip = Tooltip_HappyMagazine
}
}
dang
I don't think literature has a useDelta
But that coudl be a B42 thing
but if you copy the vailla item and change stuff, that will be fine
oh
I'm having more trouble exporting the texture in Blender, I think I can handle the folders
There will also be some model stuff in media\scripts\models_items.txt
I can't help with the texture export, for my blender work I've make a texture in Krita and then UV mapped the model onto it so the texture was already in png.
Iโm not understanding anything in this wiki 
Can you show us how it looks in blender? Also did you paint the textures inside the blender or other painting software?
yes
Thats one handsome duck. For my feeling it might be a bit big but we will see. From what i see you haven't made your model script yet?
thanks
idk how to put it in the folders, along with its texture
I wrote the scripts for the magazine, my mod is going to be a duck-shaped magazine
So in \steamapps\common\ProjectZomboid\media\scripts you have something called "models_items.txt" files, or other "models...txt" Those are called model scripts i belive
for example :
model FlashLight_Improvised
{
mesh = WorldItems/Flashlight_Improvised_Hand,
texture = WorldItems/Lights_Improvised,
scale = 1.0,
attachment world
{
offset = 0.0000 0.0000 0.0000,
rotate = -0.0000 0.0000 0.0000,
}
}
Mesh is where your Model (fbx file) would be, So in this case game looks in folder Model_X (always) then will go to WorldItems folder and there will look for "Flashlight_Improvised_Hand" file which has to be either X or FBX.
With texture its same case but it will instead look for "textures" folder instead of "model_X"
"attachment world" isnt currently our goal as its pretty much a way for you to edit how model is placed on ground, but you can do it later if there is need.
I personally suggest to make new txt file in script folder, give it module Base (you already import it in your script so everything is alrgiht).
and lets say you exort your model to media>models_x>Duck.fbx (you don't need to insert it further, but you can)
and texture to media>textures>Duck.png
Then your model script would be "
module Base
{
model MyFirstDuck
{
mesh = Duck,
texture = Duck,
}
{
When you get to updating loot tables so your item shows up in random loot I just published a library mod to make that easier by copying the loot data from an existing item. https://steamcommunity.com/sharedfiles/filedetails/?id=3487312010
Then your item script would look somewhat like:
module MyMagazines
{
imports
{
Base
}
item HappyMagazine
{
DisplayName = Happy Magazine,
DisplayCategory = Literature,
Type = Literature,
Icon = Item_MyMagazine,
Weight = 0.2,
WorldStaticModel = MyFirstDuck,
UseDelta = 0.1,
StressChange = -20,
UnhappinessChange = -20,
BoredomChange = -20,
PanicChange = -20,
Tags = Reading,
Tooltip = Tooltip_HappyMagazine
}
}
Looks like your model did not load, the thing is you have static model which is for in hand display, you would need worldstaticmodel to show it on ground too.
No wait, my mistake you do have "WorldStaticModel", then it means that it should appear. It might be typo on your end or badly exported mesh, or maybe lack of texture?
Show me both you model and item scripts
I need to find someone to partner up with, lmfao. Iโll make the model and they handle the rest, because this is frying my brain
okay
one sec
module MyMagazines
{
imports
{
Base
}
item HappyMagazine
{
DisplayName = Happy Magazine,
DisplayCategory = Literature,
Type = Moveable,
Icon = duck_plush,
Model = MyFirstDuck,
WorldStaticModel = MyFirstDuck,
PlaceStaticModel = MyFirstDuck,
Weight = 0.2,
MoveSpeed = 1.0,
PickupSound = PickupGeneric,
UseDelta = 0.1,
StressChange = -20,
UnhappinessChange = -20,
BoredomChange = -20,
PanicChange = -20,
Tags = Reading,
Tooltip = Tooltip_HappyMagazine
}
}
require "Items/ItemUtil"
local function debugPrint(text)
print("[MyMagazines Mod] Loaded successfully!")
end
debugPrint("MyMagazines loaded successfully!")
that's it, I think
Iโll probably create another one, this one got too messy and confusing
???
You still don't have Model script anywhere, and there is no such thing as " PlaceStaticModel = MyFirstDuck,"
There are:
"StaticModel=" for display in hands, so in your case you need it for your model to show during reading,
"WorldStaticModel=" for displaying when item is on ground
What ?
What the fuck is that ?
And you do not put lua thing in same file as script...
Did you just chatGPT this shit ?
Doggy calm down
Yea I'm calm, just got extremely confused about it
But in more seriousness, there's a plague currently of modders trying to use AI to make mods and they end up not learning anything because AI will never give them a proper good answer in the current state it is in
no dude, Iโm learning and Iโm not making the mod alone, just chill. Not everyone is born knowing everything
Never said that, and like I said I'm chill, just got kind of stunned by what I read
Iโm not used to making mods in lua, itโs still confusing. I only know python
you don't need a lua file in your mod at all, it doesn't do anything
But in a "calmer" note, this code won't do anything, and tbh that function isn't even useful at all because you could replace it with print simply and it would do the same thing, but even worst that function has a text argument that is never actually used
And like albion said, for an item mod you don't need a Lua file
okay
thanks
does https://projectzomboid.com/modding/zombie/iso/IsoGridSquare.html#getDoorOrWindowOrWindowFrame(zombie.iso.IsoDirections,boolean) work on this version? and if so how do you create a IsoDirections data?
declaration: package: zombie.iso, class: IsoGridSquare
the site you linked is for 41.77, there's basically no api differences between those versions so i would assume so
Hmm not sure
IsoDirections is an enum so you don't need to create it
just use IsoDirections.E for east etc
Decompile the java to check what that function does, a lot of these kind of stuff don't do anything
your item script is kind of strange as well, you should just copy a vanilla magazine and change what you need to: yours seems to have parameters copied from different kinds of items that aren't relevant here, as well as a couple that don't even exist? ๐ (that's why it looks like you used ai)
ermmmmmm I'll just try it out in-game!!!
If you do that you'll put a massive amount of work into just figuring out if you're doing a mistake or if that shit doesn't even work in the first place
And I can assure that for this kind of function, you better check there even is code behind it ๐
good point
looks implemented
And tbf, if you continue doing modding for PZ, I'd suggest decompiling, that's kind of the next step
i don't think it'll find stuff that isn't on that square though (so only N and W will actually work)
One issue too
Actually nvm
Thought it wouldn't give you multiple possibilities, but it can't have multiple ones in the same direction
i think there's some utils for finding stuff like walls independent of the actual square in starlit
no nevermind, there's some wall utils but they still only catch ones on the actual square
Base game sort of has this kind of thing I believe
Wait no
It's also actual square too
it kind of has it but it's really picky
Thought you just meant in general catching walls etc
in general working with walls is really annoying, i had to put a whole bunch of work into it for excavation
some of that code is supposed to move into starlit eventually but it's not general enough yet
Yea
are custom decompilers needed orrrrrr
Yes
Way way better
i see i see
- the most recent one by albion requires a single double click, compared to command lines for the majority of them
- they take into account extra informations for a better decompiled code
So no it's not mandatory, but tbf if you want to decompile the game code, you're making your life way harder by picking generic decompilers
noted
How does map making work with B42
Refer to the mapping Discord
Where can I find the link to that discord
I DMed it to you
Alright thank you

but i dont want to give myself eyestrain just to read decompiled code
has anyone made a gore mod yet
had one in development, weird that i'm still seemingly the only one that's tried. from what i've seen at least. not sure if i should keep going
@bright fog omg i just saw the tiledef and you actually linked it
THANK YOU SO MUCH
Does anyone know how to initiate puddles via Lua? I'm trying to mimic the climate settings I made in debug mode
Figured out how to get the rain, wind and fog. But puddles are tough
Yea, was a pain, so make sure to do the same later down the line please ๐
But you weren't the only one in that case, it just turns out that you're the one with the most individual tile mods I guess lol

appreciate you man and yep ill keep the format
Thx
lost the author name tho was sorta an advertising venue but still its worth it
not required but its recommended to use the decompiler tool ZomboidDecompiler that uses vineflower instead of just vineflower itself from the cli, faster and easier
Yea but like I said that's not the point of it and I try to reduce as much as possible advertising for things that are not useful to other modders
i understand
gave you your 4th profile award
Lol thx
it seems like getDoorOrWindowOrWindowFrame doesnt work
Why am I not even surprised 
Check if the vanilla game uses it
Both in the Lua and in the Java
(So decompile the game)
:(
That's also why you should decompile the game
like,, dis?
Yea
seems like it does use it
Check where it's used and how
These could be deprecated code and never trigger
btw it's better to use code lens for this kind of thing
keyboard shortcuts may be different in vscode but in intellij it'd be ctrl-n to search classes, find the declaring class, then ctrl-click the method declaration's name to see all usages
am using vscode rn
because intellij just uhh
blew up
i really need to fix it i had a mod project on it ๐
i cant even find the intellij community install
I'll need to check this out
but basically doing it this way is a lot more resilient to weirdness, text search can report a lot of false positives
in this case it's a really awkward long method name so it's not going to come up with anything else lol but when it isn't it's a lot faster to do it this way
You can access it by ctrl clicking the method right ?
yeah
Ok I see what it is then
you can ctrl-click basically anything to see all references to it
I'll try to document that on the wiki page I guess
i... cant find intellij idea community edition download
OH
IT WAS JUST 1 SCROLL DOWN THE PAGE
Yea they try to hide lol
honestly i dont even think i need to reinstall it because really it broke because of lua plugin
yeah don't use that garbage
if you've seen some older guides they recommend it but it's massively out of date and doesn't even work anymore
hi guys, any ideas on this? ๐ฅฒ
I've used its decompiler no problem with B42.
craftRecipe OpenBoxOfDigitalWatches
{
timedAction = OpenAmmoBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
category = Packing,
inputs
{
item 1 [Base.BoxOfDigitalWatches] flags[Prop2],
}
outputs
{
item 24 Base.WristWatch_Left_DigitalBlack,
}
}
craftRecipe PackBoxOfDigitalWatches
{
timedAction = PlaceAmmoInBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
category = Packing,
OnCreate = Recipe.OnCreate.ToConditionInheriter,
inputs
{
item 24 [Base.WristWatch_Left_DigitalBlack;Base.WristWatch_Left_DigitalRed;Base.WristWatch_Left_DigitalDress] flags[Prop2],
}
outputs
{
item 1 Base.BoxOfDigitalWatches,
}
}```
any better way to accomplish packing different types of digital watches, or different types of items overall? i'd rather not have seperate boxes for black, red and dress watches
i do have a lua script to inherit condition but not types of items
the decompiler is fine, it's the lua plugin that's worthless
i use it for browsing java code since it's generally the best java ide, but it isn't good for actually writing lua mods in
require 'recipecode'
function Recipe.OnCreate.FromTypeInheriter(craftRecipeData, player)
local items = craftRecipeData:getAllConsumedItems();
local results = craftRecipeData:getAllCreatedItems()
local box = items:get(0);
for i = 0, results:size() - 1 do
local resultItem = results:get(i);
if box:getModData()["itemID" .. i] then
resultItem:setItemID(box:getModData()["itemID" .. i])
end
end
end
function Recipe.OnCreate.ToTypeInheriter(craftRecipeData, player)
local results = craftRecipeData:getAllCreatedItems()
local items = craftRecipeData:getAllConsumedItems();
local box = results:get(0);
for i = 0, items:size() - 1 do
local item = items:get(i);
if item:getItemID() ~= item:getItemID() then
box:getModData()["itemID" .. i] = item:getItemID();
end
end
end```
i copied the condition inheritor and replaced some of the condition related bits with itemID, but i'd have to check if the parameters are correct
im not seeing anything relating to item ID on the javadocs and most of the code here is meant for floats not strings
found one but its in isoanimal not craftrecipe
and its integer this time
I suspect the player object isn't ready yet when OnNewGame is fired?
Guys, how do I mod?
plot twist: doors objects were included in the GetObjects array, i was just convinced that it wasnt (womp)
or getSpecialObjects
Depends on the kind of mod you want to make
Map.
And making buildings.
i know how to add additional clothing by professions, but is there a way to remove some of the already available clothing for a specific profession?
i also discovered cars dont collide with doors... which is not what i want to see
spent some time revising it after reviewing some of the javadocs
require 'recipecode'
function Recipe.OnCreate.FromTypeInheriter(craftRecipeData, player)
local items = craftRecipeData:getAllConsumedItems()
local results = craftRecipeData:getAllCreatedItems()
local source = items:get(0)
local sourceModData = source:getModData()
for i = 0, results:size() - 1 do
local result = results:get(i)
local storedID = sourceModData["itemID" .. i]
if storedID then
result:setItemID(storedID)
end
end
end
function Recipe.OnCreate.ToTypeInheriter(craftRecipeData, player)
local results = craftRecipeData:getAllCreatedItems()
local items = craftRecipeData:getAllConsumedItems()
local container = results:get(0)
local containerModData = container:getModData()
for i = 0, items:size() - 1 do
local item = items:get(i)
local itemID = item:getItemID()
if itemID then
containerModData["itemID" .. i] = itemID
end
end
end```
not sure if it will work but i'll test it out shortly
try something like this:```lua
---@param t table
---@param v any
local function removeByValue(t, v)
for i = 1, #t do
if t[i] == v then
table.remove(t, i)
end
end
end
removeByValue(ClothingSelectionDefinitions.fireofficer.Tshirt.items,
"Base.Tshirt_Profession_FiremanBlue")
if you want to remove every item in a slot, it's probably safer to do ClothingSelectionDefinitions.fireofficer.Tshirt = nil or else it'll leave an empty table that might cause issues later on
gotcha, i'll test it out
did not work
yeah no im not doing this my brain is fried
Check your errors
Check what the error says, this is the next step to developping Lua mods and you basically can't work without reading them
i checked the console, it didnt list any script errors
this is the most i had
even then ive already scrapped most of the typeinheriter code its just complex for me
works to remove profession specific clothing, but not base clothing
Uh getItemID is a thing ?
i need to remove base clothing from a specific profession
i probably should've been more clear about that
That's not a thing
getItemID doesn't exist
oh, that won't be possible in any simple way
So what are you trying to do exactly here ?
yeahh i figured
the only way i could think to do it would create huge conflicts with any mod adding more professions
still working on the packaging mod, i was trying to pack multiple different watches into the same box, and be able to unpack them and receive the same items as with the input
Ah
That's not how you'd do it
That's not the item ID at least
You will use item ID, but that's not the item ID
because those methods don't exist
crud
I'm expressing myself badly here lol
Give me a minute
You get consumed items with https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/entity/components/crafting/recipe/CraftRecipeData.html#getAllConsumedItems() like you're doing, that's good
This gives you an ArrayList of InventoryItem and you want to use getFullType
declaration: package: zombie.inventory, class: InventoryItem
declaration: package: zombie.entity.components.crafting.recipe, class: CraftRecipeData
getFullType is the way to get the item ID
Then your unboxing craft cannot output anything, and instead the output will be done from Lua
And you will create the items manually
mkay
See this page to create items in the inventory
https://pzwiki.net/wiki/InventoryItem#InventoryItem_creation
why is there no subclass for walls ๐ฅ
Because they create classes for things that should get functions
That's why you got IsoWindow and IsoDoor because those have technical aspects behind them
Walls however are nothing special and most needed is handled via tile properties
i just wanted to like if instanceof but i mean i alr got a way around it
There's literally a isWall method
In IsoObject
Walls are IsoObjects
Don't trust the isWallN and isWallW however ... do that with tile properties because corners are special ...
That's not how you search
outdated docs..,
No it's not
Oh wait no it is, I mean I never used this method
But you're on B41 doc
Use the B42
You're on B42 right ?
mmmmmm no
Ah nvm then
Wait did you look at the mod we shared the other day that did exactly what you wanted to do ?
yeah
but i wanted the vehicles to not come to a complete stop which in my testing they did not seem to achieve
which means am gonan have to... figure out also how to damage the vehicle because the vehicle doesnt actually collide
But vehicles do not come to a complete stop
They literally have images of the vehicle going through fences on the mod page no ?
they did yeah
but when i tested out, while it did break the objects, the cars also lost all momuntem
i could test again because honestly i dont really remember well if that was the case
oh
no
I didn't even knew their mod was in B41
Also, the creator was around here, or in the modding Discord when developing it
You can probably contact him
am good so far
Don't hesitate to look at mod files too to see how things work, how they handle it
Of course do not copy pasta the code without authorization, but I think there's no shame to learning from others' work
i looked at their code to see how they got the position of the grids
oh wait
that was from the other mod
super bulldozer
i looked at super bulldozer code to see how they got the position of the grid but thats all i did really
is this normal
theres clearly loops going on how come can't i use continue
there is no continue keyword in lua
Do you have to be driving a certain speed for that to happen?
looks awesome
holy shit that's sick
๐ป
Working in B41. There are some tile objects that seem to not be interactable at all... how do i go about changing it so that i can pick them up, use them, etc.? I'm in debug mode and I cant even get the option to pick this up using the pickup/place context.
I've managed to locate the item at least the sprite in location_community_medical_01 but not sure how to reference that specific sprite or whatever.
Thats so cool, i need that to my mods
hi is anyone here making mods for vehicles?
would like to pay for a modder to make a vehicle for me if its possible
?
Which vehicle do you want?
Can I private messege you?
For sure
hey so i dont know if theres already a mod for this but i want to put a simple compass rose/star on the map, how would i go about doing that?
comma's are, important. "why isn't this done yet?" - "because my brain is bad"
moveables are set in the tile properties. you can apply tile properties on game start or you can overwrite the default properties with your own tile definitions
hey quick question how many uses do.. chips have
One. If I open a packet of chips, I eat a packet of chips.
Not sure about Zomboid without checking, but I think they're just a food item so no "uses" but eat/eat half/eat 1/4
craftRecipe PackBoxOfPlainChips
{
timedAction = PlaceAmmoInBox,
Time = 15,
Tags = InHandCraft;CanBeDoneInDark,
category = Packing,
OnCreate = Recipe.OnCreate.ToConditionInheriter,
inputs
{
item 180 [Base.Crisps] flags[Prop2],
}
outputs
{
item 1 Base.BoxOfPlainChips,
}
}```
that's probably more accurate than me tryig to remember.
food items usedelta is technically the same as like glue or alcohol wipes
its the amount of hunger they give i think
Are you coding individual chips as seperate items?
thats their uses
currently yes
i have no better way of doing it
hides his rice
RICE!
oh yeah i should add like
those dried pea bags and such
I got asked at work if I knew LUA, and now I'm writing LUA scripts for HAProxy. Somehow HAProxy has worse documentation for their LUA PAI than Zomboid does.
They wrote the introduction and then just.. stopped.
I want to mod a new town into pz but im clueless and never done this before, Any ideas where i start??
Java.
lots of classes starting wih RVS, one for each story.
This is the outfit for "rich Jerk", the crashed car & briefcase of gold:
I'm not familiar with the mapping tools, but... start with the mapping tools. The #mapping channel is more map focused than this one, and check out https://pzwiki.net/wiki/Modding for general modding info, especially under the "Mapping and tiles" header.
Then come up with an idea, find a place to put it that doesn't conflict with any of the more popular map mods that already exist, and make it.
thank you for your help
Is there a way to make altered zombie data persist through player deaths?
My game world has no sprinters allowed through the sandbox settings, but occasionally some zombies are spawned and set to be sprinters via a mod I created. When I die whilst fighting them and after I respawn, the sprinters are back to non-sprint mode.
I use this lua code:
zombie:setWalkType("sprint1")
Is there a way to make this setter persist?
(Edit: I should note that this even happens when I respawn in the same cell where I died and where the former sprinter is now suddenly a walker.)
From my understanding, the zombie objects get reused from a pool rather than being individually persistent
Is that something that could be potentially "solved" with moddata tables?
For example, by adding some sort of unique identifier to a zombie on spawn and then recalling that unique identifier on player respawn to re-set the parameters back to where I'd like them?
Thanks for the info BTW - I wasn't aware of the pooling thing!
Maybe, but I think anything you attach to a zombie will (at best) end up on a random other zombie
Have a look at the Bandits mod - that makes zombies into NPCs, and those are still NPCs after reloading, so it is doing something to keep state data for zombies.
Dang...
Thank you! I will have a look!
If you figure it out post the answer here for reference!
Will do!
They might tie it to outfit, since every "faction" has a defined outfit and outfits persist since those presumably just a single saved guid. Assuming the mod also stops the outfits in question being used by normal zombies.
But check their code instead of my guesses. ๐
persistenOutfitId is close to being a good id for a zombie. it changes once a zombie looses its hat so that need fact needs to be addressed. The generated id is a combined number of outfit id and a random number of 500 plus the info about the hat and a bit determining if that is a female. Bandits uses pregenerated 200 naked outfits but then puts the clothing according to configutation. All zombie data is lost on game reload. So it stores persistenOutfitId in global mod data together with the configuration that is used to restore the zombie(bandit) to the expected state
Seems the Bandits they are using getPersistentOutfitID() as a GUID, caching it and recalling it... every tick. ๐ฅ Thankfully, there is some code to help performance on that front included though (basically skipping the entire function a tick while the process is too slow). Pretty neat stuff!
it changes once a zombie looses its hat so that need fact needs to be addressed.
Aha!
So that is why this bit exists:
local hat = bits[16]
if hat == "1" then
bits[16] = "0"
id = toDec(bits)
idcache[dec] = id
else
id = dec
idcache[dec] = id
end
return id```
realizes he is talking to the mod author
yes, and there is extra caching method because bit conversion costs some performance, and the version of lua is old and do not allow bitwise operations
me rn: 
Thanks for this info Slayer - it is so crucial for me!
I see how you store the persistent outfit IDs as the GUID in the BanditUtils.GetZombieID, and how you cache that data from zombies on the tick in UpdateZombieCache, but how is the persistent info recalled/loaded onto existing zombies as the player approaches them/as the zombies are loaded in a cell?
on each zombie update, the zombie is check if has a bandit flag (local erasable on game restart), if not, its id is checked if it exists in global mod data which serves as a persistent database of bandits, if yes then it means the zombie needs to be banditized (apply visual style, put the right clothes, give weapons etc), and then mark the zombie as a bandit so that the process does not repeat
this?
light.isBandit = true
light.brain = BanditBrain.Get(zombie)```
globalmoddata is like a soul of a bandit. Bandits work as long as they are paired. if and id of a zombie is not in global moddata the bandit immediately returns to zombie behavior
if gmd.Queue then
if gmd.Queue[id] then -- and id ~= 0
if not zombie:getVariableBoolean("Bandit") then
brain = gmd.Queue[id]
Banditize(zombie, brain)
end
else
if zombie:getVariableBoolean("Bandit") then
Zombify(zombie)
end
end
end
```
Yeah, this is my experience too - not for setting bandit-style attributes, but just a basic setter for the sprint speed. In my situation, after I die, the sprinters revert to walkers. This information is AWESOME and I am thankful to be able to pick your brain on this! Thanks so much!
yea just mirror everything you want for your zombies in global mod data.
remember to garbage collect data from global mod data once zombie is killed
Cheers! Thanks again!
np
Listen to this guy, he knows more about Bandits than I do. ๐
See the wiki page regarding zombies
I don't think I need to read everything Slayer, I kind of already see from a few mentions of what you should use
Zombie ID involves the use of the pID of zombies, and yeah that's the only way to store persistent zombie info
However I don't know if Slayer mentioned it but extremely important info: this ID is non unique
See the wiki page regarding that
All these should give you written info regarding how IsoZombie works and the pID page gives a code snipet of a pID method
errmmmmm
why does it need an arguement and how can i get a Vector3f for the arguement
If I understand correctly, Bandits defines 200 unique outfits that don't get used by normal zombie spawns, so the mod can spawn one of those and know that is the only zombie with that outfit and hence the persistentID will be unique
Vector3f.new()
it's often also acceptable to pass nil in situations like this
it takes an argument so it can reuse an existing vector3 instead of allocating a new one every time which may improve performance
i haven't checked this function but it is likely it'll just create one if you don't give it one
i also looked at vector2 from getMovementLastFrame
and its properties were not capitalized
is this the same case for vector3
returned nil
BRO
This is great
Maybe also worth to check out https://github.com/SirDoggyJvla/Zomboid-Forge-B42 though it doesn't explicitly mention per-zombi-instance persistance. Not sure if thats what you are after either.
Though the Sir himself already replied you so if he didn't bring it up, don't let me guide you astray ๐
Zomboid Forge is a Project Zomboid mod which allows modders to easily add their own custom zombies to the game. - SirDoggyJvla/Zomboid-Forge-B42
does britas weapon pack still work multiplayer
It sets the velocity in the object you pass it then returns that.
If you don't need direction you can use getSpeed2D() instead, which gives the ground speed (ignoring any vertical component to movement) and there's also getCurrentSpeedKmHour() (the code uses kph, then they write "mph" on the dashboard because 'MERICA!)
if it works it works, and if you just need direction and not magnitude you don't have to worry about the affect of a varied frame rate.
Check the show generator range mod
there's a method for it that highlights and lets you specify color (or at least, you can choose good or bad aka green or red)
I think it's a property of isoSquare, but that generator mod is teh quickest way to check I can think of.
thx
How many Zomboid modders also mod Rimworld? It looks like it's gearing up for an expansion soon so there will be two games trying to consume all of my free time.
Yea that's ok it's good you shared it. I don't store persistent informations of zombies anymore but I do use the pID still to identify the zombie
Is the API getModFileReader(mod, path, createIfNil) broken?
HydroMancerX (Creator of Hydrocraft) went there.
i was thinking about putting something into starlit for this and i found a method wayyyyy more efficient than the one on the wiki lol
~3-6x faster depending on if you're annoying enough about performance to inline functions
Nice
What did you optimize ?
i didn't do it the same way at all
But you get the same output ?
if it didn't work why would i brag about it ๐
idk just making sure everything's checks up
i've tried it on a range of pids and it seems to work consistently
i can't say for sure it works in 100% of cases but the maths work out to me
So what did you do ?
Did you test on male and female zombies and compared with the original one ?
Could easily inline it yea
this implementation is around 3x faster than yours, if you inline Bitwise.get in Bitwise.set it becomes around 6x faster instead but i don't want to do that
You verify that the bit exists ?
may look into some form of preprocessing to automatically inline performance critical functions like this but that's for another day
Yea I see what you did
Yea inlining the get in set could make sure you don't recalculate local bit = 2^(pos - 1)
that's not very expensive anyway
yea
the only real advantage to inlining is that it skips the overhead
which it seems is nearly the entire cost of this function lol
i considered internal functions to reduce stuff like that but didn't seem worth the complexity
what are internal functions ?
here i mean separating implementation from API:```lua
local function get(int, bit)
...
end
Bitwise.get = function(int, pos)
return get(int, 2^(pos - 1)
end
Bitwise.set = function(int, pos, value)
local bit = 2^(pos - 1)
local hasBit = get(int, bit)
...
end
i'd avoid recalculating it if the function expected it to be already calculated, but that sucks for the API so i'd just have a separate function that the API delegates to
Yea makes sense
Well tell me if you introduce a trueID function in Starlit, I'll reference it on the wiki page of pID
@bright fog Need bitwise ops?
No
k
Ok. Saw bitwise and had flashbacks.
i'll probably just encourage people to use Bitwise.set(pId, 16, true) since another function on top of that just adds overhead
but internally i'm not doing that anyway so maybe not ๐
---@param zombie IsoZombie
---@return integer
local function getZombieID(zombie)
return Bitwise.set(zombie:getPersistentOutfitID(), 16, true)
end
No caching ?
you can cache if you want, i saw yours did that, it didn't seem that important to me
it's not really that expensive anyway
It was extremely important actually
Kind of the core of the whole thing if you remove the bit swap operation. Because from what @sour island had said, caching was a major performance boost
but it's also a memory leak ๐ค
actually yeah if i make this public API i'll add caching
thinking about it most people do this shit on tick
Exactly
and it's going to be in the cache literally 99% of the time
That's the reason caching it was needed, because this function had to be called by N zombies x every ticks
Heya, so I have Project Zomboid Script Support installed and active in my vscode. Any Idea why I see colorized output for vanilla scripts but not for my modded scripts? I even tried to copy over vanilla content 1:1 but it doesn't seem to get recognized.
I tried editing the settings, which came coded towards a windows c:/ drive, to no avail.
I'm unsure why this happens but I get the same issue
You can manually force the language usage by pressing ctrl + shift + P
then
Change Language Mode
@true plinth any idea why that happens ? My guess is an existent workspace won't take the changes
That worked!
ctrl N doesn't seem to do anything on my side
should be whatever this is set to in the keymap
Where do you find settings I can't seem to be able to find them ๐
Oh god I found them
Too many buttons syndrom
Yea idk for some reasons it wasn't set for me
Oh god I think I know what's going on
the defaults might have changed since i started using idea, or i might have changed it years ago and forgot about it
I think it imported my VSCode keybinds ?
I did find the keybind online with the same keys tbf
https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf


