#mod_development
1 messages · Page 172 of 1
ya get rid of usedelta if it's not a drainable
here is what it looks like now
also if it's not a drainable you won;t have partial stacks and can't consolidate it, axe the consolodate line
what
ConsolidateOption
delete it?>
ya, that's also for drainables
can you try booting up now and looking for it? my fingers are crossed that this was the only problem
even if there was an issue with the model or the icon or the texture it should still show up in item picker right anyone?
and the icon is in the right folder and named Item_RedDuctTape? and is the right size and everything?
here
item_redducttape != Item_RedDuctTape
change either the filename or the line in the item so the two match
i don't think it needs it, but make sure it matches
yes, the item not showing up means there is a massive issue with the block that is stopping it from being read or the file isn't being read at all
when you look at it does anything jump out at you?
no
sigh i wish i could figure it out
i think the file isn't being read at all but i've already suggested every cause i know of that
unclear, what IDE is that you are using?
looks like vscode
it is
thats my question
that is weird, it should just be the icon for the file type
but it shows .txt so ???
could you send me the item_redducttape.txt?
sent
sent
works for me with no changes
are my scripts right?
yeah
all i did was put your file into one of my mods
there all in my scripts folder
I saw somewhere where someone puts there mod id after module instead of base
can you change something in one of your other files and see if it changes ingame?
i think what is happening is it is loading another copy of your mod from another folder
like what
if you worked in both mods and workshop folders it might load the other one, if your mod is on steam and you're subscribed it might load the steam version instead
make a backup or something but yeah, if you delete the machete and it's still in the game then you know for sure
alright loading up the game
good news or something
it did not change anything
so what shall I do
albion you the best
check Zomboid/Workshop/ and Zomboid/mods/ to make sure the copy you are working on is the only copy of your mod
for sure
its empty
what do I do
where should I work
I like working in mods make sure everything works
before updating
you can work in either one as long as there's only one copy, but it's probably easier to work from workshop once you've first uploaded it (otherwise you'll have to keep moving it around every time you want to push an update)
that's what i usually do, develop from mods and then move to workshop when it's ready for its first release
what does that mean as long as there's only one copy
if you have your mod in mods, and then you copy it into workshop to publish it, then your mod exists twice, and changes you make to one might not show up, it just messes everything up
so what do I do in the future?
just make sure if you move your mod to workshop to delete the one in mods
oh okay
I guess I should move everything now
wait so
if I move the workshop one somewhere else will it still be on the workshop?
yeah, that folder is just an area for you to upload it, steam has whatever you uploaded
did it wrok
@deft plaza what was issue
heyy so now it shows up in item picker?
I assume but I will check
scale is bad
this is the scale
that has fuckall to do with mod develop,emt
so its big?
yup
its 0.06?
ah
it
0.01 then
lets see one sec
the scale is still messed up
the scale must be messed up in blender
scale
ctrl A to apply transforms
what
er, scale as well
wait how do I transform
what does it do
basically you usually want scale in blender to be 1
if you stand on the square with it and copy-paste this into the lua console it'll spit out the names of all the objects on that square, hopefully should be easy to recognise which one is the flag
local objects = getPlayer():getSquare():getObjects(); for i=0, objects:size()-1 do print(objects:get(i):getSprite() and objects:get(i):getSprite():getName()) end
Thanks! I've had the game for less than a week. How do I open the console? 💧
launch the game with -debug
🙏
not sure if this does the trick, or if this is just a skill issue on my part
huh...
it's not part of the wall is it 😨
check the bit of wall next to it, if the wall there has a different sprite that's bad news
this is the scale
but it is still showing up in game
big
hey seperate question
what do you guys thinkj
should add the option to make the machete
or should make it optional make a seperate mod within the mod
also this is how big the duct tape roll is
I made it
help
just reduce the scale in the script
nows its very small I'm going to try 0.0010
how would I make two seperate mod versions in 1
as in one I have everything on one I have something removed
two mod folders with different ids in their mod.infos
wait how will it be in the same mod then?
if its different ids
it should be in the same Workshop/myMod/Contents/mods/ folder
@deft plaza
so when you upload it it uploads both as one workshop item
yea
Can I see it?
not now one sec
The on before iirc
iirc?
If I recall correctly
you basically want your structure to be like
Workshop/myMod/Contents/mods/Mod1/mod.info
Workshop/myMod/Contents/mods/Mod2/mod.info
two mods
Why is there 2 mods??
because they wanted a version without something
Makes senss
you will see
You are making another mod?
no you will see
what kind of objects
Like guns or swrods
inventory items?
Or whatver dropped on the ground
Yes
Cuz they obey the tile right
Like certain elevation
i think you have to remove it and recreate it in new location
But can it be placed like
For example under the table
not possible with current renderer
Or cuz the tile will make it go on top of it
Right...
What about like upwards
Cuz im assuming the render thing is cuz under the table means theres cropping
Like it was suppose to be that tile is below
And you cant put it under the table cuz ot will mean the gun is below
constructor has zoff parameter, probably means z offset?
ya i think so
I thought it was an offset like code based place on ground
But now im curious if z works
it does
Nice so you can add the item as if its floating
without shadow it will never look like its floating
you probably can force it to be 'under' a table but i don't think it'll render correctly
- ya there's no way to tell depth in pz's style
Yeh ive seen alot of illusions
Like if you have a deadbody floatin on z1 but without floor tiles
It will still look like its on z0
Anyone knows what the SuburbsDistributions[“laboratory”] is Broken error indicates?
hey does likes show on steam workshop stuff
It happens in fresh install vanilla 41.78 along with a mannequin zone error i’m sure someone is familiar with those
Quick question (not to overshadow Rightwayup) Do you all reckon its possible to change weather for specific players but not the whole server? I strongly suspect the answer is no from my own searches, but figured it can't hurt to ask people with more experience .
i looked at it briefly when i was writing up the events data, and maybe...?
albion is my recipe correct
missing module
Ah theres a chance... Alright... Can't hurt to try some stuff
thanks
I added it anything else?
need commas after each item name
everything
now what
does anyone know why this is not spawning?
sorry for the ping but you are good at this stuff
anything wrong
You gave it a 0.02% chance of spawning if it is rolled.
Is there already a mod that shows player 0 mod data, like Debug shows global mod data ? If not I'll make one.
This mod let you instect IsoObject modData
I mean, I am being very literal. You gave your red duct tape an incredibly low chance of spawning. Increase that and you will see it spawning more often.
well dude I used the abundant option
alright how much should I do then
Thanx mate
how much should I do
I want crate tools to be the most and garage tool to be the second most
That's up to you, how easy do you want to be for people to find it?
this is still a very very low chance
you can check if your spawns work and see an actual spawn chance for your settings with lootzed
They do work, you are off by 2 decimals.
thats not low
they aren't raw percentages but yes it's much closer to 0.5%
Yeah, that should work.
probably totally un related
but its not in the spawn menu anymore
code again
if someone can dm me the problems
I'm too tired and I got a headache
thank you guys
Is there already something to manage the fact that players flags must be spread on the network to work in MP ? (e.g. zombiesDontAttack)
Reason: Bad word usage
Is there a recommended way to link to things in the workshop.txt or mod.info files? I was hoping markdown would work but seems like Steam is too smart to let people XSS attack each other. I just want to mention another steam user as thanks.
for workshop.txt [url=url]text[/url] iirc
If I want to access a java class from LUA that doesn't have a LUA interface (Lets say for example, FliesSound), is there any way I can do this quick & simple, or will I have to create some additional files to emulate the java class in LUA?
wdym lua interface?
if you're talking about class exposure, a class is either exposed or it isn't, nothing you can do to change that from lua
Right, I meant like for example there's Clock.lua, and Clock.java. I take from what you're saying is I'm SOL?
yeah, that's not really how zomboid's lua works
can I dm someone a question
ah the headache of translation file encoding
Hi ! Quick question, I'd like to make a re-texture for some of the basegame vehicles. I have read the tutorial on the forums, but as I understand it that would overwrite the base game vanilla texture?? If I wanted to have it be standalone then would i just take the 3D model from the Zomboid folder, then rename it to myawesomecar blah blah blah whatever the Namin convention would have to be and put it in the mod folder??
You can do it like new car. Will be enough just create new texture and new vehicle script + add spawn vehicle to world
Or you can modify vanilla script (and overwrite it) and some cars will spawn with new textures + vanilla textures
u can just do
for k,v in pairs(tbl) do
if v == value_to_remove then
tbl[k] = nil
end
end
about sequential table
local tbl = {}
for i = 1, 100 do tbl[i] = true end
-- with it u can use ipairs and #
for k,v in ipairs(tbl) do print(k, v) end -- output: 100 lines
print(#tbl) -- output: 100
-- if use ur func for this `tbl` then:
for k,v in pairs(tbl) do if v == some_value then tbl[k] end end
-- for example we removed 35 index
-- then ipairs and # won't work correctly
for k,v in ipairs(tbl) do print(k, v) end -- output: 34 lines
print(#tbl) -- output: 34
-- problem is ipairs and # going from 1 to N where's N it's last index of sequence
-- for sequential tables u should use table.remove
-- for example: table.remove(tbl, 24) and after it lua will remove 24 index and shift all keys after 24
N = 24
tbl[N] = nil
tbl[N] = tbl[N + 1]
tbl[N + 1] = tbl[N + 2]
...
tbl[#tbl] = nil
Oh brilliant thanks!!!
It's pretty obvious. You're not following the syntax.
brother I'm new
All you need to do is look at the examples in the game's files and check against them.
Also if you think I'm attacking you, that's on you.
hello, how can i check if the player has 1 or more nail item in their inventory (excluding nearby containers/floor)
Single player?
mp
local player = ..;
local inventory = player:getInventory();
-- I can't remember how to get items specifically but should be in this object
Should be in there.
I'll double-check. Grabbing my Umbrella environment.
so something similar to this?

@jaunty marten Hey.
would it be necessary to go for a function with Count or is it fine to just getItemFromType
Oh. You could try getting the item with the ID.

local item = inventory:getItemById('Base.Nails');
if item not nil then
-- ...
end
Hey. How're you?
pretty good, and u?
Tired. Too hot here for my comfort.
I brushed up on Webpack this weekend and worked on a mock interface for writing 3rd party documentation for Umbrella.
Not final. No functionality. Just a set of panes and some filler text.
I already have a functional API on npmjs for PZ-Rosetta, my dataset solution for extracting data from the JavaDocs and Lua docs stuff too.
amount of items
needed?


okay cool thank you

is this recipe code right
Replace the semicolon with = otherwise it seems ok
Did you define Recipe.GetItemTypes.RedDuctTape?
define?
its suppposed to be txt
Take a look at recipecode.lua in server folder
There are all the vanilla functions called for recipes and what kinda recipe items are allowed
I don't understand a single thing
If you have something like [Recipe.GetItemTypes.DuctTape] in your txt file its actually referencing a lua function that will be executed when creating the recipe
So instead of painstakingly referencing for example all the knives in the base game you can just write a lua function that gets all sharp weapons and says that those are needed for the recipe to work
I still don't get it man
Do you have only redducttape as the modded item?
Then just write how its called in the file instead of Recipe.GetItemType.RedDuctTapr
So RedDuctTape=1
Also missing the closing bracket
where does that go
In the end
like this? you sure?
Yes
Yep looks good
dude the crafting recipe is not even there
where is the crafting recipe.txt supposed be
Ye
so apparently
group:setHideModel
on my custom bodylocation under /shared/NPC/ doesn't seem to work on multiplayer. I've been reading about ClientCommand and ServerCommand but currently struggling to understand how can I work with these.
Other things such as
group:setExclusive on the same bodylocation.lua works fine.
dude something is wrong man
its giving me errors everytime I try and open the recipe
menu
Then your recipe is broken
🤯
Thanks Mr. Obivious
Then figure it out on your own lol
Hey can you check your attitude? Nobody is paid to help you here.
You're asking without trying first.
Nobody will help you if you're going to talk down to people.
how are you talking? "it's pretty obvious. You're not following the syntax"
that's what you said
I can call a moderator if that's what you'd like.
for what dude I have been asking for help and there is no point of it
You could look through the f11 menu in the error log what exactly the error is
See this guy gives good help he tells me what I should do or could do Thank you
How about we just calm down and look what the error log says
There is an error button up left
Yea im aure it just repeats that all the time
oh okay
Im not currently at pc but you would be wise to look through some of the vanilla recipes and see how they do it
sure
And mostly its just syntax problems really
which file is that again
once the basics are in and it's functional, I'll be adding features of convinence
I have this on my item recipe script
``
Result:someDrainableItem=5,
``
This will produce
5 items and are all full
Question
Ks there a way to get that number 5
Onto the lua as variable
OnCreate with moddata?
Its suppose to be usedDelta
But since its more than 1 it becomes quantity instead of amount
I want
To convert it into
0.05
But theres alot of em
There is a usedDelta call for drainable items that you could call in OnCreate
I was able to do q table and refer from that
But it would be so much easier if i can just get the result's = var
Which idk what its called
Yeah but
It produces 5 items
Im guessing it will give me
1 per item
I need the var 5
Not 5 x 1
If that makes sense?
Thnx btw
It refers a lua function in recipecode.lua
so do I need it?
If you want all the base ducttapes types as a required item
what
The param for oncreate and ontest doesnt make sense for me
Like result is singular but uou can add quantity
oh wait do you mean the amount of it
Isnt it suppose to be table instead
No those are tags i believe
Like sharpknives
So all the vanilla knives are there
Excpt for crafted one i think
Stone knife? Not sure
Thanx for the detailed explanations. Try your first example, it does not work as a function. For sequential table (ipairs), if I understand well, there is no way to make its removal compatible with non sequential ones (pairs). Thanx for your time too.
Should result be Display name?
Is this the right channelfor asking questions ,or should i stick to mod support?
what kind of question
about one of my 3d models
if you want help to use mods, mod_support, if you want help to make mods, mod_development
recipe Attach Bread Knife to Spear
{
SpearCrafted,
BreadKnife,
DuctTape=2,
Result:SpearBreadKnife,
Time:100.0,
OnCreate:Recipe.OnCreate.UpgradeSpear,
Category:Survivalist,
}
take a look at this Attach Bread Knife to Spear, from base game I think its similar to what you are trying to do.
well since i want to make a mod with it then it shoudl be the right channel
My question is Oncreate now?
What is OnCreate
Hello there, Does any of you know why the IsoGameCharacter flag m_invisible makes you invisible from zombies in vanilla but makes you invisible to yourself when using NPC mods ? (NPCmods I tested being superb survivors, continued and Dogs)
So,my vehicle body model is invisible in the debug editor,any ideas why???
i think its when you create somting
why can you craft it with normal duct tape
to make it harder
wym
the duct tape is only there for a little bit of a challenge
alright
the red duct tape makes it way harder
ig
because it will be easy to make the red handle machete with duct tape
so its like whats the point
no i mean it says you can with normal duct tape
oh why is it there?
yeah
Just because I guess
alr
so does anyone know what should I put for OnCreate
i think its OnCreate then add the machete
wdym it does not work as a function?
put your code in a function call it => no effect out of the function.
??
local tbl = {...}
local function removeValue(tbl_arg, val)
for k,v in pairs(tbl_arg) do
if v == val then tbl_arg[k] = nil end
end
end
removeValue(tbl, some_value)
Yes. I feel very stupid writing that, but that failed me so many times 😄
I'll look for one of my failed experiments

nope
wait when you say add the machete you mean the red?
bet
what should be the machete name though display name or item name
i would assume item nae,m
this?
what are you going to play
ghosts of tabor with a friend
oh cool
So, I got 2 use cases. One with non sequential table (key,value) where key are used for retrieval, periodic cleaning occures (parses the whole table on pairs) on the whole table and I need the table to not grow over time. with table[key]=nil the key remains valid in the table and my cleaning process time takes more and more time.
is this right guys?
keys are valid cos u still using them
lua won't remove objects if they have any reference
second use case with sequential table (table.insert used for construction) where periodic use (with pairs) and periodic cleaning (with pairs) occures. I also (crucialy) need to detect when the table is empty.
table.isempty(t)
bump
wonder if you still have the keys 🤔
I do not understand that. when I write: myTable[myKey]=myValue; myTable[myKey]=nil; then myTable[myKey] exists and its value is nil. the table still contains it.
if table still contains it then u do smth wrong lol
lol
even in theory it can't work that way
can someone help please.
have you tried asking ChatGPT?

real
can you replicate the problem persistently? Does using pairs then give you nil values?
also I have a question for those people who have those donate links on there mod
What is your table, is it some kind of modData?
bump again
@deft plaza inspect these things and stop asking each your step, please
https://pzwiki.net/wiki/Modding
https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/
https://theindiestone.com/forums/index.php?/topic/53019-details-on-the-improved-modding-tag-system-in-4169/
Type = Normal,There are various types of items in Project Zomobid, below you will se each of them with a short description. Normal – A basic item. Drainable – An item that has a certain amount of uses before it's destroyed Food – An item that can be consumed by the character Weapon – An item that...
New Tag Info! - Several new Tags were added to the item scripts, and their functionality added to the lua code. - This allows for modders to add new items that seamlessly work with the game in several places, such as adding new fully-functional Sledgehammer items, or adding new Gasoline container...
sorry man
@deft plaza
can you please make a thread, so you don't spam here?
dude just forget it alright
🤨
I'll give it a break
lmao
god sorry for asking for help
Guys, what causes black models in the editor but also invisible in the game??
Sorry mate don't let them get on your nerve.
Follow Вишня's links though and don't bother the trolls
@mellow frigate
- how to replicate it
- is the table some sort of modData?
I do not have the problematic code in hand anymore, as I used that costly remove function instead.
better to just remove this function from ur lib cos it working incorrectly
I see, well now and then you discover weird facts about kahlua.
as input table ~= output table
Certainly not, it works wonder.
it solves mine, feel free to not use it if you keep memory of iterators of your sequential tables.
for sequential tables it's fine I think but ur lib is public so it can confuse someone who will use it
-- ur version
function luautils.removeFromTable(tab, elem)
local newTab = {}
local found = 0
for it,val in pairs (tab) do
if val ~= elem then
newTab[it] = val
found = found + 1
end
end
if luautils.Verbose and found ~= 1 then
print ('luautils.removeFromTable removed '..found..' elements from '..tab2str(tab))
end
return newTab
end
-- correct version
function luautils.removeFromTable(tab, elem)
local found = 0
for it,val in pairs (tab) do
if val == elem then
tab[it] = nil
found = found + 1
end
end
if luautils.Verbose and found ~= 1 then
print ('luautils.removeFromTable removed '..found..' elements from '..tab2str(tab))
end
return tab -- tbh no need to return it cos it's same table but for backward compatibility it's fine
end
If I can make everybody happy, I will.
It's his first time modding cut him a lil slack
this isn't how lua works, a key that points to nil is not 'in the table'
if you loop through pairs you will not find keys that point to nil, otherwise every possible key would be in every table because all undefined keys point to nil
nil is not a value
Shouldn't they stay until garbage collection though?
it depends what you mean by that
if the key was an object reference then the object will still exist until it's garbage collected, as would the value it pointed to if that was an object, but the key is immediately not 'part of the table' afaik
If you want to get your coding questions answered stop posting screenshots of your code, and learn how to post your code the right way.
#shorts
Convenient video to share here.
I never had this issue, so I would agree with this.
@hollow current
just saw thi s on vanilla and remembered your problem, might need to set both name and custom name? idk
hope this helps you out
function Recipe.OnCreate.GetMuffin(items, result, player, selectedItem)
result:setBaseHunger(selectedItem:getBaseHunger() / 6);
result:setHungChange(selectedItem:getHungChange() / 6);
result:setCalories(selectedItem:getCalories() / 6);
result:setProteins(selectedItem:getProteins() / 6);
result:setLipids(selectedItem:getLipids() / 6);
result:setCarbohydrates(selectedItem:getCarbohydrates() / 6);
-- This gives a bonus. See Food.getHungerChange().
result:setCooked(true);
result:setName(selectedItem:getDisplayName());
result:setCustomName(true);
player:getInventory():AddItem("Base.MuffinTray");
player:getInventory():Remove(selectedItem);
end
How does one test it, by using __newindex?
I remember reading this, it said you can set tables to keep the keys and stay at fixed length.
Anyhow.
Does someone know or have an example of the API to call and spawn a zombie in the world?
I'm trying to create a function to spawns a zombie at the targetSquare in the world for testing my mod.
nevermind, I think I got it.
https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#createHordeFromTo(float,float,float,float,int)
float spawnY,
float targetX,
float targetY,
int count)```
addZombiesInOutfit is the one I usually use.
thanks, that actually looks like the better call
now I'm curious about what the default string outfits are
do you have a list or reference to outfits?
It should be the same as the list when you try to spawn the zombies with debug ui.
... actually screw it, i'll just pass in a nil value and see what happens
nil means random outfit
yep, thanks, it'll do, i'm just testing some interactions between zombies and world objects
my use of it was not working properly. I'll remove the function in next version.
Guys, why is the car's body texture offset in game but not in blender? What values should I thinker with?
Is there a guide somewhere that states which encodings are used by certain languages for the translation files?
I use VS code to open the game's built in translation for a langauge these days
there's a table in the modding page on the wiki
You can click the encoding at the bottom right of the window and it offers to reopen with a different encoding
And it tells you what it probably is
Did not know about this table, nice
I'm hoping to get someone's opinion on how to tackle an issue i'm facing. I'm gonna try to keep this really concise:
- Working on furry trait mod
- a small set of traits increase the nutrition, unhappiness, boredom bonus of a type of food (most often plants/meat)
- I've hooked into oneat.perform to have it run the function that handles the increase
- it works by detecting a tag on the food items that I set on game start.
Problem: Meals are created during runtime (soup, stew, roasts, etc). How do I apply item tags or otherwise give a bonus to these items? Thoughts:
- See if one or two ingredient meals can be resolved into meat/plant based on their name (tomato and onion roast, for example, or Vegetable soup)
- Access the ingredients somehow and determine if that a majority of the ingredients have the correct tag, apply the bonus
- ???your solution or thoughts???
Hi! What's a difference between vehicleObj:getId() and vehicleObj:getID() ?
getID() returns an IsoObject id, getId() returns a vehicle id
Thank you!
Any of these good as keys for mod data?
Im testing trying to test sqlId across clients right now
didn't test it myself but someone was in here earlier who found neither to be persistent
it would be absolutely crazy if sqlid isn't
unique and stable id is vehicle:getKeyId(). I used it
It was me. sqlId persistent if it dedicated server. If it coop sqlId changes after restart
Oh
lmao I see
Its the item id of the key item
that makes sense
Yup, sqlId is not persistent
I guess its my local dbs sqlId
is it possible for custom vhs
yes
module Base
{
item VHS_Bananaman
{
DisplayCategory = Entertainment,
Type = Normal,
DisplayName = 7 PAVLOV SHACK! Facts, YOU already knew!,
icon = Cassette3,
Weight = 0.1,
MediaCategory = Home-VHS,
WorldStaticModel = VHSBox3,
}
model VHS_Bananaman
{
mesh=WorldItems/VHS_Banana,
texture=WorldItems/VHS_Banana,
scale=0.005,
attachment world
{
offset = 0.0000 0.1500 0.1500
rotate = 0.0000 0.0000 0.0000
}
}
}
this code is valid right?
Fastest way to check is probably to just boot the game in debug mode and give yourself the item
vehicle:getKeyId()
is working great
I doubt a ',' is valid in a displayname
aah
this shit is still chalanging
the discord server im in is doing an event with this mod and the extraction one
Is there some sort of direct connection from Client to client or all com must go through server in dedicated MP ?
how easy would it be theoretically to replace weapon models
but not stats
would i just need to make a model and put it in the appropriate location with the name of the vanilla weapon
thats like the fuckin easiest thing you could do
just use base game code
and change model
make the model takes time. And unless you can ensure they got the same parameters as vanilla (coord, scale), you'll have to adapt their relative positions (model_items.txt in vanilla).
maybe change their associated 2D icon too
I'm working on this and hitting a wall
screenshot too low res cant read
I'm going with solution #2 and i'm trying to access an index of a ?table? called ingredients that I get from an EvolvedRecipe class's getItemsList() function. Even though it's returning something for size() trying to access it as ingredients[i] is returning a nil
it's not a table so indexing with [i] is not valid
ArrayList?
list:get(i)
🤔 is it even possible to do this then?
for i = 0, ingredients:size() -1
do
for tag, count in pairs(tags)
do
local ingredient = ingredients[i]
if ingredient:hasTag(tag)
then
count = count + 1
end
end
end
it's a map
lemme try that
the keys might not be numeric or continuous
oh qwq
that's annoying
so then how am I supposed to know the difference between an item that's valid for this recipe vs. the items actually in the recipe?
there must be a way to get at them
before i start going down this rabbit hole, is it possible to add a button to the admin panel?
yes
okay, and i hesitate to ask but is it difficult?
it's item type : recipe
well actually it's type : itemrecipe which doesn't seem to be the same thing as a recipe at all
so in that case I'd likely be able to get what's currently in it by doing
local ingredients = self.recipe:getItemsList().source:getItems()?
https://projectzomboid.com/modding/zombie/scripting/objects/Recipe.html
declaration: package: zombie.scripting.objects, class: Recipe
i think itemrecipe just describes some of the properties of that item in the recipe?
oh, let me see
declaration: package: zombie.scripting.objects, class: ItemRecipe
this documentation isn't very helpful at all
no this is basically all the class is as far as i can tell
it just stores some details of an item and how it's used in that recipe
i don't think this is what you're looking for
since you're hooking the add item to recipe action you should either add tags to the result every time an item gets added, or recalculate tags after items get added (depending on how much exactly you want a single item to influence the tags)
that's more or less what I'm doing
does the timed action not already know what item you're adding?
local OriginalEvolvedRecipeAdd = ISAddItemInRecipe.perform
ISAddItemInRecipe.perform = function(self)
OriginalEvolvedRecipeAdd(self);
--get items in the recipe
local ingredients = self.recipe:getItemsList();
local tags = {}
--get all tags relating to food, and init table with string keys so their count can be added to
for _, tag in pairs(AnthroTraitsGlobals.EvolvedRecipeFoodTags)
do
tags[tag] = 0;
end
local tagWithLargestCount = "";
local tagWithLargestCountCount = 0;
--for each ingredient...
for i = 0, ingredients:size() -1
do
-- for each tag...
for tag, count in pairs(tags)
do
--if the ingredient has this tag, up the count for that key in tags
local ingredient = ingredients[i]
if ingredient:hasTag(tag)
then
count = count + 1
end
end
end
--for each tag...
for tag, count in pairs(tags)
do
--record if the count is larger than the previous
if count > tagWithLargestCountCount
then
tagWithLargestCount = tag;
tagWithLargestCountCount = count;
end
--and remove the tag from the recipe to reset what food-tags it may already have
if self.item:hasTag(tag)
then
self.item:removeTag(tag);
end
end
--if the largest count tag is present on greater than 50% of the recipe's items...
if tagWithLargestCountCount / ingredients:size() > .5
then
--add the tag to the item, so it can be handled appropriately when eaten.
self.item:addTag(tagWithLargestCount);
end
end
```lua
try looking through the result item's getExtraItems() instead
"self" has this:
it's an arraylist of strings, i think you'll need to check their tags with the scriptmanager or something
who knew this would get this complicated
i'll give it a try. For now i'm gonna comment my code above
Hello again, everyone. How can I change the coordinates of BaseVehicle? setX, setY don't work for unknown reason. Does not raise errors
that's because the vehicle's position is controlled by the physics engine
Hm, what method can I use?
I tried
local oX = vehicle:getX()
local oY = vehicle:getY()
vehicle:setPhysicsActive(false)
vehicle:setX(oX - xDif)
vehicle:setY(oX - yDif)
vehicle:setPhysicsActive(true)
don't work
try setBulletActive
not really sure why those are different methods, they sound like they should do the same thing, but i'm not able to check right now so maybe this one works better
Unfortunately there is no effect.
local oX = vehicle:getX()
local oY = vehicle:getY()
vehicle:setActiveInBullet(false)
vehicle:setX(oX - xDif)
vehicle:setY(oX - yDif)
vehicle:setActiveInBullet(true)
you could try setWorldTransform if transforms are exposed and like, manipulable
I've finished my first mod! https://steamcommunity.com/sharedfiles/filedetails/?id=2991660699
Now I just gotta figure out how to make it work properly in MP.
guys how do i make like a Wait() function?
Where can I find usage examples? I can't figure out how to define Transform. Code search didn't help either
nowhere, i've never seen anyone do this before
oh
Hey! Anyone here know if there's any way to get a chunk's corpse data in LUA? I know it's not exposed but maybe there's a roundabout way to do this?
that's why i included the 'if transforms are exposed and manipulable' lol, i have no clue
also guys how do i make so character fully heals on a function ig
wdym corpse data? are you trying to get corpse objects?
I want to get the number of corpses in a given chunk
in Java this is easy as the IsoChunk has a FliesSound.ChunkData field which has a ChunkLevelData data object with a corpseCount variable
however this is not exposed on LUA as far as I can see
yeah, i don't see any way to get that
you can loop through all of the squares in the chunk and count the corpses you find in their getStaticMovingObjects
are corpses a specific type?
that was a bad question one sec let me rephrase
if I have a reference to a given square, I am able to get all instances of corpses on that square?
I haven't read through a IsoGridSquare, but I just want to know if that's even something I can access
you can loop through getStaticMovingObjects and check how many of the objects in that array are IsoDeadBody objects
oh actually
there's just a getDeadBodys
you can just add up the size of every square's getDeadBodys array
no pain
i think this is the way. Looking at it in the f11 screen, it seems to have all the items i added to recipe
You don't think i'll be missing the just-added item this way, do you?
i don't see how it could be missing after the action would have normally completed
Yoooooo!!!
Is that on the gridsquare class?
ya!
that's what i hope, but i've run into like, the game having to wait a tick or something before displaying the correct data
that probably will be kind of slow, so i hope it's not something you need to call often
you might be able to cache it without too much trouble...?
Right, I mean if it's a small radius I could also just do that , a 3x3 grid is only 9 calls
plus I can just append them all to one list and have the loop just be accessing the list
and adding it to another bigger list
Anyone here the dev of one of those:
"Put an icon on things you've found, checkmark on books you've read, etc" mods?
Want to use one if possible as a backend for inventory tetris so I only have to read the data and handle rendering instead of remaking my own implementation.
I'll need to look into LUA performance though, are loops typically resource expensive?
I think java api calls more expensive
Ah that makes sense
I imagine it's mostly the controller layer between the two that causes the slowdown?
not inherently but the concept of 'doing something many times' can obviously lead to spikes
most performance issues in mods i've seen have been from irresponsible loops
guys pls tell me how do i do like "wait" function
there is no wait equivalent in pz, you can find an implementation or create your own
i think vishnya has a timer api on the workshop
from my understanding the LUA scripts are not asynchronous and if you called a wait function it will halt the entire game
but I could be way off base
Quick question albion, in the decompiled lua, do I have access to all the @field public ... fields directly in the LUA?
eg: here's the top of IsoChunk
---@class IsoChunk : zombie.iso.IsoChunk
---@field public bDoServerRequests boolean
---@field public wx int
---@field public wy int
---@field public squares IsoGridSquare[][]
---@field public corpseData FliesSound.ChunkData
do I have direct access to wx, wy, squares, corpsedata... ?
not quite
there's some weird method to grab fields but usually you just use a getter method
to grab a field that doesn't have a getter you need a whole bunch of api calls
Sorry to ask again, but can someone help me with a texture issue? in blender the model shows as fully textured, however in game the texture is broken
Don't expect performant code
hahahaha
That's not a common theme here
this is straight from the java code LMAO
Yes.
my bad didn't realize there was a convo going on lol didn't mean to butt in
why no 3d array 😭
I've spent almost 2000 hours inside the core engine
I can't find a solution for moving cars. Is it really impossible? A lot of work for nothing 😦
Yeah? How many times has it made you slam your head into a wall?
because reading this is really...
painful 😭
I've read obfuscation for 15 years
try beautiful java
Sounds good not as much as you think
it won't fix the logic but it makes things a bit easier to follow
@red tiger Do you happen to know a way to change the coordinates of the car?
2d 3d array isn't real it cannot hurt you
Nope
uh
Okay now do 1D array of 2D coordinates
1D of 3D coordinates 💀
I prefer the challange of backflipping between the cracks of 18 other mods in lua, in a hopeless quest for compatibility
Can't fix cracks in the floor when the foundation is compromised.
You'd be surprised what you can fix with:
-- your entire file
end)```
alright I know someone is gonna get a butthurt because I asked for help
I tried my best
new mod btw
What is wrong with my code
also the other mod I made works
glad to hear you got the other mod working, does commenting out the days fresh and days rotten work like that?
I just copied and pasted the cookie code into the txt made it mine basically
still looking over it but had to lol at this. Why you eating me bro? lol
my fault lol
trying to dig up cookie in my game's code now, i don't see anything wrong with it
Just jumps out as a special character
Jack'o'lantern works tho
can that be a problem
{
DisplayName = Jack'o'lantern,
DisplayCategory = Food,
Type = Food,
Weight = 1,
Icon = Jackolantern,
DaysFresh = 5,
DaysTotallyRotten = 8,
HungerChange = -40,
Calories = 404,
Carbohydrates = 20.45,
Lipids = 20.61,
Proteins = 34.53,
WorldStaticModel = Jackolantern_Ground,
}```
???
Probably not the issue then
Someone earlier had a comma in their displayname which was their issue
i sometimes see commas on offset and rotate, sometimes i don't. does anyone know which is right?
I think either is fine. ZScript is really forgiving.
But that makes it kind of confusing imo
oh that would explain why i see both
could it be the issue you were having the other day where you had two copies of the mod and the wrong one was loading?
nope lol I listened to there is no folder in mods
just workshop
well shoot, i'm looking at this cookie and seeing nothing wrong with it. so it's just not showing up in itempicker?
okay so the problem has to be with the item block not the model block (i think)
item block?
ya the block of code that starts with item
i'm not 100% on what you are asking but just because you change stuff with the files in your workshop folder does not meran you need to update the workshop item.
you will run into errors trying to join servers running the workshop version of your mod if you have a newer version on your computer tho
looks to me like cookiebox doesn't have a filetype
should be .txt right?
can you show me the folders with the icon and worlditems if you don't mind?
sure thing
you have to click on it
can anyone post me a guide on how to make an item forageable?
does NearItem= reference a tile or any tile or item?
anyone can answer my question anytime just means more time for me to relax lol
do an imports {base}
alright
like this?
where is the module base with the {} emcompassing all?
what
like this
ya
okay thanks let's see if it works
imports means you are importing the base library to your mod
I think I finally know what it means does it mean your basically adding the average code to your mod?
more or less
oh okay
its more techy stuff but yeah
nice
in a nutshell it means your code uses the base code to run
think of it as using action.eat
without the import action.eat means nothing, but its defined elsewhere what action is and eat is a derivative of action
so any code that expands the base game needs to import the base code for it to properly work
I keep making a backup and only editing that and forgetting to add it to the workshop folder
Thank you
did it work?
yup
pls ping me if you do so
This might be a silly question. but. Is it possible I could do this?
SandboxVars.ModName[partialString.."_cost"]
yes
yeah
oh poggers let's goooo
👋 good evening/morning/afternoon everyone! I'm trying to write a temporary function that checks the player's inventory to determine if they have a bag eligible to hold dirt. I've dug into ISShovelGroundCursor.GetEmptyItem which I believe is where the game starts to determine if the player has an eligible fillable item. The function I'm currently studying in the game files is as follows:
local function predicateEmpty(item)
return item:hasTag("HoldDirt") and item:getInventory():isEmpty();
end
function ISShovelGroundCursor.GetEmptyItem(playerObj, groundType)
local playerInv = playerObj:getInventory()
local fullType
if groundType == "dirt" then
fullType = "Base.Dirtbag"
elseif groundType == "gravel" then
fullType = "Base.Gravelbag"
elseif groundType == "sand" then
fullType = "Base.Sandbag"
end
local item = playerInv:getBestEvalArgRecurse(predicateTypeNotFull, comparatorMostFull, fullType)
if not item then
item = playerInv:getFirstEvalRecurse(predicateEmpty)
end
return fullType,item
end
I'm writing my own function to determine empty items so I'm not worried about returning fullType at the moment. I'm only interested in understanding item = playerInv:getFirstEvalRecurse(predicateEmpty) I don't understand what's going on here. getFirstEvalRecurse must be a method that isn't exposed to lua because I only find places where it's called, never where it's declared. predicateEmpty is declared locally at the top of the file but when it's called it doesn't send an item parameter, yet the local definition expects one?
**Can anyone clarify where getFirstEvalRecurse is coming from and how predicateEmpty is defined expecting a parameter but isn't called with one? **
getFirstEvalRecurse is an ItemContainer method, it returns the first item in the container or any subcontainers that the function passed to it returns true for
predicateEmpty's usage there isn't a call, it's passing the reference to the function to the java so that it can be called by it later (similar to adding a function to an event), so the parameters aren't passed from this side of the code
iirc it just passes the item and nothing else
I'm trying to wrap my tiny little brain around what you just said. Is the following statement true or false? "The local definition of predicateEmpty is not called or referenced in any way by playerInv:getFirstEvalRecurse(predicateEmpty)"
it passes that function to the java method, which then calls the function
it basically just loops through its item list, calls the function you gave it for each item with the item as a parameter, and returns the first item that the given function returns true with
okay that's starting to make sense. Thanks! I still can't find the definition for getFirstEvalRecurse anywhere. I started looking for ItemContainer too. Are either of them exposed to lua in a way that I can read the definition? Is my local workspace just hosed and is that why I can't find them?
it sounds like it, are you using umbrella?
all these Eval methods basically just let you use a function to filter what items they return
I'm just getting more frustrated and I should be in bed anyway. I'm going to tackle this in the morning. Thanks for the help as always Albion! You rock!
uploaded my abandoned blackouts mod, since the main feature of the mod was finished and just sitting for months
crap i forgot to add required mod 🤦

thanks for your help on the mod! i have trouble following advice so i only applied what worked and what i could understand
it's in the same state as it was however many months ago, but it seems to work just fine
im sure someone will be able to make a better one in the future, but at least now we have one
Can anyone point me to a "Getting started" guide for modding in PZ? can't really seem to find one
Hello, welcome to PZ mod development!
Here are some links with resources to get familiar with making mods for Project Zomboid.
https://pzwiki.net/wiki/Modding
https://github.com/FWolfe/Zomboid-Modding-Guide
guys how do i change player texture?
like not clothes
but the player itself
i wnat to make player look like a zombie
no
(im actually editing it to be better and to upgrade my skills but i wont publish cuz i aint got permission to do so) im making it better so player looks like a zombie by a texture cuz there is no this thing rn
.
so can you answer?
Sorry, I'm not familiar with this.
ok
so will anyone help
Good morning.
The best thing to do in this situation is wait a bit and then kindly ask again. Make sure not to be spammy when doing it and you should eventually get help.
You need to create custom outfits i guess
Good morning (but not for me, its not morning for me)
so what is the name of zombie texture or where do i get it?
You need to create zed looking assets . Or just require authentic z
As it does have a bunch of zed skins
i found :SetTexture()
I was telling you to create your own
Thats if the clothing has multi textures
Like tshirts has bunch of texture
So it has index
SetTexture(1)
You will see this on the clothing xml
Goodluck
Guys, I already asked yesterday, at night. Maybe someone knows how to change the coordinates of the car? Maybe there is some way? Ordinary setX and setY don't work
Doesnt work on mp afaik
Even if you execute the code on the server? There must be some way
i need it on mp
it depends what you're trying to do but i know some mods have a way of storing vehicles and respawning them elsewhere, that could be a hack for it
custom steam reply button since they don't have one for some reason
https://cdn.discordapp.com/attachments/1075779152499720222/1120722886244696134/chrome_Gfd0Lq8xDb.gif
not exactlymod related but i figured some of y'all would think its cool
IMO Valve doesn't care about improving the workshop tools / setup.
it definitely seems that way
no way for this currently
guys how to play animations for player?
Hello,
I'm trying to put my player on its knees to eat a corpse.
My player is eating the corpse but does not drop on its knees
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>IdleToEatInfected</m_Name>
<m_AnimName>Zombie_IdleTo_OnKnees</m_AnimName><!--Zombie_IdleToEating-->
<m_Looped>false</m_Looped>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_EarlyBlendOut>false</m_EarlyBlendOut>
<m_SpeedScale>0.56</m_SpeedScale>
<m_BlendTime>0.50</m_BlendTime>
<m_Scalar></m_Scalar>
<m_Scalar2></m_Scalar2>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>FeastOnCorpse</m_StringValue><!--action activation-->
</m_Conditions>
<m_Conditions>
<m_Name>isInfected</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Events>
<m_EventName>SetVariable</m_EventName>
<m_Time>End</m_Time>
<m_ParameterValue>EatingStarted=true</m_ParameterValue>
</m_Events>
</animNode>```
```<!--player/actions/eatingInfected.xml new file: loop animation-->
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>eatingInfected</m_Name>
<m_AnimName>Zombie_IdleEating_OnKnees</m_AnimName><!--Zombie_IdleEating-->
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>EatSpeed</m_SpeedScale>
<m_BlendTime>0.50</m_BlendTime>
<m_Conditions>
<m_Name>EatingStarted</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>isInfected</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
</animNode>```
We can see on the log below that both animations are started together.
I also wonder if there is something from Zombie_Idle that is still maintaining the character standing.
Anyone has cues on what I'm doing wrong ?
oh wow, btw im editing your mod but i wont publish it without your permission btw i improved it
i think
infected players right?
If you can move cars in singleplayer, couldn't you use server commands to move the car?
I see you're doing things by the book. Nice
for client used hack
i added like so you dont instantly turn into zombie, and that you have god mode on for one second and then it turns off to remove all of the bleedings and reset ya health
Hack as in "Java mod"? =P
like this? https://github.com/xyberviri/CarWanna/
Im doing admin tool for mass car moving. And if you use this method, then, for example, items inside cars will be lost. And the key id will also change
and im trying to figure out the thing where you like "die" and then get up when infected
and do ya know that your mod is on the front page?
What is hack?
you can probably restore those things yourself without much hassle
take BaseVehicle private variable and use it for change vehicle transform
Can you show a small example, please?
Items also have states. I'm afraid it will be quite boring
You'd need to add a method for this in the Java code.
I need to work it on mp
I used this for my first towing mod
You'd need debug=true for this to work, correct?
Why won't it work on the server-side?
mp vehicle sync
Yeah. desync is a bitch.
The server would have to pause the simulation and sync the physics clocks.
:D
Maybe we can send some kind of synchronization command?
(Speaking vaguely on purpose)
is there anything I'm doing wrong here
food mod?
yup yup
module MM_Roundmeal
{
model ROUNDMEAL_1
{
mesh = WorldItems/ROUNDMEAL,
texture = WorldItems/ROUNDMEAL,
scale = 0.01,
}
}
this is one of mine
the least i could do for the help
alright cool
just did this too
Oooo nice man
im gonna upload
alright cool
i added a custom item with it too
nice
Nokia597
he is not up yet I guess
yeah i didnt get a friend req or dm
what does he did it for?
ooh
he was the tribal mod guy wasnt he
not sure
Guys, need your help with joypad keys.
getCore():getKey("Left") - it's for keyboard, whats key should be on joypad?
or it's same?
Maybe the same. Try test it
not sure...
i think not...
Keyboard.KEY_A
but joypad has Joypad.AButton (B, Y, X buttons), LBumper, RBumper
and i can't find left up right down arrow
any clue why its not showing the model?
explain please
I know we've said this and it's been sort of a meme but you really need to organize the layout of that better. Mainly because with spacing like that it's hard to read
You can use prettier to have it automatically make your code look better
Also, do you have any references for how other models are made?
what do mean?

